Commit 4264fe8e by Nepxion

修改界面

parent b59e3c63
...@@ -45,6 +45,15 @@ public class ServiceController { ...@@ -45,6 +45,15 @@ public class ServiceController {
return result; return result;
} }
public static List<String> getGroups() {
String url = getUrl() + "console/groups";
String result = restTemplate.getForEntity(url, String.class).getBody();
return RestUtil.fromJson(restTemplate, result, new TypeReference<List<String>>() {
});
}
public static Map<String, List<Instance>> getInstanceMap() { public static Map<String, List<Instance>> getInstanceMap() {
String url = getUrl() + "console/instance-map"; String url = getUrl() + "console/instance-map";
......
...@@ -262,7 +262,7 @@ public class RouterTopology extends AbstractTopology { ...@@ -262,7 +262,7 @@ public class RouterTopology extends AbstractTopology {
if (this.instance != instance) { if (this.instance != instance) {
this.instance = instance; this.instance = instance;
textField.setText(""); textField.setText(StringUtils.EMPTY);
dataBox.clear(); dataBox.clear();
} }
} }
...@@ -304,7 +304,7 @@ public class RouterTopology extends AbstractTopology { ...@@ -304,7 +304,7 @@ public class RouterTopology extends AbstractTopology {
if (routerPath.contains(";")) { if (routerPath.contains(";")) {
routerPath = routerPath.substring(0, routerPath.lastIndexOf(";")); routerPath = routerPath.substring(0, routerPath.lastIndexOf(";"));
} else { } else {
routerPath = ""; routerPath = StringUtils.EMPTY;
} }
textField.setText(routerPath); textField.setText(routerPath);
...@@ -349,7 +349,7 @@ public class RouterTopology extends AbstractTopology { ...@@ -349,7 +349,7 @@ public class RouterTopology extends AbstractTopology {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public void execute(ActionEvent e) { public void execute(ActionEvent e) {
textField.setText(""); textField.setText(StringUtils.EMPTY);
dataBox.clear(); dataBox.clear();
} }
}; };
......
...@@ -299,7 +299,7 @@ public class ServiceTopology extends AbstractTopology { ...@@ -299,7 +299,7 @@ public class ServiceTopology extends AbstractTopology {
} }
} }
return ""; return StringUtils.EMPTY;
} }
private String getValidPlugin(List<Instance> instances) { private String getValidPlugin(List<Instance> instances) {
...@@ -310,10 +310,10 @@ public class ServiceTopology extends AbstractTopology { ...@@ -310,10 +310,10 @@ public class ServiceTopology extends AbstractTopology {
} }
} }
return ""; return StringUtils.EMPTY;
} }
private Object[] filterToArray(Map<String, List<Instance>> instanceMap) { private Object[] filterInstances(Map<String, List<Instance>> instanceMap) {
List<String> filters = new ArrayList<String>(); List<String> filters = new ArrayList<String>();
for (Map.Entry<String, List<Instance>> entry : instanceMap.entrySet()) { for (Map.Entry<String, List<Instance>> entry : instanceMap.entrySet()) {
List<Instance> instances = entry.getValue(); List<Instance> instances = entry.getValue();
...@@ -326,30 +326,14 @@ public class ServiceTopology extends AbstractTopology { ...@@ -326,30 +326,14 @@ public class ServiceTopology extends AbstractTopology {
} }
} }
if (filters.contains("")) { if (filters.contains(StringUtils.EMPTY)) {
filters.remove(""); filters.remove(StringUtils.EMPTY);
} }
filters.add(NO_FILTER); filters.add(NO_FILTER);
return filters.toArray(); return filters.toArray();
} }
private Vector<Object> filterToVector(Map<String, List<Instance>> instanceMap) {
Vector<Object> filters = new Vector<Object>();
for (Map.Entry<String, List<Instance>> entry : instanceMap.entrySet()) {
List<Instance> instances = entry.getValue();
for (Instance instance : instances) {
String filter = InstanceEntityWrapper.getGroup(instance);
String plugin = InstanceEntityWrapper.getPlugin(instance);
if (StringUtils.isNotEmpty(plugin) && !filters.contains(filter)) {
filters.add(filter);
}
}
}
return filters;
}
private Object[] filterServices(TNode node, Map<String, List<Instance>> instanceMap) { private Object[] filterServices(TNode node, Map<String, List<Instance>> instanceMap) {
Set<String> services = instanceMap.keySet(); Set<String> services = instanceMap.keySet();
List<String> filterServices = new ArrayList<String>(); List<String> filterServices = new ArrayList<String>();
...@@ -379,7 +363,7 @@ public class ServiceTopology extends AbstractTopology { ...@@ -379,7 +363,7 @@ public class ServiceTopology extends AbstractTopology {
} }
private String getGroupName(String serviceId, int count, String filter) { private String getGroupName(String serviceId, int count, String filter) {
return ButtonManager.getHtmlText(serviceId + " [" + count + "]" + (StringUtils.isNotEmpty(filter) ? "\n" + filter : "")); return ButtonManager.getHtmlText(serviceId + " [" + count + "]" + (StringUtils.isNotEmpty(filter) ? "\n" + filter : StringUtils.EMPTY));
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
...@@ -562,7 +546,7 @@ public class ServiceTopology extends AbstractTopology { ...@@ -562,7 +546,7 @@ public class ServiceTopology extends AbstractTopology {
return; return;
} }
Object[] filters = filterToArray(instanceMap); Object[] filters = filterInstances(instanceMap);
if (filterPanel == null) { if (filterPanel == null) {
filterPanel = new FilterPanel(); filterPanel = new FilterPanel();
filterPanel.setPreferredSize(new Dimension(320, 60)); filterPanel.setPreferredSize(new Dimension(320, 60));
...@@ -736,16 +720,16 @@ public class ServiceTopology extends AbstractTopology { ...@@ -736,16 +720,16 @@ public class ServiceTopology extends AbstractTopology {
return; return;
} }
Map<String, List<Instance>> instanceMap = null; List<String> groups = null;
try { try {
instanceMap = ServiceController.getInstanceMap(); groups = ServiceController.getGroups();
} catch (Exception ex) { } catch (Exception ex) {
JExceptionDialog.traceException(HandleManager.getFrame(ServiceTopology.this), ConsoleLocale.getString("get_service_instances_failure"), ex); JExceptionDialog.traceException(HandleManager.getFrame(ServiceTopology.this), ConsoleLocale.getString("get_service_group_failure"), ex);
return; return;
} }
Vector<Object> globalFilterVector = filterToVector(instanceMap); Vector<Object> globalFilterVector = new Vector<Object>(groups);
if (globalGrayPanel == null) { if (globalGrayPanel == null) {
globalGrayPanel = new GlobalGrayPanel(); globalGrayPanel = new GlobalGrayPanel();
...@@ -853,7 +837,7 @@ public class ServiceTopology extends AbstractTopology { ...@@ -853,7 +837,7 @@ public class ServiceTopology extends AbstractTopology {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void setFilters(Vector<Object> filters) { public void setFilters(Vector<Object> filters) {
filterList.setModel(new BasicListModel(filters)); filterList.setModel(new BasicListModel(filters));
ruleTextArea.setText(""); ruleTextArea.setText(StringUtils.EMPTY);
} }
private JSecurityAction createUpdateRuleAction() { private JSecurityAction createUpdateRuleAction() {
...@@ -1077,15 +1061,15 @@ public class ServiceTopology extends AbstractTopology { ...@@ -1077,15 +1061,15 @@ public class ServiceTopology extends AbstractTopology {
ruleTabbedPane.remove(localRulePanel); ruleTabbedPane.remove(localRulePanel);
} }
dynamicVersionTextField.setText(""); dynamicVersionTextField.setText(StringUtils.EMPTY);
localVersionTextField.setText(""); localVersionTextField.setText(StringUtils.EMPTY);
updateVersionButton.setText(ConsoleLocale.getString("button_batch_update_version")); updateVersionButton.setText(ConsoleLocale.getString("button_batch_update_version"));
clearVersionButton.setText(ConsoleLocale.getString("button_batch_clear_version")); clearVersionButton.setText(ConsoleLocale.getString("button_batch_clear_version"));
updateVersionButton.setEnabled(versionControlEnabled); updateVersionButton.setEnabled(versionControlEnabled);
clearVersionButton.setEnabled(versionControlEnabled); clearVersionButton.setEnabled(versionControlEnabled);
dynamicRuleTextArea.setText(""); dynamicRuleTextArea.setText(StringUtils.EMPTY);
localRuleTextArea.setText(""); localRuleTextArea.setText(StringUtils.EMPTY);
updateRuleButton.setText(ConsoleLocale.getString("button_batch_update_rule")); updateRuleButton.setText(ConsoleLocale.getString("button_batch_update_rule"));
clearRuleButton.setText(ConsoleLocale.getString("button_batch_clear_rule")); clearRuleButton.setText(ConsoleLocale.getString("button_batch_clear_rule"));
updateRuleButton.setEnabled(ruleControlEnabled); updateRuleButton.setEnabled(ruleControlEnabled);
...@@ -1452,15 +1436,15 @@ public class ServiceTopology extends AbstractTopology { ...@@ -1452,15 +1436,15 @@ public class ServiceTopology extends AbstractTopology {
} }
public void setToUI() { public void setToUI() {
groupStartXTextField.setText(groupLocationEntity.getStartX() + ""); groupStartXTextField.setText(groupLocationEntity.getStartX() + StringUtils.EMPTY);
groupStartYTextField.setText(groupLocationEntity.getStartY() + ""); groupStartYTextField.setText(groupLocationEntity.getStartY() + StringUtils.EMPTY);
groupHorizontalGapTextField.setText(groupLocationEntity.getHorizontalGap() + ""); groupHorizontalGapTextField.setText(groupLocationEntity.getHorizontalGap() + StringUtils.EMPTY);
groupVerticalGapTextField.setText(groupLocationEntity.getVerticalGap() + ""); groupVerticalGapTextField.setText(groupLocationEntity.getVerticalGap() + StringUtils.EMPTY);
nodeStartXTextField.setText(nodeLocationEntity.getStartX() + ""); nodeStartXTextField.setText(nodeLocationEntity.getStartX() + StringUtils.EMPTY);
nodeStartYTextField.setText(nodeLocationEntity.getStartY() + ""); nodeStartYTextField.setText(nodeLocationEntity.getStartY() + StringUtils.EMPTY);
nodeHorizontalGapTextField.setText(nodeLocationEntity.getHorizontalGap() + ""); nodeHorizontalGapTextField.setText(nodeLocationEntity.getHorizontalGap() + StringUtils.EMPTY);
nodeVerticalGapTextField.setText(nodeLocationEntity.getVerticalGap() + ""); nodeVerticalGapTextField.setText(nodeLocationEntity.getVerticalGap() + StringUtils.EMPTY);
} }
public boolean setFromUI() { public boolean setFromUI() {
......
...@@ -55,6 +55,7 @@ gray_rule_not_null=灰度规则不能为空 ...@@ -55,6 +55,7 @@ gray_rule_not_null=灰度规则不能为空
execute_result=执行结果 execute_result=执行结果
get_service_group_failure=获取服务组列表失败
get_service_instances_failure=获取服务和实例列表失败 get_service_instances_failure=获取服务和实例列表失败
query_data_failure=查询数据失败,可能相关实例已下线 query_data_failure=查询数据失败,可能相关实例已下线
group_not_for_gray_release=该服务集群不能执行灰度发布 group_not_for_gray_release=该服务集群不能执行灰度发布
......
...@@ -55,6 +55,7 @@ gray_rule_not_null=\u7070\u5ea6\u89c4\u5219\u4e0d\u80fd\u4e3a\u7a7a ...@@ -55,6 +55,7 @@ gray_rule_not_null=\u7070\u5ea6\u89c4\u5219\u4e0d\u80fd\u4e3a\u7a7a
execute_result=\u6267\u884c\u7ed3\u679c execute_result=\u6267\u884c\u7ed3\u679c
get_service_group_failure=\u83b7\u53d6\u670d\u52a1\u7ec4\u5217\u8868\u5931\u8d25
get_service_instances_failure=\u83b7\u53d6\u670d\u52a1\u548c\u5b9e\u4f8b\u5217\u8868\u5931\u8d25 get_service_instances_failure=\u83b7\u53d6\u670d\u52a1\u548c\u5b9e\u4f8b\u5217\u8868\u5931\u8d25
query_data_failure=\u67e5\u8be2\u6570\u636e\u5931\u8d25\uff0c\u53ef\u80fd\u76f8\u5173\u5b9e\u4f8b\u5df2\u4e0b\u7ebf query_data_failure=\u67e5\u8be2\u6570\u636e\u5931\u8d25\uff0c\u53ef\u80fd\u76f8\u5173\u5b9e\u4f8b\u5df2\u4e0b\u7ebf
group_not_for_gray_release=\u8be5\u670d\u52a1\u96c6\u7fa4\u4e0d\u80fd\u6267\u884c\u7070\u5ea6\u53d1\u5e03 group_not_for_gray_release=\u8be5\u670d\u52a1\u96c6\u7fa4\u4e0d\u80fd\u6267\u884c\u7070\u5ea6\u53d1\u5e03
......
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