@@ -62,16 +62,16 @@ public class AppController { | |||
public Result<List<AppInfo>> queryAppInfos(HttpServletRequest request) { | |||
List<AppInfo> list = new ArrayList<>(appManagement.getBriefApps()); | |||
if (list.size() == 0) { | |||
MachineInfo machineInfo = new MachineInfo(); | |||
machineInfo.setApp("sentinel-dashboard"); | |||
machineInfo.setAppType(0); | |||
machineInfo.setHostname("id.ssjlai.com"); | |||
machineInfo.setPort(7777); | |||
machineInfo.setIp("172.19.42.44"); | |||
appManagement.addMachine(machineInfo); | |||
list = new ArrayList<>(appManagement.getBriefApps()); | |||
} | |||
// if (list.size() == 0) { | |||
// MachineInfo machineInfo = new MachineInfo(); | |||
// machineInfo.setApp("sentinel-dashboard"); | |||
// machineInfo.setAppType(0); | |||
// machineInfo.setHostname("id.ssjlai.com"); | |||
// machineInfo.setPort(7777); | |||
// machineInfo.setIp("172.19.42.44"); | |||
// appManagement.addMachine(machineInfo); | |||
// list = new ArrayList<>(appManagement.getBriefApps()); | |||
// } | |||
Collections.sort(list, Comparator.comparing(AppInfo::getApp)); | |||
return Result.ofSuccess(list); | |||
} | |||
@@ -72,10 +72,10 @@ public class FlowControllerV2 { | |||
@GetMapping("/rules") | |||
@AuthAction(PrivilegeType.READ_RULE) | |||
public Result<List<FlowRuleEntity>> apiQueryMachineRules(@RequestParam String app) { | |||
System.out.println("FlowControllerV2 apiQueryMachineRules app is " + app); | |||
if (StringUtils.isBlank(app)) { | |||
app="sentinel-dashboard"; | |||
} | |||
// System.out.println("FlowControllerV2 apiQueryMachineRules app is " + app); | |||
// if (StringUtils.isBlank(app)) { | |||
// app="sentinel-dashboard"; | |||
// } | |||
if (StringUtil.isEmpty(app)) { | |||
return Result.ofFail(-1, "app can't be null or empty"); | |||
} | |||
@@ -42,7 +42,7 @@ public class SimpleMachineDiscovery implements MachineDiscovery { | |||
@Override | |||
public long addMachine(MachineInfo machineInfo) { | |||
logger.info("SimpleMachineDiscovery addMachine"); | |||
// logger.info("SimpleMachineDiscovery addMachine"); | |||
AssertUtil.notNull(machineInfo, "machineInfo cannot be null"); | |||
AppInfo appInfo = apps.computeIfAbsent(machineInfo.getApp(), o -> new AppInfo(machineInfo.getApp(), machineInfo.getAppType())); | |||
appInfo.addMachine(machineInfo); | |||
@@ -51,7 +51,7 @@ public class SimpleMachineDiscovery implements MachineDiscovery { | |||
@Override | |||
public boolean removeMachine(String app, String ip, int port) { | |||
logger.info("app is " + app); | |||
// logger.info("app is " + app); | |||
AssertUtil.assertNotBlank(app, "app name cannot be blank"); | |||
AppInfo appInfo = apps.get(app); | |||
if (appInfo != null) { | |||
@@ -64,20 +64,20 @@ public class SimpleMachineDiscovery implements MachineDiscovery { | |||
public List<String> getAppNames() { | |||
logger.info("apps.keySet is " + apps.keySet()); | |||
// logger.info("apps.keySet is " + apps.keySet()); | |||
return new ArrayList<>(apps.keySet()); | |||
} | |||
@Override | |||
public AppInfo getDetailApp(String app) { | |||
logger.info("app is " + app); | |||
// logger.info("app is " + app); | |||
AssertUtil.assertNotBlank(app, "app name cannot be blank"); | |||
return apps.get(app); | |||
} | |||
@Override | |||
public Set<AppInfo> getBriefApps() { | |||
logger.info("apps is " + apps.toString()); | |||
// logger.info("apps is " + apps.toString()); | |||
return new HashSet<>(apps.values()); | |||
} | |||