mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-31 00:22:30 +00:00
fix: adapt cli runtime branch after rebase
This commit is contained in:
@@ -63,15 +63,8 @@ import * as api from "@/lib/api";
|
||||
import { buildTableSelectSql, quoteTableIdentifier } from "@/lib/tableSelectSql";
|
||||
import { isHiddenGridColumn, usesSyntheticRowIdKey } from "@/lib/tableEditing";
|
||||
import { displayCellValue, type CellValue } from "@/lib/cellValue";
|
||||
import { buildDataGridSaveStatements, formatGridSqlLiteral } from "@/lib/dataGridSql";
|
||||
import { formatMarkdownTable } from "@/lib/markdownTable";
|
||||
import { buildXlsxWorkbook } from "@/lib/xlsxExport";
|
||||
import {
|
||||
matchesRowStatusFilter,
|
||||
rowStatusFilterAfterAddingRow,
|
||||
type RowStatus,
|
||||
type RowStatusFilter,
|
||||
} from "@/lib/gridRowStatus";
|
||||
import { formatGridSqlLiteral } from "@/lib/dataGridSql";
|
||||
import { matchesRowStatusFilter, type RowStatus, type RowStatusFilter } from "@/lib/gridRowStatus";
|
||||
import { useAgentRuntimeStore } from "@/stores/agentRuntimeStore";
|
||||
|
||||
import { useToast } from "@/composables/useToast";
|
||||
|
||||
@@ -41,18 +41,19 @@ export const useAgentRuntimeStore = defineStore("agentRuntime", () => {
|
||||
}
|
||||
|
||||
async function syncNow() {
|
||||
const connectionStore = useConnectionStore();
|
||||
const queryStore = useQueryStore();
|
||||
const snapshot = buildAgentRuntimeSnapshot({
|
||||
tabs: queryStore.tabs,
|
||||
activeTabId: queryStore.activeTabId,
|
||||
getConnection: (connectionId) => connectionStore.getConfig(connectionId),
|
||||
selectedSql: selectedSql.value,
|
||||
selection: selection.value,
|
||||
resultSampleLimit: DEFAULT_RESULT_SAMPLE_LIMIT,
|
||||
});
|
||||
if (!globalThis.localStorage) return;
|
||||
|
||||
try {
|
||||
const connectionStore = useConnectionStore();
|
||||
const queryStore = useQueryStore();
|
||||
const snapshot = buildAgentRuntimeSnapshot({
|
||||
tabs: queryStore.tabs,
|
||||
activeTabId: queryStore.activeTabId,
|
||||
getConnection: (connectionId) => connectionStore.getConfig(connectionId),
|
||||
selectedSql: selectedSql.value,
|
||||
selection: selection.value,
|
||||
resultSampleLimit: DEFAULT_RESULT_SAMPLE_LIMIT,
|
||||
});
|
||||
await api.agentRuntimeUpdateSnapshot(snapshot);
|
||||
} catch (err) {
|
||||
console.debug("[DBX] Agent runtime snapshot sync skipped:", err);
|
||||
|
||||
@@ -17,16 +17,24 @@ import type { SavedSqlFile } from "@/types/database";
|
||||
const STORAGE_KEY = "dbx-open-tabs";
|
||||
const ACTIVE_TAB_KEY = "dbx-active-tab";
|
||||
|
||||
function browserStorage(): Storage | undefined {
|
||||
return globalThis.localStorage;
|
||||
}
|
||||
|
||||
function saveTabs(tabs: QueryTab[], activeTabId: string | null) {
|
||||
const storage = browserStorage();
|
||||
if (!storage) return;
|
||||
try {
|
||||
localStorage.setItem(STORAGE_KEY, JSON.stringify(serializeOpenTabs(tabs)));
|
||||
localStorage.setItem(ACTIVE_TAB_KEY, activeTabId || "");
|
||||
storage.setItem(STORAGE_KEY, JSON.stringify(serializeOpenTabs(tabs)));
|
||||
storage.setItem(ACTIVE_TAB_KEY, activeTabId || "");
|
||||
} catch {}
|
||||
}
|
||||
|
||||
function loadSavedTabs(): { tabs: QueryTab[]; activeTabId: string | null } {
|
||||
const storage = browserStorage();
|
||||
if (!storage) return { tabs: [], activeTabId: null };
|
||||
try {
|
||||
return restoreOpenTabsState(localStorage.getItem(STORAGE_KEY), localStorage.getItem(ACTIVE_TAB_KEY), {
|
||||
return restoreOpenTabsState(storage.getItem(STORAGE_KEY), storage.getItem(ACTIVE_TAB_KEY), {
|
||||
queryOnly: isTauriRuntime(),
|
||||
});
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user