25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
feat(redis): improve key browser workflows
t8y25c2028c2c43a
diff --git a/apps/desktop/src/components/redis/RedisKeyBrowser.vue b/apps/desktop/src/components/redis/RedisKeyBrowser.vueindex 0b1dcf34bf..43075a418f 100644--- a/apps/desktop/src/components/redis/RedisKeyBrowser.vue+++ b/apps/desktop/src/components/redis/RedisKeyBrowser.vue@@ -1,5 +1,5 @@<script setup lang="ts">-import { computed, ref, onMounted, onUnmounted } from "vue";+import { computed, nextTick, ref, onMounted, onUnmounted, watch } from "vue";import { useI18n } from "vue-i18n";import {Search,@@ -10,9 +10,9 @@ import {FolderClosed,FolderOpen,Trash2,- DatabaseZap,- Play,- Terminal,+ Plus,+ KeyRound,+ TerminalSquare,} from "lucide-vue-next";import { RecycleScroller } from "vue-virtual-scroller";import "vue-virtual-scroller/dist/vue-virtual-scroller.css";@@ -21,6 +21,9 @@ import "splitpanes/dist/splitpanes.css";import { Button } from "@/components/ui/button";import { Input } from "@/components/ui/input";import { Badge } from "@/components/ui/badge";+import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";+import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";+import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";import DangerConfirmDialog from "@/components/editor/DangerConfirmDialog.vue";import RedisValueViewer from "./RedisValueViewer.vue";import * as api from "@/lib/api";@@ -35,6 +38,8 @@ import {type RedisKeyTreeNode,} from "@/lib/redisKeyTree";import { classifyRedisCommandSafety } from "@/lib/redisCommandSafety";+import { isRedisClearScreenCommand, nextRedisCommandDb, redisKeyTextToRaw } from "@/lib/redisCommandSession";+import { formatRedisCommandResult, formatRedisStringValue } from "@/lib/redisValuePresentation";import { isCancelSearchShortcut } from "@/lib/keyboardShortcuts";const { t } = useI18n();@@ -42,6 +47,15 @@ const connectionStore = useConnectionStore();const settingsStore = useSettingsStore();type RedisSearchMode = "key" | "value";+type RedisCreateKeyType = "string" | "hash" | "list" | "set" | "zset";+type RedisSidePanel = "detail" | "command";+type RedisCommandHistoryEntry = {+ id: number;+ prompt: string;+ command: string;+ output: string;+ error: boolean;+};const props = defineProps<{connectionId: string;@@ -53,7 +67,8 @@ const treeKeys = ref<RedisKeyTreeNode[]>([]);const loading = ref(false);const loadingMore = ref(false);const rootRef = ref<HTMLElement>();-const searchPattern = ref("*");+const commandTerminalRef = ref<HTMLElement>();+const searchPattern = ref("");const searchMode = ref<RedisSearchMode>("key");const selectedKeyRaw = ref<string | null>(null);const hasMore = ref(false);@@ -61,22 +76,24 @@ const scanCursor = ref(0);const expandedGroupIds = ref<Set<string>>(new Set());const checkedKeys = ref<Set<string>>(new Set());const pendingDanger = ref<- | { kind: "delete-keys"; title: string; keyRaws: string[] }- | { kind: "flush-db" }- | { kind: "command"; command: string }- | null+ { kind: "delete-keys"; title: string; keyRaws: string[] } | { kind: "command"; command: string } | null>(null);const showDangerConfirm = ref(false);const commandText = ref("");-const commandResult = ref<any>(null);-const commandError = ref("");const commandRunning = ref(false);+const commandDb = ref(props.db);+const commandHistory = ref<RedisCommandHistoryEntry[]>([]);+const activeSidePanel = ref<RedisSidePanel>("detail");+const showCreateKeyDialog = ref(false);+const creatingKey = ref(false);+const createKeyName = ref("");+const createKeyType = ref<RedisCreateKeyType>("string");+const createKeyValue = ref("");+const createKeyField = ref("");+const createKeyScore = ref("0");+const createKeyError = ref("");let searchRequestId = 0;-const keyGridStyle = {- gridTemplateColumns: "minmax(12rem, 0.35fr) 80px 1fr 60px 60px",-};-const valueQuery = computed(() => searchPattern.value.trim());const effectivePattern = computed(() => (searchMode.value === "key" ? searchPattern.value.trim() || "*" : "*"));const isSearchMode = computed(() =>@@ -97,20 +114,27 @@ const dangerDetails = computed(() => {count: pendingDanger.value.keyRaws.length,});}- if (pendingDanger.value.kind === "flush-db") return t("redis.flushDbDetails", { db: props.db });return pendingDanger.value.command;});-const formattedCommandResult = computed(() => {- if (commandResult.value == null) return "";- if (typeof commandResult.value === "string") return commandResult.value;- return JSON.stringify(commandResult.value, null, 2);+const dangerConfirmLabel = computed(() => {+ if (pendingDanger.value?.kind === "command") return t("dangerDialog.confirm");+ return t("dangerDialog.deleteConfirm");});+const commandPrompt = computed(() => `db${commandDb.value}>`);+const createKeyTypeOptions = computed<{ value: RedisCreateKeyType; label: string }[]>(() => [+ { value: "string", label: "String" },+ { value: "hash", label: "Hash" },+ { value: "list", label: "List" },+ { value: "set", label: "Set" },+ { value: "zset", label: "Sorted Set" },+]);const visibleRows = computed(() =>flattenVisibleRedisKeyTree(treeKeys.value, expandedGroupIds.value).map((row) => ({...row,id: row.node.id,})),);+let commandHistoryId = 0;function countLeaves(node: RedisKeyTreeNode): number {if (node.kind === "leaf") return 1;@@ -220,6 +244,7 @@ function onRowClick(node: RedisKeyTreeNode) {}selectedKeyRaw.value = node.keyRaw;+ activeSidePanel.value = "detail";}function onKeyDeleted() {@@ -256,11 +281,6 @@ function requestGroupDelete(node: RedisKeyTreeNode, event: Event) {showDangerConfirm.value = true;}-function requestFlushDb() {- pendingDanger.value = { kind: "flush-db" };- showDangerConfirm.value = true;-}-function resetLoadedKeys() {flatKeys.value = [];treeKeys.value = [];@@ -285,42 +305,175 @@ async function deleteKeyRaws(keys: string[]) {});}+function scrollCommandTerminalToEnd() {+ void nextTick(() => {+ if (!commandTerminalRef.value) return;+ commandTerminalRef.value.scrollTop = commandTerminalRef.value.scrollHeight;+ });+}++function appendCommandHistory(entry: Omit<RedisCommandHistoryEntry, "id">) {+ commandHistory.value = [...commandHistory.value, { id: ++commandHistoryId, ...entry }];+ scrollCommandTerminalToEnd();+}+async function runRedisCommand(command: string) {+ const prompt = commandPrompt.value;commandRunning.value = true;- commandError.value = "";- commandResult.value = null;try {- const result = await api.redisExecuteCommand(props.connectionId, props.db, command);- commandResult.value = result.value;+ const result = await api.redisExecuteCommand(props.connectionId, commandDb.value, command);+ appendCommandHistory({+ prompt,+ command,+ output: formatRedisCommandResult(result.value),+ error: false,+ });+ commandDb.value = nextRedisCommandDb(commandDb.value, command, result.value);if (result.safety === "confirm") {await loadKeys();}} catch (error) {- commandError.value = error instanceof Error ? error.message : String(error);+ appendCommandHistory({+ prompt,+ command,+ output: error instanceof Error ? error.message : String(error),+ error: true,+ });} finally {commandRunning.value = false;+ scrollCommandTerminalToEnd();+ }+}++async function openCommandPanel() {+ activeSidePanel.value = "command";+ await nextTick();+ getCommandInput()?.focus();+}++function resetCreateKeyForm() {+ createKeyName.value = "";+ createKeyType.value = "string";+ createKeyValue.value = "";+ createKeyField.value = "";+ createKeyScore.value = "0";+ createKeyError.value = "";+}++function openCreateKeyDialog() {+ resetCreateKeyForm();+ showCreateKeyDialog.value = true;+}++function createdKeyPreview(value: any): string {+ if (typeof value === "string") {+ const text = formatRedisStringValue(value).replace(/\s+/g, " ").trim();+ return text.length > 160 ? `${text.slice(0, 160)}…` : text;+ }+ if (Array.isArray(value) && value.length > 0) return String(value.length);+ return "";+}++function upsertCreatedKey(value: any) {+ const keyInfo: RedisKeyInfo = {+ key_display: value.key_display,+ key_raw: value.key_raw,+ key_type: value.key_type,+ ttl: value.ttl,+ size: typeof value.value === "string" ? value.value.length : (value.total ?? 0),+ value_preview: createdKeyPreview(value.value),+ };+ const existingIndex = flatKeys.value.findIndex((key) => key.key_raw === keyInfo.key_raw);+ if (existingIndex >= 0) {+ flatKeys.value = flatKeys.value.map((key, index) => (index === existingIndex ? keyInfo : key));+ } else {+ flatKeys.value = [keyInfo, ...flatKeys.value];+ }+ selectedKeyRaw.value = keyInfo.key_raw;+ rebuildTree(isSearchMode.value);+ connectionStore.updateRedisDbKeyStats(props.connectionId, props.db, {+ loaded: isSearchMode.value ? undefined : flatKeys.value.length,+ totalDelta: existingIndex >= 0 ? 0 : 1,+ });+}++async function createRedisKey() {+ const keyName = createKeyName.value.trim();+ if (!keyName) {+ createKeyError.value = t("redis.createKeyNameRequired");+ return;+ }+ if (createKeyType.value === "hash" && !createKeyField.value.trim()) {+ createKeyError.value = t("redis.createFieldRequired");+ return;+ }+ const score = Number.parseFloat(createKeyScore.value || "0");+ if (createKeyType.value === "zset" && Number.isNaN(score)) {+ createKeyError.value = t("redis.createScoreInvalid");+ return;+ }++ creatingKey.value = true;+ createKeyError.value = "";+ try {+ const keyRaw = redisKeyTextToRaw(keyName);+ if (createKeyType.value === "string") {+ await api.redisSetString(props.connectionId, props.db, keyRaw, createKeyValue.value);+ } else if (createKeyType.value === "hash") {+ await api.redisHashSet(props.connectionId, props.db, keyRaw, createKeyField.value, createKeyValue.value);+ } else if (createKeyType.value === "list") {+ await api.redisListPush(props.connectionId, props.db, keyRaw, createKeyValue.value);+ } else if (createKeyType.value === "set") {+ await api.redisSetAdd(props.connectionId, props.db, keyRaw, createKeyValue.value);+ } else if (createKeyType.value === "zset") {+ await api.redisZadd(props.connectionId, props.db, keyRaw, createKeyValue.value, score);+ }+ const created = await api.redisGetValue(props.connectionId, props.db, keyRaw);+ upsertCreatedKey(created);+ showCreateKeyDialog.value = false;+ } catch (error) {+ createKeyError.value = error instanceof Error ? error.message : String(error);+ } finally {+ creatingKey.value = false;}}async function executeCommand() {const command = commandText.value.trim();if (!command) {- commandError.value = t("redis.commandEmpty");- commandResult.value = null;+ appendCommandHistory({+ prompt: commandPrompt.value,+ command: "",+ output: t("redis.commandEmpty"),+ error: true,+ });+ return;+ }+ if (isRedisClearScreenCommand(command)) {+ commandHistory.value = [];+ commandText.value = "";+ scrollCommandTerminalToEnd();return;}const safety = classifyRedisCommandSafety(command);if (safety === "blocked") {- commandError.value = t("redis.commandBlocked");- commandResult.value = null;+ appendCommandHistory({+ prompt: commandPrompt.value,+ command,+ output: t("redis.commandBlocked"),+ error: true,+ });+ commandText.value = "";return;}if (safety === "confirm") {pendingDanger.value = { kind: "command", command };showDangerConfirm.value = true;+ commandText.value = "";return;}+ commandText.value = "";await runRedisCommand(command);}@@ -332,10 +485,6 @@ async function applyDangerAction() {if (pending.kind === "delete-keys") {await deleteKeyRaws(pending.keyRaws);- } else if (pending.kind === "flush-db") {- await api.redisFlushDb(props.connectionId, props.db);- resetLoadedKeys();- connectionStore.updateRedisDbKeyStats(props.connectionId, props.db, { loaded: 0, total: 0 });} else {await runRedisCommand(pending.command);}@@ -360,20 +509,6 @@ function typeColor(type: string): string {}}-function formatSize(size: number, type: string, valuePreview: string): string {- if (!valuePreview) return "";- if (type === "string") {- if (size >= 1024) return `${(size / 1024).toFixed(1)} KB`;- return `${size} B`;- }- return String(size);-}--function formatTtl(ttl: number): string {- if (ttl === -2) return "";- return ttl === -1 ? "∞" : `${ttl}s`;-}-let searchTimer: ReturnType<typeof setTimeout> | null = null;function onSearchInput() {@@ -384,9 +519,6 @@ function onSearchInput() {function setSearchMode(mode: RedisSearchMode) {if (searchMode.value === mode) return;searchMode.value = mode;- if (mode === "key" && !searchPattern.value.trim()) {- searchPattern.value = "*";- }void loadKeys();}@@ -394,6 +526,10 @@ function getSearchInput(): HTMLInputElement | null {return rootRef.value?.querySelector<HTMLInputElement>("[data-redis-search-input]") ?? null;}+function getCommandInput(): HTMLInputElement | null {+ return rootRef.value?.querySelector<HTMLInputElement>("[data-redis-command-input]") ?? null;+}+function focusSearch(): boolean {const input = getSearchInput();if (!input) return false;@@ -409,270 +545,382 @@ function onSearchKeydown(event: KeyboardEvent) {}if (!isCancelSearchShortcut(event)) return;event.preventDefault();- searchPattern.value = searchMode.value === "key" ? "*" : "";+ searchPattern.value = "";void loadKeys();}onUnmounted(() => {searchRequestId++;if (searchTimer) clearTimeout(searchTimer);+ window.removeEventListener("dbx-redis-db-flushed", onRedisDbFlushed);});-onMounted(loadKeys);+function onRedisDbFlushed(event: Event) {+ const detail = (event as CustomEvent<{ connectionId: string; db: number }>).detail;+ if (!detail || detail.connectionId !== props.connectionId || detail.db !== props.db) return;+ resetLoadedKeys();+}++onMounted(() => {+ window.addEventListener("dbx-redis-db-flushed", onRedisDbFlushed);+ void loadKeys();+});++watch(+ () => props.db,+ (db) => {+ commandDb.value = db;+ },+);defineExpose({ focusSearch });</script><template>- <Splitpanes class="h-full" horizontal>- <!-- Key table (top) -->- <Pane :size="selectedKey ? 50 : 100" :min-size="25">- <div ref="rootRef" class="h-full flex flex-col overflow-hidden">- <!-- Toolbar -->- <div class="h-9 flex items-center gap-1 px-2 border-b shrink-0">- <Search class="w-3.5 h-3.5 text-muted-foreground shrink-0" />- <div class="h-6 flex rounded-md border bg-muted/30 p-0.5 shrink-0" role="group">- <button- type="button"- class="h-5 px-2 text-xs rounded-sm transition-colors"- :class="- searchMode === 'key'- ? 'bg-background text-foreground shadow-sm'- : 'text-muted-foreground hover:text-foreground'- "- @click="setSearchMode('key')"+ <div ref="rootRef" class="h-full">+ <Splitpanes class="redis-workspace-splitpanes h-full">+ <!-- Key tree (left) -->+ <Pane :size="36" :min-size="24">+ <div class="relative h-full flex flex-col overflow-hidden">+ <!-- Toolbar -->+ <div class="h-9 flex items-center gap-1 px-2 border-b shrink-0">+ <Search class="w-3.5 h-3.5 text-muted-foreground shrink-0" />+ <div class="h-6 flex rounded-md border bg-muted/30 p-0.5 shrink-0" role="group">+ <button+ type="button"+ class="h-5 px-2 text-xs rounded-sm transition-colors"+ :class="+ searchMode === 'key'+ ? 'bg-background text-foreground shadow-sm'+ : 'text-muted-foreground hover:text-foreground'+ "+ @click="setSearchMode('key')"+ >+ {{ t("redis.searchByKey") }}+ </button>+ <button+ type="button"+ class="h-5 px-2 text-xs rounded-sm transition-colors"+ :class="+ searchMode === 'value'+ ? 'bg-background text-foreground shadow-sm'+ : 'text-muted-foreground hover:text-foreground'+ "+ @click="setSearchMode('value')"+ >+ {{ t("redis.searchByValue") }}+ </button>+ </div>+ <Input+ v-model="searchPattern"+ data-redis-search-input+ class="h-6 text-xs border-0 shadow-none focus-visible:ring-0"+ :placeholder="searchPlaceholder"+ @input="onSearchInput"+ @keydown="onSearchKeydown"+ />+ <Button variant="ghost" size="icon" class="h-6 w-6 shrink-0" @click="loadKeys">+ <Loader2 v-if="loading" class="h-3 w-3 animate-spin" />+ <RefreshCw v-else class="h-3 w-3" />+ </Button>+ <Button+ variant="ghost"+ size="icon"+ class="h-6 w-6 shrink-0"+ :title="t('redis.createKey')"+ @click="openCreateKeyDialog">- {{ t("redis.searchByKey") }}- </button>- <button- type="button"- class="h-5 px-2 text-xs rounded-sm transition-colors"- :class="- searchMode === 'value'- ? 'bg-background text-foreground shadow-sm'- : 'text-muted-foreground hover:text-foreground'- "- @click="setSearchMode('value')"+ <Plus class="h-3 w-3" />+ </Button>+ <span class="text-xs text-muted-foreground shrink-0 ml-1">{{+ loading && flatKeys.length === 0 ? loadingEmptyText : t("redis.keys", { count: flatKeys.length })+ }}</span>+ <Button+ v-if="checkedKeys.size > 0"+ variant="ghost"+ size="sm"+ class="h-6 text-xs text-destructive shrink-0 ml-1"+ @click="requestBatchDelete">- {{ t("redis.searchByValue") }}- </button>+ <Trash2 class="w-3 h-3 mr-1" />{{ checkedKeys.size }}+ </Button></div>- <Input- v-model="searchPattern"- data-redis-search-input- class="h-6 text-xs border-0 shadow-none focus-visible:ring-0"- :placeholder="searchPlaceholder"- @input="onSearchInput"- @keydown="onSearchKeydown"- />- <Button variant="ghost" size="icon" class="h-6 w-6 shrink-0" @click="loadKeys">- <Loader2 v-if="loading" class="h-3 w-3 animate-spin" />- <RefreshCw v-else class="h-3 w-3" />- </Button>- <span class="text-xs text-muted-foreground shrink-0 ml-1">{{- loading && flatKeys.length === 0 ? loadingEmptyText : t("redis.keys", { count: flatKeys.length })- }}</span>- <Button- v-if="checkedKeys.size > 0"- variant="ghost"- size="sm"- class="h-6 text-xs text-destructive shrink-0 ml-1"- @click="requestBatchDelete"- >- <Trash2 class="w-3 h-3 mr-1" />{{ checkedKeys.size }}- </Button>- </div>- <div class="min-h-9 flex items-center gap-1 px-2 border-b bg-muted/20 shrink-0">- <Terminal class="w-3.5 h-3.5 text-muted-foreground shrink-0" />- <span- class="h-5 px-1.5 rounded border bg-background/70 text-[10px] font-medium uppercase tracking-wide text-muted-foreground shrink-0"- >- {{ t("redis.commandPrefix") }}- </span>- <span class="font-mono text-xs text-muted-foreground shrink-0">></span>- <Input- v-model="commandText"- data-redis-command-input- class="h-6 text-xs border-0 shadow-none focus-visible:ring-0 font-mono bg-transparent"- :placeholder="t('redis.commandHint')"- @keydown.enter="executeCommand"- />- <Button- variant="ghost"- size="icon"- class="h-6 w-6 shrink-0"- :title="t('redis.executeCommand')"- :disabled="commandRunning"- @click="executeCommand"+ <div+ v-if="flatKeys.length === 0 && !loading"+ class="flex-1 flex items-center justify-center text-muted-foreground text-xs">- <Loader2 v-if="commandRunning" class="h-3 w-3 animate-spin" />- <Play v-else class="h-3 w-3" />- </Button>- <div class="w-px h-4 bg-border shrink-0" />- <Button- variant="ghost"- size="icon"- class="h-6 w-6 shrink-0 text-destructive"- :title="t('redis.flushDb')"- @click="requestFlushDb"+ {{ t("redis.noKeys") }}+ </div>+ <div+ v-else-if="loading && flatKeys.length === 0"+ class="flex-1 flex items-center justify-center gap-2 text-muted-foreground text-xs">- <DatabaseZap class="h-3 w-3" />- </Button>- </div>-- <div v-if="commandError || formattedCommandResult" class="border-b px-2 py-1 shrink-0 text-xs">- <pre- class="max-h-24 overflow-auto whitespace-pre-wrap break-words font-mono"- :class="commandError ? 'text-destructive' : 'text-muted-foreground'"- >{{ commandError || formattedCommandResult }}</pre+ <Loader2 class="w-3.5 h-3.5 animate-spin" />+ <span>{{ loadingEmptyText }}</span>+ </div>+ <RecycleScroller+ v-else+ class="redis-key-scroller flex-1"+ :items="visibleRows"+ :item-size="30"+ :buffer="600"+ :skip-hover="true"+ key-field="id">- </div>-- <!-- Table header -->- <div class="grid border-b bg-muted/50 shrink-0 text-xs font-medium text-muted-foreground" :style="keyGridStyle">- <div class="px-3 py-1 border-r">{{ t("redis.columnKey") }}</div>- <div class="px-2 py-1 border-r">{{ t("redis.columnType") }}</div>- <div class="px-3 py-1 border-r">{{ t("redis.columnValue") }}</div>- <div class="px-2 py-1 border-r text-right">{{ t("redis.columnSize") }}</div>- <div class="px-2 py-1 text-right">{{ t("redis.columnTTL") }}</div>- </div>-- <!-- Table body -->- <div- v-if="flatKeys.length === 0 && !loading"- class="flex-1 flex items-center justify-center text-muted-foreground text-xs"- >- {{ t("redis.noKeys") }}- </div>- <div- v-else-if="loading && flatKeys.length === 0"- class="flex-1 flex items-center justify-center gap-2 text-muted-foreground text-xs"- >- <Loader2 class="w-3.5 h-3.5 animate-spin" />- <span>{{ loadingEmptyText }}</span>- </div>- <RecycleScroller- v-else- class="redis-key-scroller flex-1"- :items="visibleRows"- :item-size="28"- :buffer="600"- :skip-hover="true"- key-field="id"- >- <template #default="{ item: row }">- <div- class="grid border-b text-xs cursor-pointer hover:bg-accent/50 group"- :class="{ 'bg-accent': row.node.kind === 'leaf' && selectedKeyRaw === row.node.keyRaw }"- :style="{ ...keyGridStyle, height: '28px' }"- @click="onRowClick(row.node)"- >- <!-- Key column -->+ <template #default="{ item: row }"><div- class="px-3 flex items-center gap-1 border-r overflow-hidden"- :style="{ paddingLeft: `${12 + row.depth * 16}px` }"+ class="flex items-center gap-2 border-b px-3 text-[13px] cursor-pointer hover:bg-accent/50 group"+ :class="{ 'bg-accent': row.node.kind === 'leaf' && selectedKeyRaw === row.node.keyRaw }"+ :style="{ height: '30px' }"+ @click="onRowClick(row.node)">- <template v-if="row.node.kind === 'group'">- <component- :is="expandedGroupIds.has(row.node.id) ? ChevronDown : ChevronRight"- class="w-3 h-3 shrink-0 text-muted-foreground"- />- <component- :is="expandedGroupIds.has(row.node.id) ? FolderOpen : FolderClosed"- class="w-3 h-3 shrink-0 text-amber-500"- />- <span class="truncate font-mono">{{ row.node.label }}</span>- <span class="text-muted-foreground ml-1">({{ countLeaves(row.node) }})</span>+ <div+ class="min-w-0 flex flex-1 items-center gap-1 overflow-hidden"+ :style="{ paddingLeft: `${12 + row.depth * 16}px` }"+ >+ <template v-if="row.node.kind === 'group'">+ <component+ :is="expandedGroupIds.has(row.node.id) ? ChevronDown : ChevronRight"+ class="w-3 h-3 shrink-0 text-muted-foreground"+ />+ <component+ :is="expandedGroupIds.has(row.node.id) ? FolderOpen : FolderClosed"+ class="w-3 h-3 shrink-0 text-amber-500"+ />+ <span class="truncate font-mono">{{ row.node.label }}</span>+ <span class="text-muted-foreground ml-1">({{ countLeaves(row.node) }})</span>+ </template>+ <template v-else>+ <span class="relative flex h-4 w-4 shrink-0 items-center justify-center">+ <KeyRound+ class="h-3.5 w-3.5 text-muted-foreground/70 transition-opacity group-hover:opacity-0"+ :class="{ 'opacity-0': checkedKeys.has(row.node.keyRaw) }"+ />+ <input+ type="checkbox"+ class="absolute h-3.5 w-3.5 accent-primary cursor-pointer opacity-0 group-hover:opacity-100"+ :class="{ 'opacity-100': checkedKeys.has(row.node.keyRaw) }"+ :checked="checkedKeys.has(row.node.keyRaw)"+ @click="toggleCheck(row.node.keyRaw, $event)"+ />+ </span>+ <span class="truncate font-mono">{{ row.node.label }}</span>+ </template>+ </div>++ <div class="flex shrink-0 items-center justify-end gap-1">+ <Badge+ v-if="row.node.kind === 'leaf'"+ variant="outline"+ class="text-xs px-1.5 py-0"+ :class="typeColor(row.node.keyType)"+ >{{ row.node.keyType }}</Badge+ ><Button+ v-if="row.node.kind === 'group'"variant="ghost"size="icon"- class="ml-auto h-5 w-5 shrink-0 text-destructive opacity-0 group-hover:opacity-100"+ class="h-5 w-5 shrink-0 text-destructive opacity-0 group-hover:opacity-100":title="t('redis.deleteGroup')"@click="requestGroupDelete(row.node, $event)"><Trash2 class="h-3 w-3" /></Button>- </template>- <template v-else>- <input- type="checkbox"- class="w-3 h-3 shrink-0 accent-primary cursor-pointer opacity-0 group-hover:opacity-100"- :class="{ 'opacity-100': checkedKeys.has(row.node.keyRaw) }"- :checked="checkedKeys.has(row.node.keyRaw)"- @click="toggleCheck(row.node.keyRaw, $event)"- />- <span class="truncate font-mono">{{ row.node.label }}</span>- </template>+ </div></div>-- <!-- Type column -->- <div class="border-r flex items-center justify-center">- <Badge- v-if="row.node.kind === 'leaf'"- variant="outline"- class="text-xs px-1.5 py-0"- :class="typeColor(row.node.keyType)"- >{{ row.node.keyType }}</Badge+ </template>+ </RecycleScroller>+ <div v-if="hasMore" class="shrink-0 border-t px-2 py-1.5 flex items-center justify-center">+ <Button+ variant="outline"+ size="sm"+ class="h-7 text-xs w-full"+ :disabled="loadingMore || loading"+ @click="loadMore"+ >+ <Loader2 v-if="loadingMore" class="w-3 h-3 mr-1.5 animate-spin" />+ {{ t("redis.loadMoreKeys") }}+ </Button>+ </div>+ </div>+ </Pane>++ <!-- Workspace (right) -->+ <Pane :size="64" :min-size="36">+ <div class="h-full min-w-0 bg-background flex flex-col overflow-hidden">+ <Tabs v-model="activeSidePanel" class="h-full min-h-0 gap-0">+ <div class="h-9 shrink-0 border-b bg-background px-3 flex items-center">+ <TabsList class="h-7 gap-1 p-0.5">+ <TabsTrigger value="detail" class="h-6 flex-none gap-1.5 rounded-md px-2 text-xs">+ <KeyRound class="size-3.5" />+ {{ t("redis.keyDetail") }}+ </TabsTrigger>+ <TabsTrigger+ value="command"+ class="h-6 flex-none gap-1.5 rounded-md px-2 text-xs"+ @click="openCommandPanel">- </div>+ <TerminalSquare class="size-3.5" />+ {{ t("redis.commandLine") }}+ </TabsTrigger>+ </TabsList>+ </div>- <!-- Value preview column -->- <div class="px-3 flex items-center border-r truncate font-mono text-muted-foreground">- <span v-if="row.node.kind === 'leaf'" class="truncate">{{ row.node.valuePreview }}</span>+ <TabsContent value="detail" class="m-0 min-h-0 flex-1 flex flex-col">+ <RedisValueViewer+ v-if="selectedKey"+ :key="selectedKey.key_raw"+ :connection-id="connectionId"+ :db="db"+ :key-display="selectedKey.key_display"+ :key-raw="selectedKey.key_raw"+ :metadata="selectedKey"+ @deleted="onKeyDeleted"+ />+ <div v-else class="flex-1 flex items-center justify-center text-xs text-muted-foreground">+ {{ t("redis.selectKeyForDetail") }}</div>+ </TabsContent>- <!-- Size column -->- <div class="px-2 flex items-center justify-end border-r text-muted-foreground">- <template v-if="row.node.kind === 'leaf'">- {{ formatSize(row.node.size, row.node.keyType, row.node.valuePreview) }}- </template>+ <TabsContent value="command" class="m-0 min-h-0 flex-1 flex flex-col">+ <div+ class="relative flex min-h-0 flex-1 flex-col bg-[#090c10] font-mono text-[13px] leading-5 text-slate-100"+ @click="getCommandInput()?.focus()"+ >+ <div ref="commandTerminalRef" class="min-h-0 flex-1 overflow-auto px-4 pb-3 pt-4">+ <div class="mb-4 text-slate-400">+ <span class="text-slate-200">{{ t("redis.commandWelcome") }}</span>+ </div>++ <div v-for="entry in commandHistory" :key="entry.id" class="mb-2">+ <div class="flex min-w-0 items-start gap-2 whitespace-pre-wrap break-words">+ <span class="shrink-0 text-[#d7ba7d]">{{ entry.prompt }}</span>+ <span class="min-w-0 text-slate-100">{{ entry.command }}</span>+ </div>+ <pre+ v-if="entry.output"+ class="ml-0 whitespace-pre-wrap break-words pl-0"+ :class="entry.error ? 'text-[#ff6b6b]' : 'text-slate-300'"+ >{{ entry.output }}</pre+ >+ </div>+ </div>++ <form+ class="flex shrink-0 items-center gap-2 border-t border-white/10 bg-[#090c10] px-4 py-2"+ @submit.prevent="executeCommand"+ >+ <span class="shrink-0 text-[#d7ba7d]">{{ commandPrompt }}</span>+ <input+ v-model="commandText"+ data-redis-command-input+ class="min-w-0 flex-1 border-0 bg-transparent p-0 font-mono text-[13px] text-slate-100 caret-[#d7ba7d] outline-none placeholder:text-slate-600"+ :disabled="commandRunning"+ autocomplete="off"+ autocapitalize="off"+ spellcheck="false"+ @keydown.enter.prevent="executeCommand"+ />+ <Loader2 v-if="commandRunning" class="h-3.5 w-3.5 shrink-0 animate-spin text-slate-500" />+ </form></div>+ </TabsContent>+ </Tabs>+ </div>+ </Pane>+ </Splitpanes>++ <DangerConfirmDialog+ v-model:open="showDangerConfirm"+ :message="t('dangerDialog.deleteMessage')"+ :details="dangerDetails"+ :confirm-label="dangerConfirmLabel"+ @confirm="applyDangerAction"+ />++ <Dialog v-model:open="showCreateKeyDialog">+ <DialogContent class="sm:max-w-md">+ <DialogHeader>+ <DialogTitle>{{ t("redis.createKey") }}</DialogTitle>+ </DialogHeader>++ <div class="grid gap-3">+ <label class="grid gap-1.5 text-xs font-medium">+ <span>{{ t("redis.createKeyName") }}</span>+ <Input+ v-model="createKeyName"+ class="h-8 font-mono text-xs"+ :placeholder="t('redis.createKeyNamePlaceholder')"+ @keydown.enter="createRedisKey"+ />+ </label>++ <label class="grid gap-1.5 text-xs font-medium">+ <span>{{ t("redis.createKeyType") }}</span>+ <Select+ :model-value="createKeyType"+ @update:model-value="(value: any) => (createKeyType = value as RedisCreateKeyType)"+ >+ <SelectTrigger class="h-8 text-xs">+ <SelectValue />+ </SelectTrigger>+ <SelectContent>+ <SelectItem v-for="option in createKeyTypeOptions" :key="option.value" :value="option.value">+ {{ option.label }}+ </SelectItem>+ </SelectContent>+ </Select>+ </label>++ <label v-if="createKeyType === 'hash'" class="grid gap-1.5 text-xs font-medium">+ <span>{{ t("redis.createField") }}</span>+ <Input+ v-model="createKeyField"+ class="h-8 font-mono text-xs"+ :placeholder="t('redis.createFieldPlaceholder')"+ @keydown.enter="createRedisKey"+ />+ </label>++ <label v-if="createKeyType === 'zset'" class="grid gap-1.5 text-xs font-medium">+ <span>{{ t("redis.createScore") }}</span>+ <Input+ v-model="createKeyScore"+ class="h-8 font-mono text-xs"+ placeholder="0"+ @keydown.enter="createRedisKey"+ />+ </label>++ <label class="grid gap-1.5 text-xs font-medium">+ <span>{{+ t(createKeyType === "set" || createKeyType === "zset" ? "redis.createMember" : "redis.createValue")+ }}</span>+ <textarea+ v-model="createKeyValue"+ class="min-h-28 resize-y rounded-md border bg-background p-2 font-mono text-xs outline-none focus-visible:ring-1 focus-visible:ring-ring"+ spellcheck="false"+ :placeholder="t('redis.createValuePlaceholder')"+ />+ </label>++ <p v-if="createKeyError" class="text-xs text-destructive">{{ createKeyError }}</p>+ </div>- <!-- TTL column -->- <div class="px-2 flex items-center justify-end text-muted-foreground">- <template v-if="row.node.kind === 'leaf'">{{ formatTtl(row.node.ttl) }}</template>- </div>- </div>- </template>- </RecycleScroller>- <div v-if="hasMore" class="shrink-0 border-t px-2 py-1.5 flex items-center justify-center">- <Button- variant="outline"- size="sm"- class="h-7 text-xs w-full"- :disabled="loadingMore || loading"- @click="loadMore"- >- <Loader2 v-if="loadingMore" class="w-3 h-3 mr-1.5 animate-spin" />- {{ t("redis.loadMoreKeys") }}+ <DialogFooter>+ <Button variant="ghost" :disabled="creatingKey" @click="showCreateKeyDialog = false">+ {{ t("dangerDialog.cancel") }}</Button>- </div>- </div>- </Pane>-- <!-- Value viewer (bottom) -->- <Pane v-if="selectedKey" :size="50" :min-size="20">- <div class="h-full min-w-0">- <RedisValueViewer- :key="selectedKey.key_raw"- :connection-id="connectionId"- :db="db"- :key-display="selectedKey.key_display"- :key-raw="selectedKey.key_raw"- @deleted="onKeyDeleted"- />- </div>- </Pane>- </Splitpanes>-- <DangerConfirmDialog- v-model:open="showDangerConfirm"- :message="t('dangerDialog.deleteMessage')"- :details="dangerDetails"- :confirm-label="pendingDanger?.kind === 'command' ? t('dangerDialog.confirm') : t('dangerDialog.deleteConfirm')"- @confirm="applyDangerAction"- />+ <Button :disabled="creatingKey" @click="createRedisKey">+ <Loader2 v-if="creatingKey" class="h-4 w-4 animate-spin" />+ <Plus v-else class="h-4 w-4" />+ {{ t("redis.createKeySubmit") }}+ </Button>+ </DialogFooter>+ </DialogContent>+ </Dialog>+ </div></template><style scoped>@@ -684,4 +932,14 @@ defineExpose({ focusSearch });.redis-key-scroller :deep(.vue-recycle-scroller__item-view) {contain: layout style paint;}++.redis-workspace-splitpanes :deep(.splitpanes--vertical > .splitpanes__splitter) {+ width: 1px !important;+ border-left: 0;+ background: var(--border);+}++.redis-workspace-splitpanes :deep(.splitpanes__splitter:hover) {+ background: var(--primary) !important;+}</style>diff --git a/apps/desktop/src/components/redis/RedisValueViewer.vue b/apps/desktop/src/components/redis/RedisValueViewer.vueindex a363ba96a3..9a48642cdb 100644--- a/apps/desktop/src/components/redis/RedisValueViewer.vue+++ b/apps/desktop/src/components/redis/RedisValueViewer.vue@@ -8,12 +8,13 @@ import { Badge } from "@/components/ui/badge";import { Sheet, SheetContent, SheetFooter, SheetHeader, SheetTitle } from "@/components/ui/sheet";import DangerConfirmDialog from "@/components/editor/DangerConfirmDialog.vue";import * as api from "@/lib/api";-import type { RedisValue } from "@/lib/api";+import type { RedisKeyInfo, RedisValue } from "@/lib/api";import { useToast } from "@/composables/useToast";import {canEditRedisMemberDetail,clampRedisMemberDetailSheetWidth,formatRedisMemberDetail,+ formatRedisStringValue,getRedisMemberSelectionKey,highlightRedisJsonDetail,} from "@/lib/redisValuePresentation";@@ -26,6 +27,7 @@ const props = defineProps<{db: number;keyDisplay: string;keyRaw: string;+ metadata?: RedisKeyInfo | null;}>();const emit = defineEmits<{ deleted: [] }>();@@ -95,6 +97,20 @@ const deleteDetails = computed(() => {const isBinaryStringValue = computed(() => data.value?.key_type === "string" && data.value?.value_is_binary);const hasMore = computed(() => scanCursor.value != null && scanCursor.value > 0);+const metadataSizeLabel = computed(() => {+ const metadata = props.metadata;+ if (!metadata || metadata.size <= 0) return "";+ if (metadata.key_type === "string") {+ if (metadata.size >= 1024) return `${(metadata.size / 1024).toFixed(1)} KB`;+ return `${metadata.size} B`;+ }+ return String(metadata.size);+});++function collectionCountLabel(kind: "items" | "fields" | "members", loaded: number, total?: number | null) {+ if (total == null || total === loaded) return t(`redis.${kind}`, { count: loaded });+ return t(`redis.loaded${kind[0].toUpperCase()}${kind.slice(1)}`, { loaded, total });+}async function load(options: { selectDefaultMember?: boolean } = {}) {const shouldSelectDefaultMember = options.selectDefaultMember ?? true;@@ -103,7 +119,7 @@ async function load(options: { selectDefaultMember?: boolean } = {}) {data.value = await api.redisGetValue(props.connectionId, props.db, props.keyRaw);scanCursor.value = data.value.scan_cursor ?? undefined;if (data.value.key_type === "string") {- editValue.value = String(data.value.value);+ editValue.value = formatRedisStringValue(data.value.value);clearSelectedMember();} else if (["list", "set", "zset", "hash"].includes(data.value.key_type)) {collectionItems.value = Array.isArray(data.value.value) ? [...data.value.value] : [];@@ -428,7 +444,7 @@ async function confirmDelete() {}function formatValue(val: any): string {- if (typeof val === "string") return val;+ if (typeof val === "string") return formatRedisStringValue(val);return JSON.stringify(val, null, 2);}@@ -444,42 +460,53 @@ onBeforeUnmount(stopResizeMemberSheet);<template v-else-if="data"><!-- Header -->- <div class="h-9 flex items-center gap-2 px-4 border-b bg-muted/30 shrink-0">- <span class="font-mono text-sm font-medium truncate">{{ data.key_display }}</span>- <Badge variant="secondary" class="text-xs">{{ data.key_type }}</Badge>- <template v-if="!editingTtl">- <Badge- v-if="data.ttl > 0"- variant="outline"- class="text-xs cursor-pointer hover:bg-accent"- @click="startEditTtl"- >TTL: {{ data.ttl }}s</Badge- >- <Badge- v-else-if="data.ttl === -1"- variant="outline"- class="text-xs opacity-50 cursor-pointer hover:bg-accent hover:opacity-100"- @click="startEditTtl"- >{{ t("redis.noExpiry") }}</Badge- >- </template>- <div v-else class="flex items-center gap-1">- <Input- v-model="ttlInput"- class="h-6 w-20 text-xs"- placeholder="seconds (-1=no expiry)"- autofocus- @keydown.enter="saveTtl"- @keydown.escape="cancelEditTtl"- />- <Button variant="ghost" size="icon" class="h-6 w-6" @click="saveTtl"><Save class="h-3 w-3" /></Button>+ <div class="shrink-0 border-b bg-background">+ <div class="flex h-9 items-center gap-2 px-4">+ <span class="min-w-0 flex-1 truncate font-mono text-sm font-semibold">{{ data.key_display }}</span>+ <Button variant="ghost" size="icon" class="h-7 w-7 shrink-0" @click="load"+ ><RefreshCw class="h-3.5 w-3.5"+ /></Button>+ <Button variant="ghost" size="icon" class="h-7 w-7 shrink-0" @click="copyValue"+ ><Copy class="h-3.5 w-3.5"+ /></Button>+ <Button variant="ghost" size="icon" class="h-7 w-7 shrink-0 text-destructive" @click="requestDeleteKey"+ ><Trash2 class="h-3.5 w-3.5"+ /></Button>+ </div>++ <div class="flex min-h-7 flex-wrap items-center gap-2 px-4 pb-1">+ <Badge variant="secondary" class="font-mono text-xs uppercase">{{ data.key_type }}</Badge>+ <Badge v-if="metadataSizeLabel" variant="outline" class="text-xs text-muted-foreground">+ {{ t("redis.columnSize") }}: {{ metadataSizeLabel }}+ </Badge>+ <template v-if="!editingTtl">+ <Badge+ v-if="data.ttl > 0"+ variant="outline"+ class="text-xs cursor-pointer text-muted-foreground hover:bg-accent"+ @click="startEditTtl"+ >TTL: {{ data.ttl }}s</Badge+ >+ <Badge+ v-else-if="data.ttl === -1"+ variant="outline"+ class="text-xs cursor-pointer text-muted-foreground hover:bg-accent"+ @click="startEditTtl"+ >{{ t("redis.noExpiry") }}</Badge+ >+ </template>+ <div v-else class="flex items-center gap-1">+ <Input+ v-model="ttlInput"+ class="h-6 w-20 text-xs"+ placeholder="seconds (-1=no expiry)"+ autofocus+ @keydown.enter="saveTtl"+ @keydown.escape="cancelEditTtl"+ />+ <Button variant="ghost" size="icon" class="h-6 w-6" @click="saveTtl"><Save class="h-3 w-3" /></Button>+ </div></div>- <span class="flex-1" />- <Button variant="ghost" size="icon" class="h-7 w-7" @click="load"><RefreshCw class="h-3.5 w-3.5" /></Button>- <Button variant="ghost" size="icon" class="h-7 w-7" @click="copyValue"><Copy class="h-3.5 w-3.5" /></Button>- <Button variant="ghost" size="icon" class="h-7 w-7 text-destructive" @click="requestDeleteKey"- ><Trash2 class="h-3.5 w-3.5"- /></Button></div><!-- String -->@@ -499,7 +526,7 @@ onBeforeUnmount(stopResizeMemberSheet);size="sm"@click="isEditing = false;- editValue = String(data.value);+ editValue = formatRedisStringValue(data.value);">{{ t("grid.discard") }}</Button>@@ -511,7 +538,7 @@ onBeforeUnmount(stopResizeMemberSheet);<div v-else-if="data.key_type === 'list'" class="flex-1 flex flex-col overflow-hidden"><div class="flex items-center gap-2 px-4 py-1.5 border-b shrink-0"><span class="text-xs text-muted-foreground">{{- t("redis.items", { count: collectionItems.length }) + (data.total != null ? ` / ${data.total}` : "")+ collectionCountLabel("items", collectionItems.length, data.total)}}</span><span class="flex-1" /><Input v-model="newValue" class="h-6 w-40 text-xs" placeholder="value" @keydown.enter="listPush" />@@ -573,7 +600,7 @@ onBeforeUnmount(stopResizeMemberSheet);<div v-else-if="data.key_type === 'set'" class="flex-1 flex flex-col overflow-hidden"><div class="flex items-center gap-2 px-4 py-1.5 border-b shrink-0"><span class="text-xs text-muted-foreground">{{- t("redis.items", { count: collectionItems.length }) + (data.total != null ? ` / ${data.total}` : "")+ collectionCountLabel("items", collectionItems.length, data.total)}}</span><span class="flex-1" /><Input v-model="newValue" class="h-6 w-40 text-xs" placeholder="member" @keydown.enter="setAdd" />@@ -633,7 +660,7 @@ onBeforeUnmount(stopResizeMemberSheet);<div v-else-if="data.key_type === 'hash'" class="flex-1 flex flex-col overflow-hidden"><div class="flex items-center gap-2 px-4 py-1.5 border-b shrink-0"><span class="text-xs text-muted-foreground">{{- t("redis.fields", { count: collectionItems.length }) + (data.total != null ? ` / ${data.total}` : "")+ collectionCountLabel("fields", collectionItems.length, data.total)}}</span><span class="flex-1" /><Input v-model="newField" class="h-6 w-24 text-xs" placeholder="field" />@@ -696,7 +723,7 @@ onBeforeUnmount(stopResizeMemberSheet);<div v-else-if="data.key_type === 'zset'" class="flex-1 flex flex-col overflow-hidden"><div class="flex items-center gap-2 px-4 py-1.5 border-b shrink-0"><span class="text-xs text-muted-foreground">{{- t("redis.members", { count: collectionItems.length }) + (data.total != null ? ` / ${data.total}` : "")+ collectionCountLabel("members", collectionItems.length, data.total)}}</span><span class="flex-1" /><Input v-model="newScore" class="h-6 w-20 text-xs" placeholder="score" />diff --git a/apps/desktop/src/components/sidebar/TreeItem.vue b/apps/desktop/src/components/sidebar/TreeItem.vueindex e137b4988d..c3d1710a7f 100644--- a/apps/desktop/src/components/sidebar/TreeItem.vue+++ b/apps/desktop/src/components/sidebar/TreeItem.vue@@ -655,6 +655,7 @@ const createDatabaseName = ref("");const createDatabaseCharset = ref("utf8mb4");const createDatabaseCollation = ref("utf8mb4_unicode_ci");const showDropDatabaseConfirm = ref(false);+const showFlushRedisDbConfirm = ref(false);const showCreateSchemaDialog = ref(false);const createSchemaName = ref("");const showDropSchemaConfirm = ref(false);@@ -1010,6 +1011,28 @@ function dropDatabase() {showDropDatabaseConfirm.value = true;}+function flushRedisDb() {+ showFlushRedisDbConfirm.value = true;+}++async function confirmFlushRedisDb() {+ const node = props.node;+ if (node.type !== "redis-db" || !node.connectionId || !node.database) return;+ try {+ await connectionStore.ensureConnected(node.connectionId);+ await api.redisFlushDb(node.connectionId, Number(node.database));+ connectionStore.updateRedisDbKeyStats(node.connectionId, Number(node.database), { loaded: 0, total: 0 });+ window.dispatchEvent(+ new CustomEvent("dbx-redis-db-flushed", {+ detail: { connectionId: node.connectionId, db: Number(node.database) },+ }),+ );+ toast(t("redis.flushDbSuccess", { db: node.database }), 3000);+ } catch (e: any) {+ toast(t("contextMenu.tableOperationFailed", { message: e?.message || String(e) }), 5000);+ }+}+async function confirmDropDatabase() {const node = props.node;if (!node.connectionId) return;@@ -1943,6 +1966,12 @@ const isDragging = computed(() => dragState.active && dragState.draggedId === pr<ContextMenuItem v-if="isNodeDefaultDatabase" @click="clearNodeDefaultDatabase"><Database class="w-4 h-4" /> {{ t("contextMenu.clearDefaultDatabase") }}</ContextMenuItem>+ <template v-if="node.type === 'redis-db'">+ <ContextMenuSeparator />+ <ContextMenuItem class="text-destructive" @click="flushRedisDb">+ <Eraser class="w-4 h-4" /> {{ t("redis.flushDb") }}+ </ContextMenuItem>+ </template></template><template v-if="node.type === 'table' || node.type === 'view'">@@ -2328,6 +2357,15 @@ const isDragging = computed(() => dragState.active && dragState.draggedId === pr@confirm="confirmDropDatabase"/>+ <DangerConfirmDialog+ v-model:open="showFlushRedisDbConfirm"+ :title="t('redis.flushDb')"+ :message="t('redis.flushDbMessage')"+ :details="t('redis.flushDbDetails', { db: node.database })"+ :confirm-label="t('redis.flushDbConfirm')"+ @confirm="confirmFlushRedisDb"+ />+<Dialog v-model:open="showCreateSchemaDialog"><DialogContent class="sm:max-w-[400px]"><DialogHeader>diff --git a/apps/desktop/src/i18n/locales/en.ts b/apps/desktop/src/i18n/locales/en.tsindex 3328e6d143..2459ec3a1c 100644--- a/apps/desktop/src/i18n/locales/en.ts+++ b/apps/desktop/src/i18n/locales/en.ts@@ -876,6 +876,9 @@ export default {items: "{count} items",fields: "{count} fields",members: "{count} members",+ loadedItems: "{loaded} of {total} items loaded",+ loadedFields: "{loaded} of {total} fields loaded",+ loadedMembers: "{loaded} of {total} members loaded",entries: "{count} entries",noExpiry: "no expiry",columnType: "Type",@@ -889,13 +892,35 @@ export default {deleteGroup: "Delete group",deleteGroupDetails: "{target}\n{count} keys",flushDb: "Clear current DB",- flushDbDetails: "Redis db{db}",+ flushDbMessage: "This will delete every key in the current Redis database and cannot be undone. Continue?",+ flushDbDetails: "Target: Redis db{db}\nScope: all keys in the current DB",+ flushDbConfirm: "Clear DB",+ flushDbSuccess: "Redis db{db} cleared",+ keyDetail: "Key detail",+ commandLine: "Command line",+ selectKeyForDetail: "Select a key to view details",+ commandWelcome: "Welcome to the Redis command console",commandPlaceholder: "Redis command, e.g. GET user:1",commandPrefix: "CMD",commandHint: "Enter a Redis command, e.g. SMEMBERS feature:flags",executeCommand: "Execute command",commandEmpty: "Enter a Redis command",+ commandEmptyResult: "Run a Redis command to see the result",commandBlocked: "This Redis command is blocked for safety",+ createKey: "Create key",+ createKeyName: "Key",+ createKeyNamePlaceholder: "user:1",+ createKeyType: "Type",+ createValue: "Value",+ createMember: "Member",+ createField: "Field",+ createFieldPlaceholder: "name",+ createScore: "Score",+ createValuePlaceholder: "value",+ createKeySubmit: "Create",+ createKeyNameRequired: "Enter a key name",+ createFieldRequired: "Enter a hash field",+ createScoreInvalid: "Enter a valid score",member: "Member",memberDetail: "Member detail",viewMember: "View full value",diff --git a/apps/desktop/src/i18n/locales/es.ts b/apps/desktop/src/i18n/locales/es.tsindex 49ef8c8be9..1bd69a7e75 100644--- a/apps/desktop/src/i18n/locales/es.ts+++ b/apps/desktop/src/i18n/locales/es.ts@@ -774,6 +774,9 @@ export default {items: "{count} elementos",fields: "{count} campos",members: "{count} miembros",+ loadedItems: "{loaded} de {total} elementos cargados",+ loadedFields: "{loaded} de {total} campos cargados",+ loadedMembers: "{loaded} de {total} miembros cargados",entries: "{count} entradas",noExpiry: "sin expiración",columnType: "Tipo",@@ -787,13 +790,36 @@ export default {deleteGroup: "Eliminar grupo",deleteGroupDetails: "{target}\n{count} claves",flushDb: "Limpiar DB actual",- flushDbDetails: "Redis db{db}",+ flushDbMessage:+ "Esto eliminará todas las claves de la base de datos Redis actual y no se puede deshacer. ¿Continuar?",+ flushDbDetails: "Destino: Redis db{db}\nAlcance: todas las claves de la DB actual",+ flushDbConfirm: "Limpiar DB",+ flushDbSuccess: "Redis db{db} limpiada",+ keyDetail: "Detalle de clave",+ commandLine: "Línea de comandos",+ selectKeyForDetail: "Selecciona una clave para ver detalles",+ commandWelcome: "Bienvenido a la consola de comandos Redis",commandPlaceholder: "Comando Redis, p. ej. GET user:1",commandPrefix: "CMD",commandHint: "Ingresa un comando Redis, p. ej. SMEMBERS feature:flags",executeCommand: "Ejecutar comando",commandEmpty: "Ingresa un comando Redis",+ commandEmptyResult: "Ejecuta un comando Redis para ver el resultado",commandBlocked: "Este comando Redis está bloqueado por seguridad",+ createKey: "Crear clave",+ createKeyName: "Clave",+ createKeyNamePlaceholder: "user:1",+ createKeyType: "Tipo",+ createValue: "Valor",+ createMember: "Miembro",+ createField: "Campo",+ createFieldPlaceholder: "name",+ createScore: "Puntuación",+ createValuePlaceholder: "valor",+ createKeySubmit: "Crear",+ createKeyNameRequired: "Ingresa una clave",+ createFieldRequired: "Ingresa un campo hash",+ createScoreInvalid: "Ingresa una puntuación válida",member: "Miembro",memberDetail: "Detalle del miembro",viewMember: "Ver valor completo",diff --git a/apps/desktop/src/i18n/locales/zh-CN.ts b/apps/desktop/src/i18n/locales/zh-CN.tsindex 56ec593ed1..23eb952a14 100644--- a/apps/desktop/src/i18n/locales/zh-CN.ts+++ b/apps/desktop/src/i18n/locales/zh-CN.ts@@ -857,6 +857,9 @@ export default {items: "{count} 个元素",fields: "{count} 个字段",members: "{count} 个成员",+ loadedItems: "已加载 {loaded} / 共 {total} 个元素",+ loadedFields: "已加载 {loaded} / 共 {total} 个字段",+ loadedMembers: "已加载 {loaded} / 共 {total} 个成员",entries: "{count} 条记录",noExpiry: "永不过期",columnType: "类型",@@ -869,13 +872,35 @@ export default {deleteGroup: "删除分组",deleteGroupDetails: "{target}\n{count} 个 key",flushDb: "清空当前 DB",- flushDbDetails: "Redis db{db}",+ flushDbMessage: "这会删除当前 Redis 数据库中的所有 key,且不可撤销。确认继续?",+ flushDbDetails: "目标: Redis db{db}\n范围: 当前 DB 的所有 key",+ flushDbConfirm: "清空 DB",+ flushDbSuccess: "Redis db{db} 已清空",+ keyDetail: "键详情",+ commandLine: "命令行",+ selectKeyForDetail: "选择一个 key 查看详情",+ commandWelcome: "欢迎使用 Redis 命令行控制台",commandPlaceholder: "Redis 命令,如 GET user:1",commandPrefix: "命令",commandHint: "输入 Redis 命令,如 SMEMBERS feature:flags",executeCommand: "执行命令",commandEmpty: "请输入 Redis 命令",+ commandEmptyResult: "执行 Redis 命令后会在这里显示结果",commandBlocked: "出于安全考虑,此 Redis 命令已被阻止",+ createKey: "新增 key",+ createKeyName: "Key",+ createKeyNamePlaceholder: "user:1",+ createKeyType: "类型",+ createValue: "值",+ createMember: "成员",+ createField: "字段",+ createFieldPlaceholder: "name",+ createScore: "分数",+ createValuePlaceholder: "value",+ createKeySubmit: "新增",+ createKeyNameRequired: "请输入 key 名称",+ createFieldRequired: "请输入 hash 字段",+ createScoreInvalid: "请输入有效分数",member: "成员",memberDetail: "成员详情",viewMember: "查看完整内容",diff --git a/apps/desktop/src/lib/redisCommandSession.ts b/apps/desktop/src/lib/redisCommandSession.tsnew file mode 100644index 0000000000..5d15f38843--- /dev/null+++ b/apps/desktop/src/lib/redisCommandSession.ts@@ -0,0 +1,22 @@+export function nextRedisCommandDb(currentDb: number, command: string, result: unknown): number {+ if (result !== "OK") return currentDb;++ const match = command.trim().match(/^SELECT\s+(\d+)\s*;?$/i);+ if (!match) return currentDb;++ const nextDb = Number.parseInt(match[1], 10);+ return Number.isFinite(nextDb) ? nextDb : currentDb;+}++export function isRedisClearScreenCommand(command: string): boolean {+ return /^(clear|cls)\s*;?$/i.test(command.trim());+}++export function redisKeyTextToRaw(key: string): string {+ const bytes = new TextEncoder().encode(key);+ let binary = "";+ for (const byte of bytes) {+ binary += String.fromCharCode(byte);+ }+ return btoa(binary);+}diff --git a/apps/desktop/src/lib/redisValuePresentation.ts b/apps/desktop/src/lib/redisValuePresentation.tsindex d51174c778..9caf6b44f3 100644--- a/apps/desktop/src/lib/redisValuePresentation.ts+++ b/apps/desktop/src/lib/redisValuePresentation.ts@@ -24,15 +24,8 @@ export function clampRedisMemberDetailSheetWidth(width: number, viewportWidth: nexport function formatRedisMemberDetail(value: unknown): RedisMemberDetail {if (typeof value === "string") {- const trimmed = value.trim();- if (trimmed) {- try {- return { text: JSON.stringify(JSON.parse(trimmed), null, 2), format: "json" };- } catch {- /* fall through to plain text */- }- }- return { text: value, format: "text" };+ const formatted = formatRedisJsonString(value);+ return formatted ? { text: formatted, format: "json" } : { text: value, format: "text" };}try {@@ -42,6 +35,27 @@ export function formatRedisMemberDetail(value: unknown): RedisMemberDetail {}}+export function formatRedisStringValue(value: unknown): string {+ if (typeof value !== "string") return String(value ?? "");+ return formatRedisJsonString(value) ?? value;+}++export function formatRedisCommandResult(value: unknown): string {+ if (typeof value === "string") return formatRedisStringValue(value);+ return JSON.stringify(value, null, 2);+}++function formatRedisJsonString(value: string): string | null {+ const trimmed = value.trim();+ if (!trimmed) return null;++ try {+ return JSON.stringify(JSON.parse(trimmed), null, 2);+ } catch {+ return null;+ }+}+export function getRedisMemberSelectionKey(title: string, value: unknown): string {return `${title}\n${formatRedisMemberDetail(value).text}`;}diff --git a/packages/app-tests/redisCommandSession.test.ts b/packages/app-tests/redisCommandSession.test.tsnew file mode 100644index 0000000000..33987cd7ff--- /dev/null+++ b/packages/app-tests/redisCommandSession.test.ts@@ -0,0 +1,31 @@+import assert from "node:assert/strict";+import test from "node:test";+import {+ isRedisClearScreenCommand,+ nextRedisCommandDb,+ redisKeyTextToRaw,+} from "../../apps/desktop/src/lib/redisCommandSession.ts";++test("keeps Redis command session database after SELECT succeeds", () => {+ assert.equal(nextRedisCommandDb(3, "SELECT 0", "OK"), 0);+ assert.equal(nextRedisCommandDb(0, "select 12", "OK"), 12);+});++test("does not change Redis command session database for failed or non-select commands", () => {+ assert.equal(nextRedisCommandDb(3, "SELECT nope", "OK"), 3);+ assert.equal(nextRedisCommandDb(3, "SELECT 2", "ERR invalid DB index"), 3);+ assert.equal(nextRedisCommandDb(3, "HGET farmer:1 balance", "42"), 3);+});++test("recognizes local Redis terminal clear commands", () => {+ assert.equal(isRedisClearScreenCommand("clear"), true);+ assert.equal(isRedisClearScreenCommand(" CLEAR "), true);+ assert.equal(isRedisClearScreenCommand("cls"), true);+ assert.equal(isRedisClearScreenCommand("clear key"), false);+ assert.equal(isRedisClearScreenCommand("DEL clear"), false);+});++test("encodes Redis key text as the raw base64 transport value", () => {+ assert.equal(redisKeyTextToRaw("user:1"), "dXNlcjox");+ assert.equal(redisKeyTextToRaw("用户:配置"), "55So5oi3OumFjee9rg==");+});diff --git a/packages/app-tests/redisKeyBrowserCreateKey.test.ts b/packages/app-tests/redisKeyBrowserCreateKey.test.tsnew file mode 100644index 0000000000..556dab7057--- /dev/null+++ b/packages/app-tests/redisKeyBrowserCreateKey.test.ts@@ -0,0 +1,109 @@+import { readFileSync } from "node:fs";+import assert from "node:assert/strict";+import test from "node:test";++test("Redis key browser exposes a create key dialog for common value types", () => {+ const source = readFileSync("apps/desktop/src/components/redis/RedisKeyBrowser.vue", "utf8");++ assert.match(source, /<Plus class="h-3 w-3" \/>/);+ assert.match(source, /v-model:open="showCreateKeyDialog"/);+ assert.match(source, /createKeyTypeOptions/);+ assert.match(source, /value: "string"/);+ assert.match(source, /value: "hash"/);+ assert.match(source, /value: "list"/);+ assert.match(source, /value: "set"/);+ assert.match(source, /value: "zset"/);+});++test("Redis command line opens in the right workspace instead of taking permanent row space", () => {+ const source = readFileSync("apps/desktop/src/components/redis/RedisKeyBrowser.vue", "utf8");++ assert.match(source, /activeSidePanel/);+ assert.match(source, /@click="openCommandPanel"/);+ assert.match(source, /<Tabs v-model="activeSidePanel"/);+ assert.match(source, /<TabsContent value="command"/);+ assert.match(source, /t\("redis\.keyDetail"\)/);+ assert.match(source, /t\("redis\.commandLine"\)/);+ assert.match(source, /data-redis-command-input/);+ assert.doesNotMatch(source, /<Terminal class=/);+ assert.doesNotMatch(source, /absolute inset-x-0 bottom-0/);+ assert.doesNotMatch(source, /<div class="min-h-9 flex items-center gap-1 px-2 border-b bg-muted\/20 shrink-0">/);+});++test("Redis key list keeps metadata out of the browsing rows until a key is selected", () => {+ const source = readFileSync("apps/desktop/src/components/redis/RedisKeyBrowser.vue", "utf8");++ assert.doesNotMatch(source, /t\("redis\.columnValue"\)/);+ assert.doesNotMatch(source, /t\("redis\.columnSize"\)/);+ assert.doesNotMatch(source, /t\("redis\.columnTTL"\)/);+ assert.match(source, /:metadata="selectedKey"/);+});++test("Redis key list uses readable leaf rows with stable key icons", () => {+ const source = readFileSync("apps/desktop/src/components/redis/RedisKeyBrowser.vue", "utf8");++ assert.match(source, /:item-size="30"/);+ assert.match(source, /:style="\{ height: '30px' \}"/);+ assert.match(source, /text-\[13px\]/);+ assert.match(source, /class="h-3\.5 w-3\.5 text-muted-foreground\/70 transition-opacity group-hover:opacity-0"/);+ assert.match(source, /class="relative flex h-4 w-4 shrink-0 items-center justify-center"/);+ assert.match(source, /group-hover:opacity-0/);+ assert.match(source, /group-hover:opacity-100/);+});++test("Redis key browser uses side-by-side panes for key list and value details", () => {+ const source = readFileSync("apps/desktop/src/components/redis/RedisKeyBrowser.vue", "utf8");++ assert.match(source, /<Splitpanes class="redis-workspace-splitpanes h-full">/);+ assert.doesNotMatch(source, /<Splitpanes class="h-full" horizontal>/);+ assert.match(source, /<Pane :size="36" :min-size="24">/);+ assert.match(source, /<Pane :size="64" :min-size="36">/);+ assert.doesNotMatch(source, /v-if="showSidePanel"/);+});++test("Redis workspace tab bar aligns with the key browser toolbar height", () => {+ const source = readFileSync("apps/desktop/src/components/redis/RedisKeyBrowser.vue", "utf8");++ assert.match(source, /class="h-9 shrink-0 border-b bg-background px-3 flex items-center"/);+ assert.doesNotMatch(source, /class="h-10 shrink-0 border-b bg-muted\/20 px-3 flex items-center"/);+});++test("Redis workspace tabs use compact shadcn tabs with icons and no underline", () => {+ const source = readFileSync("apps/desktop/src/components/redis/RedisKeyBrowser.vue", "utf8");++ assert.match(source, /<TabsList class="h-7 gap-1 p-0\.5"/);+ assert.doesNotMatch(source, /<TabsList variant="line"/);+ assert.doesNotMatch(source, /data-active:after:/);+ assert.doesNotMatch(source, /data-active:text-destructive/);+ assert.match(source, /<KeyRound class="size-3\.5"/);+ assert.match(source, /<TerminalSquare class="size-3\.5"/);+ assert.doesNotMatch(source, /grid h-7 w-52 grid-cols-2 p-0\.5/);+});++test("Redis command workspace uses a terminal-like surface", () => {+ const source = readFileSync("apps/desktop/src/components/redis/RedisKeyBrowser.vue", "utf8");++ assert.match(source, /type RedisCommandHistoryEntry/);+ assert.match(source, /commandHistory/);+ assert.match(source, /isRedisClearScreenCommand/);+ assert.match(source, /commandHistory\.value = \[\]/);+ assert.match(source, /t\("redis\.commandWelcome"\)/);+ assert.match(source, /v-for="entry in commandHistory"/);+ assert.match(source, /{{ commandPrompt }}/);+ assert.match(source, /{{ entry\.prompt }}/);+ assert.match(source, /{{ entry\.command }}/);+ assert.match(source, /class="relative flex min-h-0 flex-1 flex-col bg-\[#090c10\] font-mono text-\[13px\] leading-5 text-slate-100"/);+ assert.match(source, /class="flex shrink-0 items-center gap-2 border-t border-white\/10 bg-\[#090c10\] px-4 py-2"/);+ assert.match(source, /class="min-w-0 flex-1 border-0 bg-transparent p-0 font-mono text-\[13px\] text-slate-100 caret-\[#d7ba7d\] outline-none/);+ assert.doesNotMatch(source, /class="border-b border-slate-800 bg-slate-950 px-4 py-3 text-slate-100"/);+ assert.doesNotMatch(source, /class="min-h-full whitespace-pre-wrap break-words rounded-md border border-slate-800 bg-slate-950/);+});++test("Redis browser uses a single thin shared splitter between panes", () => {+ const source = readFileSync("apps/desktop/src/components/redis/RedisKeyBrowser.vue", "utf8");++ assert.match(source, /<Splitpanes class="redis-workspace-splitpanes h-full">/);+ assert.doesNotMatch(source, /class="h-full min-w-0 border-l bg-background flex flex-col overflow-hidden"/);+ assert.match(source, /\.redis-workspace-splitpanes :deep\(\.splitpanes--vertical > \.splitpanes__splitter\)/);+ assert.match(source, /width: 1px !important;/);+});diff --git a/packages/app-tests/redisSidebarFlushDb.test.ts b/packages/app-tests/redisSidebarFlushDb.test.tsnew file mode 100644index 0000000000..c788f02a1a--- /dev/null+++ b/packages/app-tests/redisSidebarFlushDb.test.ts@@ -0,0 +1,28 @@+import assert from "node:assert/strict";+import { readFileSync } from "node:fs";+import test from "node:test";++test("Redis DB flush is exposed from the sidebar DB context menu", () => {+ const source = readFileSync("apps/desktop/src/components/sidebar/TreeItem.vue", "utf8");++ assert.match(source, /const showFlushRedisDbConfirm = ref\(false\)/);+ assert.match(source, /function flushRedisDb\(\)/);+ assert.match(source, /async function confirmFlushRedisDb\(\)/);+ assert.match(source, /await api\.redisFlushDb\(node\.connectionId, Number\(node\.database\)\)/);+ assert.match(source, /connectionStore\.updateRedisDbKeyStats\(node\.connectionId, Number\(node\.database\), \{ loaded: 0, total: 0 \}\)/);+ assert.match(source, /node\.type === 'redis-db'/);+ assert.match(source, /@click="flushRedisDb"/);+ assert.match(source, /t\("redis\.flushDb"\)/);+ assert.match(source, /t\('redis\.flushDbMessage'\)/);+ assert.match(source, /t\('redis\.flushDbDetails', \{ db: node\.database \}\)/);+ assert.match(source, /t\('redis\.flushDbConfirm'\)/);+});++test("Redis command panel no longer shows a flush DB button", () => {+ const source = readFileSync("apps/desktop/src/components/redis/RedisKeyBrowser.vue", "utf8");++ assert.doesNotMatch(source, /requestFlushDb/);+ assert.doesNotMatch(source, /redisFlushDb/);+ assert.doesNotMatch(source, /DatabaseZap/);+ assert.doesNotMatch(source, /redis\.flushDb/);+});diff --git a/packages/app-tests/redisValuePresentation.test.ts b/packages/app-tests/redisValuePresentation.test.tsindex fb7c5eb950..0b93398ada 100644--- a/packages/app-tests/redisValuePresentation.test.ts+++ b/packages/app-tests/redisValuePresentation.test.ts@@ -3,7 +3,9 @@ import test from "node:test";import {canEditRedisMemberDetail,clampRedisMemberDetailSheetWidth,+ formatRedisCommandResult,formatRedisMemberDetail,+ formatRedisStringValue,getRedisMemberSelectionKey,highlightRedisJsonDetail,} from "../../apps/desktop/src/lib/redisValuePresentation.ts";@@ -22,6 +24,16 @@ test("keeps plain Redis member strings unchanged", () => {assert.equal(detail.text, "plain long member value");});+test("formats JSON string values without changing plain strings", () => {+ assert.equal(formatRedisStringValue('{"id":1,"name":"Ada"}'), '{\n "id": 1,\n "name": "Ada"\n}');+ assert.equal(formatRedisStringValue("plain redis value"), "plain redis value");+});++test("formats Redis command results with JSON strings expanded", () => {+ assert.equal(formatRedisCommandResult('{"balance":42,"unit":"USD"}'), '{\n "balance": 42,\n "unit": "USD"\n}');+ assert.equal(formatRedisCommandResult(["a", 2]), '[\n "a",\n 2\n]');+});+test("formats non-string Redis member values as JSON", () => {const detail = formatRedisMemberDetail({ field: "name", value: '{"nested":true}' });diff --git a/packages/app-tests/redisValueSearch.test.ts b/packages/app-tests/redisValueSearch.test.tsindex a2ac313654..311248858a 100644--- a/packages/app-tests/redisValueSearch.test.ts+++ b/packages/app-tests/redisValueSearch.test.ts@@ -12,12 +12,25 @@ test("Redis browser exposes key/value search modes", () => {assert.match(source, /redis\.searchByValue/);});+test("Redis key search input starts blank while scanning all keys internally", () => {+ const source = readFileSync("apps/desktop/src/components/redis/RedisKeyBrowser.vue", "utf8");++ assert.match(source, /searchPattern\s*=\s*ref\(""\)/);+ assert.match(source, /searchPattern\.value\.trim\(\) \|\| "\*"/);+ assert.doesNotMatch(source, /searchPattern\.value = "\*"/);+});+test("Redis command input is visually distinct from search", () => {const source = readFileSync("apps/desktop/src/components/redis/RedisKeyBrowser.vue", "utf8");assert.match(source, /data-redis-command-input/);- assert.match(source, /redis\.commandPrefix/);- assert.match(source, /redis\.commandHint/);+ assert.match(source, /t\("redis\.commandWelcome"\)/);+ assert.match(source, /{{ commandPrompt }}/);+ assert.match(source, /ref="commandTerminalRef"/);+ assert.match(source, /@submit\.prevent="executeCommand"/);+ assert.match(source, /@keydown\.enter\.prevent="executeCommand"/);+ assert.match(source, /caret-\[#d7ba7d\]/);+ assert.doesNotMatch(source, /redis\.commandPrefix/);});test("Redis value search streams incremental scan pages from the browser", () => {diff --git a/packages/app-tests/redisValueViewerLayout.test.ts b/packages/app-tests/redisValueViewerLayout.test.tsnew file mode 100644index 0000000000..1f0bf69d29--- /dev/null+++ b/packages/app-tests/redisValueViewerLayout.test.ts@@ -0,0 +1,21 @@+import { readFileSync } from "node:fs";+import assert from "node:assert/strict";+import test from "node:test";++test("Redis value viewer uses a clearer two-line side panel header", () => {+ const source = readFileSync("apps/desktop/src/components/redis/RedisValueViewer.vue", "utf8");++ assert.match(source, /class="flex h-9 items-center gap-2 px-4"/);+ assert.match(source, /class="flex min-h-7 flex-wrap items-center gap-2 px-4 pb-1"/);+ assert.doesNotMatch(source, /class="h-9 flex items-center gap-2 px-4 border-b bg-muted\/30 shrink-0"/);+});++test("Redis collection headers avoid unclear raw loaded over total suffixes", () => {+ const source = readFileSync("apps/desktop/src/components/redis/RedisValueViewer.vue", "utf8");++ assert.match(source, /function collectionCountLabel/);+ assert.doesNotMatch(source, /` \/ \$\{data\.total\}`/);+ assert.match(source, /collectionCountLabel\("items", collectionItems\.length, data\.total\)/);+ assert.match(source, /collectionCountLabel\("fields", collectionItems\.length, data\.total\)/);+ assert.match(source, /collectionCountLabel\("members", collectionItems\.length, data\.total\)/);+});