feat(sqlfile): add refresh, locate, and context menu to SQL Files panel (#2715)

* feat(sqlfile): add refresh, locate, and context menu to SQL Files panel

- Add per-folder Refresh and Reveal-in-file-manager buttons on each opened
  folder header, plus a Refresh-all button on the panel toolbar. Re-scan
  prunes expand state for paths that no longer exist after refresh.
- Add right-click context menus (via CustomContextMenu) for files, folders,
  folder headers, and the panel background: open, execute SQL file, reveal
  in file manager, copy path, expand/collapse all, refresh, remove folder.
- Highlight the selected tree row on click/right-click; clicking empty space
  clears the selection.
- Wire "Execute SQL file" from the panel into the App-level
  SqlFileExecutionDialog via connectionStore.sqlFileSource.filePath + a new
  prefillFilePath prop, so the dialog opens with the file preview preloaded.
- Add zh-CN/en strings under sqlFileTree.

* chore(i18n): autofill new translations

* fix(sqlfile): clear prefillFilePath on close, dedupe i18n keys

---------

Co-authored-by: wanqinghua <wanqhua@gmail.com>
Co-authored-by: dbx-i18n-bot <github-actions[bot]@users.noreply.github.com>
Co-authored-by: t8y2 <1156263951@qq.com>
This commit is contained in:
authored and GitHub committed 2026-07-07 10:34:32 +08:00
1 parent 56fbbbfc8e
commit dde8d4584f
12 files changed
+395 -58

No files matched your search

@@ -32,6 +32,7 @@ const dataComparePrefillSchema = ref("");
const dataComparePrefillTable = ref("");
const sqlFilePrefillConnectionId = ref("");
const sqlFilePrefillDatabase = ref("");
const sqlFilePrefillFilePath = ref("");
const diagramPrefillConnectionId = ref("");
const diagramPrefillDatabase = ref("");
const diagramPrefillSchema = ref("");
@@ -115,12 +116,22 @@ export function useDialogSources() {
if (v) {
sqlFilePrefillConnectionId.value = v.connectionId;
sqlFilePrefillDatabase.value = v.database;
sqlFilePrefillFilePath.value = v.filePath ?? "";
showSqlFileDialog.value = true;
connectionStore.sqlFileSource = null;
}
},
);
// Clear the pre-filled file path once the dialog closes so a later open
// via the toolbar (which doesn't go through sqlFileSource) doesn't re-load
// the previously previewed file. prefillConnectionId/database are harmless
// when stale (they only preselect dropdowns), but a stale path triggers an
// async file read + preview render — a visible side effect.
watch(showSqlFileDialog, (open) => {
if (!open) sqlFilePrefillFilePath.value = "";
});
watch(
() => connectionStore.diagramSource,
(v) => {
@@ -305,6 +316,7 @@ export function useDialogSources() {
dataComparePrefillTable,
sqlFilePrefillConnectionId,
sqlFilePrefillDatabase,
sqlFilePrefillFilePath,
diagramPrefillConnectionId,
diagramPrefillDatabase,
diagramPrefillSchema,