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
5653336b
Commit
5653336b
authored
Sep 15, 2018
by
Nepxion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改界面
parent
552c8c13
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
61 additions
and
88 deletions
+61
-88
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/controller/ServiceController.java
+2
-2
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/workspace/ServiceTopology.java
+31
-70
discovery-console-desktop/src/main/resources/com/nepxion/discovery/console/desktop/locale/Locale.properties
+1
-3
discovery-console-desktop/src/main/resources/com/nepxion/discovery/console/desktop/locale/Locale_zh_CN.properties
+1
-3
discovery-console/src/main/java/com/nepxion/discovery/console/endpoint/ConsoleEndpoint.java
+26
-10
No files found.
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/controller/ServiceController.java
View file @
5653336b
...
@@ -54,10 +54,10 @@ public class ServiceController {
...
@@ -54,10 +54,10 @@ public class ServiceController {
});
});
}
}
public
static
Map
<
String
,
List
<
Instance
>>
getInstanceMap
()
{
public
static
Map
<
String
,
List
<
Instance
>>
getInstanceMap
(
List
<
String
>
groups
)
{
String
url
=
getUrl
()
+
"console/instance-map"
;
String
url
=
getUrl
()
+
"console/instance-map"
;
String
result
=
restTemplate
.
getForEntity
(
url
,
String
.
class
).
getBody
();
String
result
=
restTemplate
.
postForEntity
(
url
,
groups
,
String
.
class
).
getBody
();
return
RestUtil
.
fromJson
(
restTemplate
,
result
,
new
TypeReference
<
Map
<
String
,
List
<
Instance
>>>()
{
return
RestUtil
.
fromJson
(
restTemplate
,
result
,
new
TypeReference
<
Map
<
String
,
List
<
Instance
>>>()
{
});
});
...
...
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/workspace/ServiceTopology.java
View file @
5653336b
...
@@ -32,12 +32,12 @@ import javax.swing.BorderFactory;
...
@@ -32,12 +32,12 @@ import javax.swing.BorderFactory;
import
javax.swing.Box
;
import
javax.swing.Box
;
import
javax.swing.BoxLayout
;
import
javax.swing.BoxLayout
;
import
javax.swing.ButtonGroup
;
import
javax.swing.ButtonGroup
;
import
javax.swing.DefaultComboBoxModel
;
import
javax.swing.JLabel
;
import
javax.swing.JLabel
;
import
javax.swing.JPanel
;
import
javax.swing.JPanel
;
import
javax.swing.JToolBar
;
import
javax.swing.JToolBar
;
import
javax.swing.SwingConstants
;
import
javax.swing.SwingConstants
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
com.nepxion.cots.twaver.element.TElement
;
import
com.nepxion.cots.twaver.element.TElement
;
...
@@ -64,9 +64,9 @@ import com.nepxion.swing.action.JSecurityAction;
...
@@ -64,9 +64,9 @@ import com.nepxion.swing.action.JSecurityAction;
import
com.nepxion.swing.button.ButtonManager
;
import
com.nepxion.swing.button.ButtonManager
;
import
com.nepxion.swing.button.JClassicButton
;
import
com.nepxion.swing.button.JClassicButton
;
import
com.nepxion.swing.button.JClassicMenuButton
;
import
com.nepxion.swing.button.JClassicMenuButton
;
import
com.nepxion.swing.combobox.JBasicComboBox
;
import
com.nepxion.swing.dialog.JExceptionDialog
;
import
com.nepxion.swing.dialog.JExceptionDialog
;
import
com.nepxion.swing.dialog.JOptionDialog
;
import
com.nepxion.swing.dialog.JOptionDialog
;
import
com.nepxion.swing.element.ElementNode
;
import
com.nepxion.swing.framework.dockable.JDockable
;
import
com.nepxion.swing.framework.dockable.JDockable
;
import
com.nepxion.swing.framework.dockable.JDockableView
;
import
com.nepxion.swing.framework.dockable.JDockableView
;
import
com.nepxion.swing.handle.HandleManager
;
import
com.nepxion.swing.handle.HandleManager
;
...
@@ -83,6 +83,7 @@ import com.nepxion.swing.optionpane.JBasicOptionPane;
...
@@ -83,6 +83,7 @@ import com.nepxion.swing.optionpane.JBasicOptionPane;
import
com.nepxion.swing.popupmenu.JBasicPopupMenu
;
import
com.nepxion.swing.popupmenu.JBasicPopupMenu
;
import
com.nepxion.swing.query.JQueryHierarchy
;
import
com.nepxion.swing.query.JQueryHierarchy
;
import
com.nepxion.swing.scrollpane.JBasicScrollPane
;
import
com.nepxion.swing.scrollpane.JBasicScrollPane
;
import
com.nepxion.swing.selector.checkbox.JCheckBoxSelector
;
import
com.nepxion.swing.tabbedpane.JBasicTabbedPane
;
import
com.nepxion.swing.tabbedpane.JBasicTabbedPane
;
import
com.nepxion.swing.textarea.JBasicTextArea
;
import
com.nepxion.swing.textarea.JBasicTextArea
;
import
com.nepxion.swing.textfield.JBasicTextField
;
import
com.nepxion.swing.textfield.JBasicTextField
;
...
@@ -91,8 +92,6 @@ import com.nepxion.swing.textfield.number.JNumberTextField;
...
@@ -91,8 +92,6 @@ import com.nepxion.swing.textfield.number.JNumberTextField;
public
class
ServiceTopology
extends
AbstractTopology
{
public
class
ServiceTopology
extends
AbstractTopology
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
public
static
final
String
NO_FILTER
=
ConsoleLocale
.
getString
(
"no_service_cluster_filter"
);
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
,
120
);
private
LocationEntity
nodeLocationEntity
=
new
LocationEntity
(
0
,
0
,
120
,
120
);
private
TopologyEntity
serviceGroupEntity
=
new
TopologyEntity
(
TopologyEntityType
.
SERVICE_GROUP
,
TopologyStyleType
.
LARGE
,
true
);
private
TopologyEntity
serviceGroupEntity
=
new
TopologyEntity
(
TopologyEntityType
.
SERVICE_GROUP
,
TopologyStyleType
.
LARGE
,
true
);
...
@@ -109,7 +108,6 @@ public class ServiceTopology extends AbstractTopology {
...
@@ -109,7 +108,6 @@ public class ServiceTopology extends AbstractTopology {
private
JBasicRadioButtonMenuItem
pushSyncModeRadioButtonMenuItem
;
private
JBasicRadioButtonMenuItem
pushSyncModeRadioButtonMenuItem
;
private
JBasicRadioButtonMenuItem
ruleToConfigCenterRadioButtonMenuItem
;
private
JBasicRadioButtonMenuItem
ruleToConfigCenterRadioButtonMenuItem
;
private
JBasicRadioButtonMenuItem
ruleToServiceRadioButtonMenuItem
;
private
JBasicRadioButtonMenuItem
ruleToServiceRadioButtonMenuItem
;
private
FilterPanel
filterPanel
;
private
GlobalGrayPanel
globalGrayPanel
;
private
GlobalGrayPanel
globalGrayPanel
;
private
GrayPanel
grayPanel
;
private
GrayPanel
grayPanel
;
private
JBasicTextArea
resultTextArea
;
private
JBasicTextArea
resultTextArea
;
...
@@ -117,7 +115,6 @@ public class ServiceTopology extends AbstractTopology {
...
@@ -117,7 +115,6 @@ public class ServiceTopology extends AbstractTopology {
private
LayoutDialog
layoutDialog
;
private
LayoutDialog
layoutDialog
;
private
Map
<
String
,
List
<
Instance
>>
globalInstanceMap
;
private
Map
<
String
,
List
<
Instance
>>
globalInstanceMap
;
private
String
globalFilter
;
public
ServiceTopology
()
{
public
ServiceTopology
()
{
initializeToolBar
();
initializeToolBar
();
...
@@ -243,16 +240,13 @@ public class ServiceTopology extends AbstractTopology {
...
@@ -243,16 +240,13 @@ public class ServiceTopology extends AbstractTopology {
for
(
Map
.
Entry
<
String
,
List
<
Instance
>>
entry
:
globalInstanceMap
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
List
<
Instance
>>
entry
:
globalInstanceMap
.
entrySet
())
{
String
serviceId
=
entry
.
getKey
();
String
serviceId
=
entry
.
getKey
();
List
<
Instance
>
instances
=
entry
.
getValue
();
List
<
Instance
>
instances
=
entry
.
getValue
();
addService
(
globalFilter
,
serviceId
,
instances
);
addService
(
serviceId
,
instances
);
}
}
}
}
private
void
addService
(
String
filterId
,
String
serviceId
,
List
<
Instance
>
instances
)
{
private
void
addService
(
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
))
{
return
;
}
int
count
=
groupLocationMap
.
size
();
int
count
=
groupLocationMap
.
size
();
String
groupName
=
getGroupName
(
serviceId
,
instances
.
size
(),
filter
);
String
groupName
=
getGroupName
(
serviceId
,
instances
.
size
(),
filter
);
...
@@ -313,27 +307,6 @@ public class ServiceTopology extends AbstractTopology {
...
@@ -313,27 +307,6 @@ public class ServiceTopology extends AbstractTopology {
return
StringUtils
.
EMPTY
;
return
StringUtils
.
EMPTY
;
}
}
private
Object
[]
filterInstances
(
Map
<
String
,
List
<
Instance
>>
instanceMap
)
{
List
<
String
>
filters
=
new
ArrayList
<
String
>();
for
(
Map
.
Entry
<
String
,
List
<
Instance
>>
entry
:
instanceMap
.
entrySet
())
{
List
<
Instance
>
instances
=
entry
.
getValue
();
for
(
Instance
instance
:
instances
)
{
String
plugin
=
InstanceEntityWrapper
.
getPlugin
(
instance
);
String
filter
=
InstanceEntityWrapper
.
getGroup
(
instance
);
if
(
StringUtils
.
isNotEmpty
(
plugin
)
&&
!
filters
.
contains
(
filter
))
{
filters
.
add
(
filter
);
}
}
}
if
(
filters
.
contains
(
StringUtils
.
EMPTY
))
{
filters
.
remove
(
StringUtils
.
EMPTY
);
}
filters
.
add
(
NO_FILTER
);
return
filters
.
toArray
();
}
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
>();
...
@@ -536,35 +509,46 @@ public class ServiceTopology extends AbstractTopology {
...
@@ -536,35 +509,46 @@ public class ServiceTopology extends AbstractTopology {
JSecurityAction
action
=
new
JSecurityAction
(
ConsoleLocale
.
getString
(
"show_topology"
),
ConsoleIconFactory
.
getSwingIcon
(
"component/ui_16.png"
),
ConsoleLocale
.
getString
(
"show_topology"
))
{
JSecurityAction
action
=
new
JSecurityAction
(
ConsoleLocale
.
getString
(
"show_topology"
),
ConsoleIconFactory
.
getSwingIcon
(
"component/ui_16.png"
),
ConsoleLocale
.
getString
(
"show_topology"
))
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
@SuppressWarnings
(
"unchecked"
)
public
void
execute
(
ActionEvent
e
)
{
public
void
execute
(
ActionEvent
e
)
{
Map
<
String
,
List
<
Instance
>>
instanceMap
=
null
;
List
<
String
>
groups
=
null
;
try
{
try
{
instanceMap
=
ServiceController
.
getInstanceMap
();
groups
=
ServiceController
.
getGroups
();
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
JExceptionDialog
.
traceException
(
HandleManager
.
getFrame
(
ServiceTopology
.
this
),
ConsoleLocale
.
getString
(
"get_service_
instances
_failure"
),
ex
);
JExceptionDialog
.
traceException
(
HandleManager
.
getFrame
(
ServiceTopology
.
this
),
ConsoleLocale
.
getString
(
"get_service_
group
_failure"
),
ex
);
return
;
return
;
}
}
Object
[]
filters
=
filterInstances
(
instanceMap
);
List
<
ElementNode
>
filterElementNodes
=
new
ArrayList
<
ElementNode
>();
if
(
filterPanel
==
null
)
{
for
(
String
filter
:
groups
)
{
filterPanel
=
new
FilterPanel
();
filterElementNodes
.
add
(
new
ElementNode
(
filter
,
IconFactory
.
getSwingIcon
(
"component/file_chooser_16.png"
),
filter
));
filterPanel
.
setPreferredSize
(
new
Dimension
(
320
,
60
));
}
JCheckBoxSelector
checkBoxSelector
=
new
JCheckBoxSelector
(
HandleManager
.
getFrame
(
ServiceTopology
.
this
),
ConsoleLocale
.
getString
(
"service_cluster_filter"
),
new
Dimension
(
400
,
350
),
filterElementNodes
);
checkBoxSelector
.
setVisible
(
true
);
checkBoxSelector
.
dispose
();
List
<
String
>
filters
=
new
ArrayList
<
String
>();
if
(
checkBoxSelector
.
isConfirmed
())
{
List
<
ElementNode
>
selectedFilterElementNodes
=
checkBoxSelector
.
getSelectedElementNodes
();
for
(
ElementNode
selectedFilterElementNode
:
selectedFilterElementNodes
)
{
filters
.
add
(
selectedFilterElementNode
.
getText
());
}
}
}
filterPanel
.
setFilters
(
filters
);
int
selectedValue
=
JBasicOptionPane
.
showOptionDialog
(
HandleManager
.
getFrame
(
ServiceTopology
.
this
),
filterPanel
,
ConsoleLocale
.
getString
(
"service_cluster_filter"
),
JBasicOptionPane
.
DEFAULT_OPTION
,
JBasicOptionPane
.
PLAIN_MESSAGE
,
ConsoleIconFactory
.
getSwingIcon
(
"banner/query.png"
),
new
Object
[]
{
SwingLocale
.
getString
(
"yes"
),
SwingLocale
.
getString
(
"no"
)
},
null
,
true
);
Map
<
String
,
List
<
Instance
>>
instanceMap
=
null
;
if
(
selectedValue
!=
0
)
{
try
{
instanceMap
=
ServiceController
.
getInstanceMap
(
filters
);
}
catch
(
Exception
ex
)
{
JExceptionDialog
.
traceException
(
HandleManager
.
getFrame
(
ServiceTopology
.
this
),
ConsoleLocale
.
getString
(
"get_service_instances_failure"
),
ex
);
return
;
return
;
}
}
globalInstanceMap
=
instanceMap
;
globalInstanceMap
=
instanceMap
;
globalFilter
=
filterPanel
.
getFilter
();
String
title
=
ConsoleLocale
.
getString
(
"title_service_cluster_gray_release"
);
String
title
=
ConsoleLocale
.
getString
(
"title_service_cluster_gray_release"
)
+
" "
+
(
CollectionUtils
.
isNotEmpty
(
filters
)
?
filters
:
StringUtils
.
EMPTY
);
if
(!
StringUtils
.
equals
(
globalFilter
,
NO_FILTER
))
{
title
+=
" ["
+
globalFilter
+
"]"
;
}
background
.
setTitle
(
title
);
background
.
setTitle
(
title
);
showTopology
();
showTopology
();
...
@@ -745,29 +729,6 @@ public class ServiceTopology extends AbstractTopology {
...
@@ -745,29 +729,6 @@ public class ServiceTopology extends AbstractTopology {
return
action
;
return
action
;
}
}
private
class
FilterPanel
extends
JPanel
{
private
static
final
long
serialVersionUID
=
1L
;
private
JBasicComboBox
filterComboBox
;
public
FilterPanel
()
{
filterComboBox
=
new
JBasicComboBox
();
setLayout
(
new
FiledLayout
(
FiledLayout
.
COLUMN
,
FiledLayout
.
FULL
,
5
));
add
(
filterComboBox
);
add
(
new
JLabel
(
NO_FILTER
+
" - "
+
ConsoleLocale
.
getString
(
"description_no_service_cluster_filter"
)));
}
@SuppressWarnings
(
"unchecked"
)
public
void
setFilters
(
Object
[]
filters
)
{
filterComboBox
.
setModel
(
new
DefaultComboBoxModel
<>(
filters
));
}
public
String
getFilter
()
{
return
filterComboBox
.
getSelectedItem
().
toString
();
}
}
private
class
GlobalGrayPanel
extends
JQueryHierarchy
{
private
class
GlobalGrayPanel
extends
JQueryHierarchy
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
...
...
discovery-console-desktop/src/main/resources/com/nepxion/discovery/console/desktop/locale/Locale.properties
View file @
5653336b
...
@@ -18,9 +18,7 @@ rule_to_config_center=规则推送到远程配置中心
...
@@ -18,9 +18,7 @@ rule_to_config_center=规则推送到远程配置中心
rule_to_service
=
规则推送到服务或者服务集群
rule_to_service
=
规则推送到服务或者服务集群
title_service_cluster_gray_release
=
服务集群灰度发布
title_service_cluster_gray_release
=
服务集群灰度发布
service_cluster_filter
=
服务集群选取
service_cluster_filter
=
服务集群组过滤
no_service_cluster_filter
=
全部服务集群
description_no_service_cluster_filter
=
便于执行跨服务集群灰度发布
title_service_gray_router
=
服务灰度路由
title_service_gray_router
=
服务灰度路由
service_list
=
服务列表
service_list
=
服务列表
...
...
discovery-console-desktop/src/main/resources/com/nepxion/discovery/console/desktop/locale/Locale_zh_CN.properties
View file @
5653336b
...
@@ -18,9 +18,7 @@ rule_to_config_center=\u89c4\u5219\u63a8\u9001\u5230\u8fdc\u7a0b\u914d\u7f6e\u4e
...
@@ -18,9 +18,7 @@ rule_to_config_center=\u89c4\u5219\u63a8\u9001\u5230\u8fdc\u7a0b\u914d\u7f6e\u4e
rule_to_service
=
\u
89c4
\u5219\u
63a8
\u9001\u5230\u
670d
\u
52a1
\u6216\u8005\u
670d
\u
52a1
\u
96c6
\u
7fa4
rule_to_service
=
\u
89c4
\u5219\u
63a8
\u9001\u5230\u
670d
\u
52a1
\u6216\u8005\u
670d
\u
52a1
\u
96c6
\u
7fa4
title_service_cluster_gray_release
=
\u
670d
\u
52a1
\u
96c6
\u
7fa4
\u7070\u
5ea6
\u
53d1
\u
5e03
title_service_cluster_gray_release
=
\u
670d
\u
52a1
\u
96c6
\u
7fa4
\u7070\u
5ea6
\u
53d1
\u
5e03
service_cluster_filter
=
\u
670d
\u
52a1
\u
96c6
\u
7fa4
\u9009\u
53d6
service_cluster_filter
=
\u
670d
\u
52a1
\u
96c6
\u
7fa4
\u
7ec4
\u
8fc7
\u
6ee4
no_service_cluster_filter
=
\u5168\u
90e8
\u
670d
\u
52a1
\u
96c6
\u
7fa4
description_no_service_cluster_filter
=
\u
4fbf
\u
4e8e
\u6267\u
884c
\u
8de8
\u
670d
\u
52a1
\u
96c6
\u
7fa4
\u7070\u
5ea6
\u
53d1
\u
5e03
title_service_gray_router
=
\u
670d
\u
52a1
\u7070\u
5ea6
\u
8def
\u7531
title_service_gray_router
=
\u
670d
\u
52a1
\u7070\u
5ea6
\u
8def
\u7531
service_list
=
\u
670d
\u
52a1
\u5217\u8868
service_list
=
\u
670d
\u
52a1
\u5217\u8868
...
...
discovery-console/src/main/java/com/nepxion/discovery/console/endpoint/ConsoleEndpoint.java
View file @
5653336b
...
@@ -18,6 +18,7 @@ import java.util.LinkedHashMap;
...
@@ -18,6 +18,7 @@ import java.util.LinkedHashMap;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -72,7 +73,7 @@ public class ConsoleEndpoint {
...
@@ -72,7 +73,7 @@ public class ConsoleEndpoint {
}
}
@RequestMapping
(
path
=
"/groups"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
path
=
"/groups"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
value
=
"获取服务注册中心的服务
所在的组
列表"
,
notes
=
""
,
response
=
List
.
class
,
httpMethod
=
"GET"
)
@ApiOperation
(
value
=
"获取服务注册中心的服务
组名
列表"
,
notes
=
""
,
response
=
List
.
class
,
httpMethod
=
"GET"
)
@ResponseBody
@ResponseBody
@ManagedOperation
@ManagedOperation
public
List
<
String
>
groups
()
{
public
List
<
String
>
groups
()
{
...
@@ -80,7 +81,7 @@ public class ConsoleEndpoint {
...
@@ -80,7 +81,7 @@ public class ConsoleEndpoint {
}
}
@RequestMapping
(
path
=
"/services"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
path
=
"/services"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
value
=
"获取服务注册中心的服务列表"
,
notes
=
""
,
response
=
List
.
class
,
httpMethod
=
"GET"
)
@ApiOperation
(
value
=
"获取服务注册中心的服务
名
列表"
,
notes
=
""
,
response
=
List
.
class
,
httpMethod
=
"GET"
)
@ResponseBody
@ResponseBody
@ManagedOperation
@ManagedOperation
public
List
<
String
>
services
()
{
public
List
<
String
>
services
()
{
...
@@ -88,7 +89,7 @@ public class ConsoleEndpoint {
...
@@ -88,7 +89,7 @@ public class ConsoleEndpoint {
}
}
@RequestMapping
(
path
=
"/instances/{serviceId}"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
path
=
"/instances/{serviceId}"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
value
=
"获取服务注册中心
服务的
实例列表"
,
notes
=
""
,
response
=
List
.
class
,
httpMethod
=
"GET"
)
@ApiOperation
(
value
=
"获取服务注册中心
的服务
实例列表"
,
notes
=
""
,
response
=
List
.
class
,
httpMethod
=
"GET"
)
@ResponseBody
@ResponseBody
@ManagedOperation
@ManagedOperation
public
List
<
ServiceInstance
>
instances
(
@PathVariable
(
value
=
"serviceId"
)
@ApiParam
(
value
=
"服务名"
,
required
=
true
)
String
serviceId
)
{
public
List
<
ServiceInstance
>
instances
(
@PathVariable
(
value
=
"serviceId"
)
@ApiParam
(
value
=
"服务名"
,
required
=
true
)
String
serviceId
)
{
...
@@ -96,19 +97,19 @@ public class ConsoleEndpoint {
...
@@ -96,19 +97,19 @@ public class ConsoleEndpoint {
}
}
@RequestMapping
(
path
=
"/instance-list/{serviceId}"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
path
=
"/instance-list/{serviceId}"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
value
=
"获取服务注册中心
服务的
实例列表(精简数据)"
,
notes
=
""
,
response
=
List
.
class
,
httpMethod
=
"GET"
)
@ApiOperation
(
value
=
"获取服务注册中心
的服务
实例列表(精简数据)"
,
notes
=
""
,
response
=
List
.
class
,
httpMethod
=
"GET"
)
@ResponseBody
@ResponseBody
@ManagedOperation
@ManagedOperation
public
List
<
InstanceEntity
>
instanceList
(
@PathVariable
(
value
=
"serviceId"
)
@ApiParam
(
value
=
"服务名"
,
required
=
true
)
String
serviceId
)
{
public
List
<
InstanceEntity
>
instanceList
(
@PathVariable
(
value
=
"serviceId"
)
@ApiParam
(
value
=
"服务名"
,
required
=
true
)
String
serviceId
)
{
return
getInstanceList
(
serviceId
);
return
getInstanceList
(
serviceId
);
}
}
@RequestMapping
(
path
=
"/instance-map"
,
method
=
RequestMethod
.
GE
T
)
@RequestMapping
(
path
=
"/instance-map"
,
method
=
RequestMethod
.
POS
T
)
@ApiOperation
(
value
=
"获取服务注册中心的服务
和实例的Map(精简数据)"
,
notes
=
""
,
response
=
Map
.
class
,
httpMethod
=
"GE
T"
)
@ApiOperation
(
value
=
"获取服务注册中心的服务
实例的Map(精简数据)"
,
notes
=
"服务组名列表"
,
response
=
Map
.
class
,
httpMethod
=
"POS
T"
)
@ResponseBody
@ResponseBody
@ManagedOperation
@ManagedOperation
public
Map
<
String
,
List
<
InstanceEntity
>>
instanceMap
()
{
public
Map
<
String
,
List
<
InstanceEntity
>>
instanceMap
(
@RequestBody
@ApiParam
(
value
=
"服务组名列表"
,
required
=
true
)
List
<
String
>
groups
)
{
return
getInstanceMap
();
return
getInstanceMap
(
groups
);
}
}
@RequestMapping
(
path
=
"/remote-config/update/{group}/{serviceId}"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
path
=
"/remote-config/update/{group}/{serviceId}"
,
method
=
RequestMethod
.
POST
)
...
@@ -262,12 +263,27 @@ public class ConsoleEndpoint {
...
@@ -262,12 +263,27 @@ public class ConsoleEndpoint {
return
instanceEntityList
;
return
instanceEntityList
;
}
}
public
Map
<
String
,
List
<
InstanceEntity
>>
getInstanceMap
()
{
public
Map
<
String
,
List
<
InstanceEntity
>>
getInstanceMap
(
List
<
String
>
groups
)
{
List
<
String
>
services
=
getServices
();
List
<
String
>
services
=
getServices
();
Map
<
String
,
List
<
InstanceEntity
>>
instanceMap
=
new
LinkedHashMap
<
String
,
List
<
InstanceEntity
>>(
services
.
size
());
Map
<
String
,
List
<
InstanceEntity
>>
instanceMap
=
new
LinkedHashMap
<
String
,
List
<
InstanceEntity
>>(
services
.
size
());
for
(
String
service
:
services
)
{
for
(
String
service
:
services
)
{
List
<
InstanceEntity
>
instanceEntityList
=
getInstanceList
(
service
);
List
<
InstanceEntity
>
instanceEntityList
=
getInstanceList
(
service
);
instanceMap
.
put
(
service
,
instanceEntityList
);
if
(
CollectionUtils
.
isNotEmpty
(
groups
))
{
for
(
InstanceEntity
instance
:
instanceEntityList
)
{
String
plugin
=
InstanceEntityWrapper
.
getPlugin
(
instance
);
String
group
=
InstanceEntityWrapper
.
getGroup
(
instance
);
if
(
StringUtils
.
isNotEmpty
(
plugin
)
&&
groups
.
contains
(
group
))
{
List
<
InstanceEntity
>
instanceList
=
instanceMap
.
get
(
service
);
if
(
instanceList
==
null
)
{
instanceList
=
new
ArrayList
<
InstanceEntity
>();
instanceMap
.
put
(
service
,
instanceList
);
}
instanceList
.
add
(
instance
);
}
}
}
else
{
instanceMap
.
put
(
service
,
instanceEntityList
);
}
}
}
return
instanceMap
;
return
instanceMap
;
...
...
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