fix: select incorrect database when double click key layer #99
This commit is contained in:
parent
94c7b7ade5
commit
f7f394972d
|
@ -87,7 +87,18 @@ func (b *browserService) Stop() {
|
|||
func (b *browserService) OpenConnection(name string) (resp types.JSResp) {
|
||||
// get connection config
|
||||
selConn := Connection().getConnection(name)
|
||||
item, err := b.getRedisClient(name, selConn.LastDB)
|
||||
// correct last database index
|
||||
lastDB := selConn.LastDB
|
||||
if selConn.DBFilterType == "show" && !sliceutil.Contains(selConn.DBFilterList, lastDB) {
|
||||
lastDB = selConn.DBFilterList[0]
|
||||
} else if selConn.DBFilterType == "hide" && sliceutil.Contains(selConn.DBFilterList, lastDB) {
|
||||
lastDB = selConn.DBFilterList[0]
|
||||
}
|
||||
if lastDB != selConn.LastDB {
|
||||
Connection().SaveLastDB(name, lastDB)
|
||||
}
|
||||
|
||||
item, err := b.getRedisClient(name, lastDB)
|
||||
if err != nil {
|
||||
resp.Msg = err.Error()
|
||||
return
|
||||
|
|
|
@ -152,6 +152,10 @@ const onDisconnect = () => {
|
|||
}
|
||||
|
||||
const handleSelectDB = async (db) => {
|
||||
if (db === props.db) {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
loading.value = true
|
||||
browserStore.setKeyFilter(props.server, {})
|
||||
|
|
|
@ -295,7 +295,7 @@ const onUpdateSelectedKeys = (keys, options) => {
|
|||
}
|
||||
}
|
||||
// default is load blank key to display server status
|
||||
tabStore.openBlank(props.server)
|
||||
tabStore.openBlank(props.server, props.db)
|
||||
} finally {
|
||||
tabStore.setSelectedKeys(props.server, keys)
|
||||
}
|
||||
|
|
|
@ -49,13 +49,6 @@ const contextMenuParam = reactive({
|
|||
currentNode: null,
|
||||
})
|
||||
|
||||
const renderIcon = (icon) => {
|
||||
return () => {
|
||||
return h(NIcon, null, {
|
||||
default: () => h(icon),
|
||||
})
|
||||
}
|
||||
}
|
||||
const menuOptions = {
|
||||
[ConnectionType.Group]: ({ opened }) => [
|
||||
{
|
||||
|
|
|
@ -151,7 +151,7 @@ const useTabStore = defineStore('tab', {
|
|||
},
|
||||
|
||||
openBlank(server) {
|
||||
this.upsertTab({ server, db: 0 })
|
||||
this.upsertTab({ server })
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -194,7 +194,7 @@ const useTabStore = defineStore('tab', {
|
|||
// tab.title = db !== undefined ? `${server}/db${db}` : `${server}`
|
||||
tab.title = server
|
||||
tab.server = server
|
||||
tab.db = db
|
||||
tab.db = db == null ? tab.db : db
|
||||
tab.type = type
|
||||
tab.ttl = ttl
|
||||
tab.key = key
|
||||
|
|
Loading…
Reference in New Issue