fix the tag remove error. (#5457)

This commit is contained in:
brothelul 2021-04-26 13:46:30 +08:00 committed by GitHub
parent da3a1ea796
commit 81c1e53ac6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 20 deletions

View File

@ -369,7 +369,7 @@ class ConfigEditor extends React.Component {
appName: this.inApp ? this.edasAppId : this.field.getValue('appName'),
group: this.field.getValue('group'),
desc: this.field.getValue('desc'),
config_tags: this.state.config_tags.join(),
config_tags: this.state.config_tags.join(','),
type: this.state.configType,
content,
tenant: this.tenant,

View File

@ -238,6 +238,10 @@ class ConfigEditor extends React.Component {
Object.keys(form).forEach(key => {
payload[key] = form[key];
});
let configTags = this.state.form.config_tags;
if (configTags.length > 0) {
payload.config_tags = configTags.join(',');
}
const stringify = require('qs/lib/stringify');
this.setState({ loading: true });
return request({
@ -308,18 +312,20 @@ class ConfigEditor extends React.Component {
setConfigTags(tags) {
const { tagDataSource } = this.state;
const lastTag = tags[tags.length - 1];
if (tagDataSource.indexOf(lastTag) < 0) {
this.setState({ tagDataSource: [...tagDataSource, lastTag] });
}
if (tags.length > 5) {
tags.pop();
}
tags.forEach((v, i) => {
if (v.indexOf(',') !== -1 || v.indexOf('=') !== -1) {
tags.splice(i, 1);
if (tags.length > 0) {
const lastTag = tags[tags.length - 1];
if (tagDataSource.indexOf(lastTag) < 0) {
this.setState({ tagDataSource: [...tagDataSource, lastTag] });
}
});
if (tags.length > 5) {
tags.pop();
}
tags.forEach((v, i) => {
if (v.indexOf(',') !== -1 || v.indexOf('=') !== -1) {
tags.splice(i, 1);
}
});
}
this.changeForm({ config_tags: tags });
}
@ -365,6 +371,9 @@ class ConfigEditor extends React.Component {
this.changeForm({ ...form, config_tags: configTags ? configTags.split(',') : [] });
this.initMoacoEditor(type, content);
this.codeVal = content;
this.setState({
tagDataSource: this.state.form.config_tags,
});
return res;
});
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long