feat(editor): retain multiple query result runs
This commit is contained in:
1 parent
fddc0fdf50
commit
7f20b03177
26 files changed
+846
-109
No files matched your search
@@ -3,16 +3,20 @@ import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
const mocks = vi.hoisted(() => ({
|
||||
analyzeEditableQueryEditability: vi.fn(),
|
||||
cancelQuery: vi.fn(),
|
||||
closeClientConnectionSession: vi.fn(),
|
||||
closeQuerySession: vi.fn(),
|
||||
ensureConnected: vi.fn(),
|
||||
executeMulti: vi.fn(),
|
||||
getConnectionConfig: vi.fn(),
|
||||
prepareQueryPaginationExecutionPlan: vi.fn(),
|
||||
saveOpenTabsState: vi.fn(),
|
||||
tabResultSnapshots: new Map<string, unknown>(),
|
||||
}));
|
||||
|
||||
vi.mock("@/lib/backend/api", () => ({
|
||||
analyzeEditableQueryEditability: mocks.analyzeEditableQueryEditability,
|
||||
cancelQuery: mocks.cancelQuery,
|
||||
closeClientConnectionSession: mocks.closeClientConnectionSession,
|
||||
closeQuerySession: mocks.closeQuerySession,
|
||||
executeMulti: mocks.executeMulti,
|
||||
@@ -22,7 +26,7 @@ vi.mock("@/lib/backend/api", () => ({
|
||||
|
||||
vi.mock("@/stores/connectionStore", () => ({
|
||||
useConnectionStore: () => ({
|
||||
ensureConnected: vi.fn().mockResolvedValue(undefined),
|
||||
ensureConnected: mocks.ensureConnected,
|
||||
getConfig: mocks.getConnectionConfig,
|
||||
recordConnectionLostError: vi.fn(),
|
||||
}),
|
||||
@@ -34,6 +38,21 @@ vi.mock("@/stores/settingsStore", () => ({
|
||||
}),
|
||||
}));
|
||||
|
||||
vi.mock("@/lib/tabs/tabResultCache", async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import("@/lib/tabs/tabResultCache")>();
|
||||
return {
|
||||
...actual,
|
||||
writeTabResultSnapshot: vi.fn(async (key: string, snapshot: unknown) => {
|
||||
mocks.tabResultSnapshots.set(key, actual.decodeTabResultSnapshot(actual.encodeTabResultSnapshot(snapshot as Parameters<typeof actual.encodeTabResultSnapshot>[0])));
|
||||
return true;
|
||||
}),
|
||||
readTabResultSnapshot: vi.fn(async (key: string) => mocks.tabResultSnapshots.get(key)),
|
||||
deleteTabResultSnapshot: vi.fn(async (key: string) => {
|
||||
mocks.tabResultSnapshots.delete(key);
|
||||
}),
|
||||
};
|
||||
});
|
||||
|
||||
function installLocalStorage() {
|
||||
const data = new Map<string, string>();
|
||||
vi.stubGlobal("localStorage", {
|
||||
@@ -43,12 +62,25 @@ function installLocalStorage() {
|
||||
});
|
||||
}
|
||||
|
||||
function deferred<T>() {
|
||||
let resolve!: (value: T | PromiseLike<T>) => void;
|
||||
let reject!: (reason?: unknown) => void;
|
||||
const promise = new Promise<T>((resolvePromise, rejectPromise) => {
|
||||
resolve = resolvePromise;
|
||||
reject = rejectPromise;
|
||||
});
|
||||
return { promise, resolve, reject };
|
||||
}
|
||||
|
||||
describe("queryStore multi-statement errors", () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
vi.unstubAllGlobals();
|
||||
mocks.tabResultSnapshots.clear();
|
||||
installLocalStorage();
|
||||
setActivePinia(createPinia());
|
||||
mocks.cancelQuery.mockResolvedValue(true);
|
||||
mocks.ensureConnected.mockResolvedValue(undefined);
|
||||
mocks.getConnectionConfig.mockReturnValue({
|
||||
id: "mysql-1",
|
||||
name: "MySQL",
|
||||
@@ -270,4 +302,199 @@ describe("queryStore multi-statement errors", () => {
|
||||
|
||||
expect(mocks.executeMulti).toHaveBeenCalledWith("mysql-1", "app", "SELECT 1", undefined, expect.any(String), expect.objectContaining({ continueOnError: false }));
|
||||
});
|
||||
|
||||
it("keeps old and new executions as result runs, then lets normal execution replace the active run", async () => {
|
||||
mocks.executeMulti
|
||||
.mockResolvedValueOnce([{ columns: ["value"], rows: [[1]], affected_rows: 0, execution_time_ms: 1 }])
|
||||
.mockResolvedValueOnce([{ columns: ["value"], rows: [[2]], affected_rows: 0, execution_time_ms: 1 }])
|
||||
.mockResolvedValueOnce([{ columns: ["value"], rows: [[3]], affected_rows: 0, execution_time_ms: 1 }]);
|
||||
const { useQueryStore } = await import("@/stores/queryStore");
|
||||
const store = useQueryStore();
|
||||
const tabId = store.createTab("mysql-1", "app", "Query");
|
||||
|
||||
await store.executeCurrentSql("SELECT 1 AS value");
|
||||
await store.executeCurrentSql("SELECT 2 AS value", { openInNewResultTab: true });
|
||||
|
||||
const tab = store.tabs.find((item) => item.id === tabId)!;
|
||||
expect(tab.resultAutoSave).toBeUndefined();
|
||||
expect(tab.resultRuns).toHaveLength(2);
|
||||
expect(tab.activeResultRunId).toBe(tab.resultRuns?.[1]?.id);
|
||||
|
||||
expect(await store.setActiveResultRun(tabId, tab.resultRuns![0]!.id)).toBe(true);
|
||||
expect(tab.result?.rows[0]?.[0]).toBe(1);
|
||||
expect(await store.setActiveResultRun(tabId, tab.resultRuns![1]!.id)).toBe(true);
|
||||
expect(tab.result?.rows[0]?.[0]).toBe(2);
|
||||
|
||||
await store.executeCurrentSql("SELECT 3 AS value");
|
||||
|
||||
expect(tab.resultRuns).toHaveLength(2);
|
||||
expect(tab.activeResultRunId).toBe(tab.resultRuns?.[1]?.id);
|
||||
expect(await store.setActiveResultRun(tabId, tab.resultRuns![0]!.id)).toBe(true);
|
||||
expect(tab.result?.rows[0]?.[0]).toBe(1);
|
||||
expect(await store.setActiveResultRun(tabId, tab.resultRuns![1]!.id)).toBe(true);
|
||||
expect(tab.resultRuns?.[1]).toMatchObject({
|
||||
sql: "SELECT 3 AS value",
|
||||
result: { rows: [[3]] },
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps ordinary executions in the single-result path by default", async () => {
|
||||
mocks.executeMulti.mockResolvedValue([{ columns: ["value"], rows: [[1]], affected_rows: 0, execution_time_ms: 1 }]);
|
||||
const { useQueryStore } = await import("@/stores/queryStore");
|
||||
const store = useQueryStore();
|
||||
const tabId = store.createTab("mysql-1", "app", "Query");
|
||||
|
||||
await store.executeCurrentSql("SELECT 1 AS value");
|
||||
|
||||
const tab = store.tabs.find((item) => item.id === tabId)!;
|
||||
expect(tab.result?.rows).toEqual([[1]]);
|
||||
expect(tab.resultRuns).toBeUndefined();
|
||||
expect(tab.activeResultRunId).toBeUndefined();
|
||||
});
|
||||
|
||||
it("restores the retained result when a new-result execution fails before dispatch", async () => {
|
||||
mocks.executeMulti.mockResolvedValueOnce([{ columns: ["value"], rows: [[1]], affected_rows: 0, execution_time_ms: 1 }]);
|
||||
const { useQueryStore } = await import("@/stores/queryStore");
|
||||
const store = useQueryStore();
|
||||
const tabId = store.createTab("mysql-1", "app", "Query");
|
||||
await store.executeCurrentSql("SELECT 1 AS value");
|
||||
mocks.ensureConnected.mockRejectedValueOnce(new Error("connection failed"));
|
||||
|
||||
await store.executeCurrentSql("SELECT 2 AS value", { openInNewResultTab: true });
|
||||
|
||||
const tab = store.tabs.find((item) => item.id === tabId)!;
|
||||
expect(tab.resultRuns).toHaveLength(1);
|
||||
expect(tab.activeResultRunId).toBe(tab.resultRuns?.[0]?.id);
|
||||
expect(tab.result?.rows).toEqual([[1]]);
|
||||
});
|
||||
|
||||
it("hydrates a restored active run before starting a new-result execution", async () => {
|
||||
mocks.executeMulti.mockResolvedValueOnce([{ columns: ["value"], rows: [[1]], affected_rows: 0, execution_time_ms: 1 }]);
|
||||
const { useQueryStore } = await import("@/stores/queryStore");
|
||||
const store = useQueryStore();
|
||||
const tabId = store.createTab("mysql-1", "app", "Query");
|
||||
await store.executeCurrentSql("SELECT 1 AS value");
|
||||
const tab = store.tabs.find((item) => item.id === tabId)!;
|
||||
store.toggleResultAutoSave(tabId);
|
||||
const run = tab.resultRuns?.[0];
|
||||
expect(run?.resultCacheKey).toBeTruthy();
|
||||
run!.result = undefined;
|
||||
run!.results = undefined;
|
||||
tab.result = undefined;
|
||||
tab.results = undefined;
|
||||
mocks.ensureConnected.mockRejectedValueOnce(new Error("connection failed"));
|
||||
|
||||
await store.executeCurrentSql("SELECT 2 AS value", { openInNewResultTab: true });
|
||||
|
||||
expect(tab.resultRuns).toHaveLength(1);
|
||||
expect(tab.activeResultRunId).toBe(run?.id);
|
||||
expect(tab.result?.rows).toEqual([[1]]);
|
||||
expect(mocks.tabResultSnapshots.has(run!.resultCacheKey!)).toBe(true);
|
||||
|
||||
run!.result = undefined;
|
||||
run!.results = undefined;
|
||||
tab.result = undefined;
|
||||
tab.results = undefined;
|
||||
|
||||
expect(await store.setActiveResultRun(tabId, run!.id)).toBe(true);
|
||||
expect(tab.result?.rows).toEqual([[1]]);
|
||||
});
|
||||
|
||||
it("captures a new run when another retained run is selected during execution", async () => {
|
||||
const pendingExecution = deferred<Array<{ columns: string[]; rows: number[][]; affected_rows: number; execution_time_ms: number }>>();
|
||||
mocks.executeMulti.mockResolvedValueOnce([{ columns: ["value"], rows: [[1]], affected_rows: 0, execution_time_ms: 1 }]).mockImplementationOnce(() => pendingExecution.promise);
|
||||
const { useQueryStore } = await import("@/stores/queryStore");
|
||||
const store = useQueryStore();
|
||||
const tabId = store.createTab("mysql-1", "app", "Query");
|
||||
await store.executeCurrentSql("SELECT 1 AS value");
|
||||
store.toggleResultAutoSave(tabId);
|
||||
const tab = store.tabs.find((item) => item.id === tabId)!;
|
||||
const retainedRunId = tab.activeResultRunId!;
|
||||
const retainedRunCacheKey = tab.resultRuns?.find((run) => run.id === retainedRunId)?.resultCacheKey;
|
||||
|
||||
const execution = store.executeCurrentSql("SELECT 2 AS value", { openInNewResultTab: true });
|
||||
await vi.waitFor(() => expect(mocks.executeMulti).toHaveBeenCalledTimes(2));
|
||||
expect(await store.setActiveResultRun(tabId, retainedRunId)).toBe(true);
|
||||
pendingExecution.resolve([{ columns: ["value"], rows: [[2]], affected_rows: 0, execution_time_ms: 1 }]);
|
||||
await execution;
|
||||
|
||||
expect(tab.resultRuns).toHaveLength(2);
|
||||
expect(tab.activeResultRunId).not.toBe(retainedRunId);
|
||||
expect(tab.result).toMatchObject({ rows: [[2]] });
|
||||
expect(tab.resultRuns?.find((run) => run.id === tab.activeResultRunId)?.resultCacheKey).not.toBe(retainedRunCacheKey);
|
||||
expect(await store.setActiveResultRun(tabId, retainedRunId)).toBe(true);
|
||||
expect(tab.result).toMatchObject({ rows: [[1]] });
|
||||
});
|
||||
|
||||
it("restores the retained result when a new-result execution returns no result", async () => {
|
||||
mocks.executeMulti.mockResolvedValueOnce([{ columns: ["value"], rows: [[1]], affected_rows: 0, execution_time_ms: 1 }]).mockResolvedValueOnce([]);
|
||||
const { useQueryStore } = await import("@/stores/queryStore");
|
||||
const store = useQueryStore();
|
||||
const tabId = store.createTab("mysql-1", "app", "Query");
|
||||
await store.executeCurrentSql("SELECT 1 AS value");
|
||||
|
||||
await store.executeCurrentSql("SELECT 2 AS value", { openInNewResultTab: true });
|
||||
|
||||
const tab = store.tabs.find((item) => item.id === tabId)!;
|
||||
expect(tab.resultRuns).toHaveLength(1);
|
||||
expect(tab.activeResultRunId).toBe(tab.resultRuns?.[0]?.id);
|
||||
expect(tab.result?.rows).toEqual([[1]]);
|
||||
});
|
||||
|
||||
it("restores the retained result when a new-result execution is cancelled", async () => {
|
||||
const pendingExecution = deferred<never>();
|
||||
mocks.executeMulti.mockResolvedValueOnce([{ columns: ["value"], rows: [[1]], affected_rows: 0, execution_time_ms: 1 }]).mockImplementationOnce(() => pendingExecution.promise);
|
||||
const { useQueryStore } = await import("@/stores/queryStore");
|
||||
const store = useQueryStore();
|
||||
const tabId = store.createTab("mysql-1", "app", "Query");
|
||||
await store.executeCurrentSql("SELECT 1 AS value");
|
||||
|
||||
const execution = store.executeCurrentSql("SELECT 2 AS value", { openInNewResultTab: true });
|
||||
await vi.waitFor(() => expect(mocks.executeMulti).toHaveBeenCalledTimes(2));
|
||||
await expect(store.cancelTabExecution(tabId)).resolves.toBe(true);
|
||||
pendingExecution.reject(new Error("Query canceled"));
|
||||
await execution;
|
||||
|
||||
const tab = store.tabs.find((item) => item.id === tabId)!;
|
||||
expect(tab.resultRuns).toHaveLength(1);
|
||||
expect(tab.activeResultRunId).toBe(tab.resultRuns?.[0]?.id);
|
||||
expect(tab.result?.rows).toEqual([[1]]);
|
||||
});
|
||||
|
||||
it("keeps the retained result when a cancelled execution still returns data", async () => {
|
||||
const pendingExecution = deferred<Array<{ columns: string[]; rows: number[][]; affected_rows: number; execution_time_ms: number }>>();
|
||||
mocks.executeMulti.mockResolvedValueOnce([{ columns: ["value"], rows: [[1]], affected_rows: 0, execution_time_ms: 1 }]).mockImplementationOnce(() => pendingExecution.promise);
|
||||
const { useQueryStore } = await import("@/stores/queryStore");
|
||||
const store = useQueryStore();
|
||||
const tabId = store.createTab("mysql-1", "app", "Query");
|
||||
await store.executeCurrentSql("SELECT 1 AS value");
|
||||
|
||||
const execution = store.executeCurrentSql("SELECT 2 AS value", { openInNewResultTab: true });
|
||||
await vi.waitFor(() => expect(mocks.executeMulti).toHaveBeenCalledTimes(2));
|
||||
await expect(store.cancelTabExecution(tabId)).resolves.toBe(true);
|
||||
pendingExecution.resolve([{ columns: ["value"], rows: [[2]], affected_rows: 0, execution_time_ms: 1 }]);
|
||||
await execution;
|
||||
|
||||
const tab = store.tabs.find((item) => item.id === tabId)!;
|
||||
expect(tab.resultRuns).toHaveLength(1);
|
||||
expect(tab.activeResultRunId).toBe(tab.resultRuns?.[0]?.id);
|
||||
expect(tab.result?.rows).toEqual([[1]]);
|
||||
});
|
||||
|
||||
it("restores the adjacent retained result after closing the active run", async () => {
|
||||
mocks.executeMulti.mockResolvedValueOnce([{ columns: ["value"], rows: [[1]], affected_rows: 0, execution_time_ms: 1 }]).mockResolvedValueOnce([{ columns: ["value"], rows: [[2]], affected_rows: 0, execution_time_ms: 1 }]);
|
||||
const { useQueryStore } = await import("@/stores/queryStore");
|
||||
const store = useQueryStore();
|
||||
const tabId = store.createTab("mysql-1", "app", "Query");
|
||||
await store.executeCurrentSql("SELECT 1 AS value");
|
||||
await store.executeCurrentSql("SELECT 2 AS value", { openInNewResultTab: true });
|
||||
const tab = store.tabs.find((item) => item.id === tabId)!;
|
||||
const activeRunId = tab.activeResultRunId!;
|
||||
|
||||
expect(await store.removeResultRun(tabId, activeRunId)).toBe(true);
|
||||
|
||||
expect(tab.resultRuns).toHaveLength(1);
|
||||
expect(tab.activeResultRunId).toBe(tab.resultRuns?.[0]?.id);
|
||||
expect(tab.result?.rows).toEqual([[1]]);
|
||||
});
|
||||
});
|
||||
@@ -115,6 +115,12 @@ describe("normalizeEditorSettings", () => {
|
||||
expect(normalizeEditorSettings({ dataGridSearchMode: "invalid" as any }).dataGridSearchMode).toBe("filter");
|
||||
});
|
||||
|
||||
it("defaults retained result runs to tiled tabs and preserves list mode", () => {
|
||||
expect(normalizeEditorSettings({}).resultRunDisplayMode).toBe("tabs");
|
||||
expect(normalizeEditorSettings({ resultRunDisplayMode: "list" }).resultRunDisplayMode).toBe("list");
|
||||
expect(normalizeEditorSettings({ resultRunDisplayMode: "invalid" as any }).resultRunDisplayMode).toBe("tabs");
|
||||
});
|
||||
|
||||
it("defaults persistent data grid view options off and preserves enabled values", () => {
|
||||
const defaults = normalizeEditorSettings({});
|
||||
expect(defaults.dataGridMultiRowTranspose).toBe(false);
|
||||
@@ -348,6 +354,19 @@ describe("settingsStore sidebar connection sort persistence", () => {
|
||||
await store.persistEditorSettings();
|
||||
expect(isProxy(saveEditorSettings.mock.calls[1][0])).toBe(false);
|
||||
});
|
||||
|
||||
it("persists the retained result run display mode", async () => {
|
||||
const saveEditorSettings = vi.fn().mockResolvedValue(undefined);
|
||||
vi.doMock("@/lib/backend/api", () => ({ saveEditorSettings }));
|
||||
|
||||
const { useSettingsStore } = await import("@/stores/settingsStore");
|
||||
const store = useSettingsStore();
|
||||
store.updateEditorSettings({ resultRunDisplayMode: "list" });
|
||||
|
||||
expect(store.editorSettings.resultRunDisplayMode).toBe("list");
|
||||
expect(saveEditorSettings).toHaveBeenCalledWith(expect.objectContaining({ resultRunDisplayMode: "list" }));
|
||||
expect(isProxy(saveEditorSettings.mock.calls[0][0])).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
// --- activeModel lifecycle tests ---
|
||||
|
||||
@@ -480,6 +480,7 @@ export const useQueryStore = defineStore("query", () => {
|
||||
const tableStructureRefreshVersions = ref<Record<string, number>>({});
|
||||
const savedSqlEditorPositionTimers = new Map<string, ReturnType<typeof setTimeout>>();
|
||||
const pendingTabSessionResets = new Map<string, Promise<void>>();
|
||||
const pendingResultRunRestores = new Map<string, string>();
|
||||
let resultCacheTrimScheduled = false;
|
||||
let resultCacheTrimRunning = false;
|
||||
let resultCacheTrimRequested = false;
|
||||
@@ -597,7 +598,7 @@ export const useQueryStore = defineStore("query", () => {
|
||||
}
|
||||
}
|
||||
|
||||
function clearResultPayload(tab: QueryTab, options: { evicted?: boolean } = {}) {
|
||||
function clearResultPayload(tab: QueryTab, options: { evicted?: boolean; preserveCacheSnapshot?: boolean } = {}) {
|
||||
tab.result = undefined;
|
||||
tab.results = undefined;
|
||||
tab.activeResultIndex = undefined;
|
||||
@@ -617,7 +618,7 @@ export const useQueryStore = defineStore("query", () => {
|
||||
tab.resultEvicted = options.evicted ? true : undefined;
|
||||
tab.resultCacheState = options.evicted ? tab.resultCacheState : undefined;
|
||||
if (!options.evicted) {
|
||||
if (tab.resultCacheKey) void deleteTabResultSnapshot(tab.resultCacheKey);
|
||||
if (tab.resultCacheKey && !options.preserveCacheSnapshot) void deleteTabResultSnapshot(tab.resultCacheKey);
|
||||
tab.resultCacheKey = undefined;
|
||||
}
|
||||
}
|
||||
@@ -682,6 +683,17 @@ export const useQueryStore = defineStore("query", () => {
|
||||
touchResult(tab, Date.now(), { reuseEstimatedBytes: true });
|
||||
}
|
||||
|
||||
function restorePendingResultRun(tab: QueryTab, executionId: string): boolean {
|
||||
const runId = pendingResultRunRestores.get(executionId);
|
||||
pendingResultRunRestores.delete(executionId);
|
||||
if (!runId) return false;
|
||||
const run = tab.resultRuns?.find((item) => item.id === runId);
|
||||
if (!run || !resultRunHasPayload(run)) return false;
|
||||
projectResultRun(tab, run);
|
||||
evictInactiveResultRunPayloads(tab);
|
||||
return true;
|
||||
}
|
||||
|
||||
async function restoreResultRunPayload(tab: QueryTab, runId: string) {
|
||||
const run = tab.resultRuns?.find((item) => item.id === runId);
|
||||
if (!run || run.result || run.results?.length) return run;
|
||||
@@ -792,7 +804,7 @@ export const useQueryStore = defineStore("query", () => {
|
||||
}
|
||||
}
|
||||
|
||||
function captureDisplayedResultRun(tab: QueryTab, sql: string, createdAt = Date.now()) {
|
||||
function captureDisplayedResultRun(tab: QueryTab, sql: string, createdAt = Date.now(), options: { reuseResultCacheKey?: boolean } = {}) {
|
||||
if (tab.mode !== "query" || !tab.result) return;
|
||||
const sequence = nextResultRunSequence(tab);
|
||||
const run: NonNullable<QueryTab["resultRuns"]>[number] = {
|
||||
@@ -824,7 +836,7 @@ export const useQueryStore = defineStore("query", () => {
|
||||
resultSessionId: tab.resultSessionId,
|
||||
resultAccessedAt: tab.resultAccessedAt,
|
||||
resultEstimatedBytes: tab.resultEstimatedBytes,
|
||||
resultCacheKey: tab.resultCacheKey,
|
||||
resultCacheKey: options.reuseResultCacheKey === false ? undefined : tab.resultCacheKey,
|
||||
resultCacheState: tab.resultCacheState,
|
||||
resultEvicted: tab.resultEvicted,
|
||||
queryAnalysis: tab.queryAnalysis,
|
||||
@@ -836,6 +848,10 @@ export const useQueryStore = defineStore("query", () => {
|
||||
void persistResultRun(tab, run);
|
||||
tab.resultRuns = [...(tab.resultRuns ?? []), run];
|
||||
tab.activeResultRunId = run.id;
|
||||
if (options.reuseResultCacheKey === false) {
|
||||
tab.resultCacheKey = run.resultCacheKey;
|
||||
tab.resultCacheState = run.resultCacheState;
|
||||
}
|
||||
evictInactiveResultRunPayloads(tab);
|
||||
}
|
||||
|
||||
@@ -849,12 +865,13 @@ export const useQueryStore = defineStore("query", () => {
|
||||
return tab.resultAutoSave === true;
|
||||
}
|
||||
|
||||
function syncActiveResultRunFromDisplayed(tab: QueryTab) {
|
||||
function syncActiveResultRunFromDisplayed(tab: QueryTab, sql?: string) {
|
||||
if (!tab.activeResultRunId || !tab.resultRuns?.length) return;
|
||||
const index = tab.resultRuns.findIndex((run) => run.id === tab.activeResultRunId);
|
||||
if (index < 0) return;
|
||||
const run = {
|
||||
...tab.resultRuns[index],
|
||||
...(sql ? { sql } : {}),
|
||||
result: tab.result,
|
||||
results: tab.results,
|
||||
activeResultIndex: tab.activeResultIndex,
|
||||
@@ -891,10 +908,12 @@ export const useQueryStore = defineStore("query", () => {
|
||||
tab.resultRuns[index] = run;
|
||||
}
|
||||
|
||||
function syncDisplayedResultRun(tab: QueryTab, sql: string) {
|
||||
function syncDisplayedResultRun(tab: QueryTab, sql: string, captureNewRun = false) {
|
||||
if (tab.mode !== "query" || !tab.result) return;
|
||||
if (tab.activeResultRunId) {
|
||||
syncActiveResultRunFromDisplayed(tab);
|
||||
if (captureNewRun) {
|
||||
captureDisplayedResultRun(tab, sql, Date.now(), { reuseResultCacheKey: false });
|
||||
} else if (tab.activeResultRunId) {
|
||||
syncActiveResultRunFromDisplayed(tab, sql);
|
||||
} else if (tab.resultAutoSave) {
|
||||
captureDisplayedResultRun(tab, sql);
|
||||
}
|
||||
@@ -2458,16 +2477,21 @@ export const useQueryStore = defineStore("query", () => {
|
||||
function clearAcknowledgedCancelIfStillRunning(id: string, executionId: string) {
|
||||
setTimeout(() => {
|
||||
const current = tabs.value.find((t) => t.id === id);
|
||||
if (!current || current.executionId !== executionId || !current.isCancelling) return;
|
||||
if (!current || current.executionId !== executionId || !current.isCancelling) {
|
||||
pendingResultRunRestores.delete(executionId);
|
||||
return;
|
||||
}
|
||||
current.isExecuting = false;
|
||||
current.isCancelling = false;
|
||||
current.executionId = undefined;
|
||||
current.queryExecutionStartedAt = undefined;
|
||||
current.result = toErrorResult(new Error("Query canceled"));
|
||||
current.results = undefined;
|
||||
current.activeResultIndex = undefined;
|
||||
current.resultSessionId = undefined;
|
||||
touchResult(current);
|
||||
if (!restorePendingResultRun(current, executionId)) {
|
||||
current.result = toErrorResult(new Error("Query canceled"));
|
||||
current.results = undefined;
|
||||
current.activeResultIndex = undefined;
|
||||
current.resultSessionId = undefined;
|
||||
touchResult(current);
|
||||
}
|
||||
}, CANCEL_ACK_SETTLE_TIMEOUT_MS);
|
||||
}
|
||||
|
||||
@@ -2478,7 +2502,7 @@ export const useQueryStore = defineStore("query", () => {
|
||||
await executeCurrentSql(tab.sql);
|
||||
}
|
||||
|
||||
async function executeCurrentSql(sql: string, options?: { skipRedisSafetyCheck?: boolean; sourceOffset?: number }) {
|
||||
async function executeCurrentSql(sql: string, options?: { skipRedisSafetyCheck?: boolean; sourceOffset?: number; openInNewResultTab?: boolean }) {
|
||||
if (!activeTabId.value) return;
|
||||
const tab = tabs.value.find((item) => item.id === activeTabId.value);
|
||||
if (tab?.mode === "query") {
|
||||
@@ -2488,7 +2512,7 @@ export const useQueryStore = defineStore("query", () => {
|
||||
tab.resultSortMode = undefined;
|
||||
tab.resultSortedSql = undefined;
|
||||
}
|
||||
await executeTabSql(activeTabId.value, sql, { resultBaseSql: sql, resultSortedSql: undefined, ...options });
|
||||
return await executeTabSql(activeTabId.value, sql, { resultBaseSql: sql, resultSortedSql: undefined, ...options });
|
||||
}
|
||||
|
||||
type QueryMetadataPatch = Pick<QueryTab, "queryAnalysis" | "querySourceColumns" | "queryEditabilityReason" | "tableMeta">;
|
||||
@@ -2981,11 +3005,17 @@ export const useQueryStore = defineStore("query", () => {
|
||||
sourceOffset?: number;
|
||||
sourceTraceId?: string;
|
||||
skipEnsureConnected?: boolean;
|
||||
openInNewResultTab?: boolean;
|
||||
},
|
||||
) {
|
||||
const tab = tabs.value.find((t) => t.id === id);
|
||||
if (!tab || !sql.trim()) return;
|
||||
|
||||
const openInNewResultTab = tab.mode === "query" && options?.openInNewResultTab === true;
|
||||
if (openInNewResultTab && tab.activeResultRunId && !tab.result) {
|
||||
await setActiveResultRun(id, tab.activeResultRunId);
|
||||
if (tabs.value.find((item) => item.id === id) !== tab) return false;
|
||||
}
|
||||
const executionId = uuid();
|
||||
const executionEditorFingerprint = tab.mode === "query" ? sqlTextFingerprint(tab.sql) : undefined;
|
||||
const traceId = executionId.slice(0, 8);
|
||||
@@ -2997,11 +3027,19 @@ export const useQueryStore = defineStore("query", () => {
|
||||
tab.queryExecutionStartedAt = Date.now();
|
||||
}
|
||||
tab.executionId = executionId;
|
||||
const previousDisplayedSql = tab.resultBaseSql ?? tab.lastExecutedSql ?? tab.sql;
|
||||
tab.lastExecutedSql = sql;
|
||||
tab.resultLocalSortOriginalRows = undefined;
|
||||
tab.resultLocalSortOriginalMongoDocuments = undefined;
|
||||
tab.resultLocalSortOriginalMongoCopyDocuments = undefined;
|
||||
const updateActiveResultRun = !!tab.activeResultRunId && options?.preserveResultDuringExecution === true;
|
||||
if (openInNewResultTab && tab.result && !tab.activeResultRunId) {
|
||||
captureDisplayedResultRun(tab, previousDisplayedSql);
|
||||
}
|
||||
if (openInNewResultTab && tab.activeResultRunId) {
|
||||
pendingResultRunRestores.set(executionId, tab.activeResultRunId);
|
||||
}
|
||||
const preserveResultDuringExecution = options?.preserveResultDuringExecution === true || (tab.mode === "query" && !!tab.activeResultRunId && !tab.resultAutoSave && !openInNewResultTab);
|
||||
const updateActiveResultRun = !!tab.activeResultRunId && preserveResultDuringExecution;
|
||||
if (!updateActiveResultRun) {
|
||||
tab.activeResultRunId = undefined;
|
||||
}
|
||||
@@ -3010,8 +3048,8 @@ export const useQueryStore = defineStore("query", () => {
|
||||
}
|
||||
tab.resultTotalRowCountLoading = false;
|
||||
const previousResultSessionClose = closeResultSession(tab, options?.pagination?.sessionId);
|
||||
if (!options?.preserveResultDuringExecution || !tab.result) {
|
||||
clearResultPayload(tab);
|
||||
if (!preserveResultDuringExecution || !tab.result) {
|
||||
clearResultPayload(tab, { preserveCacheSnapshot: openInNewResultTab && pendingResultRunRestores.has(executionId) });
|
||||
}
|
||||
queryExecutionLog("info", "start", {
|
||||
traceId,
|
||||
@@ -3030,6 +3068,8 @@ export const useQueryStore = defineStore("query", () => {
|
||||
let pageOffset: number | undefined;
|
||||
let countSql: string | undefined;
|
||||
let useAgentResultSession = false;
|
||||
let executionDispatched = false;
|
||||
let producedResult = false;
|
||||
try {
|
||||
await waitForTabSessionReset(id);
|
||||
const connStore = useConnectionStore();
|
||||
@@ -3068,7 +3108,7 @@ export const useQueryStore = defineStore("query", () => {
|
||||
.split("\n")
|
||||
.map((line) => line.trim())
|
||||
.filter((line) => line.length > 0);
|
||||
if (commands.length === 0) return;
|
||||
if (commands.length === 0) return false;
|
||||
queryExecutionLog("info", "redis:start", { traceId, db: currentDb, commandCount: commands.length, sqlLength: sql.length });
|
||||
|
||||
const allResults: QueryResult[] = [];
|
||||
@@ -3097,6 +3137,7 @@ export const useQueryStore = defineStore("query", () => {
|
||||
|
||||
const current = tabs.value.find((t) => t.id === id);
|
||||
if (current?.executionId === executionId) {
|
||||
if (openInNewResultTab && current.isCancelling && restorePendingResultRun(current, executionId)) return false;
|
||||
if (allResults.length > 1) {
|
||||
const activeResultIndex = allResults.findIndex((r) => !r.columns.includes("Error"));
|
||||
const resultIndex = preservedResultIndex(allResults, current.activeResultIndex, options?.preserveActiveResultIndex) ?? (activeResultIndex >= 0 ? activeResultIndex : 0);
|
||||
@@ -3108,6 +3149,7 @@ export const useQueryStore = defineStore("query", () => {
|
||||
current.activeResultIndex = undefined;
|
||||
current.result = allResults[0];
|
||||
}
|
||||
producedResult = current.result !== undefined;
|
||||
touchResult(current);
|
||||
current.queryAnalysis = undefined;
|
||||
current.querySourceColumns = undefined;
|
||||
@@ -3116,7 +3158,7 @@ export const useQueryStore = defineStore("query", () => {
|
||||
current.tableMeta = undefined;
|
||||
current.resultBaseSql = options?.resultBaseSql ?? sql;
|
||||
current.resultSortedSql = options?.resultSortedSql;
|
||||
syncDisplayedResultRun(current, options?.resultBaseSql ?? sql);
|
||||
syncDisplayedResultRun(current, options?.resultBaseSql ?? sql, openInNewResultTab);
|
||||
// Reflect db switches from SELECT N in the tab so the toolbar dropdown, tab title and
|
||||
// sidebar stay in sync with the command's effective db.
|
||||
if (current.database !== String(currentDb)) {
|
||||
@@ -3129,7 +3171,7 @@ export const useQueryStore = defineStore("query", () => {
|
||||
if (hadMutatingCommand) {
|
||||
void connStore.refreshRedisDbKeyCounts(tab.connectionId);
|
||||
}
|
||||
return;
|
||||
return producedResult;
|
||||
}
|
||||
|
||||
if (conn?.db_type === "mongodb" && mongoCommands.length === 0 && sql.trim()) {
|
||||
@@ -3396,6 +3438,7 @@ export const useQueryStore = defineStore("query", () => {
|
||||
|
||||
const current = tabs.value.find((t) => t.id === id);
|
||||
if (current?.executionId === executionId) {
|
||||
if (openInNewResultTab && current.isCancelling && restorePendingResultRun(current, executionId)) return false;
|
||||
const activeGroupIndex = current.activeResultIndex;
|
||||
const activeGroupResults = current.results;
|
||||
const shouldReplaceActiveResultInGroup = options?.replaceActiveResultInGroup === true && allResults.length === 1 && Array.isArray(activeGroupResults) && typeof activeGroupIndex === "number" && activeGroupIndex >= 0 && activeGroupIndex < activeGroupResults.length;
|
||||
@@ -3416,6 +3459,7 @@ export const useQueryStore = defineStore("query", () => {
|
||||
current.activeResultIndex = undefined;
|
||||
current.result = allResults[0];
|
||||
}
|
||||
producedResult = current.result !== undefined;
|
||||
touchResult(current);
|
||||
current.queryAnalysis = undefined;
|
||||
current.querySourceColumns = undefined;
|
||||
@@ -3424,10 +3468,10 @@ export const useQueryStore = defineStore("query", () => {
|
||||
current.tableMeta = undefined;
|
||||
current.resultBaseSql = shouldReplaceActiveResultInGroup ? (current.resultBaseSql ?? options?.resultBaseSql ?? sql) : (options?.resultBaseSql ?? sql);
|
||||
current.resultSortedSql = options?.resultSortedSql;
|
||||
syncDisplayedResultRun(current, current.resultBaseSql ?? options?.resultBaseSql ?? sql);
|
||||
syncDisplayedResultRun(current, current.resultBaseSql ?? options?.resultBaseSql ?? sql, openInNewResultTab);
|
||||
if (current.database !== currentDatabase) current.database = currentDatabase;
|
||||
}
|
||||
return;
|
||||
return producedResult;
|
||||
}
|
||||
|
||||
const elasticsearchRequests = elasticsearchRestRequestRanges(sqlToExecute, effectiveDbType);
|
||||
@@ -3464,12 +3508,14 @@ export const useQueryStore = defineStore("query", () => {
|
||||
elapsed: elapsed(),
|
||||
});
|
||||
const current = tabs.value.find((item) => item.id === id);
|
||||
if (current?.executionId === executionId && openInNewResultTab && current.isCancelling && restorePendingResultRun(current, executionId)) return false;
|
||||
if (current?.executionId === executionId && allResults.length > 0) {
|
||||
const errorResultIndex = allResults.findIndex((result) => result.columns.includes("Error") || elasticsearchHttpErrorStatus(result) !== undefined);
|
||||
const resultIndex = errorResultIndex >= 0 ? errorResultIndex : 0;
|
||||
current.results = allResults.length > 1 ? allResults : undefined;
|
||||
current.activeResultIndex = allResults.length > 1 ? resultIndex : undefined;
|
||||
current.result = allResults[resultIndex];
|
||||
producedResult = current.result !== undefined;
|
||||
touchResult(current);
|
||||
current.queryAnalysis = undefined;
|
||||
current.querySourceColumns = undefined;
|
||||
@@ -3478,9 +3524,9 @@ export const useQueryStore = defineStore("query", () => {
|
||||
current.tableMeta = undefined;
|
||||
current.resultBaseSql = options?.resultBaseSql ?? sql;
|
||||
current.resultSortedSql = undefined;
|
||||
syncDisplayedResultRun(current, current.resultBaseSql);
|
||||
syncDisplayedResultRun(current, current.resultBaseSql, openInNewResultTab);
|
||||
}
|
||||
return;
|
||||
return producedResult;
|
||||
}
|
||||
|
||||
if (tab.mode === "query") {
|
||||
@@ -3533,6 +3579,7 @@ export const useQueryStore = defineStore("query", () => {
|
||||
queryExecutionLog("info", "begin-manual-txn:done", { traceId, txnSessionId: tab.txnSessionId, elapsed: elapsed() });
|
||||
}
|
||||
queryExecutionLog("info", "execute-in-txn:invoke", { traceId, txnSessionId: tab.txnSessionId, elapsed: elapsed() });
|
||||
executionDispatched = true;
|
||||
executionPromise = api.executeInManualTransaction(tab.txnSessionId, sqlToExecute, executionDatabase, executionSchema, pageLimit);
|
||||
} else {
|
||||
queryExecutionLog("info", "execute-multi:start", { traceId, elapsed: elapsed() });
|
||||
@@ -3563,6 +3610,7 @@ export const useQueryStore = defineStore("query", () => {
|
||||
optionKeys: Object.keys(executionOptions),
|
||||
clientSession: Boolean(clientSessionId),
|
||||
});
|
||||
executionDispatched = true;
|
||||
executionPromise = api.executeMulti(tab.connectionId, executionDatabase, sqlToExecute, executionSchema, executionId, executionOptions);
|
||||
}
|
||||
const results = annotateQueryResultSources(markQueryResultsRowsRaw(await withFrontendQueryTimeout(executionPromise, frontendTimeoutSecs, t("editor.queryTimeoutError", { seconds: frontendTimeoutSecs }))), queryBaseSql, sourceLabelDatabase, effectiveDbType, options?.sourceOffset);
|
||||
@@ -3583,6 +3631,7 @@ export const useQueryStore = defineStore("query", () => {
|
||||
});
|
||||
const current = tabs.value.find((t) => t.id === id);
|
||||
if (current?.executionId === executionId) {
|
||||
if (openInNewResultTab && current.isCancelling && restorePendingResultRun(current, executionId)) return false;
|
||||
if (successfulOracleSchemaChanges > 0) {
|
||||
current.completionContextVersion = (current.completionContextVersion ?? 0) + successfulOracleSchemaChanges;
|
||||
}
|
||||
@@ -3617,6 +3666,7 @@ export const useQueryStore = defineStore("query", () => {
|
||||
current.activeResultIndex = undefined;
|
||||
current.result = results[0];
|
||||
}
|
||||
producedResult = current.result !== undefined;
|
||||
current.resultBaseSql = shouldReplaceActiveResultInGroup ? (current.resultBaseSql ?? queryBaseSql) : queryBaseSql;
|
||||
current.resultEditorFingerprint = shouldReplaceActiveResultInGroup ? (current.resultEditorFingerprint ?? executionEditorFingerprint) : executionEditorFingerprint;
|
||||
current.resultSortedSql = resultSortedSql;
|
||||
@@ -3662,7 +3712,7 @@ export const useQueryStore = defineStore("query", () => {
|
||||
totalRowCountResolved = true;
|
||||
}
|
||||
touchResult(current);
|
||||
syncDisplayedResultRun(current, queryBaseSql);
|
||||
syncDisplayedResultRun(current, queryBaseSql, openInNewResultTab);
|
||||
if (!options?.appendResult && !totalRowCountResolved && (current.mode === "query" || current.mode === "data") && current.result) {
|
||||
countQueryTotalRowsInBackground({
|
||||
tabId: id,
|
||||
@@ -3719,11 +3769,15 @@ export const useQueryStore = defineStore("query", () => {
|
||||
}
|
||||
const current = tabs.value.find((t) => t.id === id);
|
||||
if (current?.executionId === executionId) {
|
||||
if (options?.appendResult && current.result) {
|
||||
const restoredRetainedResult = openInNewResultTab && (current.isCancelling || !executionDispatched) && restorePendingResultRun(current, executionId);
|
||||
if (restoredRetainedResult) {
|
||||
queryExecutionLog("info", "retained-result:restored-after-abort", { traceId, elapsed: elapsed() });
|
||||
return false;
|
||||
} else if (options?.appendResult && current.result) {
|
||||
// A failed background segment must not replace the visible result or
|
||||
// silently invalidate pending edits. The next explicit refresh can retry.
|
||||
queryExecutionLog("warn", "append-result:preserved-after-error", { traceId, elapsed: elapsed() });
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
const errorResult = toErrorResult(e);
|
||||
const activeGroupIndex = current.activeResultIndex;
|
||||
@@ -3753,17 +3807,24 @@ export const useQueryStore = defineStore("query", () => {
|
||||
current.resultTotalRowCount = undefined;
|
||||
current.resultTotalRowCountLoading = false;
|
||||
touchResult(current);
|
||||
syncDisplayedResultRun(current, queryBaseSql);
|
||||
producedResult = true;
|
||||
syncDisplayedResultRun(current, queryBaseSql, openInNewResultTab);
|
||||
}
|
||||
} finally {
|
||||
const current = tabs.value.find((t) => t.id === id);
|
||||
if (current?.executionId === executionId) {
|
||||
if (openInNewResultTab && !current.activeResultRunId) {
|
||||
restorePendingResultRun(current, executionId);
|
||||
} else {
|
||||
pendingResultRunRestores.delete(executionId);
|
||||
}
|
||||
current.isExecuting = false;
|
||||
current.isCancelling = false;
|
||||
current.queryExecutionStartedAt = undefined;
|
||||
current.executionId = undefined;
|
||||
queryExecutionLog("info", "finish", { traceId, elapsed: elapsed() });
|
||||
} else {
|
||||
pendingResultRunRestores.delete(executionId);
|
||||
queryExecutionLog("warn", "finish-stale", {
|
||||
traceId,
|
||||
currentExecutionId: current?.executionId,
|
||||
@@ -3772,6 +3833,7 @@ export const useQueryStore = defineStore("query", () => {
|
||||
}
|
||||
}
|
||||
scheduleResultCacheTrim();
|
||||
return producedResult;
|
||||
}
|
||||
|
||||
async function explainTabSql(id: string, sql: string, databaseType?: DatabaseType, explainMode?: string) {
|
||||
@@ -4118,6 +4180,7 @@ export const useQueryStore = defineStore("query", () => {
|
||||
if (!canceled) {
|
||||
const current = tabs.value.find((t) => t.id === id);
|
||||
if (current && current.executionId === executionId) {
|
||||
restorePendingResultRun(current, executionId);
|
||||
current.isExecuting = false;
|
||||
current.isCancelling = false;
|
||||
current.executionId = undefined;
|
||||
@@ -4130,9 +4193,16 @@ export const useQueryStore = defineStore("query", () => {
|
||||
if (tab) useConnectionStore().recordConnectionLostError(tab.connectionId, e);
|
||||
const current = tabs.value.find((t) => t.id === id);
|
||||
if (current && current.executionId === executionId) {
|
||||
// 复用 setErrorResult 的完整清理:分组结果不清空的话,错误结果不会展示,
|
||||
// 估算值也会继续按旧的 results 计算
|
||||
setErrorResult(id, e);
|
||||
if (restorePendingResultRun(current, executionId)) {
|
||||
current.isExecuting = false;
|
||||
current.isCancelling = false;
|
||||
current.queryExecutionStartedAt = undefined;
|
||||
current.executionId = undefined;
|
||||
} else {
|
||||
// 复用 setErrorResult 的完整清理:分组结果不清空的话,错误结果不会展示,
|
||||
// 估算值也会继续按旧的 results 计算
|
||||
setErrorResult(id, e);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} finally {
|
||||
|
||||
@@ -311,6 +311,8 @@ const DATA_GRID_RENDER_MODES = ["dom", "canvas"] as const;
|
||||
export type DataGridRenderMode = (typeof DATA_GRID_RENDER_MODES)[number];
|
||||
const DATA_GRID_SEARCH_MODES = ["filter", "highlight"] as const;
|
||||
export type DataGridSearchMode = (typeof DATA_GRID_SEARCH_MODES)[number];
|
||||
const RESULT_RUN_DISPLAY_MODES = ["tabs", "list"] as const;
|
||||
export type ResultRunDisplayMode = (typeof RESULT_RUN_DISPLAY_MODES)[number];
|
||||
export const TABLE_FONT_SIZE_MIN = 8;
|
||||
export const TABLE_FONT_SIZE_MAX = 16;
|
||||
export const TABLE_FONT_SIZE_DEFAULT = 13;
|
||||
@@ -418,6 +420,7 @@ export interface EditorSettings {
|
||||
dataGridQuickEntry: boolean;
|
||||
dataGridRenderMode: DataGridRenderMode;
|
||||
dataGridSearchMode: DataGridSearchMode;
|
||||
resultRunDisplayMode: ResultRunDisplayMode;
|
||||
dataGridAutoTransposeSingleRow: boolean;
|
||||
dataGridMultiRowTranspose: boolean;
|
||||
dataGridHideNullColumns: boolean;
|
||||
@@ -582,6 +585,7 @@ export const DEFAULT_EDITOR_SETTINGS: EditorSettings = {
|
||||
dataGridQuickEntry: false,
|
||||
dataGridRenderMode: "canvas",
|
||||
dataGridSearchMode: "filter",
|
||||
resultRunDisplayMode: "tabs",
|
||||
dataGridAutoTransposeSingleRow: false,
|
||||
dataGridMultiRowTranspose: false,
|
||||
dataGridHideNullColumns: false,
|
||||
@@ -674,6 +678,10 @@ function normalizeDataGridSearchMode(value: unknown): DataGridSearchMode {
|
||||
return DATA_GRID_SEARCH_MODES.includes(value as DataGridSearchMode) ? (value as DataGridSearchMode) : DEFAULT_EDITOR_SETTINGS.dataGridSearchMode;
|
||||
}
|
||||
|
||||
function normalizeResultRunDisplayMode(value: unknown): ResultRunDisplayMode {
|
||||
return RESULT_RUN_DISPLAY_MODES.includes(value as ResultRunDisplayMode) ? (value as ResultRunDisplayMode) : DEFAULT_EDITOR_SETTINGS.resultRunDisplayMode;
|
||||
}
|
||||
|
||||
function normalizeTableFontSize(value: unknown): number {
|
||||
if (typeof value !== "number" || !Number.isFinite(value)) return TABLE_FONT_SIZE_DEFAULT;
|
||||
return Math.min(TABLE_FONT_SIZE_MAX, Math.max(TABLE_FONT_SIZE_MIN, Math.round(value)));
|
||||
@@ -861,6 +869,7 @@ export function normalizeEditorSettings(settings: Partial<EditorSettings>, exist
|
||||
dataGridQuickEntry: settings.dataGridQuickEntry ?? DEFAULT_EDITOR_SETTINGS.dataGridQuickEntry,
|
||||
dataGridRenderMode: normalizeDataGridRenderMode(settings.dataGridRenderMode),
|
||||
dataGridSearchMode: normalizeDataGridSearchMode(settings.dataGridSearchMode),
|
||||
resultRunDisplayMode: normalizeResultRunDisplayMode(settings.resultRunDisplayMode),
|
||||
dataGridAutoTransposeSingleRow: settings.dataGridAutoTransposeSingleRow === true,
|
||||
dataGridMultiRowTranspose: settings.dataGridMultiRowTranspose === true,
|
||||
dataGridHideNullColumns: settings.dataGridHideNullColumns === true,
|
||||
@@ -1233,6 +1242,7 @@ export const useSettingsStore = defineStore("settings", () => {
|
||||
if (partial.dataGridQuickEntry !== undefined) editorSettings.value.dataGridQuickEntry = partial.dataGridQuickEntry;
|
||||
if (partial.dataGridRenderMode !== undefined) editorSettings.value.dataGridRenderMode = normalizeDataGridRenderMode(partial.dataGridRenderMode);
|
||||
if (partial.dataGridSearchMode !== undefined) editorSettings.value.dataGridSearchMode = normalizeDataGridSearchMode(partial.dataGridSearchMode);
|
||||
if (partial.resultRunDisplayMode !== undefined) editorSettings.value.resultRunDisplayMode = normalizeResultRunDisplayMode(partial.resultRunDisplayMode);
|
||||
if (partial.dataGridAutoTransposeSingleRow !== undefined) editorSettings.value.dataGridAutoTransposeSingleRow = partial.dataGridAutoTransposeSingleRow === true;
|
||||
if (partial.dataGridMultiRowTranspose !== undefined) editorSettings.value.dataGridMultiRowTranspose = partial.dataGridMultiRowTranspose === true;
|
||||
if (partial.dataGridHideNullColumns !== undefined) editorSettings.value.dataGridHideNullColumns = partial.dataGridHideNullColumns === true;
|
||||
|
||||
Reference in new issue
Block a user