From f3b19815f7d712553dfaef45064bf8a6e7a4738d Mon Sep 17 00:00:00 2001 From: alan Date: Fri, 30 Aug 2019 15:23:59 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=87=8D=E5=91=BD?= =?UTF-8?q?=E5=90=8D=E6=97=B6=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/connection/list/list_item/list_item.model.ts | 7 +++++++ src/modules/pages/connection/list/list_item/list_item.ts | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/modules/pages/connection/list/list_item/list_item.model.ts b/src/modules/pages/connection/list/list_item/list_item.model.ts index 96b0f53..cc4fc11 100644 --- a/src/modules/pages/connection/list/list_item/list_item.model.ts +++ b/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); }, diff --git a/src/modules/pages/connection/list/list_item/list_item.ts b/src/modules/pages/connection/list/list_item/list_item.ts index 879c454..e101629 100644 --- a/src/modules/pages/connection/list/list_item/list_item.ts +++ b/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);