form/RoleSelector.js \
form/DiskSelector.js \
form/MultiDiskSelector.js \
+ form/NotificationFilterSelector.js \
form/TaskTypeSelector.js \
form/ACME.js \
form/UserSelector.js \
--- /dev/null
+Ext.define('Proxmox.form.NotificationFilterSelector', {
+ extend: 'Proxmox.form.ComboGrid',
+ alias: ['widget.pmxNotificationFilterSelector'],
+
+ // 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,
+ allowBlank: true,
+ editable: false,
+ autoSelect: false,
+
+ listConfig: {
+ columns: [
+ {
+ header: gettext('Filter'),
+ dataIndex: 'name',
+ sortable: true,
+ hideable: false,
+ flex: 1,
+ },
+ {
+ header: gettext('Comment'),
+ dataIndex: 'comment',
+ sortable: true,
+ hideable: false,
+ flex: 2,
+ },
+ ],
+ },
+
+ initComponent: function() {
+ let me = this;
+
+ Ext.apply(me, {
+ store: {
+ fields: ['name', 'comment'],
+ proxy: {
+ type: 'proxmox',
+ url: `/api2/json/${me.baseUrl}/filters`,
+ },
+ sorters: [
+ {
+ property: 'name',
+ direction: 'ASC',
+ },
+ ],
+ autoLoad: true,
+ },
+ });
+
+ me.callParent();
+ },
+});
allowBlank: '{!isCreate}',
},
},
+ {
+ xtype: 'pmxNotificationFilterSelector',
+ name: 'filter',
+ fieldLabel: gettext('Filter'),
+ cbind: {
+ deleteEmpty: '{!isCreate}',
+ baseUrl: '{baseUrl}',
+ },
+ },
{
xtype: 'proxmoxtextfield',
name: 'comment',
initComponent: function() {
let me = this;
+ if (!me.baseUrl) {
+ throw "baseUrl is not set!";
+ }
+
let menuItems = [];
for (const [endpointType, config] of Object.entries(
Proxmox.Schema.notificationEndpointTypes).sort()) {
name: 'endpoint',
allowBlank: false,
},
+ {
+ xtype: 'pmxNotificationFilterSelector',
+ name: 'filter',
+ fieldLabel: gettext('Filter'),
+ cbind: {
+ deleteEmpty: '{!isCreate}',
+ baseUrl: '{baseUrl}',
+ },
+ },
{
xtype: 'proxmoxtextfield',
name: 'comment',
return this.up('pmxSendmailEditPanel').mailValidator();
},
},
+ {
+ xtype: 'pmxNotificationFilterSelector',
+ name: 'filter',
+ fieldLabel: gettext('Filter'),
+ cbind: {
+ deleteEmpty: '{!isCreate}',
+ baseUrl: '{baseUrl}',
+ },
+ },
{
xtype: 'proxmoxtextfield',
name: 'comment',
name: me.name,
xtype: endpointConfig.ipanel,
isCreate: me.isCreate,
+ baseUrl: me.baseUrl,
type: me.type,
}],
});