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
10c5564c
Commit
10c5564c
authored
Sep 27, 2018
by
Nepxion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改界面
parent
1417f17e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
104 additions
and
3 deletions
+104
-3
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/ConsoleLogin.java
+85
-1
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/controller/ServiceController.java
+13
-2
discovery-console-desktop/src/main/resources/com/nepxion/discovery/console/desktop/locale/Locale.properties
+2
-0
discovery-console-desktop/src/main/resources/com/nepxion/discovery/console/desktop/locale/Locale_en_US.properties
+2
-0
discovery-console-desktop/src/main/resources/com/nepxion/discovery/console/desktop/locale/Locale_zh_CN.properties
+2
-0
No files found.
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/ConsoleLogin.java
View file @
10c5564c
...
...
@@ -9,16 +9,33 @@ package com.nepxion.discovery.console.desktop;
* @version 1.0
*/
import
java.awt.Component
;
import
java.awt.Font
;
import
java.awt.Frame
;
import
java.util.Locale
;
import
java.util.Vector
;
import
javax.swing.DefaultListCellRenderer
;
import
javax.swing.JList
;
import
javax.swing.JPanel
;
import
org.apache.commons.lang3.StringUtils
;
import
com.nepxion.discovery.common.entity.UserEntity
;
import
com.nepxion.discovery.console.desktop.controller.ServiceController
;
import
com.nepxion.discovery.console.desktop.locale.ConsoleLocale
;
import
com.nepxion.swing.combobox.JBasicComboBox
;
import
com.nepxion.swing.dialog.JLoginDialog
;
import
com.nepxion.swing.font.FontContext
;
import
com.nepxion.swing.label.JBasicLabel
;
import
com.nepxion.swing.layout.table.TableLayout
;
public
class
ConsoleLogin
extends
JLoginDialog
{
private
static
final
long
serialVersionUID
=
1L
;
private
JBasicLabel
urlLabel
;
private
JBasicComboBox
urlComboBox
;
public
ConsoleLogin
()
{
super
(
null
);
}
...
...
@@ -27,12 +44,79 @@ public class ConsoleLogin extends JLoginDialog {
super
(
parent
);
}
@SuppressWarnings
(
"unchecked"
)
@Override
protected
void
initEditorPanelLayout
()
{
urlLabel
=
new
JBasicLabel
();
urlLabel
.
setFont
(
new
Font
(
FontContext
.
getFontName
(),
FONT_STYLE
,
FONT_SIZE
));
String
url
=
null
;
try
{
url
=
ServiceController
.
getUrl
();
}
catch
(
Exception
e
)
{
}
Vector
<
String
>
urls
=
new
Vector
<
String
>();
if
(
StringUtils
.
isNotEmpty
(
url
))
{
urls
.
add
(
url
);
}
urlComboBox
=
new
JBasicComboBox
(
urls
);
urlComboBox
.
setEditable
(
true
);
urlComboBox
.
setRenderer
(
new
DefaultListCellRenderer
()
{
private
static
final
long
serialVersionUID
=
1L
;
@SuppressWarnings
(
"rawtypes"
)
public
Component
getListCellRendererComponent
(
JList
list
,
Object
value
,
int
index
,
boolean
isSelected
,
boolean
cellHasFocus
)
{
super
.
getListCellRendererComponent
(
list
,
value
,
index
,
isSelected
,
cellHasFocus
);
setToolTipText
(
value
.
toString
());
return
this
;
}
});
double
[][]
size
=
{
{
80
,
230
},
{
TableLayout
.
PREFERRED
,
TableLayout
.
PREFERRED
,
TableLayout
.
PREFERRED
,
TableLayout
.
PREFERRED
}
};
TableLayout
tableLayout
=
new
TableLayout
(
size
);
tableLayout
.
setVGap
(
10
);
editorPanel
=
new
JPanel
();
editorPanel
.
setLayout
(
tableLayout
);
editorPanel
.
add
(
urlLabel
,
"0, 0"
);
editorPanel
.
add
(
urlComboBox
,
"1, 0"
);
editorPanel
.
add
(
accountLabel
,
"0, 1"
);
editorPanel
.
add
(
accountTextField
,
"1, 1"
);
editorPanel
.
add
(
passwordLabel
,
"0, 2"
);
editorPanel
.
add
(
passwordField
,
"1, 2"
);
editorPanel
.
add
(
localeLabel
,
"0, 3"
);
editorPanel
.
add
(
localeComboBox
,
"1, 3"
);
}
@Override
protected
void
initLocale
(
Locale
locale
)
{
super
.
initLocale
(
locale
);
urlLabel
.
setText
(
ConsoleLocale
.
getString
(
"url"
,
locale
));
}
@Override
public
boolean
login
(
String
userId
,
String
password
,
Locale
locale
)
throws
Exception
{
Object
url
=
urlComboBox
.
getSelectedItem
();
if
(
url
==
null
||
StringUtils
.
isEmpty
(
url
.
toString
().
trim
()))
{
throw
new
IllegalArgumentException
(
"Console url can't be null or empty"
);
}
ServiceController
.
setUrl
(
url
.
toString
().
trim
());
UserEntity
userEntity
=
new
UserEntity
();
userEntity
.
setUserId
(
userId
);
userEntity
.
setPassword
(
password
);
return
ServiceController
.
authenticate
(
userEntity
);
}
...
...
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/controller/ServiceController.java
View file @
10c5564c
...
...
@@ -33,6 +33,8 @@ import com.nepxion.discovery.console.desktop.entity.Instance;
public
class
ServiceController
{
public
static
RestTemplate
restTemplate
;
private
static
String
consoleUrl
;
static
{
restTemplate
=
new
RestTemplate
();
restTemplate
.
setErrorHandler
(
new
RestErrorHandler
());
...
...
@@ -238,12 +240,21 @@ public class ServiceController {
return
result
;
}
private
static
String
getUrl
()
{
String
url
=
PropertiesContext
.
getProperties
().
getString
(
"url"
);
public
static
String
getUrl
()
{
String
url
=
null
;
if
(
StringUtils
.
isNotEmpty
(
consoleUrl
))
{
url
=
consoleUrl
;
}
else
{
url
=
PropertiesContext
.
getProperties
().
getString
(
"url"
);
}
return
UrlUtil
.
formatUrl
(
url
);
}
public
static
void
setUrl
(
String
url
)
{
consoleUrl
=
url
;
}
private
static
String
getUrl
(
Instance
instance
)
{
String
url
=
"http://"
+
instance
.
getHost
()
+
":"
+
instance
.
getPort
()
+
UrlUtil
.
formatContextPath
(
InstanceEntityWrapper
.
getContextPath
(
instance
));
...
...
discovery-console-desktop/src/main/resources/com/nepxion/discovery/console/desktop/locale/Locale.properties
View file @
10c5564c
url
=
控制台地址
title
=
Discovery 灰度发布控制台
navigator_bar
=
导航区
content_bar
=
工作区
...
...
discovery-console-desktop/src/main/resources/com/nepxion/discovery/console/desktop/locale/Locale_en_US.properties
0 → 100644
View file @
10c5564c
url
=
Console Url
\ No newline at end of file
discovery-console-desktop/src/main/resources/com/nepxion/discovery/console/desktop/locale/Locale_zh_CN.properties
View file @
10c5564c
url
=
\u
63a7
\u5236\u
53f0
\u5730\u5740
title
=
Discovery
\u7070\u
5ea6
\u
53d1
\u
5e03
\u
63a7
\u5236\u
53f0
navigator_bar
=
\u
5bfc
\u
822a
\u
533a
content_bar
=
\u
5de5
\u
4f5c
\u
533a
...
...
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