prune jobs: switch default to on-error-only notifications

we can still do that as notifications for prune jobs weren't released
yet.

We may want to evaluate if we adapt (some) other notification types
too on next major release.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2022-11-24 17:32:03 +01:00
parent c4166d27fc
commit b1dacb0710
2 changed files with 16 additions and 8 deletions

View File

@ -425,13 +425,9 @@ pub fn send_prune_status(
(None, _) => return Ok(()),
};
match notify.prune {
None => { /* send notifications by default */ }
Some(notify) => {
if notify == Notify::Never || (result.is_ok() && notify == Notify::Error) {
return Ok(());
}
}
let notify_prune = notify.prune.unwrap_or(Notify::Error);
if notify_prune == Notify::Never || (result.is_ok() && notify_prune == Notify::Error) {
return Ok(());
}
let (fqdn, port) = get_server_url();

View File

@ -10,6 +10,18 @@ Ext.define('PBS.form.NotifyType', {
],
});
Ext.define('PBS.form.NotifyErrorDefaultType', {
extend: 'Proxmox.form.KVComboBox',
alias: 'widget.pbsNotifyErrorDefaultType',
comboItems: [
['__default__', gettext('Default (Errors)')],
['always', gettext('Always')],
['error', gettext('Errors')],
['never', gettext('Never')],
],
});
Ext.define('PBS.window.NotifyOptions', {
extend: 'Proxmox.window.Edit',
xtype: 'pbsNotifyOptionEdit',
@ -73,7 +85,7 @@ Ext.define('PBS.window.NotifyOptions', {
deleteEmpty: false,
},
{
xtype: 'pbsNotifyType',
xtype: 'pbsNotifyErrorDefaultType',
name: 'prune',
fieldLabel: gettext('Prune Jobs'),
value: '__default__',