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
a5a7c4fb
Commit
a5a7c4fb
authored
Sep 17, 2018
by
Nepxion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加获取注册发现中心的接口
parent
c56e11f1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
7 deletions
+44
-7
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/ConsoleFrame.java
+1
-1
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/controller/ServiceController.java
+8
-0
discovery-console-desktop/src/main/resources/com/nepxion/discovery/console/desktop/locale/Locale.properties
+1
-0
discovery-console-desktop/src/main/resources/com/nepxion/discovery/console/desktop/locale/Locale_zh_CN.properties
+1
-0
discovery-console/src/main/java/com/nepxion/discovery/console/endpoint/ConsoleEndpoint.java
+33
-6
No files found.
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/ConsoleFrame.java
View file @
a5a7c4fb
...
...
@@ -25,7 +25,7 @@ public class ConsoleFrame extends JBasicFrame {
private
static
final
long
serialVersionUID
=
1L
;
public
ConsoleFrame
()
{
super
(
ConsoleLocale
.
getString
(
"title"
)
+
" ["
+
ServiceController
.
getConfigType
()
+
" "
+
ConsoleLocale
.
getString
(
"config_center"
)
+
"]"
,
ConsoleIconFactory
.
getSwingIcon
(
"ribbon/navigator_nepxion.png"
),
new
Dimension
(
1280
,
900
));
super
(
ConsoleLocale
.
getString
(
"title"
)
+
" ["
+
ServiceController
.
get
DiscoveryType
()
+
" "
+
ConsoleLocale
.
getString
(
"discovery_center"
)
+
"] ["
+
ServiceController
.
get
ConfigType
()
+
" "
+
ConsoleLocale
.
getString
(
"config_center"
)
+
"]"
,
ConsoleIconFactory
.
getSwingIcon
(
"ribbon/navigator_nepxion.png"
),
new
Dimension
(
1280
,
900
));
}
public
void
launch
()
{
...
...
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/controller/ServiceController.java
View file @
a5a7c4fb
...
...
@@ -37,6 +37,14 @@ public class ServiceController {
restTemplate
.
setErrorHandler
(
new
RestErrorHandler
());
}
public
static
String
getDiscoveryType
()
{
String
url
=
getUrl
()
+
"console/discovery-type"
;
String
result
=
restTemplate
.
getForEntity
(
url
,
String
.
class
).
getBody
();
return
result
;
}
public
static
String
getConfigType
()
{
String
url
=
getUrl
()
+
"console/config-type"
;
...
...
discovery-console-desktop/src/main/resources/com/nepxion/discovery/console/desktop/locale/Locale.properties
View file @
a5a7c4fb
...
...
@@ -13,6 +13,7 @@ push_global_config=全链路灰度发布
push_control_mode
=
推送模式设置
push_async_mode
=
异步推送
push_sync_mode
=
同步推送
discovery_center
=
注册发现中心
config_center
=
远程配置中心
rule_to_config_center
=
规则推送到远程配置中心
rule_to_service
=
规则推送到服务或者服务集群
...
...
discovery-console-desktop/src/main/resources/com/nepxion/discovery/console/desktop/locale/Locale_zh_CN.properties
View file @
a5a7c4fb
...
...
@@ -13,6 +13,7 @@ push_global_config=\u5168\u94fe\u8def\u7070\u5ea6\u53d1\u5e03
push_control_mode
=
\u
63a8
\u9001\u
6a21
\u
5f0f
\u
8bbe
\u
7f6e
push_async_mode
=
\u
5f02
\u
6b65
\u
63a8
\u9001
push_sync_mode
=
\u
540c
\u
6b65
\u
63a8
\u9001
discovery_center
=
\u
6ce8
\u
518c
\u
53d1
\u
73b0
\u
4e2d
\u
5fc3
config_center
=
\u
8fdc
\u
7a0b
\u
914d
\u
7f6e
\u
4e2d
\u
5fc3
rule_to_config_center
=
\u
89c4
\u5219\u
63a8
\u9001\u5230\u
8fdc
\u
7a0b
\u
914d
\u
7f6e
\u
4e2d
\u
5fc3
rule_to_service
=
\u
89c4
\u5219\u
63a8
\u9001\u5230\u
670d
\u
52a1
\u6216\u8005\u
670d
\u
52a1
\u
96c6
\u
7fa4
...
...
discovery-console/src/main/java/com/nepxion/discovery/console/endpoint/ConsoleEndpoint.java
View file @
a5a7c4fb
...
...
@@ -55,6 +55,13 @@ import com.nepxion.discovery.console.rest.VersionUpdateRestInvoker;
public
class
ConsoleEndpoint
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
ConsoleEndpoint
.
class
);
private
static
final
String
[][]
DISCOVERY_DESCRIPTION
=
{
{
"Eureka"
,
"Spring Cloud Eureka Discovery Client,Spring Cloud No-op DiscoveryClient,Composite Discovery Client,Simple Discovery Client"
},
{
"Consul"
,
"Spring Cloud Consul Discovery Client"
},
{
"Zookeeper"
,
"Spring Cloud Zookeeper Discovery Client"
},
{
"Nacos"
,
"Spring Cloud Nacos Discovery Client"
}
};
@Autowired
private
DiscoveryClient
discoveryClient
;
...
...
@@ -64,6 +71,14 @@ public class ConsoleEndpoint {
@Autowired
private
RestTemplate
consoleRestTemplate
;
@RequestMapping
(
path
=
"/discovery-type"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
value
=
"获取注册发现中心类型"
,
notes
=
""
,
response
=
String
.
class
,
httpMethod
=
"GET"
)
@ResponseBody
@ManagedOperation
public
ResponseEntity
<?>
discoveryType
()
{
return
getDiscoveryType
();
}
@RequestMapping
(
path
=
"/config-type"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
value
=
"获取配置中心类型"
,
notes
=
""
,
response
=
String
.
class
,
httpMethod
=
"GET"
)
@ResponseBody
...
...
@@ -200,16 +215,28 @@ public class ConsoleEndpoint {
return
executeVersionClear
(
serviceId
,
version
,
false
);
}
private
ResponseEntity
<?>
get
Config
Type
()
{
String
configType
=
null
;
private
ResponseEntity
<?>
get
Discovery
Type
()
{
String
description
=
discoveryClient
.
description
()
;
for
(
int
i
=
0
;
i
<
DISCOVERY_DESCRIPTION
.
length
;
i
++)
{
String
discoveryType
=
DISCOVERY_DESCRIPTION
[
i
][
0
];
String
discoveryDescription
=
DISCOVERY_DESCRIPTION
[
i
][
1
];
if
(
discoveryDescription
.
contains
(
description
))
{
return
ResponseEntity
.
ok
().
body
(
discoveryType
);
}
}
return
ResponseEntity
.
ok
().
body
(
DiscoveryConstant
.
UNKNOWN
);
}
private
ResponseEntity
<?>
getConfigType
()
{
if
(
configAdapter
!=
null
)
{
configType
=
configAdapter
.
getConfigType
();
}
else
{
configType
=
DiscoveryConstant
.
UNKNOWN
;
String
configType
=
configAdapter
.
getConfigType
();
return
ResponseEntity
.
ok
().
body
(
configType
)
;
}
return
ResponseEntity
.
ok
().
body
(
configType
);
return
ResponseEntity
.
ok
().
body
(
DiscoveryConstant
.
UNKNOWN
);
}
public
List
<
String
>
getGroups
()
{
...
...
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