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。

feat(settings): keep dialog open after apply

t8y2f45ee8f2725d
diff --git a/apps/desktop/src/components/editor/EditorSettingsDialog.vue b/apps/desktop/src/components/editor/EditorSettingsDialog.vue
index 06a8d4319b..7030398297 100644
--- a/apps/desktop/src/components/editor/EditorSettingsDialog.vue
+++ b/apps/desktop/src/components/editor/EditorSettingsDialog.vue
@@ -276,7 +276,7 @@ function hasChanges(): boolean {
);
}
-async function applySettings() {
+async function persistSettings() {
if (hasBlockingShortcutConflicts.value) return;
settingsStore.updateEditorSettings({
fontFamily: editFontFamily.value,
@@ -299,6 +299,14 @@ async function applySettings() {
await settingsStore.updateDesktopSettings({
show_tray_icon: editShowTrayIcon.value,
});
+}
+
+async function applySettings() {
+ await persistSettings();
+}
+
+async function applySettingsAndClose() {
+ await persistSettings();
emit("update:open", false);
}
@@ -1796,6 +1804,9 @@ watch(
<Button :disabled="!hasChanges() || hasBlockingShortcutConflicts" @click="applySettings">
{{ t("settings.apply") }}
</Button>
+ <Button :disabled="!hasChanges() || hasBlockingShortcutConflicts" @click="applySettingsAndClose">
+ {{ t("settings.applyAndClose") }}
+ </Button>
</DialogFooter>
<DialogFooter
diff --git a/apps/desktop/src/i18n/locales/en.ts b/apps/desktop/src/i18n/locales/en.ts
index 7217c8df6e..5b972a032f 100644
--- a/apps/desktop/src/i18n/locales/en.ts
+++ b/apps/desktop/src/i18n/locales/en.ts
@@ -1464,6 +1464,7 @@ export default {
syncSecretsSkipped: "Encrypted secrets were present but were not restored.",
syncDownloadConfirm: "Download and apply the remote DBX snapshot? Local metadata and saved SQL will be replaced.",
apply: "Apply",
+ applyAndClose: "Apply and Close",
reset: "Reset",
resetDefaults: "Reset Defaults",
save: "Save",
diff --git a/apps/desktop/src/i18n/locales/es.ts b/apps/desktop/src/i18n/locales/es.ts
index baf5f27e52..d4f191be77 100644
--- a/apps/desktop/src/i18n/locales/es.ts
+++ b/apps/desktop/src/i18n/locales/es.ts
@@ -1359,6 +1359,7 @@ export default {
syncDownloadConfirm:
"¿Descargar y aplicar la instantánea remota de DBX? Se reemplazarán metadatos locales y SQL guardado.",
apply: "Aplicar",
+ applyAndClose: "Aplicar y cerrar",
reset: "Restablecer",
resetDefaults: "Restablecer valores por defecto",
executeMode: "Modo de ejecución (Cmd+Enter)",
diff --git a/apps/desktop/src/i18n/locales/zh-CN.ts b/apps/desktop/src/i18n/locales/zh-CN.ts
index 96f360f282..5b1aa92006 100644
--- a/apps/desktop/src/i18n/locales/zh-CN.ts
+++ b/apps/desktop/src/i18n/locales/zh-CN.ts
@@ -1430,6 +1430,7 @@ export default {
syncSecretsSkipped: "远端包含加密敏感信息,但本次未恢复。",
syncDownloadConfirm: "要下载并应用远端 DBX 快照吗?本地元信息和保存的 SQL 会被替换。",
apply: "应用",
+ applyAndClose: "应用并关闭",
reset: "重置",
resetDefaults: "恢复默认",
save: "保存",
diff --git a/packages/app-tests/settingsDialogLayout.test.ts b/packages/app-tests/settingsDialogLayout.test.ts
index 5e28432bf5..c5b7c36c91 100644
--- a/packages/app-tests/settingsDialogLayout.test.ts
+++ b/packages/app-tests/settingsDialogLayout.test.ts
@@ -60,6 +60,14 @@ test("shortcut conflicts only block applying changed shortcut settings", () => {
assert.match(source, /:disabled="!hasChanges\(\) \|\| hasBlockingShortcutConflicts"/);
});
+test("settings dialog exposes separate apply and apply-and-close actions", () => {
+ assert.match(source, /async function persistSettings\(\)/);
+ assert.match(source, /async function applySettings\(\)/);
+ assert.match(source, /async function applySettingsAndClose\(\)/);
+ assert.match(source, /await persistSettings\(\);[\s\S]*emit\("update:open", false\)/);
+ assert.match(source, /t\("settings\.applyAndClose"\)/);
+});
+
test("settings dialog exposes sidebar activation in navigation settings", () => {
assert.match(source, /value: "navigation"/);
assert.match(source, /activeSettingsTab === ['"]navigation['"]/);