diff --git a/dashboard/src/components/SystemUpdate.vue b/dashboard/src/components/SystemUpdate.vue index 91aaffec0..622f6e2e0 100644 --- a/dashboard/src/components/SystemUpdate.vue +++ b/dashboard/src/components/SystemUpdate.vue @@ -57,10 +57,9 @@ const apps = ref([]); const version = ref(''); const ubuntuVersion = ref(''); const currentPattern = ref(''); -const percent = ref(0); -const message = ref(''); const updateBusy = ref(false); const updateError = ref({}); +const stopError = ref({}); const checkingBusy = ref(false); const pendingUpdate = ref(null); const skipBackup = ref(false); @@ -107,6 +106,9 @@ async function refreshInfo() { const [error, result] = await updaterModel.getBoxUpdate(); if (error) return console.error(error); + updateError.value = {}; + stopError.value = {}; + pendingUpdate.value = result || null; } @@ -201,14 +203,11 @@ async function refreshTasks() { async function onSubmitUpdate() { updateError.value = {}; updateBusy.value = true; - percent.value = 0; - message.value = ''; const [error] = await updaterModel.update(skipBackup.value); - updateBusy.value = false; - if (error) { updateError.value.generic = error.message || 'Internal error'; + updateBusy.value = false; return; } @@ -227,6 +226,21 @@ async function onCheck() { checkingBusy.value = false; } +async function onStop() { + const [error] = await tasksModel.stop(lastTask.value.id); + if (error) { + if (error.statusCode === 409) { + stopError.value.generic = 'No update is currently in progress'; + } else { + console.error(error); + stopError.value.generic = error.message || 'Internal error'; + } + return; + } + + updateBusy.value = false; +} + onMounted(async () => { const [error, result] = await dashboardModel.config(); if (error) return console.error(error); @@ -257,8 +271,7 @@ onMounted(async () => {
{{ $t('settings.updateDialog.unstableWarning') }}
{{ $t('settings.updateDialog.changes') }}:
-{{ message }}
+{{ lastTask.message }}
- - - +