Browse Source

nacos持久化

master
wangjx 3 years ago
parent
commit
09356e42c4
3 changed files with 2 additions and 7 deletions
  1. +1
    -3
      sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/rule/FlowRuleNacosProvider.java
  2. +0
    -3
      sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/rule/FlowRuleNacosPublisher.java
  3. +1
    -1
      sentinel-dashboard/src/main/webapp/resources/app/scripts/directives/sidebar/sidebar.html

+ 1
- 3
sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/rule/FlowRuleNacosProvider.java View File

@@ -20,7 +20,6 @@ import com.alibaba.csp.sentinel.dashboard.config.NacosPropertiesConfiguration;
import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.FlowRuleEntity; import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.FlowRuleEntity;
import com.alibaba.csp.sentinel.datasource.Converter; import com.alibaba.csp.sentinel.datasource.Converter;
import com.alibaba.nacos.api.config.ConfigService; import com.alibaba.nacos.api.config.ConfigService;
import lombok.extern.log4j.Log4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -31,7 +30,6 @@ import java.util.List;
/** /**
* @author Eric Zhao * @author Eric Zhao
*/ */
@Log4j
@Service @Service
public class FlowRuleNacosProvider implements DynamicRuleProvider<List<FlowRuleEntity>> { public class FlowRuleNacosProvider implements DynamicRuleProvider<List<FlowRuleEntity>> {


@@ -47,7 +45,7 @@ public class FlowRuleNacosProvider implements DynamicRuleProvider<List<FlowRuleE
public List<FlowRuleEntity> getRules(String appName) throws Exception { public List<FlowRuleEntity> getRules(String appName) throws Exception {
String dataId=new StringBuilder(appName).append(NacosConstants.DATA_ID_POSTFIX).toString(); String dataId=new StringBuilder(appName).append(NacosConstants.DATA_ID_POSTFIX).toString();
String rules = configService.getConfig(dataId,nacosPropertiesConfiguration.getGroupId(),3000); String rules = configService.getConfig(dataId,nacosPropertiesConfiguration.getGroupId(),3000);
log.info("pull FlowRule from nacos Config:"+rules);
//log.info("pull FlowRule from nacos Config:"+rules);
if (rules.isEmpty()) { if (rules.isEmpty()) {
return new ArrayList<>(); return new ArrayList<>();
} else { } else {


+ 0
- 3
sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/rule/FlowRuleNacosPublisher.java View File

@@ -21,18 +21,15 @@ import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.FlowRuleEntity;
import com.alibaba.csp.sentinel.datasource.Converter; import com.alibaba.csp.sentinel.datasource.Converter;
import com.alibaba.csp.sentinel.util.AssertUtil; import com.alibaba.csp.sentinel.util.AssertUtil;
import com.alibaba.nacos.api.config.ConfigService; import com.alibaba.nacos.api.config.ConfigService;
import lombok.extern.log4j.Log4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;


import java.util.ArrayList;
import java.util.List; import java.util.List;


/** /**
* @author Eric Zhao * @author Eric Zhao
*/ */
@Log4j
@Service @Service
public class FlowRuleNacosPublisher implements DynamicRulePublisher<List<FlowRuleEntity>> { public class FlowRuleNacosPublisher implements DynamicRulePublisher<List<FlowRuleEntity>> {




+ 1
- 1
sentinel-dashboard/src/main/webapp/resources/app/scripts/directives/sidebar/sidebar.html View File

@@ -21,7 +21,7 @@
<span class="fa arrow"></span> <span class="fa arrow"></span>
<span class="arrow">({{entry.healthyCount}}/{{entry.machines.length}})</span> <span class="arrow">({{entry.healthyCount}}/{{entry.machines.length}})</span>
</a --> </a -->
<li class="glyphicon-dashboard" ng-repeat="entry in apps | filter: { app: searchApp }">
<li ng-class="glyphicon-dashboard" ng-repeat="entry in apps | filter: { app: searchApp }">
sentinel_dashboard sentinel_dashboard
<!--<ul class="nav nav-second-level" collapse="{{entry.active}}" style="display: none;">--> <!--<ul class="nav nav-second-level" collapse="{{entry.active}}" style="display: none;">-->
<ul class="nav nav-second-level" ng-show="entry.active"> <ul class="nav nav-second-level" ng-show="entry.active">


Loading…
Cancel
Save