Add checkbox to configure backup site backup for update behavior

This commit is contained in:
Johannes Zellner
2025-09-24 17:22:10 +02:00
parent 073ece0527
commit 0d3450ceed
13 changed files with 25 additions and 19 deletions

View File

@@ -26,6 +26,7 @@ const encryptedFilenames = ref(false);
const encryptionPasswordHint = ref('');
const formError = ref({});
const busy = ref(false);
const enableForUpdates = ref(false);
const provider = ref('');
const providerConfig = ref({
mountOptions: {},
@@ -151,7 +152,7 @@ async function onSubmit() {
// everything
const contents = null;
const [error, result] = await backupSitesModel.add(name.value, format.value, contents, provider.value, data, schedulePattern, retention, limitsConfig);
const [error, result] = await backupSitesModel.add(name.value, format.value, contents, enableForUpdates.value, provider.value, data, schedulePattern, retention, limitsConfig);
if (error) {
formError.value.generic = error.body ? error.body.message : 'Internal error';
busy.value = false;
@@ -221,6 +222,7 @@ defineExpose({
formError.value = {};
busy.value = false;
name.value = '';
enableForUpdates.value = false;
provider.value = '';
format.value = '';
providerConfig.value = {};
@@ -265,6 +267,8 @@ defineExpose({
<TextInput id="nameInput" v-model="name" required/>
</FormGroup>
<Checkbox v-model="enableForUpdates" :label="$t('backups.configureBackupStorage.useForUpdates')" />
<BackupProviderForm v-model:provider="provider" v-model:format="format" v-model:provider-config="providerConfig" :form-error="formError"/>
<FormGroup>

View File

@@ -1,7 +1,7 @@
<script setup>
import { ref, useTemplateRef } from 'vue';
import { Dialog, FormGroup, TextInput } from '@cloudron/pankow';
import { Checkbox, Dialog, FormGroup, TextInput } from '@cloudron/pankow';
import { prettyBinarySize } from '@cloudron/pankow/utils';
import { mountlike, s3like } from '../utils.js';
import BackupSitesModel from '../models/BackupSitesModel.js';
@@ -20,6 +20,7 @@ const site = ref({});
const formError = ref({});
const busy = ref(false);
const name = ref('');
const enableForUpdates = ref(false);
const memoryLimit = ref(0);
const uploadPartSize = ref(0);
const syncConcurrency = ref(0);
@@ -36,6 +37,13 @@ async function onSubmit() {
return console.error(error);
}
[error] = await backupSitesModel.setEnableForUpdates(site.value.id, enableForUpdates.value);
if (error) {
formError.value.generic = error.body ? error.body.message : 'Internal error';
busy.value = false;
return console.error(error);
}
const limits = {
memoryLimit: parseInt(memoryLimit.value),
uploadPartSize: parseInt(uploadPartSize.value),
@@ -70,6 +78,7 @@ defineExpose({
site.value = t;
name.value = t.name || '';
enableForUpdates.value = !!t.enableForUpdates;
memoryLimit.value = t.limits.memoryLimit || 1024 * 1024 * 1024; // 1 GB
uploadPartSize.value = t.limits.uploadPartSize || 10 * 1024 * 1024;
syncConcurrency.value = t.limits.syncConcurrency || 10;
@@ -137,6 +146,8 @@ defineExpose({
<TextInput id="backupSiteNameInput" v-model="name" required/>
</FormGroup>
<Checkbox v-model="enableForUpdates" :label="$t('backups.configureBackupStorage.useForUpdates')" />
<FormGroup>
<label for="memoryLimitInput">{{ $t('backups.configureBackupStorage.memoryLimit') }}: <b>{{ prettyBinarySize(memoryLimit, '1024 MB') }}</b></label>
<div class="small">{{ $t('backups.configureBackupStorage.memoryLimitDescription') }}</div>