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 => {
if (!re.errorCode) {
this.setIsEdit(false, oldName);
this.model.connections = this.model.connections.map(item => {
return {
...item,

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

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

Loading…
Cancel
Save