以sentinel-1.7.0为例
下载源码,idea打开。
找到sentinel-dashboard这个项目
在该项目下的pom.xml文件中找到:
<!-- for Nacos rule publisher sample --> <dependency> <groupId>com.alibaba.csp</groupId> <artifactId>sentinel-datasource-nacos</artifactId> <scope>test</scope> </dependency>
将<scope>test</scope>注释掉。
展开test->java->com.alibaba.csp.sentinel.dashboard->rule->nacos
复制NacosConfig到src->java->com.alibaba.csp.sentinel.dashboard->config
复制其余3个文件到src->java->com.alibaba.csp.sentinel.dashboard->rule
打开src->java->com.alibaba.csp.sentinel.dashboard->controller->v2->FlowControllerV2
@Qualifier("flowRuleDefaultProvider") 改为 @Qualifier("flowRuleNacosProvider")
@Qualifier("flowRuleDefaultPublisher") 改为 @Qualifier("flowRuleNacosPublisher")
打开src->webapp->resources->app->scripts->directives->sidebar->sidebar.js
注释掉
<li ui-sref-active="active" ng-if="!entry.isGateway"> <a ui-sref="dashboard.flowV1({app: entry.app})"> <i class="glyphicon glyphicon-filter"></i> 流控规则</a> </li>
解除
<li ui-sref-active="active" ng-if="entry.appType==0"> <a ui-sref="dashboard.flow({app: entry.app})"> <i class="glyphicon glyphicon-filter"></i> 流控规则 V1</a></li>将描述 流控规则 V1 改为 流控规则 V2
通过sentinel-dashboard项目打开Terminal,输入mvn clean package
在target目录下会生成我们需要的sentinel-dashboard.jar