dashboard: rename backupTargets to backupSites
This commit is contained in:
@@ -2,11 +2,11 @@
|
||||
|
||||
import { ref, useTemplateRef, computed } from 'vue';
|
||||
import { Dialog, FormGroup, MultiSelect } from '@cloudron/pankow';
|
||||
import BackupTargetsModel from '../models/BackupTargetsModel.js';
|
||||
import BackupSitesModel from '../models/BackupSitesModel.js';
|
||||
|
||||
const emit = defineEmits([ 'success' ]);
|
||||
|
||||
const backupTargetsModel = BackupTargetsModel.create();
|
||||
const backupSitesModel = BackupSitesModel.create();
|
||||
|
||||
const backupRetentions = [
|
||||
{ name: '2 days', id: { keepWithinSecs: 2 * 24 * 60 * 60 }},
|
||||
@@ -57,14 +57,14 @@ async function onSubmit() {
|
||||
if (hours.value.length === 24) hoursPattern = '*';
|
||||
else hoursPattern = hours.value;
|
||||
|
||||
let [error] = await backupTargetsModel.setSchedule(id.value, `00 00 ${hoursPattern} * * ${daysPattern}`);
|
||||
let [error] = await backupSitesModel.setSchedule(id.value, `00 00 ${hoursPattern} * * ${daysPattern}`);
|
||||
if (error) {
|
||||
busy.value = false;
|
||||
formError.value = error.body ? error.body.message : 'Internal error';
|
||||
return console.error(error);
|
||||
}
|
||||
|
||||
[error] = await backupTargetsModel.setRetention(id.value, configureRetention.value);
|
||||
[error] = await backupSitesModel.setRetention(id.value, configureRetention.value);
|
||||
if (error) {
|
||||
busy.value = false;
|
||||
formError.value = error.body ? error.body.message : 'Internal error';
|
||||
@@ -78,17 +78,17 @@ async function onSubmit() {
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
async open(target) {
|
||||
id.value = target.id;
|
||||
async open(site) {
|
||||
id.value = site.id;
|
||||
busy.value = false;
|
||||
formError.value = false;
|
||||
|
||||
const currentRetentionString = JSON.stringify(target.retention);
|
||||
const currentRetentionString = JSON.stringify(site.retention);
|
||||
let selectedRetention = backupRetentions.find(function (x) { return JSON.stringify(x.id) === currentRetentionString; });
|
||||
if (!selectedRetention) selectedRetention = backupRetentions[0];
|
||||
configureRetention.value = selectedRetention.id;
|
||||
|
||||
const tmp = target.schedule.split(' ');
|
||||
const tmp = site.schedule.split(' ');
|
||||
const tmpHours = tmp[2].split(',');
|
||||
const tmpDays = tmp[5].split(',');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user