[pve-devel] [PATCH v3 pve-manager 3/5] ui: backup jobs: add 'notification-mode' selector for backup jobs

Philipp Hufnagl p.hufnagl at proxmox.com
Tue Nov 21 13:51:50 CET 2023



On 11/21/23 13:23, Lukas Wagner wrote:
> This selector allows one to selected between the 'old' (send email
> directly via sendmail) or the 'new' notification system.
> 
> The default is 'auto', which sends and email if one is configured,
> and uses the notification system if no email address is set.
> 
> Signed-off-by: Lukas Wagner <l.wagner at proxmox.com>
> ---
>  www/manager6/dc/Backup.js | 33 ++++++++++++++++++++++++++++++++-
>  1 file changed, 32 insertions(+), 1 deletion(-)
> 
> diff --git a/www/manager6/dc/Backup.js b/www/manager6/dc/Backup.js
> index 9aae4090..8f7bab5a 100644
> --- a/www/manager6/dc/Backup.js
> +++ b/www/manager6/dc/Backup.js
> @@ -206,12 +206,15 @@ Ext.define('PVE.dc.BackupEdit', {
>      viewModel: {
>  	data: {
>  	    selMode: 'include',
> +	    notificationMode: '__default__',
>  	},
>  
>  	formulas: {
>  	    poolMode: (get) => get('selMode') === 'pool',
>  	    disableVMSelection: (get) => get('selMode') !== 'include' && get('selMode') !== 'exclude',
> -	    mailNotificationSelected: (get) => get('notificationMode') === 'mailto',
> +	    showMailtoFields: (get) => {
> +		return ['auto', 'legacy-sendmail', '__default__'].includes(get('notificationMode'));
> +	    },

WARN: line 215 col 33: arrow-body-style - Unexpected block statement
surrounding arrow body; move the returned value immediately after the
`=>`. (*)

I think it wants you to inline this like

showMailtoFields: (get) => ['auto', 'legacy-sendmail',
'__default__'].includes(get('notificationMode')),



>  	},
>      },
>  
> @@ -301,6 +304,28 @@ Ext.define('PVE.dc.BackupEdit', {
>  				},
>  			    ],
>  			    column2: [
> +				{
> +				    xtype: 'proxmoxKVComboBox',
> +				    comboItems: [
> +					[
> +					    '__default__',
> +					    Ext.String.format(
> +						gettext('{0} (Auto)'), Proxmox.Utils.defaultText
nit: comma
> +					    )
nit: comma
> +					],
> +					['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('Notify'),
> @@ -309,11 +334,17 @@ Ext.define('PVE.dc.BackupEdit', {
>  					value: (get) => get('isCreate') ? 'always' : '',
>  					deleteEmpty: '{!isCreate}',
>  				    },
> +				    bind: {
> +					disabled: '{!showMailtoFields}',
> +				    }
nit: comma
>  				},
>  				{
>  				    xtype: 'textfield',
>  				    fieldLabel: gettext('Send email to'),
>  				    name: 'mailto',
> +				    bind: {
> +					disabled: '{!showMailtoFields}',
> +				    }
nit: comma
>  				},
>  				{
>  				    xtype: 'pveBackupCompressionSelector',





More information about the pve-devel mailing list