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 }}

- - - +
{{ stopError.generic }}
+ +
+ + + +
+ + \ No newline at end of file diff --git a/dashboard/src/constants.js b/dashboard/src/constants.js index c6be09fd7..cb51ab754 100644 --- a/dashboard/src/constants.js +++ b/dashboard/src/constants.js @@ -79,13 +79,14 @@ const ROLES = { const TASK_TYPES = { TASK_APP: 'app', TASK_BACKUP: 'backup', - TASK_UPDATE: 'update', + TASK_UPDATE: 'boxUpdate', TASK_CHECK_CERTS: 'checkCerts', TASK_PREPARE_DASHBOARD_LOCATION: 'prepareDashboardLocation', TASK_CLEAN_BACKUPS: 'cleanBackups', TASK_SYNC_EXTERNAL_LDAP: 'syncExternalLdap', TASK_CHANGE_MAIL_LOCATION: 'changeMailLocation', TASK_SYNC_DNS_RECORDS: 'syncDnsRecords', + TASK_SYNC_DYNDNS: 'syncDyndns', TASK_UPDATE_DISK_USAGE: 'updateDiskUsage', }; diff --git a/src/tasks.js b/src/tasks.js index 1e85f577c..8280713b9 100644 --- a/src/tasks.js +++ b/src/tasks.js @@ -18,7 +18,7 @@ exports = module.exports = { _del: del, - // task types. if you add a task here, fill up the function table in taskworker and dashboard client.js + // task types. if you add a task here, fill up the function table in taskworker and dashboard constants.js TASK_APP: 'app', TASK_BACKUP: 'backup', TASK_BOX_UPDATE: 'boxUpdate',