Commit d0bbf8ad by 李根

修复dashboard重启之后,新添加的规则会替换掉老规则的bug

parent 155c6b3b
......@@ -5,3 +5,5 @@ target\
sentinel-dashboard-plus.iml
application-dev.yml
application-dev.properties
application-dev.yml
application-dev.properties
......@@ -188,10 +188,10 @@ public class FlowControllerV2 {
entity.setGmtCreate(oldEntity.getGmtCreate());
entity.setGmtModified(date);
try {
entity = repository.save(entity);
if (entity == null) {
return Result.ofFail(-1, "save entity fail");
}
// entity = repository.save(entity);
// if (entity == null) {
// return Result.ofFail(-1, "save entity fail");
// }
publishRules(oldEntity.getApp());
} catch (Throwable throwable) {
logger.error("Failed to update flow rule", throwable);
......
......@@ -36,4 +36,14 @@ public class InMemApiDefinitionStore extends InMemoryRuleRepositoryAdapter<ApiDe
protected long nextId() {
return ids.incrementAndGet();
}
@Override
protected void clearId() {
ids.set(0);
}
@Override
protected void setId(long id) {
ids.set(id);
}
}
......@@ -36,4 +36,14 @@ public class InMemGatewayFlowRuleStore extends InMemoryRuleRepositoryAdapter<Gat
protected long nextId() {
return ids.incrementAndGet();
}
@Override
protected void clearId() {
ids.set(0);
}
@Override
protected void setId(long id) {
ids.set(id);
}
}
......@@ -36,4 +36,14 @@ public class InMemAuthorityRuleStore extends InMemoryRuleRepositoryAdapter<Autho
protected long nextId() {
return ids.incrementAndGet();
}
@Override
protected void clearId() {
ids.set(0);
}
@Override
protected void setId(long id) {
ids.set(id);
}
}
......@@ -33,4 +33,14 @@ public class InMemDegradeRuleStore extends InMemoryRuleRepositoryAdapter<Degrade
protected long nextId() {
return ids.incrementAndGet();
}
@Override
protected void clearId() {
ids.set(0);
}
@Override
protected void setId(long id) {
ids.set(id);
}
}
......@@ -38,6 +38,11 @@ public class InMemFlowRuleStore extends InMemoryRuleRepositoryAdapter<FlowRuleEn
}
@Override
protected void clearId() {
ids.set(0);
}
@Override
protected FlowRuleEntity preProcess(FlowRuleEntity entity) {
if (entity != null && entity.isClusterMode()) {
ClusterFlowConfig config = entity.getClusterConfig();
......@@ -50,4 +55,9 @@ public class InMemFlowRuleStore extends InMemoryRuleRepositoryAdapter<FlowRuleEn
}
return entity;
}
@Override
protected void setId(long id) {
ids.set(id);
}
}
......@@ -37,6 +37,16 @@ public class InMemParamFlowRuleStore extends InMemoryRuleRepositoryAdapter<Param
}
@Override
protected void clearId() {
ids.set(0);
}
@Override
protected void setId(long id) {
ids.set(id);
}
@Override
protected ParamFlowRuleEntity preProcess(ParamFlowRuleEntity entity) {
if (entity != null && entity.isClusterMode()) {
ParamFlowClusterConfig config = entity.getClusterConfig();
......
......@@ -33,4 +33,14 @@ public class InMemSystemRuleStore extends InMemoryRuleRepositoryAdapter<SystemRu
protected long nextId() {
return ids.incrementAndGet();
}
@Override
protected void setId(long id) {
ids.set(id);
}
@Override
protected void clearId() {
ids.set(0);
}
}
......@@ -5,7 +5,7 @@ spring:
mongodb:
port: 27017
database: db1
uri: mongodb://lg:123456@118.25.153.63
uri: mongodb://lg:123456@xx.xx.xx.xx
authentication-database: admin
http:
encoding:
......@@ -34,7 +34,7 @@ auth:
nacos:
degradeDataIdPrefix: degrade-rules
serverAddr: 10.16.10.139
serverAddr: xx.xx.xx.xx
groupId: DEFAULT_GROUP
flowDataIdPrefix: flow-rules
namespace: 31b168cb-51ee-4b8b-adfa-29b42d4afa0b
......
......@@ -27,7 +27,7 @@
<ul class="nav nav-second-level" ng-show="entry.active">
<li ui-sref-active="active">
<a ui-sref="dashboard.metric({app: entry.app})">
<i class="fa fa-bar-chart"></i>&nbsp;&nbsp;实时监控11</a>
<i class="fa fa-bar-chart"></i>&nbsp;&nbsp;实时监控</a>
</li>
<li ui-sref-active="active" ng-if="!entry.isGateway">
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment