fix: db alias not display in empty database

This commit is contained in:
Lykin 2024-01-20 11:17:45 +08:00
parent 700a54081b
commit 673159dc85
1 changed files with 5 additions and 4 deletions

View File

@ -177,12 +177,12 @@ func (b *browserService) OpenConnection(name string) (resp types.JSResp) {
queryDB := func(idx int) types.ConnectionDB {
dbName := "db" + strconv.Itoa(idx)
dbInfoStr := info["Keyspace"][dbName]
if len(dbInfoStr) > 0 {
dbInfo := b.parseDBItemInfo(dbInfoStr)
var alias string
if selConn.Alias != nil {
alias = selConn.Alias[idx]
}
if len(dbInfoStr) > 0 {
dbInfo := b.parseDBItemInfo(dbInfoStr)
return types.ConnectionDB{
Name: dbName,
Alias: alias,
@ -194,6 +194,7 @@ func (b *browserService) OpenConnection(name string) (resp types.JSResp) {
} else {
return types.ConnectionDB{
Name: dbName,
Alias: alias,
Index: idx,
}
}