mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-03 21:42:14 +00:00
ui: backup job detail view: shrink code for set values of keep-X fields
makes it quite concise, but there's nothing really complex happening, so should be still easy to grasp (especially with the comment added) Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
021838f8d3
commit
2a7785a4a0
@ -783,16 +783,6 @@ Ext.define('PVE.dc.BackupInfo', {
|
||||
});
|
||||
|
||||
if (values['prune-backups'] || values.maxfiles !== undefined) {
|
||||
const keepNames = [
|
||||
'keep-all',
|
||||
'keep-last',
|
||||
'keep-hourly',
|
||||
'keep-daily',
|
||||
'keep-weekly',
|
||||
'keep-monthly',
|
||||
'keep-yearly',
|
||||
];
|
||||
|
||||
let keepValues;
|
||||
if (values['prune-backups']) {
|
||||
keepValues = values['prune-backups'];
|
||||
@ -804,11 +794,10 @@ Ext.define('PVE.dc.BackupInfo', {
|
||||
|
||||
vm.set('retentionType', keepValues['keep-all'] ? 'all' : 'other');
|
||||
|
||||
keepNames.forEach(function(name) {
|
||||
let field = me.query('[isFormField][name=' + name + ']')[0];
|
||||
if (field) {
|
||||
field.setValue(keepValues[name]);
|
||||
}
|
||||
// set values of all keep-X fields
|
||||
['all', 'last', 'hourly', 'daily', 'weekly', 'monthly', 'yearly'].forEach(time => {
|
||||
let name = `keep-${time}`;
|
||||
me.query(`[isFormField][name=${name}]`)[0]?.setValue(keepValues[name]);
|
||||
});
|
||||
} else {
|
||||
vm.set('retentionType', 'none');
|
||||
|
Loading…
Reference in New Issue
Block a user