[pve-devel] [PATCH manager] make GuestStatusView declarative
Dominik Csapak
d.csapak at proxmox.com
Mon Feb 26 13:12:21 CET 2018
use the cbind function to generate isLxc/Qemu to hide the
relevant fields, and cbind the nodename
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
www/manager6/panel/GuestStatusView.js | 35 +++++++++++++++++++++--------------
1 file changed, 21 insertions(+), 14 deletions(-)
diff --git a/www/manager6/panel/GuestStatusView.js b/www/manager6/panel/GuestStatusView.js
index 5f6360ae..2a17869a 100644
--- a/www/manager6/panel/GuestStatusView.js
+++ b/www/manager6/panel/GuestStatusView.js
@@ -5,6 +5,14 @@ Ext.define('PVE.panel.GuestStatusView', {
height: 300,
+ cbindData: function (initialConfig) {
+ var me = this;
+ return {
+ isQemu: me.pveSelNode.data.type === 'qemu',
+ isLxc: me.pveSelNode.data.type === 'lxc'
+ };
+ },
+
layout: {
type: 'vbox',
align: 'stretch'
@@ -35,9 +43,13 @@ Ext.define('PVE.panel.GuestStatusView', {
renderer: PVE.Utils.format_ha
},
{
+ xtype: 'pveInfoWidget',
itemId: 'node',
iconCls: 'fa fa-building fa-fw',
title: gettext('Node'),
+ cbind: {
+ text: '{pveSelNode.data.node}'
+ },
printBar: false
},
{
@@ -64,10 +76,15 @@ Ext.define('PVE.panel.GuestStatusView', {
},
{
itemId: 'swap',
+ xtype: 'pveInfoWidget',
iconCls: 'fa fa-refresh fa-fw',
title: gettext('SWAP usage'),
valueField: 'swap',
- maxField: 'maxswap'
+ maxField: 'maxswap',
+ cbind: {
+ hidden: '{isQemu}',
+ disabled: '{isQemu}'
+ }
},
{
itemId: 'rootfs',
@@ -95,7 +112,9 @@ Ext.define('PVE.panel.GuestStatusView', {
xtype: 'pveAgentIPView',
cbind: {
rstore: '{rstore}',
- pveSelNode: '{pveSelNode}'
+ pveSelNode: '{pveSelNode}',
+ hidden: '{isLxc}',
+ disabled: '{isLxc}'
}
}
],
@@ -111,17 +130,5 @@ Ext.define('PVE.panel.GuestStatusView', {
}
me.setTitle(me.getRecordValue('name') + text);
- },
-
- initComponent: function() {
- var me = this;
-
- me.callParent();
- if (me.pveSelNode.data.type !== 'lxc') {
- me.remove(me.getComponent('swap'));
- } else {
- me.remove(me.getComponent('ips'));
- }
- me.getComponent('node').updateValue(me.pveSelNode.data.node);
}
});
--
2.11.0
More information about the pve-devel
mailing list