Commit 1c6575c4 by Nepxion

增加图形化灰度发布功能

parent 7ee6cac6
...@@ -42,6 +42,7 @@ import com.nepxion.cots.twaver.element.TElementManager; ...@@ -42,6 +42,7 @@ import com.nepxion.cots.twaver.element.TElementManager;
import com.nepxion.cots.twaver.element.TGroup; import com.nepxion.cots.twaver.element.TGroup;
import com.nepxion.cots.twaver.element.TGroupType; import com.nepxion.cots.twaver.element.TGroupType;
import com.nepxion.cots.twaver.element.TNode; import com.nepxion.cots.twaver.element.TNode;
import com.nepxion.cots.twaver.graph.TGraphBackground;
import com.nepxion.cots.twaver.graph.TGraphManager; import com.nepxion.cots.twaver.graph.TGraphManager;
import com.nepxion.discovery.console.desktop.controller.ServiceController; import com.nepxion.discovery.console.desktop.controller.ServiceController;
import com.nepxion.discovery.console.desktop.entity.InstanceEntity; import com.nepxion.discovery.console.desktop.entity.InstanceEntity;
...@@ -79,22 +80,24 @@ public class ServiceTopology extends AbstractTopology { ...@@ -79,22 +80,24 @@ public class ServiceTopology extends AbstractTopology {
private static final String NO_FILTER = "[No filter]"; private static final String NO_FILTER = "[No filter]";
private LocationEntity groupLocationEntity = new LocationEntity(120, 200, 280, 0); private LocationEntity groupLocationEntity = new LocationEntity(120, 250, 280, 0);
private LocationEntity nodeLocationEntity = new LocationEntity(0, 0, 120, 100); private LocationEntity nodeLocationEntity = new LocationEntity(0, 0, 120, 100);
private TopologyEntity serviceGroupEntity = new TopologyEntity(TopologyEntityType.SERVICE, true, true); private TopologyEntity serviceGroupEntity = new TopologyEntity(TopologyEntityType.SERVICE, true, true);
private TopologyEntity notServiceGroupEntity = new TopologyEntity(TopologyEntityType.MQ, true, true);
private TopologyEntity serviceNodeEntity = new TopologyEntity(TopologyEntityType.SERVICE, true, false); private TopologyEntity serviceNodeEntity = new TopologyEntity(TopologyEntityType.SERVICE, true, false);
private TopologyEntity notServiceNodeEntity = new TopologyEntity(TopologyEntityType.MQ, true, false); private TopologyEntity notServiceNodeEntity = new TopologyEntity(TopologyEntityType.MQ, true, false);
private Map<String, List<InstanceEntity>> globalInstanceMap;
private String globalFilter;
private Map<String, Point> groupLocationMap = new HashMap<String, Point>(); private Map<String, Point> groupLocationMap = new HashMap<String, Point>();
private JBasicMenuItem executeGrayReleaseMenuItem; private JBasicMenuItem executeGrayReleaseMenuItem;
private JBasicMenuItem refreshGrayStateMenuItem; private JBasicMenuItem refreshGrayStateMenuItem;
private JBasicMenuItem executeGrayRouterMenuItem; private JBasicMenuItem executeGrayRouterMenuItem;
private Map<String, List<InstanceEntity>> globalInstanceMap; private TGraphBackground background;
private String globalFilter;
private JBasicComboBox filterComboBox; private JBasicComboBox filterComboBox;
private GrayPanel grayPanel; private GrayPanel grayPanel;
private JBasicTextArea resultTextArea; private JBasicTextArea resultTextArea;
...@@ -154,6 +157,8 @@ public class ServiceTopology extends AbstractTopology { ...@@ -154,6 +157,8 @@ public class ServiceTopology extends AbstractTopology {
} }
private void initializeTopology() { private void initializeTopology() {
background = graph.getGraphBackground();
background.setTitle(ConsoleLocale.getString("title_service_cluster_gray_release"));
graph.setBlinkingRule(new BlinkingRule() { graph.setBlinkingRule(new BlinkingRule() {
public boolean isBodyBlinking(Element element) { public boolean isBodyBlinking(Element element) {
return element.getAlarmState().getHighestNativeAlarmSeverity() != null || element.getClientProperty(TWaverConst.PROPERTYNAME_RENDER_COLOR) != null; return element.getAlarmState().getHighestNativeAlarmSeverity() != null || element.getClientProperty(TWaverConst.PROPERTYNAME_RENDER_COLOR) != null;
...@@ -194,7 +199,7 @@ public class ServiceTopology extends AbstractTopology { ...@@ -194,7 +199,7 @@ public class ServiceTopology extends AbstractTopology {
int count = groupLocationMap.size(); int count = groupLocationMap.size();
String groupName = getGroupName(serviceId, instances.size(), filter); String groupName = getGroupName(serviceId, instances.size(), filter);
TGroup group = createGroup(groupName, serviceGroupEntity, groupLocationEntity, count); TGroup group = createGroup(groupName, StringUtils.isNotEmpty(plugin) ? serviceGroupEntity : notServiceGroupEntity, groupLocationEntity, count);
group.setGroupType(TGroupType.ELLIPSE_GROUP_TYPE.getType()); group.setGroupType(TGroupType.ELLIPSE_GROUP_TYPE.getType());
group.setUserObject(serviceId); group.setUserObject(serviceId);
setFilter(group, filter); setFilter(group, filter);
...@@ -466,7 +471,7 @@ public class ServiceTopology extends AbstractTopology { ...@@ -466,7 +471,7 @@ public class ServiceTopology extends AbstractTopology {
filterComboBox.setModel(new DefaultComboBoxModel<>(filters)); filterComboBox.setModel(new DefaultComboBoxModel<>(filters));
int selectedValue = JBasicOptionPane.showOptionDialog(HandleManager.getFrame(ServiceTopology.this), filterComboBox, "服务集群过滤", JBasicOptionPane.DEFAULT_OPTION, JBasicOptionPane.PLAIN_MESSAGE, ConsoleIconFactory.getSwingIcon("banner/query.png"), new Object[] { SwingLocale.getString("yes"), SwingLocale.getString("no") }, null, true); int selectedValue = JBasicOptionPane.showOptionDialog(HandleManager.getFrame(ServiceTopology.this), filterComboBox, ConsoleLocale.getString("service_cluster_filter"), JBasicOptionPane.DEFAULT_OPTION, JBasicOptionPane.PLAIN_MESSAGE, ConsoleIconFactory.getSwingIcon("banner/query.png"), new Object[] { SwingLocale.getString("yes"), SwingLocale.getString("no") }, null, true);
if (selectedValue != 0) { if (selectedValue != 0) {
return; return;
} }
...@@ -474,6 +479,12 @@ public class ServiceTopology extends AbstractTopology { ...@@ -474,6 +479,12 @@ public class ServiceTopology extends AbstractTopology {
globalInstanceMap = instanceMap; globalInstanceMap = instanceMap;
globalFilter = filterComboBox.getSelectedItem().toString(); globalFilter = filterComboBox.getSelectedItem().toString();
String title = ConsoleLocale.getString("title_service_cluster_gray_release");
if (!StringUtils.equals(globalFilter, NO_FILTER)) {
title += " [" + globalFilter + "]";
}
background.setTitle(title);
showTopology(); showTopology();
} }
}; };
......
...@@ -10,6 +10,8 @@ execute_gray_release=执行灰度发布 ...@@ -10,6 +10,8 @@ execute_gray_release=执行灰度发布
execute_gray_router=执行灰度路由 execute_gray_router=执行灰度路由
refresh_gray_state=刷新灰度状态 refresh_gray_state=刷新灰度状态
title_service_cluster_gray_release=服务集群灰度发布
service_cluster_filter=服务集群过滤
service_list=服务列表 service_list=服务列表
add_service=添加一个服务 add_service=添加一个服务
delete_service=删除一个服务 delete_service=删除一个服务
......
...@@ -10,6 +10,8 @@ execute_gray_release=\u6267\u884c\u7070\u5ea6\u53d1\u5e03 ...@@ -10,6 +10,8 @@ execute_gray_release=\u6267\u884c\u7070\u5ea6\u53d1\u5e03
execute_gray_router=\u6267\u884c\u7070\u5ea6\u8def\u7531 execute_gray_router=\u6267\u884c\u7070\u5ea6\u8def\u7531
refresh_gray_state=\u5237\u65b0\u7070\u5ea6\u72b6\u6001 refresh_gray_state=\u5237\u65b0\u7070\u5ea6\u72b6\u6001
title_service_cluster_gray_release=\u670d\u52a1\u96c6\u7fa4\u7070\u5ea6\u53d1\u5e03
service_cluster_filter=\u670d\u52a1\u96c6\u7fa4\u8fc7\u6ee4
service_list=\u670d\u52a1\u5217\u8868 service_list=\u670d\u52a1\u5217\u8868
add_service=\u6dfb\u52a0\u4e00\u4e2a\u670d\u52a1 add_service=\u6dfb\u52a0\u4e00\u4e2a\u670d\u52a1
delete_service=\u5220\u9664\u4e00\u4e2a\u670d\u52a1 delete_service=\u5220\u9664\u4e00\u4e2a\u670d\u52a1
......
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