feat(updater): download and prepare desktop updates in background

This commit is contained in:
二丫讲梵 authored and GitHub committed 2026-09-10 11:44:18 +08:00
1 parent 7affad8ae0
commit e96af4aa30
77 files changed
+10536 -814

No files matched your search

@@ -1,4 +1,5 @@
<script setup lang="ts">
import { useUpdateBlocker } from "@/lib/app/updatePreparation";
import { computed, nextTick, onActivated, onBeforeUnmount, onDeactivated, onMounted, ref, shallowRef, useId, watch } from "vue";
import { Compartment, StateEffect, StateField } from "@codemirror/state";
import { ensureSyntaxTree } from "@codemirror/language";
@@ -2659,6 +2660,29 @@ function openNacosConsole() {
}
window.open(url, "_blank", "noopener,noreferrer");
}
useUpdateBlocker(() =>
isConfigDirty.value ||
isCreatingConfig.value ||
savingConfig.value ||
deletingConfig.value ||
pendingConfigSave.value ||
pendingDeleteConfig.value ||
pendingBatchDelete.value ||
pendingHistoryRollback.value ||
rollingBackHistory.value ||
instanceEditorOpen.value ||
serviceEditorOpen.value ||
registerInstanceOpen.value ||
pendingInstanceUpdate.value ||
pendingInstanceDeregister.value ||
pendingServiceDelete.value ||
deletingService.value ||
registeringInstance.value ||
Object.keys(updatingInstanceKeys.value).length > 0 ||
Object.keys(instanceWeightDrafts.value).length > 0
? t("updates.preparationDrafts")
: undefined,
);
</script>
<template>
@@ -16,7 +16,10 @@ const mocks = vi.hoisted(() => ({
toast: vi.fn(),
}));
vi.mock("vue-i18n", () => ({ useI18n: () => ({ t: (key: string) => key }) }));
vi.mock("vue-i18n", async (importOriginal) => ({
...(await importOriginal<typeof import("vue-i18n")>()),
useI18n: () => ({ t: (key: string) => key }),
}));
vi.mock("@/lib/backend/api", () => ({
nacosDeleteConfig: mocks.nacosDeleteConfig,