[pve-devel] [PATCH manager v2 4/5] ui: GuestStatusView: show privileged status as new row

Dominik Csapak d.csapak at proxmox.com
Fri Oct 20 15:27:36 CEST 2023


one small comment inline

On 7/5/23 13:12, Christoph Heiss wrote:
> As that info is not available through the store (which stores the
> status), it must be fetched separately.
> 
> Signed-off-by: Christoph Heiss <c.heiss at proxmox.com>
> ---
>   www/manager6/panel/GuestStatusView.js | 32 +++++++++++++++++++++++++++
>   1 file changed, 32 insertions(+)
> 
> diff --git a/www/manager6/panel/GuestStatusView.js b/www/manager6/panel/GuestStatusView.js
> index 8db1f492c..ca2f03453 100644
> --- a/www/manager6/panel/GuestStatusView.js
> +++ b/www/manager6/panel/GuestStatusView.js
> @@ -11,6 +11,29 @@ Ext.define('PVE.panel.GuestStatusView', {
>   	};
>       },
>   
> +    controller: {
> +	xclass: 'Ext.app.ViewController',
> +
> +	init: view => {

while this works, it's a rather unusual use for us

normally we use the standard 'function(view) {}' syntax
the advantage of that is that the 'this' object then
is the controller

if someone wants to use the controller in the future and starts
using 'this' it won't work with the arrow syntax (it will be undefined)

> +	    if (view.pveSelNode.data.type !== 'lxc') {
> +		return;
> +	    }
> +
> +	    const nodename = view.pveSelNode.data.node;
> +	    const vmid = view.pveSelNode.data.vmid;
> +
> +	    Proxmox.Utils.API2Request({
> +		url: `/api2/extjs/nodes/${nodename}/lxc/${vmid}/config`,
> +		waitMsgTargetView: view,
> +		method: 'GET',
> +		success: ({ result }) => {
> +		    view.down('#unprivileged').updateValue(
> +			Proxmox.Utils.format_boolean(result.data.unprivileged));
> +		},
> +	    });
> +	},
> +    },
> +
>       layout: {
>   	type: 'vbox',
>   	align: 'stretch',
> @@ -58,6 +81,15 @@ Ext.define('PVE.panel.GuestStatusView', {
>   	    },
>   	    printBar: false,
>   	},
> +	{
> +	    itemId: 'unprivileged',
> +	    iconCls: 'fa fa-lock fa-fw',
> +	    title: gettext('Unprivileged'),
> +	    printBar: false,
> +	    cbind: {
> +		hidden: '{isQemu}',
> +	    },
> +	},
>   	{
>   	    xtype: 'box',
>   	    height: 15,






More information about the pve-devel mailing list