Commit 94b9ba8f by Nepxion

增加图形化灰度发布功能

parent 0ac19dbe
......@@ -91,7 +91,7 @@ public class ServiceTopology extends AbstractTopology {
private JBasicMenuItem refreshGrayStateMenuItem;
private JBasicMenuItem executeGrayRouterMenuItem;
private TGraphBackground background;
private JBasicComboBox filterComboBox;
private FilterPanel filterPanel;
private GrayPanel grayPanel;
private JBasicTextArea resultTextArea;
private RouterTopology routerTopology;
......@@ -471,7 +471,6 @@ public class ServiceTopology extends AbstractTopology {
JSecurityAction action = new JSecurityAction(ConsoleLocale.getString("show_topology"), ConsoleIconFactory.getSwingIcon("component/ui_16.png"), ConsoleLocale.getString("show_topology")) {
private static final long serialVersionUID = 1L;
@SuppressWarnings("unchecked")
public void execute(ActionEvent e) {
Map<String, List<InstanceEntity>> instanceMap = null;
try {
......@@ -483,20 +482,19 @@ public class ServiceTopology extends AbstractTopology {
}
Object[] filters = filter(instanceMap);
if (filterComboBox == null) {
filterComboBox = new JBasicComboBox();
filterComboBox.setPreferredSize(new Dimension(300, filterComboBox.getPreferredSize().height));
if (filterPanel == null) {
filterPanel = new FilterPanel();
filterPanel.setPreferredSize(new Dimension(320, 60));
}
filterPanel.setFilters(filters);
filterComboBox.setModel(new DefaultComboBoxModel<>(filters));
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);
int selectedValue = JBasicOptionPane.showOptionDialog(HandleManager.getFrame(ServiceTopology.this), filterPanel, 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) {
return;
}
globalInstanceMap = instanceMap;
globalFilter = filterComboBox.getSelectedItem().toString();
globalFilter = filterPanel.getFilter();
String title = ConsoleLocale.getString("title_service_cluster_gray_release");
if (!StringUtils.equals(globalFilter, NO_FILTER)) {
......@@ -646,6 +644,29 @@ public class ServiceTopology extends AbstractTopology {
return action;
}
private class FilterPanel extends JPanel {
private static final long serialVersionUID = 1L;
private JBasicComboBox filterComboBox;
public FilterPanel() {
filterComboBox = new JBasicComboBox();
setLayout(new FiledLayout(FiledLayout.COLUMN, FiledLayout.FULL, 5));
add(filterComboBox);
add(new JLabel(NO_FILTER + " - " + ConsoleLocale.getString("no_service_cluster_filter")));
}
@SuppressWarnings("unchecked")
public void setFilters(Object[] filters) {
filterComboBox.setModel(new DefaultComboBoxModel<>(filters));
}
public String getFilter() {
return filterComboBox.getSelectedItem().toString();
}
}
private class GrayPanel extends JPanel {
private static final long serialVersionUID = 1L;
......
......@@ -12,6 +12,7 @@ refresh_gray_state=刷新灰度状态
title_service_cluster_gray_release=服务集群灰度发布
service_cluster_filter=服务集群过滤
no_service_cluster_filter=表示不过滤,执行跨服务集群灰度发布
title_service_gray_router=服务灰度路由
service_list=服务列表
......
......@@ -12,6 +12,7 @@ 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
no_service_cluster_filter=\u8868\u793a\u4e0d\u8fc7\u6ee4\uff0c\u6267\u884c\u8de8\u670d\u52a1\u96c6\u7fa4\u7070\u5ea6\u53d1\u5e03
title_service_gray_router=\u670d\u52a1\u7070\u5ea6\u8def\u7531
service_list=\u670d\u52a1\u5217\u8868
......
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