Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

chore(lint): resolve vue binding shadowing and cap lint warnings

HARRISON4b7fc6d64528
diff --git a/apps/desktop/src/components/grid/DataGrid.vue b/apps/desktop/src/components/grid/DataGrid.vue
index fb58309aef..02c5eddf26 100644
--- a/apps/desktop/src/components/grid/DataGrid.vue
+++ b/apps/desktop/src/components/grid/DataGrid.vue
@@ -949,7 +949,7 @@ function currentColumnSortState(): DataGridColumnSortState {
column: sortCol.value,
columnIndex: sortColIndex.value,
direction: sortDir.value,
- mode: sortMode.value,
+ mode: localSortMode.value,
};
}
@@ -1122,7 +1122,7 @@ const previewDialogConfig = shallowRef<{
const transposeScrollRef = ref<HTMLElement | { $el?: HTMLElement }>();
const transposeScrollLeft = ref(0);
const transposeViewportWidth = ref(0);
-const { sortColumn: sortCol, sortColumnIndex: sortColIndex, sortDirection: sortDir, sortMode, setSort, clearSort } = useDataGridSort();
+const { sortColumn: sortCol, sortColumnIndex: sortColIndex, sortDirection: sortDir, sortMode: localSortMode, setSort, clearSort } = useDataGridSort();
const queryControlsRef = ref<InstanceType<typeof DataGridQueryControls>>();
const searchBarRef = ref<{ focus: (select?: boolean) => void } | null>(null);
const replaceOpen = ref(false);
@@ -3783,7 +3783,7 @@ function currentWhereInput(): string | undefined {
}
function effectiveOrderBy(): string | undefined {
- const columnOrderBy = sortMode.value === "database" && sortCol.value ? `${queryColumnRef(sortCol.value)} ${sortDir.value.toUpperCase()}` : undefined;
+ const columnOrderBy = localSortMode.value === "database" && sortCol.value ? `${queryColumnRef(sortCol.value)} ${sortDir.value.toUpperCase()}` : undefined;
const manualOrderBy = orderByInput.value.trim() || columnOrderBy;
return combineDataGridOrderByInputs(manualOrderBy, appliedStructuredOrderByInput.value);
}
@@ -3843,7 +3843,7 @@ watch(
const previousOrderWasControlled = previous?.[3] === "database" && simpleDataGridOrderByMatchesSort(orderByInput.value, previous[0], previous[2]);
const isControlledSort = !!column && !!direction;
setSort(column && direction ? column : null, typeof columnIndex === "number" && direction ? columnIndex : null, direction ?? "asc", mode ?? "database");
- if (isControlledSort && sortMode.value === "database") {
+ if (isControlledSort && localSortMode.value === "database") {
syncOrderByInputWithSort(sortCol.value, sortDir.value);
} else if (previousOrderWasControlled) {
syncOrderByInputWithSort(null, null);
@@ -7238,7 +7238,7 @@ function applyColumnSort(column: string, columnIndex: number, direction: "asc" |
function selectHeaderSort(value: string, column: string, columnIndex: number) {
if (value === "clear") {
- applyColumnSort(column, columnIndex, null, sortMode.value);
+ applyColumnSort(column, columnIndex, null, localSortMode.value);
return;
}
const [mode, direction] = value.split("-") as [DataGridSortMode, DataGridSortDirection];
@@ -13581,7 +13581,7 @@ const gridContextMenuItems = computed<ContextMenuItem[]>(() => {
canCopyAlterSql: canCopyAlterColumnSql.value,
canFilter: canUseWhereSearch.value,
hasSort: !!sortCol.value,
- sortMode: sortMode.value,
+ sortMode: localSortMode.value,
databaseSortEnabled: props.databaseSortEnabled !== false && databaseSortSupportedForDatabase(resolvedDatabaseType.value),
frozenColumnCount: frozenColumnCount.value,
contextVisibleColIdx: contextHeaderVisibleColIdx.value ?? undefined,
diff --git a/apps/desktop/src/components/layout/SqlEditorWorkspace.vue b/apps/desktop/src/components/layout/SqlEditorWorkspace.vue
index 331d61b48c..598f88bd2f 100644
--- a/apps/desktop/src/components/layout/SqlEditorWorkspace.vue
+++ b/apps/desktop/src/components/layout/SqlEditorWorkspace.vue
@@ -58,7 +58,7 @@ const surfaceProps = computed(() => ({
}));
const contentEmits = createContentSurfaceEventForwarders(emit);
const editorGroupBindings = computed(() => ({ ...surfaceProps.value, ...contentEmits }));
-const resultSurfaceBindings = computed(() => ({ ...surfaceProps.value, ...contentEmits, activeTab: activeTab.value! }));
+const resultSurfaceBindings = computed(() => ({ ...surfaceProps.value, ...contentEmits, activeTab: activeQueryTab.value! }));
defineExpose({
focusSearch: (target: Element | null = null) => {
@@ -141,9 +141,9 @@ function setTabBarTarget(groupId: string, element: unknown) {
if (element instanceof HTMLElement) workspaceTabBarPortal.targets.set(groupId, element);
else workspaceTabBarPortal.targets.delete(groupId);
}
-const activeTab = computed(() => queryStore.tabs.find((tab) => tab.id === queryStore.activeTabId));
-const showSharedResult = computed(() => activeTab.value?.mode === "query");
-const hasSharedOutput = computed(() => showSharedResult.value && hasQueryOutput(activeTab.value));
+const activeQueryTab = computed(() => queryStore.tabs.find((tab) => tab.id === queryStore.activeTabId));
+const showSharedResult = computed(() => activeQueryTab.value?.mode === "query");
+const hasSharedOutput = computed(() => showSharedResult.value && hasQueryOutput(activeQueryTab.value));
const SHARED_RESULT_PANE_MIN_SIZE = 12;
const SHARED_RESULT_PANE_MAX_SIZE = 80;
@@ -152,9 +152,9 @@ const SHARED_RESULT_PANE_STORAGE_KEY = "dbx-shared-results-pane-size";
const storedResultPaneSize = Number(safeLocalStorageGet(SHARED_RESULT_PANE_STORAGE_KEY));
const resultPaneSize = ref(Number.isFinite(storedResultPaneSize) && storedResultPaneSize >= SHARED_RESULT_PANE_MIN_SIZE && storedResultPaneSize <= SHARED_RESULT_PANE_MAX_SIZE ? storedResultPaneSize : SHARED_RESULT_PANE_DEFAULT_SIZE);
const showResultPane = computed({
- get: () => activeTab.value?.uiState?.resultPaneOpen ?? true,
+ get: () => activeQueryTab.value?.uiState?.resultPaneOpen ?? true,
set: (open: boolean) => {
- const tab = activeTab.value;
+ const tab = activeQueryTab.value;
if (tab?.mode === "query") queryStore.updateTabUiState(tab.id, { resultPaneOpen: open });
},
});
@@ -184,7 +184,7 @@ function toggleSharedResultsPane(): boolean {
// behavior (see issue #6193): a collapsed shared pane comes back when the
// active tab starts executing.
watch(
- () => [activeTab.value?.id, activeTab.value?.isExecuting, activeTab.value?.isExplaining] as const,
+ () => [activeQueryTab.value?.id, activeQueryTab.value?.isExecuting, activeQueryTab.value?.isExplaining] as const,
([, isExecuting, isExplaining]) => {
if (isExecuting || isExplaining) showResultPane.value = true;
},
diff --git a/apps/desktop/src/components/layout/StartupLoading.vue b/apps/desktop/src/components/layout/StartupLoading.vue
index 93d8f782f6..c80be598b3 100644
--- a/apps/desktop/src/components/layout/StartupLoading.vue
+++ b/apps/desktop/src/components/layout/StartupLoading.vue
@@ -4,7 +4,7 @@ import { useI18n } from "vue-i18n";
const props = defineProps<{ label?: string; error?: unknown; retry?: () => void }>();
const { t } = useI18n();
-function retry() {
+function handleRetry() {
if (props.retry) props.retry();
else window.location.reload();
}
@@ -15,7 +15,7 @@ function retry() {
<span class="text-xl font-semibold tracking-tight" aria-hidden="true">DBX</span>
<span v-if="!error" class="startup-spinner" aria-hidden="true" />
<p class="text-sm text-muted-foreground">{{ label || t(error ? "startup.loadFailed" : "startup.loading") }}</p>
- <button v-if="error" class="rounded border border-border px-4 py-2 text-sm hover:bg-muted focus-visible:outline focus-visible:outline-2 focus-visible:outline-ring" @click="retry">{{ t("common.retry") }}</button>
+ <button v-if="error" class="rounded border border-border px-4 py-2 text-sm hover:bg-muted focus-visible:outline focus-visible:outline-2 focus-visible:outline-ring" @click="handleRetry">{{ t("common.retry") }}</button>
</div>
</template>
diff --git a/apps/desktop/src/components/mq/ProducerConsumerPanel.vue b/apps/desktop/src/components/mq/ProducerConsumerPanel.vue
index baf1fbb39c..e701748ef2 100644
--- a/apps/desktop/src/components/mq/ProducerConsumerPanel.vue
+++ b/apps/desktop/src/components/mq/ProducerConsumerPanel.vue
@@ -45,7 +45,7 @@ interface PartitionClientRow {
const producers = ref<ProducerInfo[]>([]);
const subscriptions = ref<SubscriptionInfo[]>([]);
const stats = ref<TopicStats>();
-const selectedSubscription = ref("");
+const activeSubscription = ref("");
const selectedPartitionName = ref("");
const loading = ref(false);
const unloading = ref(false);
@@ -181,7 +181,7 @@ async function loadRocketMqProducers(current: TopicRef, loadSeq: number, current
if (!isRuntimeLoadCurrent(loadSeq, currentKey)) return;
stats.value = undefined;
subscriptions.value = [];
- selectedSubscription.value = "";
+ activeSubscription.value = "";
selectedPartitionName.value = "";
}
@@ -193,8 +193,8 @@ const selectedPartition = computed(() => {
return partitionRows.value.find((row) => row.name === selectedPartitionName.value) ?? partitionRows.value[0];
});
const subscriptionOptions = computed(() => mergeSubscriptionOptions(subscriptions.value, partitionRows.value));
-const selectedPartitionSubscription = computed(() => selectedPartition.value?.subscriptions.find((sub) => sub.name === selectedSubscription.value));
-const aggregateConsumers = computed(() => subscriptions.value.find((sub) => sub.name === selectedSubscription.value)?.consumers ?? []);
+const selectedPartitionSubscription = computed(() => selectedPartition.value?.subscriptions.find((sub) => sub.name === activeSubscription.value));
+const aggregateConsumers = computed(() => subscriptions.value.find((sub) => sub.name === activeSubscription.value)?.consumers ?? []);
const displayedProducers = computed(() => selectedPartition.value?.producers ?? producers.value);
const displayedConsumers = computed(() => {
if (selectedPartition.value) return selectedPartitionSubscription.value?.consumers ?? [];
@@ -210,7 +210,7 @@ async function loadRuntimeClients() {
producers.value = [];
subscriptions.value = [];
stats.value = undefined;
- selectedSubscription.value = "";
+ activeSubscription.value = "";
selectedPartitionName.value = "";
loading.value = false;
error.value = undefined;
@@ -225,7 +225,7 @@ async function loadRuntimeClients() {
producers.value = await mqListProducers(props.connectionId, current);
subscriptions.value = await mqListSubscriptions(props.connectionId, current);
stats.value = undefined;
- selectedSubscription.value = props.selectedSubscription ?? subscriptions.value[0]?.name ?? "";
+ activeSubscription.value = props.selectedSubscription ?? subscriptions.value[0]?.name ?? "";
selectedPartitionName.value = "";
return;
}
@@ -247,7 +247,7 @@ async function loadRuntimeClients() {
if (!isRuntimeLoadCurrent(loadSeq, currentKey)) return;
const subscriptionChanged = syncSelectedSubscription();
syncSelectedPartition();
- if (selectedSubscription.value && !subscriptionChanged && !hasConsumersForSelectedSubscription()) {
+ if (activeSubscription.value && !subscriptionChanged && !hasConsumersForSelectedSubscription()) {
await loadSelectedSubscriptionConsumers({ retryIfEmpty: true });
if (!isRuntimeLoadCurrent(loadSeq, currentKey)) return;
syncSelectedPartition();
@@ -301,14 +301,14 @@ function formatOptionalBytes(value: number): string {
}
function syncSelectedSubscription(): boolean {
- const previous = selectedSubscription.value;
+ const previous = activeSubscription.value;
const options = subscriptionOptions.value;
if (props.selectedSubscription && options.some((sub) => sub.name === props.selectedSubscription)) {
- selectedSubscription.value = props.selectedSubscription;
- } else if (!options.some((sub) => sub.name === selectedSubscription.value)) {
- selectedSubscription.value = options[0]?.name ?? "";
+ activeSubscription.value = props.selectedSubscription;
+ } else if (!options.some((sub) => sub.name === activeSubscription.value)) {
+ activeSubscription.value = options[0]?.name ?? "";
}
- return previous !== selectedSubscription.value;
+ return previous !== activeSubscription.value;
}
function syncSelectedPartition() {
@@ -318,20 +318,20 @@ function syncSelectedPartition() {
return;
}
const current = rows.find((row) => row.name === selectedPartitionName.value);
- if (current?.subscriptions.some((sub) => sub.name === selectedSubscription.value)) return;
+ if (current?.subscriptions.some((sub) => sub.name === activeSubscription.value)) return;
- const withActiveConsumers = rows.find((row) => row.subscriptions.some((sub) => sub.name === selectedSubscription.value && sub.consumers.length > 0));
- const withSubscription = rows.find((row) => row.subscriptions.some((sub) => sub.name === selectedSubscription.value));
+ const withActiveConsumers = rows.find((row) => row.subscriptions.some((sub) => sub.name === activeSubscription.value && sub.consumers.length > 0));
+ const withSubscription = rows.find((row) => row.subscriptions.some((sub) => sub.name === activeSubscription.value));
selectedPartitionName.value = (withActiveConsumers ?? withSubscription ?? current ?? rows[0]).name;
}
function syncSelectedSubscriptionForPartition() {
const partition = selectedPartition.value;
if (!partition) return;
- if (selectedSubscription.value && partition.subscriptions.some((sub) => sub.name === selectedSubscription.value)) return;
+ if (activeSubscription.value && partition.subscriptions.some((sub) => sub.name === activeSubscription.value)) return;
const active = partition.subscriptions.find((sub) => sub.consumers.length > 0);
- selectedSubscription.value = (active ?? partition.subscriptions[0])?.name ?? selectedSubscription.value;
+ activeSubscription.value = (active ?? partition.subscriptions[0])?.name ?? activeSubscription.value;
}
interface LoadConsumersOptions {
@@ -340,7 +340,7 @@ interface LoadConsumersOptions {
async function loadSelectedSubscriptionConsumers(options: LoadConsumersOptions = {}): Promise<ConsumerInfo[]> {
const current = topicRef.value;
- const subscriptionName = selectedSubscription.value;
+ const subscriptionName = activeSubscription.value;
if (!current || !subscriptionName) return [];
const loadSeq = ++consumerLoadSeq;
@@ -365,7 +365,7 @@ function applySubscriptionConsumers(subscriptionName: string, consumers: Consume
}
function hasConsumersForSelectedSubscription(): boolean {
- return subscriptions.value.some((sub) => sub.name === selectedSubscription.value && sub.consumers.length > 0);
+ return subscriptions.value.some((sub) => sub.name === activeSubscription.value && sub.consumers.length > 0);
}
function topicRefKey(topic: TopicRef): string {
@@ -384,7 +384,7 @@ function isRuntimeLoadCurrent(loadSeq: number, topicKey: string): boolean {
}
function isConsumerLoadCurrent(loadSeq: number, topicKey: string, subscriptionName: string): boolean {
- return loadSeq === consumerLoadSeq && selectedSubscription.value === subscriptionName && isCurrentTopic(topicKey);
+ return loadSeq === consumerLoadSeq && activeSubscription.value === subscriptionName && isCurrentTopic(topicKey);
}
function isCurrentTopic(topicKey: string): boolean {
@@ -549,7 +549,7 @@ watch(
{ immediate: true },
);
-watch(selectedSubscription, () => {
+watch(activeSubscription, () => {
if (isProducersOnly.value) return;
syncSelectedPartition();
void loadSelectedSubscriptionConsumers({ retryIfEmpty: true }).catch((e: unknown) => {
@@ -565,7 +565,7 @@ watch(
() => props.selectedSubscription,
(subscription) => {
if (subscription && subscriptionOptions.value.some((sub) => sub.name === subscription)) {
- selectedSubscription.value = subscription;
+ activeSubscription.value = subscription;
}
},
);
@@ -700,7 +700,7 @@ watch(
<select v-if="!isKafkaStats && partitionRows.length" v-model="selectedPartitionName" :disabled="loading">
<option v-for="partition in partitionRows" :key="partition.name" :value="partition.name">{{ partition.shortName }}</option>
</select>
- <select v-model="selectedSubscription" :disabled="loading || !subscriptionOptions.length">
+ <select v-model="activeSubscription" :disabled="loading || !subscriptionOptions.length">
<option v-for="sub in subscriptionOptions" :key="sub.name" :value="sub.name">{{ sub.name }}</option>
</select>
</div>
@@ -721,7 +721,7 @@ watch(
</tr>
</thead>
<tbody>
- <tr v-for="consumer in displayedConsumers" :key="`${selectedScopeLabel}-${selectedSubscription}-${consumer.consumerName}-${consumer.address}`">
+ <tr v-for="consumer in displayedConsumers" :key="`${selectedScopeLabel}-${activeSubscription}-${consumer.consumerName}-${consumer.address}`">
<td>{{ consumer.consumerName || "-" }}</td>
<td>{{ consumer.address || "-" }}</td>
<td>{{ consumer.clientVersion || "-" }}</td>
diff --git a/apps/desktop/src/components/nacos/NacosConfigCodeViewer.vue b/apps/desktop/src/components/nacos/NacosConfigCodeViewer.vue
index 4d978cf4b2..8db3a1cf36 100644
--- a/apps/desktop/src/components/nacos/NacosConfigCodeViewer.vue
+++ b/apps/desktop/src/components/nacos/NacosConfigCodeViewer.vue
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { onBeforeUnmount, onMounted, ref, watch } from "vue";
import { EditorState } from "@codemirror/state";
-import { EditorView, lineNumbers } from "@codemirror/view";
+import { EditorView, lineNumbers as lineNumbersExtension } from "@codemirror/view";
import { basicSetup } from "codemirror";
import { useSettingsStore } from "@/stores/settingsStore";
import { useTheme } from "@/composables/useTheme";
@@ -47,7 +47,7 @@ async function mount() {
language,
theme,
editorFontTheme(EditorView, settingsStore.editorSettings.fontSize, settingsStore.editorSettings.fontFamily, { fixedHeight: true, scrollable: true }),
- ...(props.lineNumbers ? [lineNumbers()] : []),
+ ...(props.lineNumbers ? [lineNumbersExtension()] : []),
EditorState.readOnly.of(true),
EditorView.editable.of(false),
EditorView.theme({
diff --git a/apps/desktop/src/components/objects/OracleDatabaseLinksDialog.vue b/apps/desktop/src/components/objects/OracleDatabaseLinksDialog.vue
index 408dc62c19..ed47b99da5 100644
--- a/apps/desktop/src/components/objects/OracleDatabaseLinksDialog.vue
+++ b/apps/desktop/src/components/objects/OracleDatabaseLinksDialog.vue
@@ -25,7 +25,7 @@ const busy = ref(false);
const message = ref("");
const error = ref("");
const mode = ref<"create" | "alter" | "drop" | "">("");
-const name = ref("");
+const linkName = ref("");
const username = ref("");
const password = ref("");
const host = ref("");
@@ -80,7 +80,7 @@ function begin(next: "create" | "alter" | "drop") {
error.value = "";
message.value = "";
if (next === "create") {
- name.value = "";
+ linkName.value = "";
username.value = "";
host.value = "";
publicLink.value = false;
@@ -116,8 +116,8 @@ async function save() {
const sql =
mode.value === "create"
? oceanbase.value
- ? createOceanBaseDatabaseLinkSql({ name: name.value.trim(), username: username.value.trim(), password: password.value, host: host.value, public: publicLink.value, tenant: tenant.value, protocol: protocol.value, cluster: protocol.value === "OB" ? cluster.value : undefined })
- : createOracleDatabaseLinkSql({ name: name.value.trim(), username: username.value.trim(), password: password.value, host: host.value, public: publicLink.value })
+ ? createOceanBaseDatabaseLinkSql({ name: linkName.value.trim(), username: username.value.trim(), password: password.value, host: host.value, public: publicLink.value, tenant: tenant.value, protocol: protocol.value, cluster: protocol.value === "OB" ? cluster.value : undefined })
+ : createOracleDatabaseLinkSql({ name: linkName.value.trim(), username: username.value.trim(), password: password.value, host: host.value, public: publicLink.value })
: mode.value === "alter" && selected.value && !oceanbase.value
? alterOracleDatabaseLinkSql(selected.value, password.value)
: mode.value === "drop" && selected.value
@@ -212,7 +212,7 @@ async function test() {
</template>
<form v-if="mode" class="space-y-3 border-t pt-3" @submit.prevent="save">
<template v-if="mode === 'create'">
- <label class="block text-sm">{{ t("databaseLinks.name") }}<Input v-model="name" required autocomplete="off" /></label>
+ <label class="block text-sm">{{ t("databaseLinks.name") }}<Input v-model="linkName" required autocomplete="off" /></label>
<label class="block text-sm">{{ t("databaseLinks.username") }}<Input v-model="username" required autocomplete="off" /></label>
<label class="block text-sm">{{ t("databaseLinks.host") }}<Input v-model="host" required :placeholder="oceanbase ? 'host:2881 or host:1521/service' : '//host:1521/service'" autocomplete="off" /></label>
<template v-if="oceanbase">
diff --git a/apps/desktop/src/components/structure/__tests__/TableStructureEditor.mysqlGenerated.spec.ts b/apps/desktop/src/components/structure/__tests__/TableStructureEditor.mysqlGenerated.spec.ts
index a08daaf1e0..a79dcec7fc 100644
--- a/apps/desktop/src/components/structure/__tests__/TableStructureEditor.mysqlGenerated.spec.ts
+++ b/apps/desktop/src/components/structure/__tests__/TableStructureEditor.mysqlGenerated.spec.ts
@@ -260,7 +260,6 @@ function draftWithColumns(columns: ColumnSeed[]) {
name: column.name,
dataType: "int",
isNullable: true,
- defaultValue: "",
comment: "",
isPrimaryKey: false,
characterSet: "",
diff --git a/package.json b/package.json
index d5d63672b6..d1c8299bf0 100644
--- a/package.json
+++ b/package.json
@@ -41,7 +41,7 @@
"bench:sidebar-large-schema": "vitest bench apps/desktop/src/lib/sidebar/sidebarLargeSchema.bench.ts",
"bench:startup": "node --import tsx scripts/bench/startup-bundle.mjs",
"bench:table-import": "cargo run -p dbx-core --no-default-features --example table_import_bench --release --",
- "lint": "oxlint --vue-plugin apps/desktop/src",
+ "lint": "oxlint --vue-plugin apps/desktop/src --max-warnings=61",
"fmt": "oxfmt \"apps/desktop/src/**/*.{ts,vue}\"",
"pretest": "pnpm generate:connection-types",
"test": "vitest run",
diff --git a/scripts/run-check.mjs b/scripts/run-check.mjs
index 928ac82253..20eff890f2 100644
--- a/scripts/run-check.mjs
+++ b/scripts/run-check.mjs
@@ -16,7 +16,7 @@ const tasks = [
{
name: "lint",
command: "oxlint",
- args: ["--vue-plugin", "apps/desktop/src"],
+ args: ["--vue-plugin", "apps/desktop/src", "--max-warnings=61"],
},
{
name: "typecheck",