Fix SingleSelect usage for configureRetention
This commit is contained in:
@@ -16,7 +16,7 @@ const dialog = useTemplateRef('dialog');
|
||||
const scheduleEnabled = ref(false);
|
||||
const days = ref([]);
|
||||
const hours = ref([]);
|
||||
const configureRetention = ref('');
|
||||
const configureRetention = ref(''); // this is 'name' and not 'id' of backupRetentions because SingleSelect needs strings
|
||||
const isConfigureValid = computed(() => {
|
||||
return !!days.value.length && !!hours.value.length;
|
||||
});
|
||||
@@ -48,7 +48,8 @@ async function onSubmit() {
|
||||
return console.error(error);
|
||||
}
|
||||
|
||||
[error] = await backupSitesModel.setRetention(id.value, configureRetention.value);
|
||||
const selectedRetention = BackupSitesModel.backupRetentions.find(function (x) { return x.name === configureRetention.value; });
|
||||
[error] = await backupSitesModel.setRetention(id.value, selectedRetention.id);
|
||||
if (error) {
|
||||
busy.value = false;
|
||||
formError.value = error.body ? error.body.message : 'Internal error';
|
||||
@@ -68,9 +69,8 @@ defineExpose({
|
||||
formError.value = false;
|
||||
|
||||
const currentRetentionString = JSON.stringify(site.retention);
|
||||
let selectedRetention = BackupSitesModel.backupRetentions.find(function (x) { return JSON.stringify(x.id) === currentRetentionString; });
|
||||
if (!selectedRetention) selectedRetention = BackupSitesModel.backupRetentions[0];
|
||||
configureRetention.value = selectedRetention.id;
|
||||
const selectedRetention = BackupSitesModel.backupRetentions.find(function (x) { return JSON.stringify(x.id) === currentRetentionString; });
|
||||
configureRetention.value = selectedRetention ? selectedRetention.name : BackupSitesModel.backupRetentions[0].name;
|
||||
|
||||
if (site.schedule === 'never') {
|
||||
scheduleEnabled.value = false;
|
||||
@@ -122,7 +122,8 @@ defineExpose({
|
||||
|
||||
<FormGroup>
|
||||
<label for="retentionInput">{{ $t('backups.configureBackupSchedule.retentionPolicy') }}</label>
|
||||
<SingleSelect id="retentionInput" v-model="configureRetention" :options="BackupSitesModel.backupRetentions" option-key="id" option-label="name" />
|
||||
<!-- we do not used id as key because SingleSelect can only handle strings -->
|
||||
<SingleSelect id="retentionInput" v-model="configureRetention" :options="BackupSitesModel.backupRetentions" option-key="name" option-label="name" />
|
||||
</FormGroup>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
@@ -318,10 +318,6 @@ onMounted(async () => {
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.backup-site:hover {
|
||||
/*background-color: var(--pankow-color-background-hover);*/
|
||||
}
|
||||
|
||||
.backup-site-details {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
Reference in New Issue
Block a user