[pve-devel] [PATCH manager 3/7] add GuestStatusView and TemplateStatusView

Dominik Csapak d.csapak at proxmox.com
Mon Jul 11 15:46:14 CEST 2016


this implements the new StatusView class for
guests and templates

using the new pveStatusView, we do not split the status
panels per lxc/qemu, but for Template/Guest

this makes more sense, since the information which lxc
and qemu guests have are more similar than what you want
to display for templates/guests

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/panel/GuestStatusView.js    | 90 ++++++++++++++++++++++++++++++++
 www/manager6/panel/TemplateStatusView.js | 69 ++++++++++++++++++++++++
 2 files changed, 159 insertions(+)
 create mode 100644 www/manager6/panel/GuestStatusView.js
 create mode 100644 www/manager6/panel/TemplateStatusView.js

diff --git a/www/manager6/panel/GuestStatusView.js b/www/manager6/panel/GuestStatusView.js
new file mode 100644
index 0000000..f0178dd
--- /dev/null
+++ b/www/manager6/panel/GuestStatusView.js
@@ -0,0 +1,90 @@
+Ext.define('PVE.panel.GuestStatusView', {
+    extend: 'PVE.panel.StatusView',
+    alias: 'widget.pveGuestStatusView',
+
+    height: 300,
+
+    defaults: {
+	xtype: 'pveInfoWidget',
+	padding: '0 30 5 30',
+	width: 394
+    },
+    items: [
+	{
+	    xtype: 'box',
+	    height: 30
+	},
+	{
+	    itemId: 'status',
+	    title: gettext('Status'),
+	    printBar: false,
+	    textField: 'status'
+	},
+	{
+	    itemId: 'hamanaged',
+	    title: gettext('Managed by HA'),
+	    printBar: false,
+	    textField: 'ha',
+	    renderer: PVE.Utils.format_ha
+	},
+	{
+	    itemId: 'node',
+	    title: gettext('Node'),
+	    printBar: false
+	},
+	{
+	    xtype: 'box',
+	    height: 20
+	},
+	{
+	    itemId: 'cpu',
+	    title: gettext('CPU usage'),
+	    valueField: 'cpu',
+	    maxField: 'cpus',
+	    renderer: PVE.Utils.render_cpu_usage,
+	    calculate: Ext.identityFn
+	},
+	{
+	    itemId: 'memory',
+	    title: gettext('Memory usage'),
+	    valueField: 'mem',
+	    maxField: 'maxmem'
+	},
+	{
+	    itemId: 'swap',
+	    title: gettext('SWAP usage'),
+	    valueField: 'swap',
+	    maxField: 'maxswap'
+	},
+	{
+	    itemId: 'rootfs',
+	    title: gettext('Bootdisk Size'),
+	    textField: 'maxdisk',
+	    printBar: false,
+	    renderer: PVE.Utils.render_size
+	}
+    ],
+
+    updateTitle: function() {
+	var me = this;
+	var uptime = me.getRecordValue('uptime');
+
+	var text = "";
+	if (Number(uptime) > 0) {
+	    text = " (" + gettext('Uptime') + ': ' + PVE.Utils.format_duration_long(uptime)
+		+ ')';
+	}
+
+	me.setTitle(me.getRecordValue('name') + text);
+    },
+
+    initComponent: function() {
+	var me = this;
+
+	me.callParent();
+	if (me.pveSelNode.data.type !== 'lxc') {
+	    me.remove(me.getComponent('swap'));
+	}
+	me.getComponent('node').updateValue(me.pveSelNode.data.node);
+    }
+});
diff --git a/www/manager6/panel/TemplateStatusView.js b/www/manager6/panel/TemplateStatusView.js
new file mode 100644
index 0000000..5226996
--- /dev/null
+++ b/www/manager6/panel/TemplateStatusView.js
@@ -0,0 +1,69 @@
+Ext.define('PVE.panel.TemplateStatusView',{
+    extend: 'PVE.panel.StatusView',
+    alias: 'widget.pveTemplateStatusView',
+
+    defaults: {
+	xtype: 'pveInfoWidget',
+	printBar: false,
+	padding: '5 0 0 20',
+	width: 400
+    },
+    items: [
+	{
+	    xtype: 'box',
+	    padding: '20 0 0 0'
+	},
+	{
+	    itemId: 'node',
+	    title: gettext('Node')
+	},
+	{
+	    xtype: 'box',
+	    padding: '20 0 0 0'
+	},
+	{
+	    itemId: 'cpus',
+	    title: gettext('Processors'),
+	    textField: 'cpus'
+	},
+	{
+	    itemId: 'memory',
+	    title: gettext('Memory'),
+	    textField: 'maxmem',
+	    renderer: PVE.Utils.render_size
+	},
+	{
+	    itemId: 'swap',
+	    title: gettext('Swap'),
+	    textField: 'maxswap',
+	    renderer: PVE.Utils.render_size
+	},
+	{
+	    itemId: 'disk',
+	    title: gettext('Bootdisk size'),
+	    textField: 'maxdisk',
+	    renderer: PVE.Utils.render_size
+	},
+	{
+	    xtype: 'box',
+	    padding: '25 0 0 0'
+	}
+    ],
+
+    initComponent: function() {
+	var me = this;
+
+	var name = me.pveSelNode.data.name;
+	if (!name) {
+	    throw "no name specified";
+	}
+
+	me.title = name;
+
+	me.callParent();
+	if (me.pveSelNode.data.type !== 'lxc') {
+	    me.remove(me.getComponent('swap'));
+	}
+	me.getComponent('node').updateValue(me.pveSelNode.data.node);
+    }
+});
-- 
2.1.4




More information about the pve-devel mailing list