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(sql-library): add new query option to folder and panel context menus
t8y2c9cd80fc79e7
diff --git a/apps/desktop/src/components/layout/SqlLibraryPanel.vue b/apps/desktop/src/components/layout/SqlLibraryPanel.vueindex e87c850abb..63a4b8e177 100644--- a/apps/desktop/src/components/layout/SqlLibraryPanel.vue+++ b/apps/desktop/src/components/layout/SqlLibraryPanel.vue@@ -1,7 +1,7 @@<script setup lang="ts">import { computed, nextTick, onBeforeUnmount, reactive, ref } from "vue";import { useI18n } from "vue-i18n";-import { Download, FileInput, FileText, FolderCog, FolderClosed, FolderOpen, FolderPlus, Library, LocateFixed, Pencil, Search, Trash2, Upload, X } from "@lucide/vue";+import { Download, FileInput, FilePlus, FileText, FolderCog, FolderClosed, FolderOpen, FolderPlus, Library, LocateFixed, Pencil, Search, Trash2, Upload, X } from "@lucide/vue";import { Button } from "@/components/ui/button";import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";import CustomContextMenu, { type ContextMenuItem as CtxMenuItem } from "@/components/ui/CustomContextMenu.vue";@@ -394,6 +394,29 @@ async function openNewFolderInput(parentFolderId?: string) {startRenameFolder(folder);}+async function openNewQueryInFolder(folder?: SavedSqlFolder) {+ const connectionId = folder?.connectionId || connectionStore.activeConnectionId || connectionStore.connections[0]?.id;+ if (!connectionId) return;++ const takenNames = folder+ ? new Set(savedSqlStore.filesInFolder(folder.id).map((f) => f.name))+ : new Set(+ savedSqlStore+ .filesWithoutFolder()+ .filter((file) => !orphanedIds.value.has(file.id))+ .map((f) => f.name),+ );+ const name = uniqueImportedName("new_query.sql", takenNames);+ const file = await savedSqlStore.saveFile({+ connectionId,+ folderId: folder?.id,+ name,+ database: "",+ sql: "",+ });+ queryStore.openSavedSql(file);+}+const renamingTarget = ref<{ type: "folder" | "file"; id: string } | null>(null);const renameValue = ref("");const renameInputRef = ref<HTMLInputElement | null>(null);@@ -473,6 +496,7 @@ const contextMenuItems = computed<CtxMenuItem[]>(() => {if (target === "panel") {return [{ label: t("savedSql.newFolder"), action: openNewFolderInput, icon: FolderPlus },+ { label: t("savedSql.newQuery"), action: () => openNewQueryInFolder(), icon: FilePlus },{ label: t("sqlLibrary.importDirectory"), action: () => importDirectoryIntoLibrary(), icon: Upload },{ label: t("sqlLibrary.exportLibrary"), action: () => exportFolderContents(), icon: Download },{ label: "", separator: true },@@ -503,6 +527,7 @@ const contextMenuItems = computed<CtxMenuItem[]>(() => {}return [{ label: t("savedSql.newFolder"), action: () => openNewFolderInput(target.id), icon: FolderPlus },+ { label: t("savedSql.newQuery"), action: () => openNewQueryInFolder(target), icon: FilePlus },{ label: t("sqlLibrary.importIntoFolder"), action: () => importDirectoryIntoLibrary(target), icon: Upload },{ label: t("sqlLibrary.exportFolder"), action: () => exportFolderContents(target), icon: Download },{ label: "", separator: true },diff --git a/apps/desktop/src/i18n/locales/en.ts b/apps/desktop/src/i18n/locales/en.tsindex 951a5c4999..7348fc7b02 100644--- a/apps/desktop/src/i18n/locales/en.ts+++ b/apps/desktop/src/i18n/locales/en.ts@@ -98,6 +98,7 @@ export default {fileName: "File name",folder: "Folder",rootFolder: "SQL Library",+ newQuery: "New Query",newFolder: "New SQL Folder",newFolderDefault: "New Folder",renameFolder: "Rename Folder",diff --git a/apps/desktop/src/i18n/locales/es.ts b/apps/desktop/src/i18n/locales/es.tsindex 056938359a..fb5770bb99 100644--- a/apps/desktop/src/i18n/locales/es.ts+++ b/apps/desktop/src/i18n/locales/es.ts@@ -96,6 +96,7 @@ export default {fileName: "Nombre de archivo",folder: "Carpeta",rootFolder: "Biblioteca SQL",+ newQuery: "Nueva consulta",newFolder: "Nueva carpeta SQL",newFolderDefault: "Nueva carpeta",renameFolder: "Renombrar carpeta",diff --git a/apps/desktop/src/i18n/locales/it.ts b/apps/desktop/src/i18n/locales/it.tsindex 77005b3db8..25de04d766 100644--- a/apps/desktop/src/i18n/locales/it.ts+++ b/apps/desktop/src/i18n/locales/it.ts@@ -96,6 +96,7 @@ export default {fileName: "Nome file",folder: "Cartella",rootFolder: "Libreria SQL",+ newQuery: "Nuova query",newFolder: "Nuova Cartella SQL",newFolderDefault: "Nuova Cartella",renameFolder: "Rinomina Cartella",diff --git a/apps/desktop/src/i18n/locales/ja.ts b/apps/desktop/src/i18n/locales/ja.tsindex 38c82bf17f..69ceff1c0b 100644--- a/apps/desktop/src/i18n/locales/ja.ts+++ b/apps/desktop/src/i18n/locales/ja.ts@@ -98,6 +98,7 @@ export default {fileName: "ファイル名",folder: "フォルダ",rootFolder: "SQLライブラリ",+ newQuery: "新規クエリ",newFolder: "新しいSQLフォルダ",newFolderDefault: "新しいフォルダ",renameFolder: "フォルダ名を変更",diff --git a/apps/desktop/src/i18n/locales/pt-BR.ts b/apps/desktop/src/i18n/locales/pt-BR.tsindex 3cf90758db..e7580e30ba 100644--- a/apps/desktop/src/i18n/locales/pt-BR.ts+++ b/apps/desktop/src/i18n/locales/pt-BR.ts@@ -96,6 +96,7 @@ export default {fileName: "Nome do arquivo",folder: "Pasta",rootFolder: "Biblioteca SQL",+ newQuery: "Nova Consulta",newFolder: "Nova Pasta SQL",newFolderDefault: "Nova Pasta",renameFolder: "Renomear Pasta",diff --git a/apps/desktop/src/i18n/locales/zh-CN.ts b/apps/desktop/src/i18n/locales/zh-CN.tsindex f2ac7a9d62..4f92c2f296 100644--- a/apps/desktop/src/i18n/locales/zh-CN.ts+++ b/apps/desktop/src/i18n/locales/zh-CN.ts@@ -98,6 +98,7 @@ export default {fileName: "文件名",folder: "文件夹",rootFolder: "SQL 库",+ newQuery: "新建查询",newFolder: "新建 SQL 文件夹",newFolderDefault: "新建文件夹",renameFolder: "重命名文件夹",diff --git a/apps/desktop/src/i18n/locales/zh-TW.ts b/apps/desktop/src/i18n/locales/zh-TW.tsindex 9239b0fea1..b17e8c3d5c 100644--- a/apps/desktop/src/i18n/locales/zh-TW.ts+++ b/apps/desktop/src/i18n/locales/zh-TW.ts@@ -96,6 +96,7 @@ export default {fileName: "檔案名稱",folder: "資料夾",rootFolder: "SQL 庫",+ newQuery: "新建查詢",newFolder: "建立 SQL 資料夾",newFolderDefault: "建立資料夾",renameFolder: "重新命名資料夾",