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