[pbs-devel] [PATCH proxmox-backup v14 20/26] ui: render 'unmount' maintenance mode correctly

Dominik Csapak d.csapak at proxmox.com
Mon Nov 25 14:24:43 CET 2024


comments inline

On 11/22/24 15:47, Hannes Laimer wrote:
> Signed-off-by: Hannes Laimer <h.laimer at proxmox.com>
> ---
>   www/Utils.js                     |  4 +++-
>   www/window/MaintenanceOptions.js | 10 ++++++++++
>   2 files changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/www/Utils.js b/www/Utils.js
> index 7756e9b5d..6bae9b709 100644
> --- a/www/Utils.js
> +++ b/www/Utils.js
> @@ -775,7 +775,7 @@ Ext.define('PBS.Utils', {
>   	let extra = '';
>   
>   	if (activeTasks !== undefined) {
> -	    const conflictingTasks = activeTasks.write + (type === 'offline' ? activeTasks.read : 0);
> +	    const conflictingTasks = activeTasks.write + (type === 'offline' || type === 'unmount' ? activeTasks.read : 0);
>   
>   	    if (conflictingTasks > 0) {
>   		extra += '| <i class="fa fa-spinner fa-pulse fa-fw"></i> ';
> @@ -795,6 +795,8 @@ Ext.define('PBS.Utils', {
>   		break;
>   	    case 'offline': modeText = gettext("Offline");
>   		break;
> +	    case 'unmount': modeText = gettext("Unmounting");
> +		break;
>   	}
>   	return `${modeText} ${extra}`;
>       },
> diff --git a/www/window/MaintenanceOptions.js b/www/window/MaintenanceOptions.js
> index 527c36987..d7348cb4f 100644
> --- a/www/window/MaintenanceOptions.js
> +++ b/www/window/MaintenanceOptions.js
> @@ -52,6 +52,7 @@ Ext.define('PBS.window.MaintenanceOptions', {
>   	items: [
>   	    {
>   		xtype: 'pbsMaintenanceType',
> +		id: 'type-field',

same as previous patch: please don't use 'id' for this
(especially using such generic names)

>   		name: 'maintenance-type',
>   		fieldLabel: gettext('Maintenance Type'),
>   		value: '__default__',
> @@ -85,6 +86,15 @@ Ext.define('PBS.window.MaintenanceOptions', {
>   	    };
>   	}
>   
> +        let unmounting = options['maintenance-type'] === 'unmount';
> +        let defaultType = options['maintenance-type'] === '__default__';
> +        if (unmounting) {
> +            options['maintenance-type'] = '';
> +        }
> +
>   	me.callParent([options]);
> +
> +        Ext.ComponentManager.get('type-field').setDisabled(unmounting);
> +        Ext.ComponentManager.get('message-field').setDisabled(unmounting || defaultType);
>       },
>   });





More information about the pbs-devel mailing list