feat(updater): allow switching download source after failure
This commit is contained in:
14 files changed
+137
-3
No files matched your search
@@ -79,6 +79,9 @@ async function mountDialog(activeTaskCount: number, initialState: Partial<Dialog
|
||||
release_notes: "",
|
||||
},
|
||||
updateCheckMessage: "",
|
||||
checkingUpdates: false,
|
||||
updateCheckFailed: false,
|
||||
updateDownloadSource: "official",
|
||||
isDownloadingUpdate: state.isDownloadingUpdate,
|
||||
downloadProgress: state.downloadProgress,
|
||||
updateDownloaded: state.updateDownloaded,
|
||||
|
||||
@@ -4,7 +4,9 @@ import { useI18n } from "vue-i18n";
|
||||
import { AlertTriangle, Loader2 } from "@lucide/vue";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
||||
import type { UpdateInfo } from "@/lib/backend/api";
|
||||
import type { UpdateDownloadSource } from "@/lib/backend/tauri";
|
||||
import { isTauriRuntime } from "@/lib/backend/tauriRuntime";
|
||||
import { canDownloadAndInstallUpdate } from "@/composables/useAppUpdater";
|
||||
|
||||
@@ -20,6 +22,9 @@ const props = defineProps<{
|
||||
updateReady: boolean;
|
||||
isIgnoringUpdate: boolean;
|
||||
activeTaskCount: number;
|
||||
checkingUpdates: boolean;
|
||||
updateCheckFailed: boolean;
|
||||
updateDownloadSource: UpdateDownloadSource;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
@@ -29,6 +34,7 @@ const emit = defineEmits<{
|
||||
"install-downloaded": [];
|
||||
restart: [];
|
||||
"ignore-version": [];
|
||||
"change-download-source": [source: UpdateDownloadSource];
|
||||
}>();
|
||||
|
||||
const { t } = useI18n();
|
||||
@@ -136,7 +142,19 @@ watch(
|
||||
<span>{{ t("updates.activeTasksBlockUpdate", { count: activeTaskCount }) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<DialogFooter class="min-w-0">
|
||||
<DialogFooter class="relative min-w-0 sm:justify-end">
|
||||
<div v-if="updateCheckFailed && !isDownloadingUpdate && !updateReady" class="flex items-center gap-1.5 self-start sm:absolute sm:left-4 sm:top-1/2 sm:-translate-y-1/2">
|
||||
<span class="text-xs text-muted-foreground">{{ t("updates.source") }}</span>
|
||||
<Select :model-value="updateDownloadSource" :disabled="checkingUpdates" @update:model-value="(value) => value && emit('change-download-source', value as UpdateDownloadSource)">
|
||||
<SelectTrigger class="h-8 w-[150px] text-xs">
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="official">{{ t("updates.sourceOfficial") }}</SelectItem>
|
||||
<SelectItem value="cnb">{{ t("updates.sourceCnb") }}</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
<template v-if="updateInfo?.update_available">
|
||||
<div class="flex min-w-0 flex-wrap items-center gap-2 sm:justify-end">
|
||||
<Button v-if="!isCloseBlocked" variant="outline" class="shrink-0" @click="handleCancel">{{ t("dangerDialog.cancel") }}</Button>
|
||||
|
||||
Reference in new issue
Block a user