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) {
|
func (b *browserService) OpenConnection(name string) (resp types.JSResp) {
|
||||||
// get connection config
|
// get connection config
|
||||||
selConn := Connection().getConnection(name)
|
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 {
|
if err != nil {
|
||||||
resp.Msg = err.Error()
|
resp.Msg = err.Error()
|
||||||
return
|
return
|
||||||
|
|
|
@ -152,6 +152,10 @@ const onDisconnect = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleSelectDB = async (db) => {
|
const handleSelectDB = async (db) => {
|
||||||
|
if (db === props.db) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
browserStore.setKeyFilter(props.server, {})
|
browserStore.setKeyFilter(props.server, {})
|
||||||
|
|
|
@ -295,7 +295,7 @@ const onUpdateSelectedKeys = (keys, options) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// default is load blank key to display server status
|
// default is load blank key to display server status
|
||||||
tabStore.openBlank(props.server)
|
tabStore.openBlank(props.server, props.db)
|
||||||
} finally {
|
} finally {
|
||||||
tabStore.setSelectedKeys(props.server, keys)
|
tabStore.setSelectedKeys(props.server, keys)
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,13 +49,6 @@ const contextMenuParam = reactive({
|
||||||
currentNode: null,
|
currentNode: null,
|
||||||
})
|
})
|
||||||
|
|
||||||
const renderIcon = (icon) => {
|
|
||||||
return () => {
|
|
||||||
return h(NIcon, null, {
|
|
||||||
default: () => h(icon),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const menuOptions = {
|
const menuOptions = {
|
||||||
[ConnectionType.Group]: ({ opened }) => [
|
[ConnectionType.Group]: ({ opened }) => [
|
||||||
{
|
{
|
||||||
|
|
|
@ -151,7 +151,7 @@ const useTabStore = defineStore('tab', {
|
||||||
},
|
},
|
||||||
|
|
||||||
openBlank(server) {
|
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 = db !== undefined ? `${server}/db${db}` : `${server}`
|
||||||
tab.title = server
|
tab.title = server
|
||||||
tab.server = server
|
tab.server = server
|
||||||
tab.db = db
|
tab.db = db == null ? tab.db : db
|
||||||
tab.type = type
|
tab.type = type
|
||||||
tab.ttl = ttl
|
tab.ttl = ttl
|
||||||
tab.key = key
|
tab.key = key
|
||||||
|
|
Loading…
Reference in New Issue