Skip to content

Commit

Permalink
Merge pull request #1494 from loadchange/feat/1.1.0
Browse files Browse the repository at this point in the history
Fix ConfigEditor
  • Loading branch information
nkorange authored Jul 6, 2019
2 parents fbf006d + 8eb2677 commit a15fc9f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,18 @@ class ConfigEditor extends React.Component {
dataId: getParams('dataId').trim(),
group,
},
() => this.getConfig()
() =>
this.getConfig(true).then(res => {
if (!res) {
this.getConfig();
return;
}
this.setState({
isBeta: true,
tabActiveKey: 'beta',
betaPublishSuccess: true,
});
})
);
} else {
if (group) {
Expand Down Expand Up @@ -155,7 +166,7 @@ class ConfigEditor extends React.Component {
openDiff(cbName) {
this.diffcb = cbName;
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');
rightvalue = rightvalue.replace(/\r\n/g, '\n').replace(/\n/g, '\r\n');
this.diffEditorDialog.current.getInstance().openDialog(leftvalue, rightvalue);
Expand Down Expand Up @@ -310,7 +321,7 @@ class ConfigEditor extends React.Component {
);
}

getConfig(beta = false) {
getConfig(beta = false, decide = false) {
const namespace = getParams('namespace');
const { dataId, group } = this.state.form;
const params = {
Expand All @@ -327,6 +338,7 @@ class ConfigEditor extends React.Component {
}
return request.get('v1/cs/configs', { params }).then(res => {
const form = beta ? res.data : res;
if (!form) return false;
const { type, content, configTags, betaIps } = form;
this.setState({ betaIps });
this.changeForm({ ...form, config_tags: configTags ? configTags.split(',') : [] });
Expand Down Expand Up @@ -528,7 +540,7 @@ class ConfigEditor extends React.Component {
<Button
size="large"
type="primary"
disabled={!betaIps}
disabled={!betaIps || betaPublishSuccess}
onClick={() => this.openDiff('publishBeta')}
>
{locale.release}
Expand Down
4 changes: 2 additions & 2 deletions console/src/main/resources/static/js/main.js

Large diffs are not rendered by default.

0 comments on commit a15fc9f

Please sign in to comment.