Browse Source

fix: DEC-10022 重命名时若保存失败,则提示失败信息并变回原来的名字。

qufenxi
alan 5 years ago
parent
commit
2fec3aef73
  1. 1
      src/modules/pages/connection/list/list_item/list_item.model.ts
  2. 3
      src/modules/pages/connection/list/list_item/list_item.ts

1
src/modules/pages/connection/list/list_item/list_item.model.ts

@ -76,7 +76,6 @@ export class ListItemModel extends Model<{
return api.updateConnection(connection).then(re => { return api.updateConnection(connection).then(re => {
if (!re.errorCode) { if (!re.errorCode) {
this.setIsEdit(false, oldName);
this.model.connections = this.model.connections.map(item => { this.model.connections = this.model.connections.map(item => {
return { return {
...item, ...item,

3
src/modules/pages/connection/list/list_item/list_item.ts

@ -73,11 +73,12 @@ export class ListItem extends BI.BasicButton {
action: () => { action: () => {
const newName = this.nameEditor.getValue(); const newName = this.nameEditor.getValue();
this.store.changeName(name, newName).then(re => { this.store.changeName(name, newName).then(re => {
this.store.setIsEdit(false, name);
if (re.errorCode) { if (re.errorCode) {
BI.Msg.toast(BI.i18nText(re.errorMsg), { BI.Msg.toast(BI.i18nText(re.errorMsg), {
level: 'error', level: 'error',
}); });
this.nameEditor.focus(); this.nameLabel.setText(name);
} else { } else {
this.nameLabel.setText(newName); this.nameLabel.setText(newName);
} }

Loading…
Cancel
Save