pve-manager/www/manager6/panel/GuestStatusView.js
Dominik Csapak 3ff9bf5a7c add icons to summaries and improve spacing
also add a helper css class to use the png icons like fontawesome icons
and add the ha state to template summary

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-02-22 14:36:40 +01:00

113 lines
2.3 KiB
JavaScript

Ext.define('PVE.panel.GuestStatusView', {
extend: 'PVE.panel.StatusView',
alias: 'widget.pveGuestStatusView',
height: 300,
layout: {
type: 'vbox',
align: 'stretch'
},
defaults: {
xtype: 'pveInfoWidget',
padding: '2 25'
},
items: [
{
xtype: 'box',
height: 20
},
{
itemId: 'status',
title: gettext('Status'),
iconCls: 'fa fa-info fa-fw',
printBar: false,
textField: 'status'
},
{
itemId: 'hamanaged',
iconCls: 'fa fa-heartbeat fa-fw',
title: gettext('HA State'),
printBar: false,
textField: 'ha',
renderer: PVE.Utils.format_ha
},
{
itemId: 'node',
iconCls: 'fa fa-building fa-fw',
title: gettext('Node'),
printBar: false
},
{
xtype: 'box',
height: 15
},
{
itemId: 'cpu',
iconCls: 'fa fa-fw pve-itype-icon-processor pve-icon',
title: gettext('CPU usage'),
valueField: 'cpu',
maxField: 'cpus',
renderer: PVE.Utils.render_cpu_usage,
// in this specific api call
// we already have the correct value for the usage
calculate: Ext.identityFn
},
{
itemId: 'memory',
iconCls: 'fa fa-fw pve-itype-icon-memory pve-icon',
title: gettext('Memory usage'),
valueField: 'mem',
maxField: 'maxmem'
},
{
itemId: 'swap',
iconCls: 'fa fa-refresh fa-fw',
title: gettext('SWAP usage'),
valueField: 'swap',
maxField: 'maxswap'
},
{
itemId: 'rootfs',
iconCls: 'fa fa-hdd-o fa-fw',
title: gettext('Bootdisk size'),
valueField: 'disk',
maxField: 'maxdisk',
printBar: false,
renderer: function(used, max) {
var me = this;
me.setPrintBar(used > 0);
if (used === 0) {
return PVE.Utils.render_size(max);
} else {
return PVE.Utils.render_size_usage(used,max);
}
}
}
],
updateTitle: function() {
var me = this;
var uptime = me.getRecordValue('uptime');
var text = "";
if (Number(uptime) > 0) {
text = " (" + gettext('Uptime') + ': ' + Proxmox.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);
}
});