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
ed132fe2
Commit
ed132fe2
authored
Jul 22, 2018
by
Nepxion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加图形化灰度发布功能
parent
788bb2ec
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
97 additions
and
40 deletions
+97
-40
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/controller/ServiceController.java
+31
-0
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/entity/ResultEntity.java
+0
-9
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/workspace/ServiceTopology.java
+66
-31
No files found.
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/controller/ServiceController.java
View file @
ed132fe2
...
@@ -113,6 +113,24 @@ public class ServiceController {
...
@@ -113,6 +113,24 @@ public class ServiceController {
return
result
;
return
result
;
}
}
public
static
String
remoteConfigUpdate
(
String
group
,
String
serviceId
,
String
config
)
{
String
url
=
getUrl
()
+
"/console/remote-config/update/"
+
group
+
"/"
+
serviceId
;
// 解决中文乱码
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
APPLICATION_JSON_UTF8
);
HttpEntity
<
String
>
entity
=
new
HttpEntity
<
String
>(
config
,
headers
);
String
result
=
restTemplate
.
postForEntity
(
url
,
entity
,
String
.
class
).
getBody
();
if
(!
StringUtils
.
equals
(
result
,
"OK"
)
&&
!
StringUtils
.
equals
(
result
,
"NO"
))
{
ServiceErrorHandler
errorHandler
=
(
ServiceErrorHandler
)
restTemplate
.
getErrorHandler
();
result
=
errorHandler
.
getCause
();
}
return
result
;
}
public
static
List
<
ResultEntity
>
configUpdate
(
String
serviceId
,
String
config
)
{
public
static
List
<
ResultEntity
>
configUpdate
(
String
serviceId
,
String
config
)
{
String
url
=
getUrl
()
+
"/console/config/update-sync/"
+
serviceId
;
String
url
=
getUrl
()
+
"/console/config/update-sync/"
+
serviceId
;
...
@@ -145,6 +163,19 @@ public class ServiceController {
...
@@ -145,6 +163,19 @@ public class ServiceController {
return
result
;
return
result
;
}
}
public
static
String
remoteConfigClear
(
String
group
,
String
serviceId
)
{
String
url
=
getUrl
()
+
"/console/remote-config/clear/"
+
group
+
"/"
+
serviceId
;
String
result
=
restTemplate
.
postForEntity
(
url
,
null
,
String
.
class
).
getBody
();
if
(!
StringUtils
.
equals
(
result
,
"OK"
)
&&
!
StringUtils
.
equals
(
result
,
"NO"
))
{
ServiceErrorHandler
errorHandler
=
(
ServiceErrorHandler
)
restTemplate
.
getErrorHandler
();
result
=
errorHandler
.
getCause
();
}
return
result
;
}
public
static
List
<
ResultEntity
>
configClear
(
String
serviceId
)
{
public
static
List
<
ResultEntity
>
configClear
(
String
serviceId
)
{
String
url
=
getUrl
()
+
"/console/config/clear/"
+
serviceId
;
String
url
=
getUrl
()
+
"/console/config/clear/"
+
serviceId
;
...
...
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/entity/ResultEntity.java
View file @
ed132fe2
...
@@ -19,18 +19,9 @@ import org.apache.commons.lang3.builder.ToStringStyle;
...
@@ -19,18 +19,9 @@ import org.apache.commons.lang3.builder.ToStringStyle;
public
class
ResultEntity
implements
Serializable
{
public
class
ResultEntity
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
3322655604556025836L
;
private
static
final
long
serialVersionUID
=
-
3322655604556025836L
;
private
String
serviceId
;
private
String
url
;
private
String
url
;
private
String
result
;
private
String
result
;
public
String
getServiceId
()
{
return
serviceId
;
}
public
void
setServiceId
(
String
serviceId
)
{
this
.
serviceId
=
serviceId
;
}
public
String
getUrl
()
{
public
String
getUrl
()
{
return
url
;
return
url
;
}
}
...
...
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/workspace/ServiceTopology.java
View file @
ed132fe2
...
@@ -812,19 +812,21 @@ public class ServiceTopology extends AbstractTopology {
...
@@ -812,19 +812,21 @@ public class ServiceTopology extends AbstractTopology {
this
.
group
=
group
;
this
.
group
=
group
;
this
.
node
=
null
;
this
.
node
=
null
;
boolean
versionControlEnabled
=
false
;
boolean
versionControlEnabled
=
ruleToConfigCenterRadioButtonMenuItem
.
isSelected
();
boolean
ruleControlEnabled
=
false
;
boolean
ruleControlEnabled
=
ruleToConfigCenterRadioButtonMenuItem
.
isSelected
();
for
(
Iterator
<
TNode
>
iterator
=
group
.
children
();
iterator
.
hasNext
();)
{
if
(!
versionControlEnabled
&&
!
ruleControlEnabled
)
{
TNode
node
=
iterator
.
next
();
for
(
Iterator
<
TNode
>
iterator
=
group
.
children
();
iterator
.
hasNext
();)
{
InstanceEntity
instance
=
(
InstanceEntity
)
node
.
getUserObject
();
TNode
node
=
iterator
.
next
();
InstanceEntity
instance
=
(
InstanceEntity
)
node
.
getUserObject
();
boolean
versionEnabled
=
instance
.
isDiscoveryControlEnabled
();
boolean
versionEnabled
=
instance
.
isDiscoveryControlEnabled
();
if
(
versionEnabled
)
{
if
(
versionEnabled
)
{
versionControlEnabled
=
true
;
versionControlEnabled
=
true
;
}
}
boolean
ruleEnabled
=
instance
.
isDiscoveryControlEnabled
()
&&
instance
.
isConfigRestControlEnabled
();
boolean
ruleEnabled
=
instance
.
isDiscoveryControlEnabled
()
&&
instance
.
isConfigRestControlEnabled
();
if
(
ruleEnabled
)
{
if
(
ruleEnabled
)
{
ruleControlEnabled
=
true
;
ruleControlEnabled
=
true
;
}
}
}
}
}
...
@@ -865,7 +867,7 @@ public class ServiceTopology extends AbstractTopology {
...
@@ -865,7 +867,7 @@ public class ServiceTopology extends AbstractTopology {
InstanceEntity
instance
=
(
InstanceEntity
)
node
.
getUserObject
();
InstanceEntity
instance
=
(
InstanceEntity
)
node
.
getUserObject
();
boolean
versionControlEnabled
=
instance
.
isDiscoveryControlEnabled
();
boolean
versionControlEnabled
=
instance
.
isDiscoveryControlEnabled
();
boolean
ruleControlEnabled
=
instance
.
isDiscoveryControlEnabled
()
&&
instance
.
isConfigRestControlEnabled
();
boolean
ruleControlEnabled
=
instance
.
isDiscoveryControlEnabled
()
&&
instance
.
isConfigRestControlEnabled
()
&&
!
ruleToConfigCenterRadioButtonMenuItem
.
isSelected
()
;
if
(
versionTabbedPane
.
getTabCount
()
==
1
)
{
if
(
versionTabbedPane
.
getTabCount
()
==
1
)
{
versionTabbedPane
.
addTab
(
ConsoleLocale
.
getString
(
"label_local_version"
),
localVersionPanel
,
ConsoleLocale
.
getString
(
"label_local_version"
));
versionTabbedPane
.
addTab
(
ConsoleLocale
.
getString
(
"label_local_version"
),
localVersionPanel
,
ConsoleLocale
.
getString
(
"label_local_version"
));
...
@@ -1009,18 +1011,35 @@ public class ServiceTopology extends AbstractTopology {
...
@@ -1009,18 +1011,35 @@ public class ServiceTopology extends AbstractTopology {
if
(
group
!=
null
)
{
if
(
group
!=
null
)
{
String
serviceId
=
(
String
)
group
.
getUserObject
();
String
serviceId
=
(
String
)
group
.
getUserObject
();
List
<
ResultEntity
>
results
=
null
;
try
{
results
=
ServiceController
.
configUpdate
(
serviceId
,
dynamicRule
);
}
catch
(
Exception
ex
)
{
JExceptionDialog
.
traceException
(
HandleManager
.
getFrame
(
ServiceTopology
.
this
),
ConsoleLocale
.
getString
(
"query_data_failure"
),
ex
);
refreshGrayState
(
group
);
if
(
ruleToConfigCenterRadioButtonMenuItem
.
isSelected
())
{
String
filter
=
getFilter
(
group
);
String
result
=
null
;
try
{
result
=
ServiceController
.
remoteConfigUpdate
(
filter
,
serviceId
,
dynamicRule
);
}
catch
(
Exception
ex
)
{
JExceptionDialog
.
traceException
(
HandleManager
.
getFrame
(
ServiceTopology
.
this
),
ConsoleLocale
.
getString
(
"query_data_failure"
),
ex
);
return
;
refreshGrayState
(
group
);
}
showResult
(
results
);
return
;
}
showResult
(
result
);
}
else
{
List
<
ResultEntity
>
results
=
null
;
try
{
results
=
ServiceController
.
configUpdate
(
serviceId
,
dynamicRule
);
}
catch
(
Exception
ex
)
{
JExceptionDialog
.
traceException
(
HandleManager
.
getFrame
(
ServiceTopology
.
this
),
ConsoleLocale
.
getString
(
"query_data_failure"
),
ex
);
refreshGrayState
(
group
);
return
;
}
showResult
(
results
);
}
refreshGrayState
(
group
);
refreshGrayState
(
group
);
}
else
if
(
node
!=
null
)
{
}
else
if
(
node
!=
null
)
{
...
@@ -1054,18 +1073,34 @@ public class ServiceTopology extends AbstractTopology {
...
@@ -1054,18 +1073,34 @@ public class ServiceTopology extends AbstractTopology {
public
void
execute
(
ActionEvent
e
)
{
public
void
execute
(
ActionEvent
e
)
{
if
(
group
!=
null
)
{
if
(
group
!=
null
)
{
String
serviceId
=
(
String
)
group
.
getUserObject
();
String
serviceId
=
(
String
)
group
.
getUserObject
();
List
<
ResultEntity
>
results
=
null
;
if
(
ruleToConfigCenterRadioButtonMenuItem
.
isSelected
())
{
try
{
String
filter
=
getFilter
(
group
);
results
=
ServiceController
.
configClear
(
serviceId
);
String
result
=
null
;
}
catch
(
Exception
ex
)
{
try
{
JExceptionDialog
.
traceException
(
HandleManager
.
getFrame
(
ServiceTopology
.
this
),
ConsoleLocale
.
getString
(
"query_data_failure"
),
ex
);
result
=
ServiceController
.
remoteConfigClear
(
filter
,
serviceId
);
}
catch
(
Exception
ex
)
{
JExceptionDialog
.
traceException
(
HandleManager
.
getFrame
(
ServiceTopology
.
this
),
ConsoleLocale
.
getString
(
"query_data_failure"
),
ex
);
refreshGrayState
(
group
);
refreshGrayState
(
group
);
return
;
return
;
}
}
showResult
(
results
);
showResult
(
result
);
}
else
{
List
<
ResultEntity
>
results
=
null
;
try
{
results
=
ServiceController
.
configClear
(
serviceId
);
}
catch
(
Exception
ex
)
{
JExceptionDialog
.
traceException
(
HandleManager
.
getFrame
(
ServiceTopology
.
this
),
ConsoleLocale
.
getString
(
"query_data_failure"
),
ex
);
refreshGrayState
(
group
);
return
;
}
showResult
(
results
);
}
refreshGrayState
(
group
);
refreshGrayState
(
group
);
}
else
if
(
node
!=
null
)
{
}
else
if
(
node
!=
null
)
{
...
...
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