pve-manager/www/manager6/form/NotificationTargetSelector.js
Lukas Wagner 2c4780cc18 ui: backup: allow to select notification target for jobs
This commit adds a possibility to choose between different options
for notifications for backup jobs:
    - Notify via email, in the same manner as before
    - Notify via an endpoint/group

If 'notify via mail' is selected, a text field where an email address
can be entered is displayed:

    Notify:         | Always notify  v |
    Notify via:     | E-Mail         v |
    Send Mail to:   | foo@example.com  |
    Compression:    | .....          v |

If the other option is selected selected, a combo picker for selecting
a channel is displayed:

    Notify:         | Always notify  v |
    Notify via:     | Endpoint/Group v |
    Target:         | endpoint-foo   v |
    Compression:    | .....          v |

The code has also been adapted to use the newly introduced
'notification-policy' parameter, which replaces the 'mailnotification'
paramter for backup jobs. Some logic which automatically migrates from
'mailnotification' has been added.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2023-08-16 11:11:12 +02:00

55 lines
1.0 KiB
JavaScript

Ext.define('PVE.form.NotificationTargetSelector', {
extend: 'Proxmox.form.ComboGrid',
alias: ['widget.pveNotificationTargetSelector'],
// set default value to empty array, else it inits it with
// null and after the store load it is an empty array,
// triggering dirtychange
value: [],
valueField: 'name',
displayField: 'name',
deleteEmpty: true,
skipEmptyText: true,
store: {
fields: ['name', 'type', 'comment'],
proxy: {
type: 'proxmox',
url: '/api2/json/cluster/notifications/targets',
},
sorters: [
{
property: 'name',
direction: 'ASC',
},
],
autoLoad: true,
},
listConfig: {
columns: [
{
header: gettext('Target'),
dataIndex: 'name',
sortable: true,
hideable: false,
flex: 1,
},
{
header: gettext('Type'),
dataIndex: 'type',
sortable: true,
hideable: false,
flex: 1,
},
{
header: gettext('Comment'),
dataIndex: 'comment',
sortable: true,
hideable: false,
flex: 2,
},
],
},
});