Remove unused code; Use Camel-Case;Optimize if statement; (#6616)

* Remove unused code;

* Optimize if statement;

* Use Camel-Case
This commit is contained in:
myifeng 2021-08-12 09:48:50 +08:00 committed by GitHub
parent 46c1f7e6df
commit fc27e77c3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,22 +27,18 @@ import {
Balloon,
Button,
Dialog,
Field,
Form,
Checkbox,
Icon,
Input,
Loading,
Radio,
Switch,
Select,
Tab,
Message,
Grid,
ConfigProvider,
} from '@alifd/next';
import { resolve } from 'url';
import qs from 'qs';
const { Row, Col } = Grid;
@ -162,8 +158,7 @@ class ConfigEditor extends React.Component {
this.setState({
editorClass: 'editor-full-screen',
});
}
if (e.key === 'Escape') {
} else if (e.key === 'Escape') {
this.setState({
editorClass: 'editor-normal',
});
@ -189,11 +184,11 @@ class ConfigEditor extends React.Component {
openDiff(cbName) {
this.diffcb = cbName;
let leftvalue = this.monacoEditor.getValue();
let rightvalue = this.codeVal || '';
leftvalue = leftvalue.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);
let leftValue = this.monacoEditor.getValue();
let rightValue = this.codeVal || '';
leftValue = leftValue.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);
}
clickTab(tabActiveKey) {
@ -235,7 +230,7 @@ class ConfigEditor extends React.Component {
if (validateContent.validate({ content, type })) {
return this._publishConfig();
} else {
return new Promise((resolve, reject) => {
return new Promise((resolve) => {
Dialog.confirm({
content: locale.codeValErrorPrompt,
onOk: () => resolve(this._publishConfig()),
@ -292,7 +287,6 @@ class ConfigEditor extends React.Component {
}
stopBeta() {
const { locale } = this.props;
const { dataId, group } = this.state.form;
const tenant = getParams('namespace');
return request
@ -377,8 +371,7 @@ class ConfigEditor extends React.Component {
};
if (beta) {
params.beta = true;
}
if (!beta) {
} else {
params.show = 'all';
}
return request.get('v1/cs/configs', { params }).then(res => {