add cpu/memory usage, uptime to nodeview

this patch adds a custom progressbar widget  which changes color,
depending on the value, and adds cpu/memory usage and uptime as columns
to the nodeview
altough those columns are missing in the model/api call, this works , because we
inject the data in our data collectin loop and having the fields not in
the model, causes the store not to overwrite them

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2016-10-28 13:11:48 +02:00 committed by Dietmar Maurer
parent 50a1eb7d40
commit 1f8ff8418a

View File

@ -46,6 +46,35 @@ Ext.define('PVE.dc.NodeView', {
sortable: true,
dataIndex: 'ip'
},
{
header: gettext('CPU Usage'),
sortable: true,
width: 110,
dataIndex: 'cpuusage',
tdCls: 'x-progressbar-default-cell',
xtype: 'widgetcolumn',
widget: {
xtype: 'pveProgressBar'
}
},
{
header: gettext('Memory Usage'),
width: 110,
sortable: true,
tdCls: 'x-progressbar-default-cell',
dataIndex: 'memoryusage',
xtype: 'widgetcolumn',
widget: {
xtype: 'pveProgressBar'
}
},
{
header: gettext('Uptime'),
sortable: true,
dataIndex: 'uptime',
align: 'right',
renderer: PVE.Utils.render_uptime
}
],
stateful: true,
@ -78,3 +107,25 @@ Ext.define('PVE.dc.NodeView', {
});
Ext.define('PVE.widget.ProgressBar',{
extend: 'Ext.Progress',
alias: 'widget.pveProgressBar',
animate: true,
textTpl: [
'{percent}%'
],
setValue: function(value){
var me = this;
me.callParent([value]);
me.removeCls(['warning', 'critical']);
if (value > 0.89) {
me.addCls('critical');
} else if (value > 0.59) {
me.addCls('warning');
}
}
});