mirror of
https://git.proxmox.com/git/proxmox-widget-toolkit
synced 2025-07-12 16:13:14 +00:00
notification: allow to select filter for notification targets
This commit adds a new selector field for existing endpoint configuration where one is able to select a notification filter. Signed-off-by: Lukas Wagner <l.wagner@proxmox.com> Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
ea5aa12261
commit
90dbb2d359
@ -44,6 +44,7 @@ JSSRC= \
|
|||||||
form/RoleSelector.js \
|
form/RoleSelector.js \
|
||||||
form/DiskSelector.js \
|
form/DiskSelector.js \
|
||||||
form/MultiDiskSelector.js \
|
form/MultiDiskSelector.js \
|
||||||
|
form/NotificationFilterSelector.js \
|
||||||
form/TaskTypeSelector.js \
|
form/TaskTypeSelector.js \
|
||||||
form/ACME.js \
|
form/ACME.js \
|
||||||
form/UserSelector.js \
|
form/UserSelector.js \
|
||||||
|
58
src/form/NotificationFilterSelector.js
Normal file
58
src/form/NotificationFilterSelector.js
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
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();
|
||||||
|
},
|
||||||
|
});
|
@ -32,6 +32,15 @@ Ext.define('Proxmox.panel.GotifyEditPanel', {
|
|||||||
allowBlank: '{!isCreate}',
|
allowBlank: '{!isCreate}',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
xtype: 'pmxNotificationFilterSelector',
|
||||||
|
name: 'filter',
|
||||||
|
fieldLabel: gettext('Filter'),
|
||||||
|
cbind: {
|
||||||
|
deleteEmpty: '{!isCreate}',
|
||||||
|
baseUrl: '{baseUrl}',
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
xtype: 'proxmoxtextfield',
|
xtype: 'proxmoxtextfield',
|
||||||
name: 'comment',
|
name: 'comment',
|
||||||
|
@ -145,6 +145,10 @@ Ext.define('Proxmox.panel.NotificationEndpointView', {
|
|||||||
initComponent: function() {
|
initComponent: function() {
|
||||||
let me = this;
|
let me = this;
|
||||||
|
|
||||||
|
if (!me.baseUrl) {
|
||||||
|
throw "baseUrl is not set!";
|
||||||
|
}
|
||||||
|
|
||||||
let menuItems = [];
|
let menuItems = [];
|
||||||
for (const [endpointType, config] of Object.entries(
|
for (const [endpointType, config] of Object.entries(
|
||||||
Proxmox.Schema.notificationEndpointTypes).sort()) {
|
Proxmox.Schema.notificationEndpointTypes).sort()) {
|
||||||
|
@ -21,6 +21,15 @@ Ext.define('Proxmox.panel.NotificationGroupEditPanel', {
|
|||||||
name: 'endpoint',
|
name: 'endpoint',
|
||||||
allowBlank: false,
|
allowBlank: false,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
xtype: 'pmxNotificationFilterSelector',
|
||||||
|
name: 'filter',
|
||||||
|
fieldLabel: gettext('Filter'),
|
||||||
|
cbind: {
|
||||||
|
deleteEmpty: '{!isCreate}',
|
||||||
|
baseUrl: '{baseUrl}',
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
xtype: 'proxmoxtextfield',
|
xtype: 'proxmoxtextfield',
|
||||||
name: 'comment',
|
name: 'comment',
|
||||||
|
@ -88,6 +88,15 @@ Ext.define('Proxmox.panel.SendmailEditPanel', {
|
|||||||
return this.up('pmxSendmailEditPanel').mailValidator();
|
return this.up('pmxSendmailEditPanel').mailValidator();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
xtype: 'pmxNotificationFilterSelector',
|
||||||
|
name: 'filter',
|
||||||
|
fieldLabel: gettext('Filter'),
|
||||||
|
cbind: {
|
||||||
|
deleteEmpty: '{!isCreate}',
|
||||||
|
baseUrl: '{baseUrl}',
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
xtype: 'proxmoxtextfield',
|
xtype: 'proxmoxtextfield',
|
||||||
name: 'comment',
|
name: 'comment',
|
||||||
|
@ -43,6 +43,7 @@ Ext.define('Proxmox.window.EndpointEditBase', {
|
|||||||
name: me.name,
|
name: me.name,
|
||||||
xtype: endpointConfig.ipanel,
|
xtype: endpointConfig.ipanel,
|
||||||
isCreate: me.isCreate,
|
isCreate: me.isCreate,
|
||||||
|
baseUrl: me.baseUrl,
|
||||||
type: me.type,
|
type: me.type,
|
||||||
}],
|
}],
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user