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
081dbd6b
Commit
081dbd6b
authored
Jul 20, 2018
by
Nepxion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加图形化灰度发布功能
parent
2b45944c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
13 deletions
+19
-13
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/workspace/ServiceTopology.java
+19
-13
No files found.
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/workspace/ServiceTopology.java
View file @
081dbd6b
...
@@ -180,12 +180,13 @@ public class ServiceTopology extends AbstractTopology {
...
@@ -180,12 +180,13 @@ public class ServiceTopology extends AbstractTopology {
filterComboBox
.
setModel
(
new
DefaultComboBoxModel
<>(
filters
));
filterComboBox
.
setModel
(
new
DefaultComboBoxModel
<>(
filters
));
String
filter
=
""
;
int
selectedValue
=
JBasicOptionPane
.
showOptionDialog
(
HandleManager
.
getFrame
(
this
),
filterComboBox
,
"服务集群过滤"
,
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
(
this
),
filterComboBox
,
"服务集群过滤"
,
JBasicOptionPane
.
DEFAULT_OPTION
,
JBasicOptionPane
.
PLAIN_MESSAGE
,
ConsoleIconFactory
.
getSwingIcon
(
"banner/query.png"
),
new
Object
[]
{
SwingLocale
.
getString
(
"yes"
),
SwingLocale
.
getString
(
"no"
)
},
null
,
true
);
if
(
selectedValue
=
=
0
)
{
if
(
selectedValue
!
=
0
)
{
filter
=
filterComboBox
.
getSelectedItem
().
toString
()
;
return
;
}
}
String
filter
=
filterComboBox
.
getSelectedItem
().
toString
();
for
(
Map
.
Entry
<
String
,
List
<
InstanceEntity
>>
entry
:
instanceMap
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
List
<
InstanceEntity
>>
entry
:
instanceMap
.
entrySet
())
{
String
serviceId
=
entry
.
getKey
();
String
serviceId
=
entry
.
getKey
();
List
<
InstanceEntity
>
instances
=
entry
.
getValue
();
List
<
InstanceEntity
>
instances
=
entry
.
getValue
();
...
@@ -193,13 +194,24 @@ public class ServiceTopology extends AbstractTopology {
...
@@ -193,13 +194,24 @@ public class ServiceTopology extends AbstractTopology {
}
}
}
}
private
void
addService
(
String
filter
,
String
serviceId
,
List
<
InstanceEntity
>
instances
)
{
private
void
addService
(
String
filterId
,
String
serviceId
,
List
<
InstanceEntity
>
instances
)
{
// 服务注册发现中心,必须有一个规范,即在同一个服务集群下,必须所有服务的metadata格式一致,例如一个配了group,另一个没有配group
InstanceEntity
instance
=
instances
.
get
(
0
);
String
filter
=
instance
.
getFilter
();
String
plugin
=
instance
.
getPlugin
();
if
(!
StringUtils
.
equals
(
filterId
,
""
)
&&
!
StringUtils
.
equals
(
filterId
,
filter
))
{
return
;
}
int
count
=
groupLocationMap
.
size
();
int
count
=
groupLocationMap
.
size
();
String
groupName
=
getGroupName
(
serviceId
,
instances
.
size
(),
null
);
String
groupName
=
getGroupName
(
serviceId
,
instances
.
size
(),
filter
);
TGroup
group
=
createGroup
(
groupName
,
serviceGroupEntity
,
groupLocationEntity
,
count
);
TGroup
group
=
createGroup
(
groupName
,
serviceGroupEntity
,
groupLocationEntity
,
count
);
group
.
setGroupType
(
TGroupType
.
ELLIPSE_GROUP_TYPE
.
getType
());
group
.
setGroupType
(
TGroupType
.
ELLIPSE_GROUP_TYPE
.
getType
());
group
.
setUserObject
(
serviceId
);
group
.
setUserObject
(
serviceId
);
setFilter
(
group
,
filter
);
setPlugin
(
group
,
plugin
);
addInstances
(
group
,
serviceId
,
instances
);
addInstances
(
group
,
serviceId
,
instances
);
}
}
...
@@ -212,12 +224,9 @@ public class ServiceTopology extends AbstractTopology {
...
@@ -212,12 +224,9 @@ public class ServiceTopology extends AbstractTopology {
String
nodeName
=
getNodeName
(
instance
);
String
nodeName
=
getNodeName
(
instance
);
TNode
node
=
createNode
(
nodeName
,
StringUtils
.
isNotEmpty
(
plugin
)
?
serviceNodeEntity
:
notServiceNodeEntity
,
nodeLocationEntity
,
i
);
TNode
node
=
createNode
(
nodeName
,
StringUtils
.
isNotEmpty
(
plugin
)
?
serviceNodeEntity
:
notServiceNodeEntity
,
nodeLocationEntity
,
i
);
node
.
setUserObject
(
instance
);
setFilter
(
node
,
filter
);
setFilter
(
node
,
filter
);
setFilter
(
group
,
filter
);
setPlugin
(
node
,
plugin
);
setPlugin
(
node
,
plugin
);
setPlugin
(
group
,
plugin
);
node
.
setUserObject
(
instance
);
group
.
addChild
(
node
);
group
.
addChild
(
node
);
}
}
...
@@ -254,6 +263,7 @@ public class ServiceTopology extends AbstractTopology {
...
@@ -254,6 +263,7 @@ public class ServiceTopology extends AbstractTopology {
private
Object
[]
filter
(
Map
<
String
,
List
<
InstanceEntity
>>
instanceMap
)
{
private
Object
[]
filter
(
Map
<
String
,
List
<
InstanceEntity
>>
instanceMap
)
{
List
<
String
>
filters
=
new
ArrayList
<
String
>();
List
<
String
>
filters
=
new
ArrayList
<
String
>();
filters
.
add
(
""
);
for
(
Map
.
Entry
<
String
,
List
<
InstanceEntity
>>
entry
:
instanceMap
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
List
<
InstanceEntity
>>
entry
:
instanceMap
.
entrySet
())
{
List
<
InstanceEntity
>
instances
=
entry
.
getValue
();
List
<
InstanceEntity
>
instances
=
entry
.
getValue
();
...
@@ -265,10 +275,6 @@ public class ServiceTopology extends AbstractTopology {
...
@@ -265,10 +275,6 @@ public class ServiceTopology extends AbstractTopology {
}
}
}
}
if
(
filters
.
contains
(
""
))
{
filters
.
remove
(
""
);
}
return
filters
.
toArray
();
return
filters
.
toArray
();
}
}
...
...
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