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
0a61648a
Commit
0a61648a
authored
Jul 18, 2018
by
Nepxion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加图形化灰度发布功能
parent
5dcae01e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
8 deletions
+25
-8
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/entity/InstanceEntity.java
+4
-0
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/workspace/ServiceTopology.java
+21
-8
No files found.
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/entity/InstanceEntity.java
View file @
0a61648a
...
...
@@ -93,6 +93,10 @@ public class InstanceEntity implements Serializable {
this
.
rule
=
rule
;
}
public
String
getPlugin
()
{
return
metaData
.
get
(
"discovery.plugin"
);
}
@Override
public
int
hashCode
()
{
return
HashCodeBuilder
.
reflectionHashCode
(
this
);
...
...
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/workspace/ServiceTopology.java
View file @
0a61648a
...
...
@@ -84,6 +84,7 @@ public class ServiceTopology extends AbstractTopology {
private
TopologyEntity
serviceGroupEntity
=
new
TopologyEntity
(
TopologyEntityType
.
SERVICE
,
true
,
true
);
private
TopologyEntity
serviceNodeEntity
=
new
TopologyEntity
(
TopologyEntityType
.
SERVICE
,
true
,
false
);
private
TopologyEntity
notServiceNodeEntity
=
new
TopologyEntity
(
TopologyEntityType
.
MQ
,
true
,
false
);
private
Map
<
String
,
Point
>
groupLocationMap
=
new
HashMap
<
String
,
Point
>();
...
...
@@ -179,28 +180,40 @@ public class ServiceTopology extends AbstractTopology {
private
void
addService
(
String
serviceId
,
List
<
InstanceEntity
>
instances
)
{
int
count
=
groupLocationMap
.
size
();
String
groupName
=
getGroupName
(
serviceId
,
instances
.
size
());
String
groupName
=
getGroupName
(
serviceId
,
instances
.
size
()
,
null
);
TGroup
group
=
createGroup
(
groupName
,
serviceGroupEntity
,
count
,
groupStartX
,
groupStartY
,
groupHorizontalGap
,
groupVerticalGap
);
group
.
setGroupType
(
TGroupType
.
ELLIPSE_GROUP_TYPE
.
getType
());
group
.
setUserObject
(
serviceId
);
addInstances
(
group
,
service
GroupEntity
,
serviceNodeEntity
,
service
Id
,
instances
);
addInstances
(
group
,
serviceId
,
instances
);
}
private
void
addInstances
(
TGroup
group
,
TopologyEntity
groupEntity
,
TopologyEntity
nodeEntity
,
String
serviceId
,
List
<
InstanceEntity
>
instances
)
{
private
void
addInstances
(
TGroup
group
,
String
serviceId
,
List
<
InstanceEntity
>
instances
)
{
if
(
CollectionUtils
.
isNotEmpty
(
instances
))
{
for
(
int
i
=
0
;
i
<
instances
.
size
();
i
++)
{
InstanceEntity
instance
=
instances
.
get
(
i
);
String
plugin
=
instance
.
getPlugin
();
String
nodeName
=
getNodeName
(
instance
);
TNode
node
=
createNode
(
nodeName
,
nodeEntity
,
i
,
nodeStartX
,
nodeStartY
,
nodeHorizontalGap
,
nodeVerticalGap
);
TNode
node
=
null
;
if
(
StringUtils
.
isNotEmpty
(
plugin
))
{
node
=
createNode
(
nodeName
,
serviceNodeEntity
,
i
,
nodeStartX
,
nodeStartY
,
nodeHorizontalGap
,
nodeVerticalGap
);
group
.
putClientProperty
(
"plugin"
,
plugin
);
}
else
{
node
=
createNode
(
nodeName
,
notServiceNodeEntity
,
i
,
nodeStartX
,
nodeStartY
,
nodeHorizontalGap
,
nodeVerticalGap
);
group
.
putClientProperty
(
"plugin"
,
""
);
}
node
.
setUserObject
(
instance
);
group
.
addChild
(
node
);
}
}
updateGroup
(
group
);
groupLocationMap
.
put
(
serviceId
,
group
.
getLocation
());
dataBox
.
addElement
(
group
);
...
...
@@ -218,12 +231,12 @@ public class ServiceTopology extends AbstractTopology {
}
}
private
String
getGroupName
(
String
serviceId
,
int
count
)
{
return
ButtonManager
.
getHtmlText
(
serviceId
+
" ["
+
count
+
"]"
);
private
String
getGroupName
(
String
serviceId
,
int
count
,
String
plugin
)
{
return
ButtonManager
.
getHtmlText
(
serviceId
+
" ["
+
count
+
"]"
+
(
StringUtils
.
isNotEmpty
(
plugin
)
?
"\n"
+
plugin
:
""
)
);
}
private
void
updateGroup
(
TGroup
group
)
{
String
name
=
getGroupName
(
group
.
getUserObject
().
toString
(),
group
.
childrenSize
());
String
name
=
getGroupName
(
group
.
getUserObject
().
toString
(),
group
.
childrenSize
()
,
group
.
getClientProperty
(
"plugin"
).
toString
()
);
group
.
setName
(
name
);
}
...
...
@@ -232,7 +245,7 @@ public class ServiceTopology extends AbstractTopology {
StringBuilder
stringBuilder
=
new
StringBuilder
();
stringBuilder
.
append
(
instance
.
getHost
()).
append
(
":"
).
append
(
instance
.
getPort
());
if
(
StringUtils
.
isNotEmpty
(
instance
.
getVersion
()))
{
stringBuilder
.
append
(
"\n
[V"
).
append
(
instance
.
getVersion
());
stringBuilder
.
append
(
"\n[V"
).
append
(
instance
.
getVersion
());
if
(
StringUtils
.
isNotEmpty
(
instance
.
getDynamicVersion
()))
{
stringBuilder
.
append
(
" -> V"
).
append
(
instance
.
getDynamicVersion
());
}
...
...
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