[pve-devel] [PATCH manager 2/4] node zfs: added new component to display additional zfs details

Dominik Csapak d.csapak at proxmox.com
Mon Nov 5 14:29:12 CET 2018


On 10/31/18 2:03 PM, Tim Marx wrote:
> Signed-off-by: Tim Marx <t.marx at proxmox.com>
> ---
>   www/manager6/node/ZFS.js | 63 ++++++++++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 63 insertions(+)
> 
> diff --git a/www/manager6/node/ZFS.js b/www/manager6/node/ZFS.js
> index c28e20c9..9314e45e 100644
> --- a/www/manager6/node/ZFS.js
> +++ b/www/manager6/node/ZFS.js
> @@ -262,6 +262,69 @@ Ext.define('PVE.node.ZFSStatus', {
>       }
>   });
>   
> +Ext.define('PVE.node.ZFSStatus', {
> +    extend: 'Ext.grid.Panel',
> +    xtype: 'pveZFSStatus',
> +    layout: 'fit',
> +    border: false,
> +    hideHeaders: true,
> +    columns: [
> +	{
> +	    dataIndex: 'key'
> +	},
> +	{
> +	    dataIndex: 'value',
> +	    flex: 1
> +	}
> +    ],
> +
> +
> +    initComponent: function() {
> +	 /*jslint confusion: true */
> +        var me = this;
> +
> +	if (!me.nodename) {
> +	    throw "no node name specified";
> +	}
> +
> +	if (!me.zpool) {
> +	    throw "no zpool specified";
> +	}
> +	
> +	var rows = {
> +	    scan: {
> +		header: gettext('Scan')
> +	    },
> +	    status: {
> +		header: gettext('Status')
> +	    },
> +	    action: {
> +		header: gettext('Action')
> +	    },
> +	    errors: {
> +		header: gettext('Errors')
> +	    }
> +	};
> +	
> +	
> +	me.store = {
> +	    model: 'KeyValue',
> +	    proxy: {
> +		type: 'proxmox',
> +		url: "/api2/extjs/nodes/" + me.nodename + "/disks/zfs/" + me.zpool,
> +		reader: {
> +		    type: 'jsonobject',
> +		    rows: rows,
> +		    rootProperty: 'data'
> +		}
> +	    }
> +	};
> +	
> +	me.callParent();
> +	me.store.load();
> +    }
> +});
> +
>   Ext.define('PVE.node.ZFSList', {
>       extend: 'Ext.grid.Panel',
>       xtype: 'pveZFSList',
> 

instead of doing this all manually, look up our proxmox.grid.objectgrid
(in proxmox-widget-toolkit) which does 90% of this already

you would only need to define the rows and an url, the rest is done 
automatically (maybe you still need to set the border)




More information about the pve-devel mailing list