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。

improve(updates): run component updates in background

zipg929c72407d5a
diff --git a/apps/desktop/src/components/layout/UpdateDialog.spec.ts b/apps/desktop/src/components/layout/UpdateDialog.spec.ts
index 5529b2a4a8..1363259bf1 100644
--- a/apps/desktop/src/components/layout/UpdateDialog.spec.ts
+++ b/apps/desktop/src/components/layout/UpdateDialog.spec.ts
@@ -400,7 +400,70 @@ describe("UpdateDialog aggregate update center", () => {
driversTab?.click();
await flushDialog();
- expect(buttonWithText("Update Now")?.disabled).toBe(true);
+ expect(buttonWithText("Update Now")).toBeUndefined();
+ expect(buttonWithText("Updating…")?.disabled).toBe(true);
+ });
+
+ it("allows closing the dialog while component updates continue in the background", async () => {
+ const { state } = await mountDialog(0, {}, undefined, {
+ updateInfo: null,
+ componentUpdatesUpdating: true,
+ updatingComponent: "plugins",
+ pluginUpdates: [
+ {
+ key: "official:example",
+ status: "update",
+ artifact: { target: "universal", url: "https://example.com/plugin.dbxp", sha256: "hash" },
+ repository: { id: "official" },
+ plugin: { id: "example", latestVersion: "1.1.0" },
+ name: "Example plugin",
+ },
+ ],
+ });
+
+ const closeButton = document.body.querySelector<HTMLButtonElement>('[data-slot="dialog-close"]');
+ expect(closeButton).not.toBeNull();
+ closeButton?.click();
+ await flushDialog();
+ expect(state.open).toBe(false);
+
+ state.open = true;
+ await flushDialog();
+ await clickOutside();
+ expect(state.open).toBe(false);
+
+ state.open = true;
+ await flushDialog();
+ await pressEscape();
+
+ expect(state.open).toBe(false);
+ });
+
+ it("offers an explicit background action while component updates are running", async () => {
+ const { state } = await mountDialog(0, {}, undefined, {
+ updateInfo: null,
+ componentUpdatesUpdating: true,
+ updatingComponent: "plugins",
+ pluginUpdates: [
+ {
+ key: "official:example",
+ status: "update",
+ artifact: { target: "universal", url: "https://example.com/plugin.dbxp", sha256: "hash" },
+ repository: { id: "official" },
+ plugin: { id: "example", latestVersion: "1.1.0" },
+ name: "Example plugin",
+ },
+ ],
+ });
+
+ const backgroundButton = buttonWithText("Run in Background");
+ expect(backgroundButton).toBeDefined();
+ expect(buttonWithText("Updating…")?.disabled).toBe(true);
+
+ backgroundButton?.click();
+ await flushDialog();
+
+ expect(state.open).toBe(false);
});
it("organizes component updates into tabs and installs the selected category", async () => {
diff --git a/apps/desktop/src/components/layout/UpdateDialog.vue b/apps/desktop/src/components/layout/UpdateDialog.vue
index 0c1f3d2458..a98ce5a2fe 100644
--- a/apps/desktop/src/components/layout/UpdateDialog.vue
+++ b/apps/desktop/src/components/layout/UpdateDialog.vue
@@ -95,9 +95,11 @@ const selectedCategoryHasUpdate = computed(() => {
if (selectedTab.value === "plugins") return props.pluginUpdates.length > 0;
return false;
});
-const isUpdatingSelectedCategory = computed(() => selectedCategory.value !== null && props.updatingComponent === selectedCategory.value);
const isAnyComponentUpdating = computed(() => props.componentUpdatesUpdating || props.updatingComponent !== null);
-const isCloseBlocked = computed(() => props.isInstallingUpdate || isUpdatingSelectedCategory.value);
+// Component update tasks are owned by the app-level composable. Closing the
+// dialog only leaves them running in the background; replacing an app update
+// is the only operation that must keep the modal open.
+const isCloseBlocked = computed(() => props.isInstallingUpdate);
const blocksImplicitDismiss = computed(() => isCloseBlocked.value);
const canIgnoreVersion = computed(() => props.updateInfo?.update_available === true && !props.isDownloadingUpdate && !props.isInstallingUpdate && !props.updateReady && !props.isUpdatingAll);
@@ -359,9 +361,15 @@ watch(
</DialogFooter>
<DialogFooter v-else data-update-footer class="mx-0 mb-0 rounded-none border-t px-[22px] pb-2.5 pt-2.5 sm:items-center sm:justify-end">
- <Button v-if="selectedCategory" :disabled="!selectedCategoryHasUpdate || isAnyComponentUpdating || isInstallingUpdate || isUpdatingAll" @click="emit('install-component-updates', selectedCategory)">
- <Loader2 v-if="isUpdatingSelectedCategory" class="h-4 w-4 animate-spin" />
- {{ t(isUpdatingSelectedCategory ? "updates.updating" : "updates.updateNow") }}
+ <template v-if="isAnyComponentUpdating">
+ <Button variant="ghost" class="shrink-0" @click="handleOpenChange(false)">{{ t("updates.updateInBackground") }}</Button>
+ <Button class="shrink-0" disabled>
+ <Loader2 class="h-4 w-4 animate-spin" />
+ {{ t("updates.updating") }}
+ </Button>
+ </template>
+ <Button v-else-if="selectedCategory" :disabled="!selectedCategoryHasUpdate || isInstallingUpdate || isUpdatingAll" @click="emit('install-component-updates', selectedCategory)">
+ {{ t("updates.updateNow") }}
</Button>
</DialogFooter>
</div>
diff --git a/apps/desktop/src/i18n/locales/az.ts b/apps/desktop/src/i18n/locales/az.ts
index bc1d4e7b2a..26d9311f55 100644
--- a/apps/desktop/src/i18n/locales/az.ts
+++ b/apps/desktop/src/i18n/locales/az.ts
@@ -392,6 +392,7 @@ export default withEnglishFallback({
restart: "Çıx və yenidən başlat",
updateAction: "Yenilə",
updateNow: "İndi yenilə",
+ updateInBackground: "Arxa planda yenilə",
updating: "Yenilənir…",
notInstalled: "Quraşdırılmayıb",
componentsAutoUpdated: "Avtomatik yeniləndi: {components}.",
diff --git a/apps/desktop/src/i18n/locales/en.ts b/apps/desktop/src/i18n/locales/en.ts
index c16d4da3a9..24a0294366 100644
--- a/apps/desktop/src/i18n/locales/en.ts
+++ b/apps/desktop/src/i18n/locales/en.ts
@@ -535,6 +535,7 @@ export default {
restart: "Exit & Restart",
updateAction: "Update",
updateNow: "Update Now",
+ updateInBackground: "Run in Background",
updating: "Updating…",
notInstalled: "Not installed",
componentsAutoUpdated: "Automatically updated: {components}.",
diff --git a/apps/desktop/src/i18n/locales/es.ts b/apps/desktop/src/i18n/locales/es.ts
index ba9300db9c..1b82ef0629 100644
--- a/apps/desktop/src/i18n/locales/es.ts
+++ b/apps/desktop/src/i18n/locales/es.ts
@@ -524,6 +524,7 @@ export default withEnglishFallback({
restart: "Salir y reiniciar",
updateAction: "Actualizar",
updateNow: "Actualizar ahora",
+ updateInBackground: "Actualizar en segundo plano",
updating: "Actualizando…",
notInstalled: "No instalado",
componentsAutoUpdated: "Actualizados automáticamente: {components}.",
diff --git a/apps/desktop/src/i18n/locales/it.ts b/apps/desktop/src/i18n/locales/it.ts
index d83354932c..a8979d447c 100644
--- a/apps/desktop/src/i18n/locales/it.ts
+++ b/apps/desktop/src/i18n/locales/it.ts
@@ -522,6 +522,7 @@ export default withEnglishFallback({
restart: "Esci e Riavvia",
updateAction: "Aggiorna",
updateNow: "Aggiorna ora",
+ updateInBackground: "Aggiorna in background",
updating: "Aggiornamento…",
notInstalled: "Non installato",
componentsAutoUpdated: "Aggiornati automaticamente: {components}.",
diff --git a/apps/desktop/src/i18n/locales/ja.ts b/apps/desktop/src/i18n/locales/ja.ts
index 679673bfe9..14145d8f11 100644
--- a/apps/desktop/src/i18n/locales/ja.ts
+++ b/apps/desktop/src/i18n/locales/ja.ts
@@ -523,6 +523,7 @@ export default withEnglishFallback({
restart: "終了して再起動",
updateAction: "更新",
updateNow: "今すぐ更新",
+ updateInBackground: "バックグラウンドで更新",
updating: "更新中…",
notInstalled: "未インストール",
componentsAutoUpdated: "自動更新しました: {components}。",
diff --git a/apps/desktop/src/i18n/locales/ko.ts b/apps/desktop/src/i18n/locales/ko.ts
index c540de792b..92bebc4d69 100644
--- a/apps/desktop/src/i18n/locales/ko.ts
+++ b/apps/desktop/src/i18n/locales/ko.ts
@@ -530,6 +530,7 @@ export default withEnglishFallback({
restart: "종료 후 다시 시작",
updateAction: "업데이트",
updateNow: "지금 업데이트",
+ updateInBackground: "백그라운드에서 업데이트",
updating: "업데이트 중…",
notInstalled: "설치되지 않음",
componentsAutoUpdated: "자동 업데이트 완료: {components}.",
diff --git a/apps/desktop/src/i18n/locales/pt-BR.ts b/apps/desktop/src/i18n/locales/pt-BR.ts
index 480c3ff355..5bfbdd792f 100644
--- a/apps/desktop/src/i18n/locales/pt-BR.ts
+++ b/apps/desktop/src/i18n/locales/pt-BR.ts
@@ -523,6 +523,7 @@ export default withEnglishFallback({
restart: "Sair e Reiniciar",
updateAction: "Atualizar",
updateNow: "Atualizar agora",
+ updateInBackground: "Atualizar em segundo plano",
updating: "Atualizando…",
notInstalled: "Não instalado",
componentsAutoUpdated: "Atualizados automaticamente: {components}.",
diff --git a/apps/desktop/src/i18n/locales/tr.ts b/apps/desktop/src/i18n/locales/tr.ts
index 79a19559c0..fadb8504c6 100644
--- a/apps/desktop/src/i18n/locales/tr.ts
+++ b/apps/desktop/src/i18n/locales/tr.ts
@@ -394,6 +394,7 @@ export default withEnglishFallback({
restart: "Çık ve Yeniden Başlat",
updateAction: "Güncelle",
updateNow: "Şimdi Güncelle",
+ updateInBackground: "Arka planda güncelle",
updating: "Güncelleniyor…",
notInstalled: "Kurulu değil",
componentsAutoUpdated: "Otomatik güncellendi: {components}.",
diff --git a/apps/desktop/src/i18n/locales/zh-CN.ts b/apps/desktop/src/i18n/locales/zh-CN.ts
index e248fdda51..b2edaab060 100644
--- a/apps/desktop/src/i18n/locales/zh-CN.ts
+++ b/apps/desktop/src/i18n/locales/zh-CN.ts
@@ -451,6 +451,7 @@ export default withEnglishFallback({
restart: "退出并重启",
updateAction: "更新",
updateNow: "立即更新",
+ updateInBackground: "后台更新",
updating: "正在更新…",
notInstalled: "未安装",
componentsAutoUpdated: "已自动更新:{components}。",
diff --git a/apps/desktop/src/i18n/locales/zh-TW.ts b/apps/desktop/src/i18n/locales/zh-TW.ts
index 99dd5b5db3..a9a97bfa3b 100644
--- a/apps/desktop/src/i18n/locales/zh-TW.ts
+++ b/apps/desktop/src/i18n/locales/zh-TW.ts
@@ -526,6 +526,7 @@ export default withEnglishFallback({
restart: "結束並重新啟動",
updateAction: "更新",
updateNow: "立即更新",
+ updateInBackground: "背景下更新",
updating: "正在更新…",
notInstalled: "未安裝",
componentsAutoUpdated: "已自動更新:{components}。",