Skip to content

Commit

Permalink
Merge pull request alibaba#183 from jameslcj/feature_fe_module_gloablLib
Browse files Browse the repository at this point in the history
modulize the global params of fe
  • Loading branch information
yanlinly authored Oct 31, 2018
2 parents 24a2ede + 4cf9ca0 commit 0add80d
Show file tree
Hide file tree
Showing 42 changed files with 1,009 additions and 1,264 deletions.
13 changes: 0 additions & 13 deletions console/src/main/resources/static/i18ndoc.js

This file was deleted.

2 changes: 1 addition & 1 deletion console/src/main/resources/static/index.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import React from 'react';
import { Dialog, Pagination, Transfer } from '@alifd/next';
import { request, aliwareIntl } from '../../globalLib';
import './index.less';

/*****************************此行为标记行, 请勿删和修改此行, 文件和组件依赖请写在此行上面, 主体代码请写在此行下面的class中*****************************/
Expand All @@ -29,7 +30,7 @@ class BatchHandle extends React.Component {
dataSource: {}
};
}
componentDidMount() {}
componentDidMount() { }
openDialog(dataSource) {
this.setState({
visible: true,
Expand Down Expand Up @@ -69,7 +70,7 @@ class BatchHandle extends React.Component {
}
getData() {
const dataSource = this.state.dataSource;
window.request({
request({
url: `/diamond-ops/configList/serverId/${dataSource.serverId}?dataId=${dataSource.dataId}&group=${dataSource.group}&appName=${dataSource.appName}&config_tags=${dataSource.config_tags || ''}&pageNo=${this.state.currentPage}&pageSize=${dataSource.pageSize}`,
success: res => {
if (res.code === 200) {
Expand Down Expand Up @@ -104,15 +105,12 @@ class BatchHandle extends React.Component {
render() {
// console.log("valueList: ", this.state.valueList, this.transfer);

return <Dialog visible={this.state.visible} language={window.pageLanguage || 'zh-cn'} style={{ width: "500px" }} onCancel={this.closeDialog.bind(this)} onClose={this.closeDialog.bind(this)} onOk={this.onSubmit.bind(this)} title={"批量操作"}>
<div>
<Transfer ref={ref => this.transfer = ref} listStyle={{ height: 350 }} dataSource={this.state.dataSourceList || []} value={this.state.valueList} onChange={this.onChange.bind(this)} language={window.pageLanguage || 'zh-cn'} />
{/* <div>
<Table dataSource={this.state.dataSourceList} language={window.aliwareIntl.currentLanguageCode}></Table>
</div> */}
<Pagination style={{ marginTop: 10 }} current={this.state.currentPage} language={window.pageLanguage || 'zh-cn'} total={this.state.total} pageSize={this.state.pageSize} onChange={this.changePage.bind(this)} type="simple" />
</div>
</Dialog>;
return <Dialog visible={this.state.visible} language={aliwareIntl.currentLanguageCode || 'zh-cn'} style={{ width: "500px" }} onCancel={this.closeDialog.bind(this)} onClose={this.closeDialog.bind(this)} onOk={this.onSubmit.bind(this)} title={"批量操作"}>
<div>
<Transfer ref={ref => this.transfer = ref} listStyle={{ height: 350 }} dataSource={this.state.dataSourceList || []} value={this.state.valueList} onChange={this.onChange.bind(this)} language={aliwareIntl.currentLanguageCode || 'zh-cn'} />
<Pagination style={{ marginTop: 10 }} current={this.state.currentPage} language={aliwareIntl.currentLanguageCode || 'zh-cn'} total={this.state.total} pageSize={this.state.pageSize} onChange={this.changePage.bind(this)} type="simple" />
</div>
</Dialog>;
}
}
/*****************************此行为标记行, 请勿删和修改此行, 主体代码请写在此行上面的class中, 组件导出语句及其他信息请写在此行下面*****************************/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@

import React from 'react';
import './index.less';
import { getParams, request, aliwareIntl } from '../../globalLib';
import { Button, Dialog, Field, Form, Select } from '@alifd/next';
const FormItem = Form.Item;
const FormItem = Form.Item;
const { AutoComplete: Combobox } = Select;

/*****************************此行为标记行, 请勿删和修改此行, 文件和组件依赖请写在此行上面, 主体代码请写在此行下面的class中*****************************/
class CloneDialog extends React.Component {

constructor(props) {
super(props);
this.allPolicy = [{ value: 'abort', label: window.aliwareIntl.get('nacos.component.CloneDialog.Terminate_the_clone0') }, { value: 'skip', label: window.aliwareIntl.get('nacos.component.CloneDialog.skip') }, { value: 'overwrite', label: window.aliwareIntl.get('nacos.component.CloneDialog.cover') }];
this.allPolicy = [{ value: 'abort', label: aliwareIntl.get('nacos.component.CloneDialog.Terminate_the_clone0') }, { value: 'skip', label: aliwareIntl.get('nacos.component.CloneDialog.skip') }, { value: 'overwrite', label: aliwareIntl.get('nacos.component.CloneDialog.cover') }];
this.defaultPolicy = 'abort';
this.state = {
visible: false,
Expand All @@ -36,7 +37,7 @@ class CloneDialog extends React.Component {
records: [],
namespaces: [],
policy: this.defaultPolicy,
policyLabel: window.aliwareIntl.get('nacos.component.CloneDialog.Terminate_the_clone0'),
policyLabel: aliwareIntl.get('nacos.component.CloneDialog.Terminate_the_clone0'),
total: 0
};
this.field = new Field(this);
Expand All @@ -50,13 +51,13 @@ class CloneDialog extends React.Component {
};
}

componentDidMount() {}
componentDidMount() { }

openDialog(payload, callback) {
let serverId = window.getParams('serverId') || 'center';
let serverId = getParams('serverId') || 'center';
this.checkData = payload.checkData;
this.callback = callback;
window.request({
request({
type: 'get',
url: `/diamond-ops/service/serverId/${serverId}/namespaceInfo`,
success: res => {
Expand Down Expand Up @@ -86,8 +87,8 @@ class CloneDialog extends React.Component {
this.field.setValue('select', '');
} else {
Dialog.alert({
language: window.pageLanguage || 'zh-cn',
title: window.aliwareIntl.get('nacos.component.CloneDialog.get_the_namespace_failed'),
language: aliwareIntl.currentLanguageCode || 'zh-cn',
title: aliwareIntl.get('nacos.component.CloneDialog.get_the_namespace_failed'),
content: res.message
});
}
Expand Down Expand Up @@ -117,7 +118,7 @@ class CloneDialog extends React.Component {

getQuery() {
if (this.state.records.length > 0) {
return window.aliwareIntl.get('nacos.component.CloneDialog.|_the_selected_entry4');
return aliwareIntl.get('nacos.component.CloneDialog.|_the_selected_entry4');
}
if (this.state.dataId === '' && this.state.group === '' && this.state.appName === '' && this.state.configTags.length === 0) {
return '';
Expand All @@ -130,10 +131,10 @@ class CloneDialog extends React.Component {
query += ' Group: ' + this.state.group + ',';
}
if (this.state.appName !== '') {
query += window.aliwareIntl.get('nacos.component.CloneDialog.HOME_Application') + this.state.appName + ',';
query += aliwareIntl.get('nacos.component.CloneDialog.HOME_Application') + this.state.appName + ',';
}
if (this.state.configTags.length !== 0) {
query += window.aliwareIntl.get('nacos.component.CloneDialog.tags') + this.state.configTags + ',';
query += aliwareIntl.get('nacos.component.CloneDialog.tags') + this.state.configTags + ',';
}
return query.substr(0, query.length - 1);
}
Expand All @@ -152,30 +153,30 @@ class CloneDialog extends React.Component {

render() {
const init = this.field.init;
const footer = <div><Button type="primary" onClick={this.doClone.bind(this)} {...{ "disabled": this.state.total <= 0 }}>{window.aliwareIntl.get('nacos.component.CloneDialog.start_cloning')}</Button>
const footer = <div><Button type="primary" onClick={this.doClone.bind(this)} {...{ "disabled": this.state.total <= 0 }}>{aliwareIntl.get('nacos.component.CloneDialog.start_cloning')}</Button>
</div>;

return <div>
<Dialog visible={this.state.visible} footer={footer} footerAlign="center" language={window.pageLanguage || 'zh-cn'} style={{ width: 555 }} onCancel={this.closeDialog.bind(this)} onClose={this.closeDialog.bind(this)} title={window.aliwareIntl.get('nacos.component.CloneDialog.configuration_cloning\uFF08') + this.state.serverId + ")"}>
<Dialog visible={this.state.visible} footer={footer} footerAlign="center" language={aliwareIntl.currentLanguageCode || 'zh-cn'} style={{ width: 555 }} onCancel={this.closeDialog.bind(this)} onClose={this.closeDialog.bind(this)} title={aliwareIntl.get('nacos.component.CloneDialog.configuration_cloning\uFF08') + this.state.serverId + ")"}>
<Form field={this.field}>
<FormItem label={window.aliwareIntl.get('nacos.component.CloneDialog.source_space')} {...this.formItemLayout}>
<FormItem label={aliwareIntl.get('nacos.component.CloneDialog.source_space')} {...this.formItemLayout}>
<p><span style={{ color: '#33cde5' }}>{this.state.tenantFrom.name}</span>{" | " + this.state.tenantFrom.id}
</p>
</FormItem>
<FormItem label={window.aliwareIntl.get('nacos.component.CloneDialog.configuration_number')} {...this.formItemLayout}>
<FormItem label={aliwareIntl.get('nacos.component.CloneDialog.configuration_number')} {...this.formItemLayout}>
<p><span style={{ color: '#33cde5' }}>{this.state.total}</span> {this.getQuery()} </p>
</FormItem>
<FormItem label={window.aliwareIntl.get('nacos.component.CloneDialog.target_space')} {...this.formItemLayout}>
<Combobox style={{ width: '80%' }} size="medium" hasArrow placeholder={window.aliwareIntl.get('nacos.component.CloneDialog.select_namespace')} dataSource={this.state.namespaces} {...init('select', {
<FormItem label={aliwareIntl.get('nacos.component.CloneDialog.target_space')} {...this.formItemLayout}>
<Combobox style={{ width: '80%' }} size="medium" hasArrow placeholder={aliwareIntl.get('nacos.component.CloneDialog.select_namespace')} dataSource={this.state.namespaces} {...init('select', {
props: {
onChange: this.setTenantTo.bind(this)
},
rules: [{ required: true, message: window.aliwareIntl.get('nacos.component.CloneDialog.select_namespace') }]
})} language={window.aliwareIntl.currentLanguageCode}>
rules: [{ required: true, message: aliwareIntl.get('nacos.component.CloneDialog.select_namespace') }]
})} language={aliwareIntl.currentLanguageCode}>
</Combobox>
</FormItem>
<FormItem label={window.aliwareIntl.get('nacos.component.CloneDialog.the_same_configuration')} {...this.formItemLayout}>
<Select size="medium" hasArrow defaultValue={this.defaultPolicy} dataSource={this.allPolicy} onChange={this.setPolicy.bind(this)} language={window.aliwareIntl.currentLanguageCode}>
<FormItem label={aliwareIntl.get('nacos.component.CloneDialog.the_same_configuration')} {...this.formItemLayout}>
<Select size="medium" hasArrow defaultValue={this.defaultPolicy} dataSource={this.allPolicy} onChange={this.setPolicy.bind(this)} language={aliwareIntl.currentLanguageCode}>
</Select>
</FormItem>
</Form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,18 @@
* limitations under the License.
*/

import React from 'react';
import React from 'react';
import './index.less';
import { Button,Dialog, Grid, Icon } from '@alifd/next';
const { Row, Col } = Grid;
import { aliwareIntl } from '../../globalLib';
import { Button, Dialog, Grid, Icon } from '@alifd/next';
const { Row, Col } = Grid;
/*****************************此行为标记行, 请勿删和修改此行, 文件和组件依赖请写在此行上面, 主体代码请写在此行下面的class中*****************************/
class DeleteDialog extends React.Component {
constructor(props) {
super(props);
this.state = {
visible: false,
title: window.aliwareIntl.get('nacos.component.DeleteDialog.Configuration_management'),
title: aliwareIntl.get('nacos.component.DeleteDialog.Configuration_management'),
content: '',
isok: true,
dataId: '',
Expand All @@ -30,7 +31,7 @@ class DeleteDialog extends React.Component {
};
}

componentDidMount() {}
componentDidMount() { }
openDialog(payload) {
this.setState({
visible: true,
Expand All @@ -48,18 +49,18 @@ class DeleteDialog extends React.Component {
});
}
render() {
const footer = <div style={{ textAlign: 'right' }}><Button type="primary" onClick={this.closeDialog.bind(this)}>{window.aliwareIntl.get('nacos.component.DeleteDialog.determine')}</Button></div>;
const footer = <div style={{ textAlign: 'right' }}><Button type="primary" onClick={this.closeDialog.bind(this)}>{aliwareIntl.get('nacos.component.DeleteDialog.determine')}</Button></div>;
return <div>
<Dialog visible={this.state.visible} footer={footer} language={window.pageLanguage || 'zh-cn'} style={{ width: 555 }} onCancel={this.closeDialog.bind(this)} onClose={this.closeDialog.bind(this)} title={window.aliwareIntl.get('nacos.component.DeleteDialog.deletetitle')}>
<Dialog visible={this.state.visible} footer={footer} language={aliwareIntl.currentLanguageCode || 'zh-cn'} style={{ width: 555 }} onCancel={this.closeDialog.bind(this)} onClose={this.closeDialog.bind(this)} title={aliwareIntl.get('nacos.component.DeleteDialog.deletetitle')}>
<div>
<Row>
<Col span={'4'} style={{ paddingTop: 16 }}>
{this.state.isok ? <Icon type="success-filling" style={{ color: 'green' }} size={'xl'} /> : <Icon type="delete-filling" style={{ color: 'red' }} size={'xl'} />}

</Col>
<Col span={'20'}>
<div>
<h3>{this.state.isok ? window.aliwareIntl.get('nacos.component.DeleteDialog.deleted_successfully_configured') : window.aliwareIntl.get('nacos.component.DeleteDialog.delete_the_configuration_failed')}</h3>
<h3>{this.state.isok ? aliwareIntl.get('nacos.component.DeleteDialog.deleted_successfully_configured') : aliwareIntl.get('nacos.component.DeleteDialog.delete_the_configuration_failed')}</h3>
<p>
<span style={{ color: '#999', marginRight: 5 }}>Data ID:</span>
<span style={{ color: '#c7254e' }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
*/

import React from 'react';
import { aliwareIntl } from '../../globalLib';
import './index.less';
import { Button, Dialog, Grid } from '@alifd/next';
const { Row, Col } = Grid;
const { Row, Col } = Grid;

/*****************************此行为标记行, 请勿删和修改此行, 文件和组件依赖请写在此行上面, 主体代码请写在此行下面的class中*****************************/
class DiffEditorDialog extends React.Component {
Expand All @@ -25,7 +26,7 @@ class DiffEditorDialog extends React.Component {
};
}

componentDidMount() {}
componentDidMount() { }
openDialog(letfcode, rightcode) {
this.setState({
dialogvisible: true
Expand Down Expand Up @@ -67,19 +68,19 @@ class DiffEditorDialog extends React.Component {
this.props.publishConfig();
}
render() {
const footer = <div> <Button type="primary" onClick={this.confirmPub.bind(this)}>{window.aliwareIntl.get('com.alibaba.nacos.component.DiffEditorDialog.confirm_that_the')}</Button></div>;
const footer = <div> <Button type="primary" onClick={this.confirmPub.bind(this)}>{aliwareIntl.get('com.alibaba.nacos.component.DiffEditorDialog.confirm_that_the')}</Button></div>;
return <div>
<Dialog title={window.aliwareIntl.get('com.alibaba.nacos.component.DiffEditorDialog.contents')} language={window.pageLanguage || 'zh-cn'} style={{ width: '80%' }} visible={this.state.dialogvisible} footer={footer} onClose={this.closeDialog.bind(this)}>
<div style={{ height: 400 }}>
<div>
<Row>
<Col style={{ textAlign: 'center' }}>{window.aliwareIntl.get('com.alibaba.nacos.component.DiffEditorDialog.of_the_current_area')}</Col>
<Col style={{ textAlign: 'center' }}>{window.aliwareIntl.get('com.alibaba.nacos.component.DiffEditorDialog.original_value')}</Col>
</Row>
<Dialog title={aliwareIntl.get('com.alibaba.nacos.component.DiffEditorDialog.contents')} language={aliwareIntl.currentLanguageCode || 'zh-cn'} style={{ width: '80%' }} visible={this.state.dialogvisible} footer={footer} onClose={this.closeDialog.bind(this)}>
<div style={{ height: 400 }}>
<div>
<Row>
<Col style={{ textAlign: 'center' }}>{aliwareIntl.get('com.alibaba.nacos.component.DiffEditorDialog.of_the_current_area')}</Col>
<Col style={{ textAlign: 'center' }}>{aliwareIntl.get('com.alibaba.nacos.component.DiffEditorDialog.original_value')}</Col>
</Row>
</div>
<div style={{ clear: 'both', height: 480 }} ref="diffeditor"></div>

</div>
<div style={{ clear: 'both', height: 480 }} ref="diffeditor"></div>

</div>
</Dialog>
</div>;
}
Expand Down
Loading

0 comments on commit 0add80d

Please sign in to comment.