mirror of
https://git.proxmox.com/git/proxmox-widget-toolkit
synced 2025-07-26 05:47:09 +00:00
notification ui: add enable checkbox for targets/matchers
Add a 'enable' checkbox for targets and matchers in their edit windows. Also show a new 'enable' column in the overview panel. The parameter in the config is actually called 'disable', so the UI needs to invert the setting in the appropriate on{Get,Set}Values hooks. Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
This commit is contained in:
parent
3003f37779
commit
5f7b28cb19
@ -1,6 +1,6 @@
|
|||||||
Ext.define('proxmox-notification-endpoints', {
|
Ext.define('proxmox-notification-endpoints', {
|
||||||
extend: 'Ext.data.Model',
|
extend: 'Ext.data.Model',
|
||||||
fields: ['name', 'type', 'comment'],
|
fields: ['name', 'type', 'comment', 'disable'],
|
||||||
proxy: {
|
proxy: {
|
||||||
type: 'proxmox',
|
type: 'proxmox',
|
||||||
},
|
},
|
||||||
@ -9,7 +9,7 @@ Ext.define('proxmox-notification-endpoints', {
|
|||||||
|
|
||||||
Ext.define('proxmox-notification-matchers', {
|
Ext.define('proxmox-notification-matchers', {
|
||||||
extend: 'Ext.data.Model',
|
extend: 'Ext.data.Model',
|
||||||
fields: ['name', 'comment'],
|
fields: ['name', 'comment', 'disable'],
|
||||||
proxy: {
|
proxy: {
|
||||||
type: 'proxmox',
|
type: 'proxmox',
|
||||||
},
|
},
|
||||||
|
@ -16,6 +16,13 @@ Ext.define('Proxmox.panel.GotifyEditPanel', {
|
|||||||
fieldLabel: gettext('Endpoint Name'),
|
fieldLabel: gettext('Endpoint Name'),
|
||||||
allowBlank: false,
|
allowBlank: false,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
xtype: 'proxmoxcheckbox',
|
||||||
|
name: 'enable',
|
||||||
|
fieldLabel: gettext('Enable'),
|
||||||
|
allowBlank: false,
|
||||||
|
checked: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
xtype: 'proxmoxtextfield',
|
xtype: 'proxmoxtextfield',
|
||||||
fieldLabel: gettext('Server URL'),
|
fieldLabel: gettext('Server URL'),
|
||||||
@ -41,4 +48,27 @@ Ext.define('Proxmox.panel.GotifyEditPanel', {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
||||||
|
onSetValues: (values) => {
|
||||||
|
values.enable = !values.disable;
|
||||||
|
|
||||||
|
delete values.disable;
|
||||||
|
return values;
|
||||||
|
},
|
||||||
|
|
||||||
|
onGetValues: function(values) {
|
||||||
|
let me = this;
|
||||||
|
|
||||||
|
if (values.enable) {
|
||||||
|
if (!me.isCreate) {
|
||||||
|
Proxmox.Utils.assemble_field_data(values, { 'delete': 'disable' });
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
values.disable = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
delete values.enable;
|
||||||
|
|
||||||
|
return values;
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
@ -119,6 +119,12 @@ Ext.define('Proxmox.panel.NotificationEndpointView', {
|
|||||||
emptyText: gettext('No notification targets configured'),
|
emptyText: gettext('No notification targets configured'),
|
||||||
|
|
||||||
columns: [
|
columns: [
|
||||||
|
{
|
||||||
|
dataIndex: 'disable',
|
||||||
|
text: gettext('Enable'),
|
||||||
|
renderer: (disable) => Proxmox.Utils.renderEnabledIcon(!disable),
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
dataIndex: 'name',
|
dataIndex: 'name',
|
||||||
text: gettext('Target Name'),
|
text: gettext('Target Name'),
|
||||||
@ -250,6 +256,12 @@ Ext.define('Proxmox.panel.NotificationMatcherView', {
|
|||||||
emptyText: gettext('No notification matchers configured'),
|
emptyText: gettext('No notification matchers configured'),
|
||||||
|
|
||||||
columns: [
|
columns: [
|
||||||
|
{
|
||||||
|
dataIndex: 'disable',
|
||||||
|
text: gettext('Enable'),
|
||||||
|
renderer: (disable) => Proxmox.Utils.renderEnabledIcon(!disable),
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
dataIndex: 'name',
|
dataIndex: 'name',
|
||||||
text: gettext('Matcher Name'),
|
text: gettext('Matcher Name'),
|
||||||
|
@ -27,6 +27,13 @@ Ext.define('Proxmox.panel.SendmailEditPanel', {
|
|||||||
fieldLabel: gettext('Endpoint Name'),
|
fieldLabel: gettext('Endpoint Name'),
|
||||||
allowBlank: false,
|
allowBlank: false,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
xtype: 'proxmoxcheckbox',
|
||||||
|
name: 'enable',
|
||||||
|
fieldLabel: gettext('Enable'),
|
||||||
|
allowBlank: false,
|
||||||
|
checked: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
// provides 'mailto' and 'mailto-user' fields
|
// provides 'mailto' and 'mailto-user' fields
|
||||||
xtype: 'pmxEmailRecipientPanel',
|
xtype: 'pmxEmailRecipientPanel',
|
||||||
@ -67,7 +74,26 @@ Ext.define('Proxmox.panel.SendmailEditPanel', {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
||||||
onGetValues: (values) => {
|
onSetValues: (values) => {
|
||||||
|
values.enable = !values.disable;
|
||||||
|
|
||||||
|
delete values.disable;
|
||||||
|
return values;
|
||||||
|
},
|
||||||
|
|
||||||
|
onGetValues: function(values) {
|
||||||
|
let me = this;
|
||||||
|
|
||||||
|
if (values.enable) {
|
||||||
|
if (!me.isCreate) {
|
||||||
|
Proxmox.Utils.assemble_field_data(values, { 'delete': 'disable' });
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
values.disable = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
delete values.enable;
|
||||||
|
|
||||||
if (values.mailto) {
|
if (values.mailto) {
|
||||||
values.mailto = values.mailto.split(/[\s,;]+/);
|
values.mailto = values.mailto.split(/[\s,;]+/);
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,13 @@ Ext.define('Proxmox.panel.SmtpEditPanel', {
|
|||||||
fieldLabel: gettext('Endpoint Name'),
|
fieldLabel: gettext('Endpoint Name'),
|
||||||
allowBlank: false,
|
allowBlank: false,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
xtype: 'proxmoxcheckbox',
|
||||||
|
name: 'enable',
|
||||||
|
fieldLabel: gettext('Enable'),
|
||||||
|
allowBlank: false,
|
||||||
|
checked: true,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
|
|
||||||
column1: [
|
column1: [
|
||||||
@ -161,15 +168,27 @@ Ext.define('Proxmox.panel.SmtpEditPanel', {
|
|||||||
],
|
],
|
||||||
|
|
||||||
onGetValues: function(values) {
|
onGetValues: function(values) {
|
||||||
|
let me = this;
|
||||||
|
|
||||||
if (values.mailto) {
|
if (values.mailto) {
|
||||||
values.mailto = values.mailto.split(/[\s,;]+/);
|
values.mailto = values.mailto.split(/[\s,;]+/);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!values.authentication && !this.isCreate) {
|
if (!values.authentication && !me.isCreate) {
|
||||||
Proxmox.Utils.assemble_field_data(values, { 'delete': 'username' });
|
Proxmox.Utils.assemble_field_data(values, { 'delete': 'username' });
|
||||||
Proxmox.Utils.assemble_field_data(values, { 'delete': 'password' });
|
Proxmox.Utils.assemble_field_data(values, { 'delete': 'password' });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (values.enable) {
|
||||||
|
if (!me.isCreate) {
|
||||||
|
Proxmox.Utils.assemble_field_data(values, { 'delete': 'disable' });
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
values.disable = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
delete values.enable;
|
||||||
|
|
||||||
delete values.authentication;
|
delete values.authentication;
|
||||||
|
|
||||||
return values;
|
return values;
|
||||||
@ -177,6 +196,8 @@ Ext.define('Proxmox.panel.SmtpEditPanel', {
|
|||||||
|
|
||||||
onSetValues: function(values) {
|
onSetValues: function(values) {
|
||||||
values.authentication = !!values.username;
|
values.authentication = !!values.username;
|
||||||
|
values.enable = !values.disable;
|
||||||
|
delete values.disable;
|
||||||
|
|
||||||
return values;
|
return values;
|
||||||
},
|
},
|
||||||
|
@ -14,6 +14,13 @@ Ext.define('Proxmox.panel.NotificationMatcherGeneralPanel', {
|
|||||||
fieldLabel: gettext('Matcher Name'),
|
fieldLabel: gettext('Matcher Name'),
|
||||||
allowBlank: false,
|
allowBlank: false,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
xtype: 'proxmoxcheckbox',
|
||||||
|
name: 'enable',
|
||||||
|
fieldLabel: gettext('Enable'),
|
||||||
|
allowBlank: false,
|
||||||
|
checked: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
xtype: 'proxmoxtextfield',
|
xtype: 'proxmoxtextfield',
|
||||||
name: 'comment',
|
name: 'comment',
|
||||||
@ -23,6 +30,29 @@ Ext.define('Proxmox.panel.NotificationMatcherGeneralPanel', {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
||||||
|
onSetValues: function(values) {
|
||||||
|
values.enable = !values.disable;
|
||||||
|
|
||||||
|
delete values.disable;
|
||||||
|
return values;
|
||||||
|
},
|
||||||
|
|
||||||
|
onGetValues: function(values) {
|
||||||
|
let me = this;
|
||||||
|
|
||||||
|
if (values.enable) {
|
||||||
|
if (!me.isCreate) {
|
||||||
|
Proxmox.Utils.assemble_field_data(values, { 'delete': 'disable' });
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
values.disable = 1;
|
||||||
|
}
|
||||||
|
delete values.enable;
|
||||||
|
|
||||||
|
return values;
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
Ext.define('Proxmox.panel.NotificationMatcherTargetPanel', {
|
Ext.define('Proxmox.panel.NotificationMatcherTargetPanel', {
|
||||||
|
Loading…
Reference in New Issue
Block a user