feat: ARDM风格查询页优化 — 可拖拽Sidebar + Redis差异化结果展示 + KeyHeader\n\n1. Sidebar可拖拽宽度(200-600px, localStorage持久化)\n2. Redis raw_text展示加ARDM KeyHeader: key名+类型标签+TTL+格式标签+复制按钮\n3. HGETALL结果用field/value紧凑双列展示替代通用表格\n4. 后端raw_text模式自动查询key TYPE和TTL返回raw_type/raw_ttl

This commit is contained in:
logan committed 2026-05-30 18:20:22 +08:00
1 parent 4e6f9eb8fd
commit 433e7e2909
2 files changed
+122 -16

No files matched your search

+23 -2
View File
@@ -915,14 +915,35 @@ func executeRedisQuery(instance *model.Instance, dbSelect string, command string
prettyJSON = strings.TrimRight(buf.String(), "\n")
}
}
return gin.H{
// ARDM-style: auto-fetch key type and TTL for KeyHeader
var keyType, keyTTL string
if keyName != "" && cmd != "TYPE" && cmd != "TTL" && cmd != "PTTL" && cmd != "EXISTS" && cmd != "DBSIZE" && cmd != "INFO" {
if t, err := client.Type(ctx, keyName).Result(); err == nil {
keyType = t
}
if ttl, err := client.TTL(ctx, keyName).Result(); err == nil {
if ttl < 0 {
keyTTL = "永不过期"
} else {
keyTTL = fmt.Sprintf("%vs", int(ttl.Seconds()))
}
}
}
result := gin.H{
"columns": []string{},
"rows": []interface{}{},
"total": 0,
"raw_value": prettyJSON != "",
"raw_key": keyName,
"raw_text": rawValue,
}, nil
}
if keyType != "" {
result["raw_type"] = keyType
}
if keyTTL != "" {
result["raw_ttl"] = keyTTL
}
return result, nil
}
}