diff --git a/dashboard/src/views/BackupTargetsView.vue b/dashboard/src/views/BackupTargetsView.vue index b10ab97ea..abfd3c2fe 100644 --- a/dashboard/src/views/BackupTargetsView.vue +++ b/dashboard/src/views/BackupTargetsView.vue @@ -5,8 +5,9 @@ const i18n = useI18n(); const t = i18n.t; import { ref, onMounted, useTemplateRef } from 'vue'; -import { Button, Menu, TableView, InputDialog } from '@cloudron/pankow'; +import { Button, Menu, TableView, InputDialog, SingleSelect } from '@cloudron/pankow'; import Section from '../components/Section.vue'; +import SettingsItem from '../components/SettingsItem.vue'; import StateLED from '../components/StateLED.vue'; import BackupScheduleDialog from '../components/BackupScheduleDialog.vue'; import BackupTargetAddDialog from '../components/BackupTargetAddDialog.vue'; @@ -91,31 +92,6 @@ async function onRemount(target) { target.status.busy = false; } -async function refresh() { - busy.value = true; - - const [error, result] = await backupTargetsModel.list(); - if (error) return console.error(error); - - for (const target of result) { - target.status = { busy: true, state: '', message: '' }; - } - - for (const target of result) { - const [error, status] = await backupTargetsModel.status(target.id); - if (error) { - console.error(error); - continue; - } - - target.status.state = status.state === 'active' ? 'success' : 'danger'; - target.status.busy = false; - } - - targets.value = result; - busy.value = false; -} - const actionMenuModel = ref([]); const actionMenuElement = useTemplateRef('actionMenuElement'); @@ -149,6 +125,46 @@ function onActionMenu(target, event) { actionMenuElement.value.open(event, event.currentTarget); } +const primaryTargetId = ref(''); +const primaryTargetChangeBusy = ref(false); + +async function onPrimaryTargetChanged(value) { + primaryTargetChangeBusy.value = true; + + const [error] = await backupTargetsModel.setPrimary(value); + if (error) return console.error(error); + + primaryTargetId.value = value; + primaryTargetChangeBusy.value = false; +} + +async function refresh() { + busy.value = true; + + const [error, result] = await backupTargetsModel.list(); + if (error) return console.error(error); + + for (const target of result) { + target.status = { busy: true, state: '', message: '' }; + } + + for (const target of result) { + const [error, status] = await backupTargetsModel.status(target.id); + if (error) { + console.error(error); + continue; + } + + target.status.state = status.state === 'active' ? 'success' : 'danger'; + target.status.busy = false; + } + + primaryTargetId.value = result.find(t => t.primary)?.id; + + targets.value = result; + busy.value = false; +} + onMounted(async () => { const [error, result] = await profileModel.get(); if (error) return console.error(error); @@ -201,5 +217,17 @@ onMounted(async () => { + + + + + Storage + For backups created during automatic or manual app and platform updates. + + + + + + diff --git a/dashboard/src/views/SystemUpdateView.vue b/dashboard/src/views/SystemUpdateView.vue index fa45356f0..4d1e9e9e2 100644 --- a/dashboard/src/views/SystemUpdateView.vue +++ b/dashboard/src/views/SystemUpdateView.vue @@ -1,53 +1,11 @@ - - - - - Storage - For backups created during automatic or manual app and platform updates. - - - - - -