feat: Redis查询结果优化 — 复制按钮+JSON自动格式化+语义化列名
1. GET/HGET/TTL等单值命令: columns改为[key,value]替代[command,result] 2. DBSIZE等无key命令保持[command,result]格式 3. 前端添加复制按钮(Clipboard API), 2秒反馈 4. JSON值自动检测并格式化显示(whitespace-pre-wrap) 5. 结果区最大高度350px→500px 6. cost_ms字段兼容处理
This commit is contained in:
1 parent
828a0597c5
commit
18430f3717
2 files changed
+77
-14
No files matched your search
@@ -702,11 +702,25 @@ func executeRedisQuery(instance *model.Instance, dbSelect string, command string
|
||||
}
|
||||
columns = []string{"field", "value"}
|
||||
} else {
|
||||
rows = append(rows, map[string]interface{}{
|
||||
"command": command,
|
||||
"result": fmt.Sprintf("%v", v),
|
||||
})
|
||||
columns = []string{"command", "result"}
|
||||
// Single value result (GET, HGET, TYPE, TTL, etc.)
|
||||
// Try to extract key name from command
|
||||
keyName := ""
|
||||
if len(parts) > 1 {
|
||||
keyName = parts[1]
|
||||
}
|
||||
if keyName != "" {
|
||||
rows = append(rows, map[string]interface{}{
|
||||
"key": keyName,
|
||||
"value": fmt.Sprintf("%v", v),
|
||||
})
|
||||
columns = []string{"key", "value"}
|
||||
} else {
|
||||
rows = append(rows, map[string]interface{}{
|
||||
"command": command,
|
||||
"result": fmt.Sprintf("%v", v),
|
||||
})
|
||||
columns = []string{"command", "result"}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user