fix(saved-sql): 修复 SQL 库连接关联丢失与历史文件不可见
* fix: 持久化并显示 SQL 库连接关联 * fix: 补充 SQL 库关联状态翻译 * chore: 修复数据标签页策略格式 --------- Co-authored-by: zipg <4047349+zipg@users.noreply.github.com>
This commit is contained in:
1 parent
580b70e1d4
commit
445b6473f4
18 files changed
+336
-115
No files matched your search
+12
-16
@@ -56,7 +56,7 @@ import { isTauriRuntime } from "@/lib/backend/tauriRuntime";
|
||||
import { openQueryResultArchiveFile } from "@/lib/query/queryResultArchiveFile";
|
||||
import { rememberExternalSqlFileTarget, resolveExternalSqlFileTarget } from "@/lib/sql/externalSqlFileTarget";
|
||||
import { externalSqlFileOpenErrorMessage, readBrowserSqlFile, sqlFileTitleFromPath } from "@/lib/sql/sqlFileOpen";
|
||||
import type { ConnectionConfig, ObjectSourceKind, QueryTab, SavedSqlFile } from "@/types/database";
|
||||
import type { ConnectionConfig, ObjectSourceKind, QueryTab } from "@/types/database";
|
||||
import { parseConnectionDeepLink, type ConnectionDeepLinkDraft } from "@/lib/connection/connectionDeepLink";
|
||||
import {
|
||||
isBrowserReloadShortcut,
|
||||
@@ -848,16 +848,13 @@ async function saveExternalSqlPath(tab: QueryTab, options: { closeAfterSave?: bo
|
||||
}
|
||||
}
|
||||
|
||||
function savedSqlTargetForSave(tab: QueryTab, existing?: SavedSqlFile) {
|
||||
return savedSqlDefaultTargetForWrite(
|
||||
{
|
||||
connectionId: tab.connectionId,
|
||||
database: tab.database,
|
||||
schema: tab.schema,
|
||||
catalog: tab.catalog,
|
||||
},
|
||||
existing,
|
||||
);
|
||||
function savedSqlTargetForSave(tab: QueryTab) {
|
||||
return savedSqlDefaultTargetForWrite({
|
||||
connectionId: tab.connectionId,
|
||||
database: tab.database,
|
||||
schema: tab.schema,
|
||||
catalog: tab.catalog,
|
||||
});
|
||||
}
|
||||
|
||||
async function saveTabForCloseAll(tabId: string): Promise<boolean> {
|
||||
@@ -876,7 +873,7 @@ async function saveTabForCloseAll(tabId: string): Promise<boolean> {
|
||||
if (await saveExternalSqlPath(tab)) return !queryStore.isTabDirty(tab);
|
||||
|
||||
const existing = tab.savedSqlId ? savedSqlStore.getFile(tab.savedSqlId) : undefined;
|
||||
const target = savedSqlTargetForSave(tab, existing);
|
||||
const target = savedSqlTargetForSave(tab);
|
||||
try {
|
||||
const saved = await savedSqlStore.saveFile({
|
||||
id: existing?.id,
|
||||
@@ -943,7 +940,7 @@ async function handleSaveTab(tabId: string) {
|
||||
}
|
||||
const existing = tab.savedSqlId ? savedSqlStore.getFile(tab.savedSqlId) : undefined;
|
||||
if (existing) {
|
||||
const target = savedSqlTargetForSave(tab, existing);
|
||||
const target = savedSqlTargetForSave(tab);
|
||||
const updated = await savedSqlStore.saveFile({
|
||||
id: existing.id,
|
||||
connectionId: target.connectionId,
|
||||
@@ -979,7 +976,7 @@ async function openSaveSqlDialog() {
|
||||
if (await saveExternalSqlPath(tab)) return;
|
||||
const existing = tab.savedSqlId ? savedSqlStore.getFile(tab.savedSqlId) : undefined;
|
||||
if (existing) {
|
||||
const target = savedSqlTargetForSave(tab, existing);
|
||||
const target = savedSqlTargetForSave(tab);
|
||||
const updated = await savedSqlStore.saveFile({
|
||||
id: existing.id,
|
||||
connectionId: target.connectionId,
|
||||
@@ -1073,8 +1070,7 @@ async function confirmSaveSqlToLibrary() {
|
||||
const name = saveSqlName.value.trim();
|
||||
if (!tab || !tab.sql.trim() || !name) return;
|
||||
try {
|
||||
const existing = tab.savedSqlId ? savedSqlStore.getFile(tab.savedSqlId) : undefined;
|
||||
const target = savedSqlTargetForSave(tab, existing);
|
||||
const target = savedSqlTargetForSave(tab);
|
||||
const saved = await savedSqlStore.saveFile({
|
||||
id: tab.savedSqlId,
|
||||
connectionId: target.connectionId,
|
||||
|
||||
Reference in new issue
Block a user