Skip to content

Commit

Permalink
Merge pull request #644 from alibaba/develop
Browse files Browse the repository at this point in the history
0.8.0-SNAPSHOT
  • Loading branch information
yanlinly committed Jan 17, 2019
2 parents 9e652a2 + a666658 commit 489efb3
Show file tree
Hide file tree
Showing 39 changed files with 2,010 additions and 1,890 deletions.
12 changes: 11 additions & 1 deletion console/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,17 @@
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<artifactId>jjwt-api</artifactId>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-impl</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-jackson</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class JwtTokenUtils {

@PostConstruct
public void init() {
this.secretKey = "SecretKey";
this.secretKey = "SecretKey012345678901234567890123456789012345678901234567890123456789";
this.tokenValidityInMilliseconds = 1000 * 60 * 30L;
}

Expand Down Expand Up @@ -82,7 +82,7 @@ public String createToken(Authentication authentication) {
.setSubject(authentication.getName())
.claim(AUTHORITIES_KEY, "")
.setExpiration(validity)
.signWith(SignatureAlgorithm.HS512, secretKey)
.signWith(SignatureAlgorithm.HS256, secretKey)
.compact();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ class NameSpaceList extends React.Component {
切换namespace
* */
changeNameSpace(ns, nsName) {
localStorage.setItem('namespace', ns);
this.setnamespace(ns || '');
setParams({
namespace: ns || '',
Expand All @@ -101,7 +102,7 @@ class NameSpaceList extends React.Component {

getNameSpaces() {
const { locale = {} } = this.props;
if (window.namespaceList) {
if (window.namespaceList && window.namespaceList.length) {
this.handleNameSpaces(window.namespaceList);
} else {
request({
Expand Down Expand Up @@ -140,6 +141,7 @@ class NameSpaceList extends React.Component {
}
window.namespaceShowName = namespaceShowName;
setParams('namespace', nownamespace || '');
localStorage.setItem('namespace', nownamespace);
// setParams('namespaceShowName', namespaceShowName);
this.props.setNowNameSpace && this.props.setNowNameSpace(namespaceShowName, nownamespace);
this.setState({
Expand Down Expand Up @@ -191,8 +193,8 @@ class NameSpaceList extends React.Component {

return (
<div
className={namespaceList.length > 0 ? 'namespacewrapper' : ''}
style={namespaceList.length > 0 ? namespacestyle : {}}
className={namespaceList.length ? 'namespacewrapper' : ''}
style={namespaceList.length ? namespacestyle : {}}
>
{}
{title ? (
Expand Down
5 changes: 5 additions & 0 deletions console/src/main/resources/static/console-fe/src/globalLib.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ const aliwareIntl = (function(_global) {
this.nowData = nowData;
this.setMomentLocale(this.currentLanguageCode);
}

let aliwareLocal = aliwareGetCookieByKeyName('aliyun_lang') || 'zh';
let aliwareLocalSite = aliwareGetCookieByKeyName('aliyun_country') || 'cn';
aliwareLocal = aliwareLocal.toLowerCase();
Expand Down Expand Up @@ -473,6 +474,7 @@ const request = (function(_global) {
return serviceObj;
};
})();

/**
* 添加中间件函数
* @param {*function} callback 回调函数
Expand All @@ -485,6 +487,7 @@ const request = (function(_global) {
}
return this;
}

/**
* 处理中间件
* @param {*Object} config ajax请求配置信息
Expand All @@ -504,6 +507,7 @@ const request = (function(_global) {
}
return config;
}

/**
* 处理自定义url
* @param {*Object} config ajax请求配置信息
Expand Down Expand Up @@ -621,6 +625,7 @@ const request = (function(_global) {
}
);
}

// 暴露方法
Request.handleCustomService = handleCustomService;
Request.handleMiddleWare = handleMiddleWare;
Expand Down
4 changes: 2 additions & 2 deletions console/src/main/resources/static/console-fe/src/i18ndoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
module.exports = {
'zh-cn': {
'com.alibaba.nacos.layout.noenv.nacosversion': '0.7.0',
'com.alibaba.nacos.layout.noenv.nacosversion': '0.8.0',
'com.alibaba.nacos.page.configurationManagementVirtual': '配置管理',
'com.alibaba.nacos.page.serviceManagementVirtual': '服务管理',
'nacos.component.ExportDialog.tags2': '标签:',
Expand Down Expand Up @@ -574,7 +574,7 @@ module.exports = {
'nacos.page.ConfigEditor.submit_failed': '不能为空, 提交失败',
},
'en-us': {
'com.alibaba.nacos.layout.noenv.nacosversion': '0.7.0',
'com.alibaba.nacos.layout.noenv.nacosversion': '0.8.0',
'com.alibaba.nacos.page.configurationManagementVirtual': 'ConfigManagement',
'com.alibaba.nacos.page.serviceManagementVirtual': 'ServiceManagement',
'nacos.component.CloneDialog.the_same_configuration': 'Conflict:',
Expand Down
8 changes: 8 additions & 0 deletions console/src/main/resources/static/console-fe/src/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ window.globalConfig = {
request.middleWare((_config = {}) => {
let config = _config;
let { url = '' } = config;

const namespace = localStorage.getItem('namespace') ? localStorage.getItem('namespace') : '';
// 如果url中已经有 namespaceId, 不在data中添加namespaceId
config.data =
url.indexOf('namespaceId=') === -1
? Object.assign({}, config.data, { namespaceId: namespace })
: config.data;

let tenant = window.nownamespace || getParams('namespace') || '';
tenant = tenant === 'global' ? '' : tenant;
const splitArr = url.split('?');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const I18N_CONF = {
},
MainLayout: {
nacosName: 'NACOS',
nacosVersion: '0.7.0',
nacosVersion: '0.8.0',
doesNotExist: 'The page you visit does not exist',
configurationManagementVirtual: 'ConfigManagement',
configurationManagement: 'Configurations',
Expand Down Expand Up @@ -249,7 +249,7 @@ const I18N_CONF = {
escExit: 'Publish',
release: 'Back',
confirmSyanx: 'The configuration information may has a syntax error. Are you sure to submit?',
dataIdExists: 'Data ID exists',
dataIdExists: 'Configuration already exists. Enter a new Data ID and Group name.',
dataRequired: 'Data cannot be empty, submission failed',
},
CloneDialog: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const I18N_CONF = {
},
MainLayout: {
nacosName: 'NACOS',
nacosVersion: '0.7.0',
nacosVersion: '0.8.0',
doesNotExist: '您访问的页面不存在',
configurationManagementVirtual: '配置管理',
configurationManagement: '配置列表',
Expand Down Expand Up @@ -248,7 +248,7 @@ const I18N_CONF = {
escExit: '发布',
release: '返回',
confirmSyanx: '配置信息可能有语法错误, 确定提交吗?',
dataIdExists: 'Data ID 已存在',
dataIdExists: '配置已存在, 试试别的dataid和group的组合吧',
dataRequired: '数据不能为空, 提交失败',
},
CloneDialog: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ class Login extends React.Component {
});
};

onKeyDown = event => {
// 'keypress' event misbehaves on mobile so we track 'Enter' key via 'keydown' event
if (event.key === 'Enter') {
event.preventDefault();
event.stopPropagation();
this.handleSubmit();
}
};

render() {
const { locale = {} } = this.props;

Expand Down Expand Up @@ -90,6 +99,7 @@ class Login extends React.Component {
],
})}
placeholder={locale.pleaseInputUsername}
onKeyDown={this.onKeyDown}
/>
</FormItem>
<FormItem>
Expand All @@ -104,6 +114,7 @@ class Login extends React.Component {
},
],
})}
onKeyDown={this.onKeyDown}
/>
</FormItem>
<FormItem label=" ">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ $contentWidth: 1280px;
width: 480px;
height: 540px;
top: 90px;
input,
input::-webkit-input-placeholder {
font-size: 16px;
}
.login-header {
width: 100%;
line-height: 45px;
Expand All @@ -42,6 +46,7 @@ $contentWidth: 1280px;
button {
width: 100%;
height: 60px;
font-size: 16px;
background: #4190ff 100%;
color: white;
}
Expand Down Expand Up @@ -86,7 +91,7 @@ $contentWidth: 1280px;
transform: translateY(-50%);
}
.product-area {
width: 431px;
width: 600px;
margin-left: 40px;
}
.product-logo {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ class EditClusterDialog extends React.Component {
healthChecker,
} = this.state.editCluster;
request({
method: 'POST',
url: 'v1/ns/cluster/update',
method: 'PUT',
url: 'v1/ns/cluster',
data: {
serviceName,
clusterName: name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ class EditInstanceDialog extends React.Component {
const { serviceName, clusterName, getInstanceList, openLoading, closeLoading } = this.props;
const { ip, port, weight, enabled, metadataText } = this.state.editInstance;
request({
method: 'POST',
url: 'v1/ns/instance/update',
method: 'PUT',
url: 'v1/ns/instance',
data: { serviceName, clusterName, ip, port, weight, enable: enabled, metadata: metadataText },
dataType: 'text',
beforeSend: () => openLoading(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class EditServiceDialog extends React.Component {
const editService = Object.assign({}, this.state.editService);
const { name, protectThreshold, healthCheckMode, metadataText, selector } = editService;
request({
method: isCreate ? 'PUT' : 'POST',
method: isCreate ? 'POST' : 'PUT',
url: 'v1/ns/service',
data: {
serviceName: name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ class InstanceTable extends React.Component {
const newVal = Object.assign({}, instance);
newVal.list[index].enabled = !enabled;
request({
method: 'POST',
url: 'v1/ns/instance/update',
method: 'PUT',
url: 'v1/ns/instance',
data: {
serviceName,
clusterName,
Expand Down
Loading

0 comments on commit 489efb3

Please sign in to comment.