Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
discovery
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
谢捷峰
discovery
Commits
8f5105b8
Commit
8f5105b8
authored
Jul 18, 2018
by
Nepxion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加图形化灰度发布功能
parent
3ae3f538
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
115 additions
and
2 deletions
+115
-2
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/workspace/ServiceTopology.java
+115
-2
No files found.
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/workspace/ServiceTopology.java
View file @
8f5105b8
...
@@ -15,6 +15,7 @@ import twaver.Element;
...
@@ -15,6 +15,7 @@ import twaver.Element;
import
twaver.Generator
;
import
twaver.Generator
;
import
twaver.TWaverConst
;
import
twaver.TWaverConst
;
import
java.awt.BorderLayout
;
import
java.awt.Dimension
;
import
java.awt.Dimension
;
import
java.awt.Point
;
import
java.awt.Point
;
import
java.awt.event.ActionEvent
;
import
java.awt.event.ActionEvent
;
...
@@ -24,6 +25,8 @@ import java.util.List;
...
@@ -24,6 +25,8 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Map
;
import
javax.swing.Box
;
import
javax.swing.Box
;
import
javax.swing.BoxLayout
;
import
javax.swing.JLabel
;
import
javax.swing.JPanel
;
import
javax.swing.JPanel
;
import
javax.swing.JPopupMenu
;
import
javax.swing.JPopupMenu
;
import
javax.swing.JToolBar
;
import
javax.swing.JToolBar
;
...
@@ -59,6 +62,9 @@ import com.nepxion.swing.locale.SwingLocale;
...
@@ -59,6 +62,9 @@ import com.nepxion.swing.locale.SwingLocale;
import
com.nepxion.swing.menuitem.JBasicMenuItem
;
import
com.nepxion.swing.menuitem.JBasicMenuItem
;
import
com.nepxion.swing.optionpane.JBasicOptionPane
;
import
com.nepxion.swing.optionpane.JBasicOptionPane
;
import
com.nepxion.swing.popupmenu.JBasicPopupMenu
;
import
com.nepxion.swing.popupmenu.JBasicPopupMenu
;
import
com.nepxion.swing.scrollpane.JBasicScrollPane
;
import
com.nepxion.swing.textarea.JBasicTextArea
;
import
com.nepxion.swing.textfield.JBasicTextField
;
import
com.nepxion.swing.textfield.number.JNumberTextField
;
import
com.nepxion.swing.textfield.number.JNumberTextField
;
public
class
ServiceTopology
extends
AbstractTopology
{
public
class
ServiceTopology
extends
AbstractTopology
{
...
@@ -83,11 +89,11 @@ public class ServiceTopology extends AbstractTopology {
...
@@ -83,11 +89,11 @@ public class ServiceTopology extends AbstractTopology {
private
JBasicMenuItem
refreshGrayStateMenuItem
;
private
JBasicMenuItem
refreshGrayStateMenuItem
;
private
JBasicMenuItem
executeGrayRouterMenuItem
;
private
JBasicMenuItem
executeGrayRouterMenuItem
;
private
LayoutDialog
layoutDialog
;
private
Map
<
String
,
List
<
InstanceEntity
>>
instanceMap
;
private
Map
<
String
,
List
<
InstanceEntity
>>
instanceMap
;
private
GrayPanel
grayPanel
;
private
RouterTopology
routerTopology
;
private
RouterTopology
routerTopology
;
private
LayoutDialog
layoutDialog
;
public
ServiceTopology
()
{
public
ServiceTopology
()
{
initializeToolBar
();
initializeToolBar
();
...
@@ -310,6 +316,13 @@ public class ServiceTopology extends AbstractTopology {
...
@@ -310,6 +316,13 @@ public class ServiceTopology extends AbstractTopology {
return
;
return
;
}
}
if
(
grayPanel
==
null
)
{
grayPanel
=
new
GrayPanel
();
grayPanel
.
setPreferredSize
(
new
Dimension
(
1280
,
900
));
}
JBasicOptionPane
.
showOptionDialog
(
HandleManager
.
getFrame
(
ServiceTopology
.
this
),
grayPanel
,
ConsoleLocale
.
getString
(
"execute_gray_router"
),
JBasicOptionPane
.
DEFAULT_OPTION
,
JBasicOptionPane
.
PLAIN_MESSAGE
,
ConsoleIconFactory
.
getSwingIcon
(
"banner/navigator.png"
),
new
Object
[]
{
SwingLocale
.
getString
(
"close"
)
},
null
,
true
);
}
}
};
};
...
@@ -389,6 +402,106 @@ public class ServiceTopology extends AbstractTopology {
...
@@ -389,6 +402,106 @@ public class ServiceTopology extends AbstractTopology {
return
action
;
return
action
;
}
}
private
class
GrayPanel
extends
JPanel
{
private
static
final
long
serialVersionUID
=
1L
;
private
JBasicTextField
localVersionTextField
;
private
JBasicTextField
dynamicVersionTextField
;
private
JBasicTextArea
localRuleTextArea
;
private
JBasicTextArea
dynamicRuleTextArea
;
public
GrayPanel
()
{
setLayout
(
new
FiledLayout
(
FiledLayout
.
COLUMN
,
FiledLayout
.
FULL
,
5
));
add
(
createVersionPanel
());
add
(
createRulePanel
());
}
private
JPanel
createVersionPanel
()
{
localVersionTextField
=
new
JBasicTextField
();
localVersionTextField
.
setEditable
(
false
);
dynamicVersionTextField
=
new
JBasicTextField
();
JClassicButton
updateButton
=
new
JClassicButton
(
"更新灰度版本"
,
ConsoleIconFactory
.
getSwingIcon
(
"save.png"
));
updateButton
.
setPreferredSize
(
new
Dimension
(
updateButton
.
getPreferredSize
().
width
,
30
));
JClassicButton
clearButton
=
new
JClassicButton
(
"清除灰度版本"
,
ConsoleIconFactory
.
getSwingIcon
(
"paint.png"
));
updateButton
.
setPreferredSize
(
new
Dimension
(
clearButton
.
getPreferredSize
().
width
,
30
));
double
[][]
size
=
{
{
TableLayout
.
PREFERRED
,
TableLayout
.
FILL
},
{
30
,
30
}
};
TableLayout
tableLayout
=
new
TableLayout
(
size
);
tableLayout
.
setHGap
(
5
);
tableLayout
.
setVGap
(
5
);
JPanel
versionPanel
=
new
JPanel
();
versionPanel
.
setLayout
(
tableLayout
);
versionPanel
.
add
(
new
JLabel
(
"初始(本地)版本"
),
"0, 0"
);
versionPanel
.
add
(
localVersionTextField
,
"1, 0"
);
versionPanel
.
add
(
new
JLabel
(
"灰度(动态)版本"
),
"0, 1"
);
versionPanel
.
add
(
dynamicVersionTextField
,
"1, 1"
);
JPanel
toolBar
=
new
JPanel
();
toolBar
.
setLayout
(
new
BoxLayout
(
toolBar
,
BoxLayout
.
X_AXIS
));
toolBar
.
add
(
updateButton
);
toolBar
.
add
(
clearButton
);
ButtonManager
.
updateUI
(
toolBar
);
JPanel
panel
=
new
JPanel
();
panel
.
setBorder
(
UIUtil
.
createTitledBorder
(
"版本灰度"
));
panel
.
setLayout
(
new
FiledLayout
(
FiledLayout
.
COLUMN
,
FiledLayout
.
FULL
,
5
));
panel
.
add
(
versionPanel
);
panel
.
add
(
toolBar
);
return
panel
;
}
private
JPanel
createRulePanel
()
{
localRuleTextArea
=
new
JBasicTextArea
();
localRuleTextArea
.
setEditable
(
false
);
dynamicRuleTextArea
=
new
JBasicTextArea
();
JClassicButton
updateButton
=
new
JClassicButton
(
"更新灰度规则"
,
ConsoleIconFactory
.
getSwingIcon
(
"save.png"
));
updateButton
.
setPreferredSize
(
new
Dimension
(
updateButton
.
getPreferredSize
().
width
,
30
));
JClassicButton
clearButton
=
new
JClassicButton
(
"清除灰度规则"
,
ConsoleIconFactory
.
getSwingIcon
(
"paint.png"
));
updateButton
.
setPreferredSize
(
new
Dimension
(
clearButton
.
getPreferredSize
().
width
,
30
));
double
[][]
size
=
{
{
TableLayout
.
PREFERRED
,
TableLayout
.
FILL
},
{
335
,
335
}
};
TableLayout
tableLayout
=
new
TableLayout
(
size
);
tableLayout
.
setHGap
(
5
);
tableLayout
.
setVGap
(
5
);
JPanel
rulePanel
=
new
JPanel
();
rulePanel
.
setLayout
(
tableLayout
);
rulePanel
.
add
(
new
JLabel
(
"初始(本地)规则"
),
"0, 0"
);
rulePanel
.
add
(
new
JBasicScrollPane
(
localRuleTextArea
),
"1, 0"
);
rulePanel
.
add
(
new
JLabel
(
"灰度(动态)规则"
),
"0, 1"
);
rulePanel
.
add
(
new
JBasicScrollPane
(
dynamicRuleTextArea
),
"1, 1"
);
JPanel
toolBar
=
new
JPanel
();
toolBar
.
setLayout
(
new
BoxLayout
(
toolBar
,
BoxLayout
.
X_AXIS
));
toolBar
.
add
(
updateButton
);
toolBar
.
add
(
clearButton
);
ButtonManager
.
updateUI
(
toolBar
);
JPanel
panel
=
new
JPanel
();
panel
.
setBorder
(
UIUtil
.
createTitledBorder
(
"规则灰度"
));
panel
.
setLayout
(
new
BorderLayout
());
panel
.
add
(
rulePanel
,
BorderLayout
.
CENTER
);
panel
.
add
(
toolBar
,
BorderLayout
.
SOUTH
);
return
panel
;
}
}
private
class
LayoutDialog
extends
JOptionDialog
{
private
class
LayoutDialog
extends
JOptionDialog
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment