fix: database switching confusion in different tabs
This commit is contained in:
parent
af6b4257f9
commit
464a85867d
|
@ -387,7 +387,7 @@ func (b *browserService) ServerInfo(name string) (resp types.JSResp) {
|
|||
|
||||
// OpenDatabase open select database, and list all keys
|
||||
// @param path contain connection name and db name
|
||||
func (b *browserService) OpenDatabase(connName string, db int, match string, keyType string) (resp types.JSResp) {
|
||||
func (b *browserService) OpenDatabase(connName string, db int) (resp types.JSResp) {
|
||||
b.setClientCursor(connName, db, 0)
|
||||
|
||||
item, err := b.getRedisClient(connName, db)
|
||||
|
|
|
@ -32,8 +32,6 @@ const props = defineProps({
|
|||
},
|
||||
})
|
||||
|
||||
const emit = defineEmits(['update:db'])
|
||||
|
||||
const themeVars = useThemeVars()
|
||||
const i18n = useI18n()
|
||||
const dialogStore = useDialogStore()
|
||||
|
@ -164,13 +162,14 @@ const handleSelectDB = async (db) => {
|
|||
fullyLoaded.value = await browserStore.loadMoreKeys(props.server, db)
|
||||
browserTreeRef.value?.refreshTree()
|
||||
|
||||
nextTick().then(() => connectionStore.saveLastDB(props.server, db))
|
||||
nextTick().then(() => {
|
||||
connectionStore.saveLastDB(props.server, db)
|
||||
tabStore.upsertTab({ server: props.server, db })
|
||||
})
|
||||
} catch (e) {
|
||||
$message.error(e.message)
|
||||
} finally {
|
||||
loading.value = false
|
||||
// emit('update:db', db)
|
||||
// tabStore.switchTab()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -204,31 +203,6 @@ const onSelectOptions = (select) => {
|
|||
}
|
||||
}
|
||||
|
||||
// watch(
|
||||
// () => props.db,
|
||||
// async (db, prevDB) => {
|
||||
// if (db === undefined) {
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// try {
|
||||
// loading.value = true
|
||||
// browserStore.closeDatabase(props.server, prevDB)
|
||||
// browserStore.setKeyFilter(props.server, {})
|
||||
// await browserStore.openDatabase(props.server, db)
|
||||
// // browserTreeRef.value?.resetExpandKey(props.server, db)
|
||||
// fullyLoaded.value = await browserStore.loadMoreKeys(props.server, db)
|
||||
// browserTreeRef.value?.refreshTree()
|
||||
//
|
||||
// nextTick().then(() => connectionStore.saveLastDB(props.server, db))
|
||||
// } catch (e) {
|
||||
// $message.error(e.message)
|
||||
// } finally {
|
||||
// loading.value = false
|
||||
// }
|
||||
// },
|
||||
// )
|
||||
|
||||
onMounted(() => onReload())
|
||||
// forbid dynamic switch key view due to performance issues
|
||||
// const viewType = ref(0)
|
||||
|
|
|
@ -114,7 +114,7 @@ const useBrowserStore = defineStore('browser', {
|
|||
filter: {}, // all filters in opened connections map by server and FilterItem
|
||||
loadingState: {}, // all loading state in opened connections map by server and LoadingState
|
||||
viewType: {}, // view type selection for all opened connections group by 'server'
|
||||
databases: {}, // all databases in opened connections group by 'server name'
|
||||
databases: {}, // all database lists in opened connections group by 'server name'
|
||||
nodeMap: {}, // all nodes in opened connections group by 'server#db' and 'type/key'
|
||||
keySet: {}, // all keys set in opened connections group by 'server#db
|
||||
openedDB: {}, // opened database map by server and database index
|
||||
|
|
Loading…
Reference in New Issue