From 7ff4d9f804e2090bff84f1fe6d3d66b19e4a64ab Mon Sep 17 00:00:00 2001 From: ahua <50774091+ahua8522@users.noreply.github.com> Date: Mon, 6 Jul 2026 18:47:45 +0800 Subject: [PATCH] fix(sqlfile): make folder list update reactively --- apps/desktop/src/App.vue | 18 +- .../src/components/layout/AppToolbar.vue | 13 +- .../src/components/layout/SqlFilePanel.vue | 235 ++++++++++++++++++ .../desktop/src/composables/usePanelResize.ts | 4 + apps/desktop/src/i18n/locales/en.ts | 13 + apps/desktop/src/i18n/locales/es.ts | 13 + apps/desktop/src/i18n/locales/it.ts | 13 + apps/desktop/src/i18n/locales/ja.ts | 13 + apps/desktop/src/i18n/locales/pt-BR.ts | 13 + apps/desktop/src/i18n/locales/zh-CN.ts | 13 + apps/desktop/src/i18n/locales/zh-TW.ts | 13 + apps/desktop/src/lib/backend/api.ts | 2 + apps/desktop/src/lib/backend/http.ts | 11 + apps/desktop/src/lib/backend/tauri.ts | 11 + src-tauri/src/commands/list_sql_files.rs | 118 +++++++++ src-tauri/src/commands/mod.rs | 1 + src-tauri/src/lib.rs | 1 + 17 files changed, 503 insertions(+), 2 deletions(-) create mode 100644 apps/desktop/src/components/layout/SqlFilePanel.vue create mode 100644 src-tauri/src/commands/list_sql_files.rs diff --git a/apps/desktop/src/App.vue b/apps/desktop/src/App.vue index 189476fe76..718cce8409 100644 --- a/apps/desktop/src/App.vue +++ b/apps/desktop/src/App.vue @@ -90,6 +90,7 @@ import type { AiAction } from "@/lib/ai/ai"; const AiAssistant = defineAsyncComponent(() => import("@/components/editor/AiAssistant.vue")); const QueryHistory = defineAsyncComponent(() => import("@/components/editor/QueryHistory.vue")); const SqlLibraryPanel = defineAsyncComponent(() => import("@/components/layout/SqlLibraryPanel.vue")); +const SqlFilePanel = defineAsyncComponent(() => import("@/components/layout/SqlFilePanel.vue")); const DriverStorePage = defineAsyncComponent(() => import("@/components/config/DriverStoreDialog.vue")); const EditorSettingsPage = defineAsyncComponent(() => import("@/components/editor/EditorSettingsDialog.vue")); const UpdateDialog = defineAsyncComponent(() => import("@/components/layout/UpdateDialog.vue")); @@ -136,9 +137,10 @@ const agentDriverUpdateCount = ref(0); const showHistory = ref(false); const showAiPanel = ref(safeLocalStorageGet("dbx-ai-panel-open") === "true"); const showSqlLibraryPanel = ref(safeLocalStorageGet("dbx-sql-library-open") === "true"); +const showSqlFilePanel = ref(safeLocalStorageGet("dbx-sql-file-panel-open") === "true"); const sidebarOpen = ref(safeLocalStorageGet("dbx-sidebar-open") !== "false"); const aiPanelReady = ref(false); -const { sidebarWidth, aiPanelWidth, historyWidth, sqlLibraryWidth, startSidebarResize, startAiPanelResize, startHistoryResize, startSqlLibraryResize } = usePanelResize(); +const { sidebarWidth, aiPanelWidth, historyWidth, sqlLibraryWidth, sqlFilePanelWidth, startSidebarResize, startAiPanelResize, startHistoryResize, startSqlLibraryResize, startSqlFilePanelResize } = usePanelResize(); const aiAssistantRef = ref(null); const appSidebarRef = ref | null>(null); const contentAreaRef = ref | null>(null); @@ -465,6 +467,11 @@ function toggleSqlLibrary() { safeLocalStorageSet("dbx-sql-library-open", String(showSqlLibraryPanel.value)); } +function toggleSqlFilePanel() { + showSqlFilePanel.value = !showSqlFilePanel.value; + safeLocalStorageSet("dbx-sql-file-panel-open", String(showSqlFilePanel.value)); +} + function fixWithAi(errorMessage: string) { if (!showAiPanel.value) { showAiPanel.value = true; @@ -1719,6 +1726,7 @@ onUnmounted(() => { :show-ai-panel="showAiPanel" :show-history="showHistory" :show-sql-library="showSqlLibraryPanel" + :show-sql-file-panel="showSqlFilePanel" :show-driver-store="showDriverStore" :show-settings-page="showSettingsPage" :checking-updates="checkingUpdates" @@ -1732,6 +1740,7 @@ onUnmounted(() => { @toggle-ai="toggleAiPanel" @toggle-history="showHistory = !showHistory" @toggle-sql-library="toggleSqlLibrary" + @toggle-sql-file-panel="toggleSqlFilePanel" @open-github="openGitHub" @open-settings="openSettings()" @open-driver-store="openDriverStorePage" @@ -1923,6 +1932,13 @@ onUnmounted(() => { + +
+
+
+ +
+
import { computed, ref, onMounted, onBeforeUnmount, h } from "vue"; import { useI18n } from "vue-i18n"; -import { DatabaseZap, FilePlus2, Loader2, Moon, Sun, SunMoon, History, Bot, ArrowLeftRight, FileCode, BookMarked, GitCompareArrows, TableProperties, Settings, CloudDownload, Package, FileDown } from "@lucide/vue"; +import { DatabaseZap, FilePlus2, Loader2, Moon, Sun, SunMoon, History, Bot, ArrowLeftRight, FileCode, BookMarked, GitCompareArrows, TableProperties, Settings, CloudDownload, Package, FileDown, FolderTree } from "@lucide/vue"; import { Button } from "@/components/ui/button"; import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"; import LightDropdown from "@/components/ui/LightDropdown.vue"; @@ -28,6 +28,7 @@ const props = defineProps<{ showAiPanel: boolean; showHistory: boolean; showSqlLibrary: boolean; + showSqlFilePanel: boolean; showDriverStore: boolean; showSettingsPage: boolean; checkingUpdates: boolean; @@ -44,6 +45,7 @@ const emit = defineEmits<{ "toggle-ai": []; "toggle-history": []; "toggle-sql-library": []; + "toggle-sql-file-panel": []; "open-github": []; "open-settings": []; "open-driver-store": []; @@ -449,6 +451,15 @@ const toolbarDropdownTriggerClass = `inline-flex h-8 items-center gap-1 rounded- {{ t("sqlLibrary.title") }} + + + + + {{ t("sqlFileTree.title") }} + +