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
fix(redis): add blur-to-exit for TTL inline edit (#1724)
lexmin04122999d9c56f2b
diff --git a/apps/desktop/src/components/redis/RedisValueViewer.vue b/apps/desktop/src/components/redis/RedisValueViewer.vueindex 4fa13a3d80..9d7143bfe0 100644--- a/apps/desktop/src/components/redis/RedisValueViewer.vue+++ b/apps/desktop/src/components/redis/RedisValueViewer.vue@@ -1,5 +1,5 @@<script setup lang="ts">-import { computed, ref, onBeforeUnmount, onMounted } from "vue";+import { computed, ref, nextTick, onBeforeUnmount, onMounted } from "vue";import { useI18n } from "vue-i18n";import { DynamicScroller, DynamicScrollerItem, RecycleScroller } from "vue-virtual-scroller";import { Braces, Copy, Eye, FileText, Terminal, Trash2, Save, RefreshCw, Plus, Loader2, Pencil, WrapText, IndentIncrease, IndentDecrease } from "@lucide/vue";@@ -47,6 +47,7 @@ const showDeleteConfirm = ref(false);const showMemberDetail = ref(false);const editingTtl = ref(false);const ttlInput = ref("");+const ttlInputEl = ref<InstanceType<typeof Input>>();const collectionItems = ref<any[]>([]);const scanCursor = ref<number | undefined>(undefined);const selectedMemberTitle = ref("");@@ -631,6 +632,7 @@ function startEditTtl() {if (!data.value) return;ttlInput.value = data.value.ttl > 0 ? String(data.value.ttl) : "";editingTtl.value = true;+ void nextTick(() => ttlInputEl.value?.$el?.focus());}async function saveTtl() {@@ -788,8 +790,9 @@ onBeforeUnmount(() => {<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>+ <Input ref="ttlInputEl" v-model="ttlInput" class="h-6 w-20 text-xs" placeholder="seconds (-1=no expiry)" @keydown.enter="saveTtl" @keydown.escape="cancelEditTtl" @blur="cancelEditTtl" />+ <!-- mousedown fires before blur so saveTtl starts first; .prevent keeps focus on the Input so blur doesn't cancel the edit prematurely -->+ <Button variant="ghost" size="icon" class="h-6 w-6" @mousedown.prevent="saveTtl"><Save class="h-3 w-3" /></Button></div></div></div>