feat(nacos): restore config editor selection and scroll
This commit is contained in:
5 files changed
+302
-3
No files matched your search
@@ -2,7 +2,7 @@ import { defineStore } from "pinia";
|
||||
import { uuid } from "@/lib/common/utils";
|
||||
import { computed, markRaw, nextTick, onScopeDispose, reactive, ref, watch } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import type { BatchSqlExecution, ConnectionConfig, DatabaseType, IndexInfo, ObjectBrowserViewport, QueryResult, QueryResultSourceColumnRef, QueryTab, TableInfoTab, TableStructureEditorTarget } from "@/types/database";
|
||||
import type { BatchSqlExecution, ConnectionConfig, DatabaseType, IndexInfo, NacosConfigEditorViewport, ObjectBrowserViewport, QueryResult, QueryResultSourceColumnRef, QueryTab, TableInfoTab, TableStructureEditorTarget } from "@/types/database";
|
||||
import { orderPinnedFirst } from "@/lib/app/pinnedItems";
|
||||
import { canCancelQueryExecution } from "@/lib/sql/queryExecutionState";
|
||||
import { buildExplainSql, parseExplainResult, parseDamengExplainText, parseOracleExplainText, sqlServerExplainResult, type BuildExplainSqlResult } from "@/lib/diagram/explainPlan";
|
||||
@@ -3397,6 +3397,22 @@ export const useQueryStore = defineStore("query", () => {
|
||||
tab.objectBrowser = { ...tab.objectBrowser, viewport };
|
||||
}
|
||||
|
||||
function updateNacosConfigEditorViewport(connectionId: string, namespace: string, viewport: NacosConfigEditorViewport) {
|
||||
if (!Number.isFinite(viewport.scrollTop) || !Number.isFinite(viewport.scrollLeft)) return;
|
||||
const tab = tabs.value.find((candidate) => candidate.mode === "nacos" && candidate.connectionId === connectionId && (candidate.nacosNamespace || "") === namespace);
|
||||
if (!tab) return;
|
||||
const next = {
|
||||
...viewport,
|
||||
scrollTop: Math.max(0, Math.round(viewport.scrollTop)),
|
||||
scrollLeft: Math.max(0, Math.round(viewport.scrollLeft)),
|
||||
};
|
||||
const previous = tab.nacosConfigEditorViewport;
|
||||
if (previous?.namespace === next.namespace && previous.dataId === next.dataId && previous.group === next.group && previous.scrollTop === next.scrollTop && previous.scrollLeft === next.scrollLeft) {
|
||||
return;
|
||||
}
|
||||
tab.nacosConfigEditorViewport = next;
|
||||
}
|
||||
|
||||
function renameTab(id: string, title: string) {
|
||||
const trimmed = title.trim();
|
||||
if (!trimmed) return false;
|
||||
@@ -6977,6 +6993,7 @@ export const useQueryStore = defineStore("query", () => {
|
||||
updateEditorViewport,
|
||||
updateEditorSelection,
|
||||
updateObjectBrowserViewport,
|
||||
updateNacosConfigEditorViewport,
|
||||
setAutoCommit,
|
||||
commitTransaction,
|
||||
rollbackTransaction,
|
||||
|
||||
Reference in new issue
Block a user