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。

style: fix frontend formatting (oxfmt)

t8y21b8355e7e6e2
diff --git a/apps/desktop/src/components/editor/EditorSettingsDialog.vue b/apps/desktop/src/components/editor/EditorSettingsDialog.vue
index d7710fdb87..9dc60f3a7a 100644
--- a/apps/desktop/src/components/editor/EditorSettingsDialog.vue
+++ b/apps/desktop/src/components/editor/EditorSettingsDialog.vue
@@ -76,9 +76,7 @@ const systemFontsLoading = ref(false);
const systemFontsLoaded = ref(false);
// --- Snippet state ---
-const editSnippets = ref<SqlSnippet[]>(
- settingsStore.editorSettings.snippets.map((s) => ({ ...s })),
-);
+const editSnippets = ref<SqlSnippet[]>(settingsStore.editorSettings.snippets.map((s) => ({ ...s })));
const snippetDialogOpen = ref(false);
const snippetEditingId = ref<string | null>(null);
@@ -105,9 +103,7 @@ function saveSnippet() {
snippetFormPrefixError.value = "Prefix is required.";
return;
}
- const duplicate = editSnippets.value.find(
- (s) => s.prefix === prefix && s.id !== snippetEditingId.value,
- );
+ const duplicate = editSnippets.value.find((s) => s.prefix === prefix && s.id !== snippetEditingId.value);
if (duplicate) {
snippetFormPrefixError.value = "Prefix must be unique.";
return;
@@ -338,7 +334,16 @@ function setSidebarActivation(value: "single" | "double") {
const activeSettingsTab = ref("editor");
const isWeb = !isTauriRuntime();
const displayedAppVersion = computed(() => (props.appVersion ? `v${props.appVersion}` : ""));
-type SettingsCategory = "editor" | "appearance" | "navigation" | "redis" | "shortcuts" | "snippets" | "ai" | "security" | "about";
+type SettingsCategory =
+ | "editor"
+ | "appearance"
+ | "navigation"
+ | "redis"
+ | "shortcuts"
+ | "snippets"
+ | "ai"
+ | "security"
+ | "about";
const settingsCategoryNav = computed<{ value: SettingsCategory; label: string }[]>(() => [
{ value: "editor", label: t("settings.editorTab") },
{ value: "appearance", label: t("settings.appearanceTab") },
@@ -1059,9 +1064,9 @@ watch(
<!-- Snippets Tab -->
<section v-else-if="activeSettingsTab === 'snippets'" class="flex flex-col gap-4 py-2">
<div class="flex items-center justify-between">
- <p class="text-sm text-muted-foreground">{{ t('settings.snippetsDescription') }}</p>
+ <p class="text-sm text-muted-foreground">{{ t("settings.snippetsDescription") }}</p>
<Button variant="outline" size="sm" @click="openAddSnippetDialog">
- {{ t('settings.snippetsAdd') }}
+ {{ t("settings.snippetsAdd") }}
</Button>
</div>
@@ -1069,9 +1074,9 @@ watch(
<table class="w-full text-sm">
<thead>
<tr class="border-b bg-muted/50">
- <th class="px-3 py-2 text-left font-medium">{{ t('settings.snippetsLabel') }}</th>
- <th class="px-3 py-2 text-left font-medium">{{ t('settings.snippetsPrefix') }}</th>
- <th class="px-3 py-2 text-left font-medium">{{ t('settings.snippetsBody') }}</th>
+ <th class="px-3 py-2 text-left font-medium">{{ t("settings.snippetsLabel") }}</th>
+ <th class="px-3 py-2 text-left font-medium">{{ t("settings.snippetsPrefix") }}</th>
+ <th class="px-3 py-2 text-left font-medium">{{ t("settings.snippetsBody") }}</th>
<th class="px-3 py-2 w-20"></th>
</tr>
</thead>
@@ -1103,7 +1108,7 @@ watch(
<div class="flex justify-end">
<Button variant="outline" size="sm" @click="restoreDefaultSnippets">
- {{ t('settings.snippetsRestoreDefaults') }}
+ {{ t("settings.snippetsRestoreDefaults") }}
</Button>
</div>
</section>
@@ -1496,21 +1501,29 @@ watch(
<DialogContent class="sm:max-w-[500px]">
<DialogHeader>
<DialogTitle>
- {{ snippetEditingId ? t('settings.snippetsEditTitle') : t('settings.snippetsAddTitle') }}
+ {{ snippetEditingId ? t("settings.snippetsEditTitle") : t("settings.snippetsAddTitle") }}
</DialogTitle>
</DialogHeader>
<div class="flex flex-col gap-4 py-2">
<div class="flex flex-col gap-1.5">
- <Label for="snippet-label">{{ t('settings.snippetsLabel') }}</Label>
- <Input id="snippet-label" v-model="snippetForm.label" :placeholder="t('settings.snippetsLabelPlaceholder')" />
+ <Label for="snippet-label">{{ t("settings.snippetsLabel") }}</Label>
+ <Input
+ id="snippet-label"
+ v-model="snippetForm.label"
+ :placeholder="t('settings.snippetsLabelPlaceholder')"
+ />
</div>
<div class="flex flex-col gap-1.5">
- <Label for="snippet-prefix">{{ t('settings.snippetsPrefix') }}</Label>
- <Input id="snippet-prefix" v-model="snippetForm.prefix" :placeholder="t('settings.snippetsPrefixPlaceholder')" />
+ <Label for="snippet-prefix">{{ t("settings.snippetsPrefix") }}</Label>
+ <Input
+ id="snippet-prefix"
+ v-model="snippetForm.prefix"
+ :placeholder="t('settings.snippetsPrefixPlaceholder')"
+ />
<p v-if="snippetFormPrefixError" class="text-xs text-destructive">{{ snippetFormPrefixError }}</p>
</div>
<div class="flex flex-col gap-1.5">
- <Label for="snippet-body">{{ t('settings.snippetsBody') }}</Label>
+ <Label for="snippet-body">{{ t("settings.snippetsBody") }}</Label>
<textarea
id="snippet-body"
v-model="snippetForm.body"
@@ -1521,8 +1534,8 @@ watch(
</div>
</div>
<DialogFooter>
- <Button variant="outline" @click="snippetDialogOpen = false">{{ t('settings.cancel') }}</Button>
- <Button @click="saveSnippet">{{ t('settings.save') }}</Button>
+ <Button variant="outline" @click="snippetDialogOpen = false">{{ t("settings.cancel") }}</Button>
+ <Button @click="saveSnippet">{{ t("settings.save") }}</Button>
</DialogFooter>
</DialogContent>
</Dialog>
diff --git a/apps/desktop/src/lib/sqlCompletion.ts b/apps/desktop/src/lib/sqlCompletion.ts
index 9f98048e78..3276b48e1f 100644
--- a/apps/desktop/src/lib/sqlCompletion.ts
+++ b/apps/desktop/src/lib/sqlCompletion.ts
@@ -1889,9 +1889,7 @@ export function buildSnippetItemsForTest(prefix: string, snippets: SqlSnippet[])
function buildSnippetItems(prefix: string, snippets: SqlSnippet[]): SqlCompletionItem[] {
if (!prefix) return [];
return snippets
- .filter(
- (snippet) => matchesPrefix(snippet.prefix, prefix) || matchesPrefix(snippet.label, prefix),
- )
+ .filter((snippet) => matchesPrefix(snippet.prefix, prefix) || matchesPrefix(snippet.label, prefix))
.map((snippet) => {
const boostByPrefix = computeBoost(snippet.prefix, prefix);
const boostByLabel = computeBoost(snippet.label, prefix);
diff --git a/apps/desktop/src/stores/settingsStore.ts b/apps/desktop/src/stores/settingsStore.ts
index e76c1becfa..45cc4aa431 100644
--- a/apps/desktop/src/stores/settingsStore.ts
+++ b/apps/desktop/src/stores/settingsStore.ts
@@ -265,9 +265,12 @@ function normalizeSqlSnippets(value: unknown, existing?: SqlSnippet[]): SqlSnipp
if (
!item ||
typeof item !== "object" ||
- typeof item.id !== "string" || !item.id ||
- typeof item.label !== "string" || !item.label ||
- typeof item.prefix !== "string" || !item.prefix ||
+ typeof item.id !== "string" ||
+ !item.id ||
+ typeof item.label !== "string" ||
+ !item.label ||
+ typeof item.prefix !== "string" ||
+ !item.prefix ||
typeof item.body !== "string"
) {
continue;