Skip to content

Commit

Permalink
validate group and dataId not empty
Browse files Browse the repository at this point in the history
  • Loading branch information
wfnuser committed Nov 12, 2018
1 parent 4c80ac2 commit a15c812
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 20 deletions.
4 changes: 4 additions & 0 deletions console/src/main/resources/static/src/i18ndoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,8 @@ module.exports = {
"com.alibaba.nacos.page.configurationManagement.details": "详情",
"nacos.page.namespace.details": "详情",
"com.alibaba.nacos.page.listeningToQuery.query_results:_query": "查询结果:共查询到",
"com.alibaba.nacos.page.form.Data_Id_can_not_be_empty": "Data ID不能为空",
"com.alibaba.nacos.page.listeningToQuery.group_can_not_be_empty": "Group不能为空",
"com.alibaba.nacos.page.configurationManagement.fuzzyg": "模糊查询请输入Group",
"nacos.component.NameSpaceList.Forum": "论坛",
"nacos.component.ShowCodeing.,_new_ConfigChangeListener()_{_public_void_receiveConfigInfo(String": "\", new ConfigChangeListener() {\t\t\t\tpublic void receiveConfigInfo(String configInfo) {\t\t\t\t\t// 当配置更新后,通过该回调函数将最新值吐给用户。\t\t\t\t\t// 注意回调函数中不要做阻塞操作,否则阻塞通知线程。\t\t\t\t\tconfig = configInfo;\t\t\t\t\tSystem.out.println(configInfo);\t\t\t\t}\t\t\t});\t\t\t\t\t\t/**\t\t\t * 如果配置值的內容为properties格式(key=value), 可使用下面监听器。以便一个配置管理多个配置项\t\t\t */\t\t\t\t\t\t/**\t\t\tConfigService.addListener(\"",
Expand Down Expand Up @@ -915,6 +917,8 @@ module.exports = {
"com.alibaba.nacos.page.pushTrajectory.interval:": "Time Range:",
"nacos.component.ImportDialog.skip1": "Skip",
"com.alibaba.nacos.page.listeningToQuery.query_results:_query": "Search Results: Found",
"com.alibaba.nacos.page.form.Data_Id_can_not_be_empty": "Data ID cannot be empty",
"com.alibaba.nacos.page.listeningToQuery.group_can_not_be_empty": "Group cannot be empty",
"com.alibaba.nacos.page.pushTrajectory.please_input_Group": "Enter Group",
"com.alibaba.nacos.page.configRollback.rollback_successful": "Rollback Successful",
"com.alibaba.nacos.component.MiddleWareEnv.payTM_daily": "payTM Daily",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/

import React from 'react';
import { Button, Field, Form, Input, Loading, Pagination, Table } from '@alifd/next';
import { Field, Form, Input, Loading, Pagination, Table } from '@alifd/next';
import RegionGroup from '../../../components/RegionGroup';
import { getParams, setParams, request, aliwareIntl } from '../../../globalLib';
import './index.less';
Expand Down Expand Up @@ -57,7 +57,8 @@ class HistoryRollback extends React.Component {
}

componentDidMount() {

this.field.setValue('group', this.group);
this.field.setValue('dataId', this.dataId);
//this.getData()
}
openLoading() {
Expand Down Expand Up @@ -195,6 +196,11 @@ class HistoryRollback extends React.Component {
});
}
selectAll() {
this.dataId = this.field.getValue("dataId");
this.group = this.field.getValue("group");
if (!this.dataId || !this.group) {
return false;
}
if (this.dataId !== this.preDataId) {
setParams('dataId', this.dataId);
this.preDataId = this.dataId;
Expand Down Expand Up @@ -243,6 +249,10 @@ class HistoryRollback extends React.Component {
const locale = {
empty: pubnodedata
};

const { init } = this.field;
this.init = init;

return (
<div style={{ padding: 10 }}>
<Loading shape="flower" style={{ position: 'relative', width: "100%" }} visible={this.state.loading} tip="Loading..." color="#333">
Expand All @@ -252,22 +262,29 @@ class HistoryRollback extends React.Component {
</div>**/}

<div>
<Form inline>
<Form inline field={this.field}>

<Form.Item label="Data ID:">
<Input htmlType="text" placeholder={aliwareIntl.get('com.alibaba.nacos.page.historyRollback.dataid')}
style={{ width: 200 }} value={this.state.dataId} onChange={this.getDataId.bind(this)} />
<Form.Item label="Data ID:" required>
<Input placeholder={aliwareIntl.get('com.alibaba.nacos.page.historyRollback.dataid')}
style={{ width: 200 }}
{...this.init('dataId', {
rules: [{
required: true,
message: aliwareIntl.get('com.alibaba.nacos.page.form.Data_Id_can_not_be_empty')
}]
})} />
</Form.Item>
<Form.Item label="Group:">
<Input placeholder={aliwareIntl.get('com.alibaba.nacos.page.historyRollback.group')} id="userName" name="userName" value={this.state.group}
style={{ width: 200 }} onChange={this.getGroup.bind(this)} />
<Form.Item label="Group:" required>
<Input placeholder={aliwareIntl.get('com.alibaba.nacos.page.historyRollback.group')} style={{ width: 200 }} {...this.init('group', {
rules: [{
required: true,
message: aliwareIntl.get('com.alibaba.nacos.page.listeningToQuery.group_can_not_be_empty')
}]
})} />
</Form.Item>

<Form.Item label="">
<Button type="primary" style={{ marginRight: 10 }} onClick={this.selectAll.bind(this)}>
{aliwareIntl.get('com.alibaba.nacos.page.historyrollback.query')}</Button>
{}

<Form.Submit validate type="primary" onClick={this.selectAll.bind(this)} style={{ marginRight: 10 }}>{aliwareIntl.get('com.alibaba.nacos.page.historyrollback.query')}</Form.Submit>
</Form.Item>

</Form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import React from 'react';
import RegionGroup from '../../../components/RegionGroup';
import { getParams, request, aliwareIntl } from '../../../globalLib';
import './index.less';
import { Button, Field, Form, Grid, Input, Loading, Pagination, Select, Table } from '@alifd/next';
import { Field, Form, Grid, Input, Loading, Pagination, Select, Table } from '@alifd/next';
const FormItem = Form.Item;
const { Row, Col } = Grid;

Expand Down Expand Up @@ -72,7 +72,7 @@ class ListeningToQuery extends React.Component {
} else {
var dataId = this.getValue('dataId');
var group = this.getValue('group');
if (!dataId) return false;
if (!dataId || !group) return false;
queryUrl = `/nacos/v1/cs/configs/listener?dataId=${dataId}&group=${group}`;
}
request({
Expand Down Expand Up @@ -164,21 +164,33 @@ class ListeningToQuery extends React.Component {
</FormItem>
<FormItem label="Data ID:" style={{
display: this.getValue('type') === 0 ? '' : 'none'
}}>
<Input placeholder={aliwareIntl.get('com.alibaba.nacos.page.listeningToQuery.please_enter_the_dataid')} style={{ width: 200 }} {...this.init('dataId')} />
}} required>
<Input placeholder={aliwareIntl.get('com.alibaba.nacos.page.listeningToQuery.please_enter_the_dataid')}
style={{ width: 200 }}
{...this.init('dataId', {
rules: [{
required: true,
message: aliwareIntl.get('com.alibaba.nacos.page.form.Data_Id_can_not_be_empty')
}]
})} />
</FormItem>
<FormItem label="Group:" style={{
display: this.getValue('type') === 0 ? '' : 'none'
}}>
<Input placeholder={aliwareIntl.get('com.alibaba.nacos.page.listeningToQuery.please_input_group')} style={{ width: 200 }} {...this.init('group')} />
}} required>
<Input placeholder={aliwareIntl.get('com.alibaba.nacos.page.listeningToQuery.please_input_group')} style={{ width: 200 }} {...this.init('group', {
rules: [{
required: true,
message: aliwareIntl.get('com.alibaba.nacos.page.listeningToQuery.group_can_not_be_empty')
}]
})} />
</FormItem>
<FormItem label="IP:" style={{
display: this.getValue('type') === 0 ? 'none' : ''
}}>
<Input placeholder={aliwareIntl.get('com.alibaba.nacos.page.listeningToQuery.please_input_ip')} style={{ width: 200, boxSize: 'border-box' }} {...this.init('ip')} />
</FormItem>
<FormItem label="">
<Button type="primary" onClick={this.queryTrackQuery.bind(this)} style={{ marginRight: 10 }}>{aliwareIntl.get('com.alibaba.nacos.page.listeningToQuery.query')}</Button>
<Form.Submit validate type="primary" onClick={this.queryTrackQuery.bind(this)} style={{ marginRight: 10 }}>{aliwareIntl.get('com.alibaba.nacos.page.listeningToQuery.query')}</Form.Submit>
{}
</FormItem>
</Form>
Expand Down

0 comments on commit a15c812

Please sign in to comment.