Remove unused code; Use Camel-Case;Optimize if statement; (#6616)
* Remove unused code; * Optimize if statement; * Use Camel-Case
This commit is contained in:
parent
46c1f7e6df
commit
fc27e77c3a
@ -27,22 +27,18 @@ import {
|
|||||||
Balloon,
|
Balloon,
|
||||||
Button,
|
Button,
|
||||||
Dialog,
|
Dialog,
|
||||||
Field,
|
|
||||||
Form,
|
Form,
|
||||||
Checkbox,
|
Checkbox,
|
||||||
Icon,
|
Icon,
|
||||||
Input,
|
Input,
|
||||||
Loading,
|
Loading,
|
||||||
Radio,
|
Radio,
|
||||||
Switch,
|
|
||||||
Select,
|
Select,
|
||||||
Tab,
|
Tab,
|
||||||
Message,
|
Message,
|
||||||
Grid,
|
Grid,
|
||||||
ConfigProvider,
|
ConfigProvider,
|
||||||
} from '@alifd/next';
|
} from '@alifd/next';
|
||||||
import { resolve } from 'url';
|
|
||||||
import qs from 'qs';
|
|
||||||
|
|
||||||
const { Row, Col } = Grid;
|
const { Row, Col } = Grid;
|
||||||
|
|
||||||
@ -162,8 +158,7 @@ class ConfigEditor extends React.Component {
|
|||||||
this.setState({
|
this.setState({
|
||||||
editorClass: 'editor-full-screen',
|
editorClass: 'editor-full-screen',
|
||||||
});
|
});
|
||||||
}
|
} else if (e.key === 'Escape') {
|
||||||
if (e.key === 'Escape') {
|
|
||||||
this.setState({
|
this.setState({
|
||||||
editorClass: 'editor-normal',
|
editorClass: 'editor-normal',
|
||||||
});
|
});
|
||||||
@ -189,11 +184,11 @@ class ConfigEditor extends React.Component {
|
|||||||
|
|
||||||
openDiff(cbName) {
|
openDiff(cbName) {
|
||||||
this.diffcb = cbName;
|
this.diffcb = cbName;
|
||||||
let leftvalue = this.monacoEditor.getValue();
|
let leftValue = this.monacoEditor.getValue();
|
||||||
let rightvalue = this.codeVal || '';
|
let rightValue = this.codeVal || '';
|
||||||
leftvalue = leftvalue.replace(/\r\n/g, '\n').replace(/\n/g, '\r\n');
|
leftValue = leftValue.replace(/\r\n/g, '\n').replace(/\n/g, '\r\n');
|
||||||
rightvalue = rightvalue.replace(/\r\n/g, '\n').replace(/\n/g, '\r\n');
|
rightValue = rightValue.replace(/\r\n/g, '\n').replace(/\n/g, '\r\n');
|
||||||
this.diffEditorDialog.current.getInstance().openDialog(leftvalue, rightvalue);
|
this.diffEditorDialog.current.getInstance().openDialog(leftValue, rightValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
clickTab(tabActiveKey) {
|
clickTab(tabActiveKey) {
|
||||||
@ -235,7 +230,7 @@ class ConfigEditor extends React.Component {
|
|||||||
if (validateContent.validate({ content, type })) {
|
if (validateContent.validate({ content, type })) {
|
||||||
return this._publishConfig();
|
return this._publishConfig();
|
||||||
} else {
|
} else {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve) => {
|
||||||
Dialog.confirm({
|
Dialog.confirm({
|
||||||
content: locale.codeValErrorPrompt,
|
content: locale.codeValErrorPrompt,
|
||||||
onOk: () => resolve(this._publishConfig()),
|
onOk: () => resolve(this._publishConfig()),
|
||||||
@ -292,7 +287,6 @@ class ConfigEditor extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stopBeta() {
|
stopBeta() {
|
||||||
const { locale } = this.props;
|
|
||||||
const { dataId, group } = this.state.form;
|
const { dataId, group } = this.state.form;
|
||||||
const tenant = getParams('namespace');
|
const tenant = getParams('namespace');
|
||||||
return request
|
return request
|
||||||
@ -377,8 +371,7 @@ class ConfigEditor extends React.Component {
|
|||||||
};
|
};
|
||||||
if (beta) {
|
if (beta) {
|
||||||
params.beta = true;
|
params.beta = true;
|
||||||
}
|
} else {
|
||||||
if (!beta) {
|
|
||||||
params.show = 'all';
|
params.show = 'all';
|
||||||
}
|
}
|
||||||
return request.get('v1/cs/configs', { params }).then(res => {
|
return request.get('v1/cs/configs', { params }).then(res => {
|
||||||
|
Loading…
Reference in New Issue
Block a user