delete values.node;
}
+ // Get rid of new-old parameters for notification settings.
+ // These should only be set for those selected few who ran
+ // pve-manager from pvetest.
+ if (!isCreate) {
+ Proxmox.Utils.assemble_field_data(values, { 'delete': 'notification-policy' });
+ Proxmox.Utils.assemble_field_data(values, { 'delete': 'notification-target' });
+ }
+
if (!values.id && isCreate) {
values.id = 'backup-' + Ext.data.identifier.Uuid.Global.generate().slice(0, 13);
}
success: function(response, _options) {
let data = response.result.data;
+ // Migrate 'new'-old notification-policy back to
+ // old-old mailnotification. Only should affect
+ // users who used pve-manager from pvetest.
+ // This was a remnant of notifications before the
+ // overhaul.
+ let policy = data['notification-policy'];
+ if (policy === 'always' || policy === 'failure') {
+ data.mailnotification = policy;
+ }
+
if (data.exclude) {
data.vmid = data.exclude;
data.selMode = 'exclude';
PVE.Utils.unEscapeNotesTemplate(data['notes-template']);
}
+ if (data.performance) {
+ Object.assign(data, data.performance);
+ delete data.performance;
+ }
+
view.setValues(data);
},
});
viewModel: {
data: {
selMode: 'include',
+ notificationMode: '__default__',
},
formulas: {
poolMode: (get) => get('selMode') === 'pool',
disableVMSelection: (get) => get('selMode') !== 'include' && get('selMode') !== 'exclude',
+ showMailtoFields: (get) =>
+ ['auto', 'legacy-sendmail', '__default__'].includes(get('notificationMode')),
},
},
],
column2: [
{
- xtype: 'textfield',
- fieldLabel: gettext('Send email to'),
- name: 'mailto',
+ xtype: 'proxmoxKVComboBox',
+ comboItems: [
+ [
+ '__default__',
+ Ext.String.format(
+ gettext('{0} (Auto)'), Proxmox.Utils.defaultText,
+ ),
+ ],
+ ['auto', gettext('Auto')],
+ ['legacy-sendmail', gettext('Email (legacy)')],
+ ['notification-system', gettext('Notification system')],
+ ],
+ fieldLabel: gettext('Notification mode'),
+ name: 'notification-mode',
+ cbind: {
+ deleteEmpty: '{!isCreate}',
+ },
+ bind: {
+ value: '{notificationMode}',
+ },
},
{
xtype: 'pveEmailNotificationSelector',
- fieldLabel: gettext('Email'),
+ fieldLabel: gettext('Send email'),
name: 'mailnotification',
cbind: {
value: (get) => get('isCreate') ? 'always' : '',
deleteEmpty: '{!isCreate}',
},
+ bind: {
+ disabled: '{!showMailtoFields}',
+ },
+ },
+ {
+ xtype: 'textfield',
+ fieldLabel: gettext('Send email to'),
+ name: 'mailto',
+ bind: {
+ disabled: '{!showMailtoFields}',
+ },
},
{
- xtype: 'pveCompressionSelector',
+ xtype: 'pveBackupCompressionSelector',
reference: 'compressionSelector',
fieldLabel: gettext('Compression'),
name: 'compress',
},
],
},
+ {
+ xtype: 'pveBackupAdvancedOptionsPanel',
+ title: gettext('Advanced'),
+ cbind: {
+ isCreate: '{isCreate}',
+ },
+ },
],
},
],
return;
}
- let win = Ext.create('PVE.dc.BackupEdit', {
+ Ext.create('PVE.dc.BackupEdit', {
+ autoShow: true,
jobid: rec.data.id,
+ listeners: {
+ destroy: () => reload(),
+ },
});
- win.on('destroy', reload);
- win.show();
};
let run_detail = function() {
width: 80,
dataIndex: 'enabled',
align: 'center',
- // TODO: switch to Proxmox.Utils.renderEnabledIcon once available
- renderer: enabled => `<i class="fa fa-${enabled ? 'check' : 'minus'}"></i>`,
+ renderer: Proxmox.Utils.renderEnabledIcon,
sortable: true,
},
{