Browse Source

fix: 修复重命名时的bug

qufenxi
alan 5 years ago
parent
commit
f3b19815f7
  1. 7
      src/modules/pages/connection/list/list_item/list_item.model.ts
  2. 4
      src/modules/pages/connection/list/list_item/list_item.ts

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

@ -70,6 +70,13 @@ export class ListItemModel extends Model<{
const connection = this.model.connections.find(item => item.connectionName === oldName);
connection.connectionId = oldName;
connection.connectionName = newName;
this.model.connections = this.model.connections.map(item => {
return {
...item,
connectionName: item.connectionName === oldName ? newName : item.connectionName,
connectionId: oldName,
};
});
return api.updateConnection(connection);
},

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

@ -68,7 +68,7 @@ export class ListItem extends BI.BasicButton {
action: () => {
const newName = this.nameEditor.getValue();
this.store.changeName(name, newName).then(() => {
this.store.setIsEdit(false);
this.store.setIsEdit(false, name);
this.nameLabel.setText(newName);
});
},
@ -227,7 +227,7 @@ export class ListItem extends BI.BasicButton {
});
},
changeName: () => {
this.store.setIsEdit(true);
this.store.setIsEdit(true, name);
},
copy: () => {
this.store.setConnectionSelected(name);

Loading…
Cancel
Save