fix #554 close respective tab when close connection instead of all tabs

This commit is contained in:
qishibo 2021-05-20 17:47:49 +08:00
parent 19862c05f9
commit 20fbff6952
2 changed files with 9 additions and 2 deletions

View File

@ -94,7 +94,7 @@ export default {
this.$t('message.close_to_edit_connection'),
{ type: 'warning' },
).then(() => {
this.$bus.$emit('closeConnection');
this.$bus.$emit('closeConnection', this.config.connectionName);
this.$refs.editConnectionDialog.show();
}).catch(() => {});
},
@ -103,7 +103,7 @@ export default {
this.$t('message.close_to_connection'),
{ type: 'warning' },
).then(() => {
this.$bus.$emit('closeConnection');
this.$bus.$emit('closeConnection', this.config.connectionName);
}).catch(() => {});
},
editConnectionFinished(newConfig) {

View File

@ -68,6 +68,13 @@ export default {
this.tabs = this.tabs.filter((tab) => {
return tab.client.options.connectionName != connectionName;
});
// still tabs left, solve selecting which tab
if (this.tabs.length) {
// previous selected left, do not change
let filteredTab = this.tabs.filter(tab => tab.name == this.selectedTabName);
!filteredTab.length && (this.selectedTabName = this.tabs[0].name);
}
});
},
methods: {