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
8630fc97
Commit
8630fc97
authored
Jul 18, 2018
by
Nepxion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加图形化灰度发布功能
parent
9dbf5780
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
63 additions
and
20 deletions
+63
-20
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/controller/ServiceController.java
+12
-0
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/workspace/ServiceTopology.java
+49
-18
discovery-console-desktop/src/main/resources/com/nepxion/discovery/console/desktop/locale/Locale.properties
+1
-1
discovery-console-desktop/src/main/resources/com/nepxion/discovery/console/desktop/locale/Locale_zh_CN.properties
+1
-1
No files found.
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/controller/ServiceController.java
View file @
8630fc97
...
@@ -56,6 +56,18 @@ public class ServiceController {
...
@@ -56,6 +56,18 @@ public class ServiceController {
return
restTemplate
.
postForEntity
(
url
,
routeServiceIds
,
RouterEntity
.
class
).
getBody
();
return
restTemplate
.
postForEntity
(
url
,
routeServiceIds
,
RouterEntity
.
class
).
getBody
();
}
}
public
static
String
configUpdate
(
String
serviceId
,
String
config
)
{
String
url
=
getUrl
()
+
"/console/config/update-sync/"
+
serviceId
;
return
restTemplate
.
postForEntity
(
url
,
config
,
String
.
class
).
getBody
();
}
public
static
String
configClear
(
String
serviceId
)
{
String
url
=
getUrl
()
+
"/console/config/clear/"
+
serviceId
;
return
restTemplate
.
postForEntity
(
url
,
null
,
String
.
class
).
getBody
();
}
public
static
String
getUrl
()
{
public
static
String
getUrl
()
{
String
url
=
PropertiesContext
.
getProperties
().
getString
(
"url"
);
String
url
=
PropertiesContext
.
getProperties
().
getString
(
"url"
);
if
(!
url
.
endsWith
(
"/"
))
{
if
(!
url
.
endsWith
(
"/"
))
{
...
...
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/workspace/ServiceTopology.java
View file @
8630fc97
...
@@ -377,11 +377,10 @@ public class ServiceTopology extends AbstractTopology {
...
@@ -377,11 +377,10 @@ public class ServiceTopology extends AbstractTopology {
grayPanel
.
setPreferredSize
(
new
Dimension
(
1280
,
900
));
grayPanel
.
setPreferredSize
(
new
Dimension
(
1280
,
900
));
}
}
if
(
node
!=
null
)
{
if
(
group
!=
null
)
{
InstanceEntity
instance
=
(
InstanceEntity
)
node
.
getUserObject
();
grayPanel
.
setGray
(
group
);
grayPanel
.
setGray
(
instance
);
}
else
if
(
node
!=
null
)
{
}
else
{
grayPanel
.
setGray
(
node
);
grayPanel
.
setGray
(
null
);
}
}
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
);
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
);
...
@@ -457,6 +456,9 @@ public class ServiceTopology extends AbstractTopology {
...
@@ -457,6 +456,9 @@ public class ServiceTopology extends AbstractTopology {
private
JBasicTextArea
localRuleTextArea
;
private
JBasicTextArea
localRuleTextArea
;
private
JBasicTabbedPane
ruleTabbedPane
;
private
JBasicTabbedPane
ruleTabbedPane
;
private
TGroup
group
;
private
TNode
node
;
public
GrayPanel
()
{
public
GrayPanel
()
{
setLayout
(
new
BorderLayout
());
setLayout
(
new
BorderLayout
());
add
(
createVersionPanel
(),
BorderLayout
.
NORTH
);
add
(
createVersionPanel
(),
BorderLayout
.
NORTH
);
...
@@ -533,20 +535,10 @@ public class ServiceTopology extends AbstractTopology {
...
@@ -533,20 +535,10 @@ public class ServiceTopology extends AbstractTopology {
return
panel
;
return
panel
;
}
}
public
void
setGray
(
InstanceEntity
instance
)
{
public
void
setGray
(
TGroup
group
)
{
if
(
instance
!=
null
)
{
this
.
group
=
group
;
if
(
versionTabbedPane
.
getTabCount
()
==
1
)
{
this
.
node
=
null
;
versionTabbedPane
.
addTab
(
"初始(本地)版本"
,
localVersionPanel
,
"初始(本地)版本"
);
}
if
(
ruleTabbedPane
.
getTabCount
()
==
1
)
{
ruleTabbedPane
.
addTab
(
"初始(本地)规则"
,
new
JBasicScrollPane
(
localRuleTextArea
),
"初始(本地)规则"
);
}
localVersionTextField
.
setText
(
instance
.
getVersion
());
dynamicVersionTextField
.
setText
(
instance
.
getDynamicVersion
());
localRuleTextArea
.
setText
(
instance
.
getRule
());
dynamicRuleTextArea
.
setText
(
instance
.
getDynamicRule
());
}
else
{
if
(
versionTabbedPane
.
getTabCount
()
==
2
)
{
if
(
versionTabbedPane
.
getTabCount
()
==
2
)
{
versionTabbedPane
.
remove
(
1
);
versionTabbedPane
.
remove
(
1
);
}
}
...
@@ -559,6 +551,23 @@ public class ServiceTopology extends AbstractTopology {
...
@@ -559,6 +551,23 @@ public class ServiceTopology extends AbstractTopology {
localRuleTextArea
.
setText
(
""
);
localRuleTextArea
.
setText
(
""
);
dynamicRuleTextArea
.
setText
(
""
);
dynamicRuleTextArea
.
setText
(
""
);
}
}
public
void
setGray
(
TNode
node
)
{
this
.
group
=
null
;
this
.
node
=
node
;
InstanceEntity
instance
=
(
InstanceEntity
)
node
.
getUserObject
();
if
(
versionTabbedPane
.
getTabCount
()
==
1
)
{
versionTabbedPane
.
addTab
(
"初始(本地)版本"
,
localVersionPanel
,
"初始(本地)版本"
);
}
if
(
ruleTabbedPane
.
getTabCount
()
==
1
)
{
ruleTabbedPane
.
addTab
(
"初始(本地)规则"
,
new
JBasicScrollPane
(
localRuleTextArea
),
"初始(本地)规则"
);
}
localVersionTextField
.
setText
(
instance
.
getVersion
());
dynamicVersionTextField
.
setText
(
instance
.
getDynamicVersion
());
localRuleTextArea
.
setText
(
instance
.
getRule
());
dynamicRuleTextArea
.
setText
(
instance
.
getDynamicRule
());
}
}
private
JSecurityAction
createUpdateVersionAction
()
{
private
JSecurityAction
createUpdateVersionAction
()
{
...
@@ -590,7 +599,19 @@ public class ServiceTopology extends AbstractTopology {
...
@@ -590,7 +599,19 @@ public class ServiceTopology extends AbstractTopology {
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
public
void
execute
(
ActionEvent
e
)
{
public
void
execute
(
ActionEvent
e
)
{
String
dynamicRule
=
dynamicRuleTextArea
.
getText
();
if
(
group
!=
null
)
{
String
serviceId
=
(
String
)
group
.
getUserObject
();
String
result
=
ServiceController
.
configUpdate
(
serviceId
,
dynamicRule
);
System
.
out
.
println
(
result
);
refreshGrayState
(
group
);
}
else
if
(
node
!=
null
)
{
InstanceEntity
instance
=
(
InstanceEntity
)
node
.
getUserObject
();
refreshGrayState
(
node
);
}
}
}
};
};
...
@@ -602,7 +623,17 @@ public class ServiceTopology extends AbstractTopology {
...
@@ -602,7 +623,17 @@ public class ServiceTopology extends AbstractTopology {
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
public
void
execute
(
ActionEvent
e
)
{
public
void
execute
(
ActionEvent
e
)
{
if
(
group
!=
null
)
{
String
serviceId
=
(
String
)
group
.
getUserObject
();
String
result
=
ServiceController
.
configClear
(
serviceId
);
System
.
out
.
println
(
result
);
refreshGrayState
(
group
);
}
else
if
(
node
!=
null
)
{
InstanceEntity
instance
=
(
InstanceEntity
)
node
.
getUserObject
();
refreshGrayState
(
node
);
}
}
}
};
};
...
...
discovery-console-desktop/src/main/resources/com/nepxion/discovery/console/desktop/locale/Locale.properties
View file @
8630fc97
...
@@ -7,8 +7,8 @@ service_topology=服务拓扑
...
@@ -7,8 +7,8 @@ service_topology=服务拓扑
show_topology
=
显示服务拓扑
show_topology
=
显示服务拓扑
execute_gray_release
=
执行灰度发布
execute_gray_release
=
执行灰度发布
refresh_gray_state
=
刷新灰度状态
execute_gray_router
=
执行灰度路由
execute_gray_router
=
执行灰度路由
refresh_gray_state
=
刷新灰度状态
service_list
=
服务列表
service_list
=
服务列表
execute_router
=
执行路由
execute_router
=
执行路由
...
...
discovery-console-desktop/src/main/resources/com/nepxion/discovery/console/desktop/locale/Locale_zh_CN.properties
View file @
8630fc97
...
@@ -7,8 +7,8 @@ service_topology=\u670d\u52a1\u62d3\u6251
...
@@ -7,8 +7,8 @@ service_topology=\u670d\u52a1\u62d3\u6251
show_topology
=
\u
663e
\u
793a
\u
670d
\u
52a1
\u
62d3
\u6251
show_topology
=
\u
663e
\u
793a
\u
670d
\u
52a1
\u
62d3
\u6251
execute_gray_release
=
\u6267\u
884c
\u7070\u
5ea6
\u
53d1
\u
5e03
execute_gray_release
=
\u6267\u
884c
\u7070\u
5ea6
\u
53d1
\u
5e03
refresh_gray_state
=
\u5237\u
65b0
\u7070\u
5ea6
\u
72b6
\u6001
execute_gray_router
=
\u6267\u
884c
\u7070\u
5ea6
\u
8def
\u7531
execute_gray_router
=
\u6267\u
884c
\u7070\u
5ea6
\u
8def
\u7531
refresh_gray_state
=
\u5237\u
65b0
\u7070\u
5ea6
\u
72b6
\u6001
service_list
=
\u
670d
\u
52a1
\u5217\u8868
service_list
=
\u
670d
\u
52a1
\u5217\u8868
execute_router
=
\u6267\u
884c
\u
8def
\u7531
execute_router
=
\u6267\u
884c
\u
8def
\u7531
...
...
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