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 d112a42..da9924c 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 @@ -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, @@ -103,7 +102,7 @@ export class ListItemModel extends Model<{ item.connectionData = JSON.parse(item.connectionData as string); }); if (name === this.model.connectionSelected) { - this.model.connectionSelected = ''; + this.model.connectionSelected = BI.size(this.model.connections) > 0 ? this.model.connections[0].connectionName : ''; } api.shutdownConnectionStatus(name); }); 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 cd1faa3..e0bd557 100644 --- a/src/modules/pages/connection/list/list_item/list_item.ts +++ b/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); }