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