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
f224878d
Commit
f224878d
authored
Aug 01, 2018
by
Nepxion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改界面
parent
3ebc8e9e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
13 deletions
+37
-13
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/workspace/ServiceTopology.java
+37
-13
No files found.
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/workspace/ServiceTopology.java
View file @
f224878d
...
@@ -85,6 +85,11 @@ public class ServiceTopology extends AbstractTopology {
...
@@ -85,6 +85,11 @@ public class ServiceTopology extends AbstractTopology {
public
static
final
String
NO_FILTER
=
ConsoleLocale
.
getString
(
"no_service_cluster_filter"
);
public
static
final
String
NO_FILTER
=
ConsoleLocale
.
getString
(
"no_service_cluster_filter"
);
// private static AlarmSeverity grayAlarmSeverity;
// static {
// grayAlarmSeverity = AlarmSeverity.registerAlarmSeverity("GRAY", "G", 600, AlarmSeverity.COLOR_MINOR, null);
// }
private
LocationEntity
groupLocationEntity
=
new
LocationEntity
(
120
,
250
,
280
,
0
);
private
LocationEntity
groupLocationEntity
=
new
LocationEntity
(
120
,
250
,
280
,
0
);
private
LocationEntity
nodeLocationEntity
=
new
LocationEntity
(
0
,
0
,
120
,
100
);
private
LocationEntity
nodeLocationEntity
=
new
LocationEntity
(
0
,
0
,
120
,
100
);
private
TopologyEntity
serviceGroupEntity
=
new
TopologyEntity
(
TopologyEntityType
.
SERVICE_GROUP
,
TopologyStyleType
.
LARGE
,
true
);
private
TopologyEntity
serviceGroupEntity
=
new
TopologyEntity
(
TopologyEntityType
.
SERVICE_GROUP
,
TopologyStyleType
.
LARGE
,
true
);
...
@@ -227,7 +232,6 @@ public class ServiceTopology extends AbstractTopology {
...
@@ -227,7 +232,6 @@ public class ServiceTopology extends AbstractTopology {
private
void
addService
(
String
filterId
,
String
serviceId
,
List
<
Instance
>
instances
)
{
private
void
addService
(
String
filterId
,
String
serviceId
,
List
<
Instance
>
instances
)
{
String
filter
=
getValidFilter
(
instances
);
String
filter
=
getValidFilter
(
instances
);
String
plugin
=
getValidPlugin
(
instances
);
String
plugin
=
getValidPlugin
(
instances
);
if
(!
StringUtils
.
equals
(
filterId
,
NO_FILTER
)
&&
!
StringUtils
.
equals
(
filterId
,
filter
))
{
if
(!
StringUtils
.
equals
(
filterId
,
NO_FILTER
)
&&
!
StringUtils
.
equals
(
filterId
,
filter
))
{
return
;
return
;
}
}
...
@@ -293,7 +297,6 @@ public class ServiceTopology extends AbstractTopology {
...
@@ -293,7 +297,6 @@ public class ServiceTopology extends AbstractTopology {
private
Object
[]
filter
(
Map
<
String
,
List
<
Instance
>>
instanceMap
)
{
private
Object
[]
filter
(
Map
<
String
,
List
<
Instance
>>
instanceMap
)
{
List
<
String
>
filters
=
new
ArrayList
<
String
>();
List
<
String
>
filters
=
new
ArrayList
<
String
>();
for
(
Map
.
Entry
<
String
,
List
<
Instance
>>
entry
:
instanceMap
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
List
<
Instance
>>
entry
:
instanceMap
.
entrySet
())
{
List
<
Instance
>
instances
=
entry
.
getValue
();
List
<
Instance
>
instances
=
entry
.
getValue
();
for
(
Instance
instance
:
instances
)
{
for
(
Instance
instance
:
instances
)
{
...
@@ -316,7 +319,6 @@ public class ServiceTopology extends AbstractTopology {
...
@@ -316,7 +319,6 @@ public class ServiceTopology extends AbstractTopology {
private
Object
[]
filterServices
(
TNode
node
,
Map
<
String
,
List
<
Instance
>>
instanceMap
)
{
private
Object
[]
filterServices
(
TNode
node
,
Map
<
String
,
List
<
Instance
>>
instanceMap
)
{
Set
<
String
>
services
=
instanceMap
.
keySet
();
Set
<
String
>
services
=
instanceMap
.
keySet
();
List
<
String
>
filterServices
=
new
ArrayList
<
String
>();
List
<
String
>
filterServices
=
new
ArrayList
<
String
>();
for
(
String
service
:
services
)
{
for
(
String
service
:
services
)
{
TGroup
group
=
getGroup
(
service
);
TGroup
group
=
getGroup
(
service
);
// node.getParent() != group 表示自己不能路由自己
// node.getParent() != group 表示自己不能路由自己
...
@@ -346,10 +348,33 @@ public class ServiceTopology extends AbstractTopology {
...
@@ -346,10 +348,33 @@ public class ServiceTopology extends AbstractTopology {
return
ButtonManager
.
getHtmlText
(
serviceId
+
" ["
+
count
+
"]"
+
(
StringUtils
.
isNotEmpty
(
filter
)
?
"\n"
+
filter
:
""
));
return
ButtonManager
.
getHtmlText
(
serviceId
+
" ["
+
count
+
"]"
+
(
StringUtils
.
isNotEmpty
(
filter
)
?
"\n"
+
filter
:
""
));
}
}
@SuppressWarnings
(
"unchecked"
)
private
void
updateGroup
(
TGroup
group
)
{
private
void
updateGroup
(
TGroup
group
)
{
String
name
=
getGroupName
(
group
.
getUserObject
().
toString
(),
group
.
childrenSize
(),
getFilter
(
group
));
String
name
=
getGroupName
(
group
.
getUserObject
().
toString
(),
group
.
childrenSize
(),
getFilter
(
group
));
group
.
setName
(
name
);
group
.
setName
(
name
);
boolean
hasDynamicRule
=
false
;
boolean
hasDynamicVersion
=
false
;
List
<
TNode
>
nodes
=
group
.
getChildren
();
Iterator
<
TNode
>
iterator
=
nodes
.
iterator
();
while
(
iterator
.
hasNext
())
{
TNode
node
=
iterator
.
next
();
Instance
instance
=
(
Instance
)
node
.
getUserObject
();
if
(
StringUtils
.
isNotEmpty
(
instance
.
getDynamicRule
()))
{
hasDynamicRule
=
true
;
}
if
(
StringUtils
.
isNotEmpty
(
instance
.
getDynamicVersion
()))
{
hasDynamicVersion
=
true
;
}
}
group
.
getAlarmState
().
clear
();
if
(
hasDynamicRule
)
{
group
.
getAlarmState
().
addAcknowledgedAlarm
(
AlarmSeverity
.
MINOR
);
}
else
if
(
hasDynamicVersion
)
{
group
.
getAlarmState
().
addAcknowledgedAlarm
(
AlarmSeverity
.
WARNING
);
}
}
}
private
String
getNodeName
(
Instance
instance
)
{
private
String
getNodeName
(
Instance
instance
)
{
...
@@ -369,14 +394,15 @@ public class ServiceTopology extends AbstractTopology {
...
@@ -369,14 +394,15 @@ public class ServiceTopology extends AbstractTopology {
private
void
updateNode
(
TNode
node
,
Instance
instance
)
{
private
void
updateNode
(
TNode
node
,
Instance
instance
)
{
String
name
=
getNodeName
(
instance
);
String
name
=
getNodeName
(
instance
);
node
.
setName
(
name
);
node
.
setName
(
name
);
if
(
StringUtils
.
isNotEmpty
(
instance
.
getDynamicRule
()))
{
node
.
getAlarmState
().
clear
();
boolean
hasDynamicRule
=
StringUtils
.
isNotEmpty
(
instance
.
getDynamicRule
());
node
.
getAlarmState
().
addAcknowledgedAlarm
(
AlarmSeverity
.
WARNING
);
boolean
hasDynamicVersion
=
StringUtils
.
isNotEmpty
(
instance
.
getDynamicVersion
());
}
else
if
(
StringUtils
.
isNotEmpty
(
instance
.
getDynamicVersion
()))
{
node
.
getAlarmState
().
clear
();
node
.
getAlarmState
().
clear
();
if
(
hasDynamicRule
)
{
node
.
getAlarmState
().
addAcknowledgedAlarm
(
AlarmSeverity
.
MINOR
);
node
.
getAlarmState
().
addAcknowledgedAlarm
(
AlarmSeverity
.
MINOR
);
}
else
{
}
else
if
(
hasDynamicVersion
)
{
node
.
getAlarmState
().
clear
(
);
node
.
getAlarmState
().
addAcknowledgedAlarm
(
AlarmSeverity
.
WARNING
);
}
}
}
}
...
@@ -418,7 +444,6 @@ public class ServiceTopology extends AbstractTopology {
...
@@ -418,7 +444,6 @@ public class ServiceTopology extends AbstractTopology {
boolean
hasException
=
false
;
boolean
hasException
=
false
;
TGroup
group
=
(
TGroup
)
node
.
getParent
();
TGroup
group
=
(
TGroup
)
node
.
getParent
();
try
{
try
{
updateGrayState
(
node
);
updateGrayState
(
node
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -440,7 +465,6 @@ public class ServiceTopology extends AbstractTopology {
...
@@ -440,7 +465,6 @@ public class ServiceTopology extends AbstractTopology {
boolean
hasException
=
false
;
boolean
hasException
=
false
;
List
<
TNode
>
nodes
=
group
.
getChildren
();
List
<
TNode
>
nodes
=
group
.
getChildren
();
Iterator
<
TNode
>
iterator
=
nodes
.
iterator
();
Iterator
<
TNode
>
iterator
=
nodes
.
iterator
();
while
(
iterator
.
hasNext
())
{
while
(
iterator
.
hasNext
())
{
TNode
node
=
iterator
.
next
();
TNode
node
=
iterator
.
next
();
...
...
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