remove unnecessary information from lxc templates

as with vm templates, restyle the summary panel
for lxc templates

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2016-06-16 10:14:04 +02:00 committed by Dietmar Maurer
parent 5445badec7
commit 4cd199e8f3
2 changed files with 112 additions and 69 deletions

View File

@ -15,6 +15,8 @@ Ext.define('PVE.lxc.StatusView', {
throw "no VM ID specified"; throw "no VM ID specified";
} }
var template = !!me.pveSelNode.data.template;
var render_cpu = function(value, metaData, record, rowIndex, colIndex, store) { var render_cpu = function(value, metaData, record, rowIndex, colIndex, store) {
if (!me.getObjectValue('uptime')) { if (!me.getObjectValue('uptime')) {
return '-'; return '-';
@ -55,21 +57,32 @@ Ext.define('PVE.lxc.StatusView', {
return value; return value;
}; };
var rows = { var rows = {};
name: { header: gettext('Name'), defaultValue: 'no name specified' },
status: { header: gettext('Status'), defaultValue: 'unknown', renderer: render_status },
failcnt: { visible: false },
cpu: { header: gettext('CPU usage'), required: true, renderer: render_cpu },
cpus: { visible: false },
mem: { header: gettext('Memory usage'), required: true, renderer: render_mem },
maxmem: { visible: false },
swap: { header: gettext('VSwap usage'), required: true, renderer: render_swap },
maxswap: { visible: false },
maxdisk: { header: gettext('Bootdisk size'), renderer: PVE.Utils.render_size, required: true},
uptime: { header: gettext('Uptime'), required: true, renderer: PVE.Utils.render_uptime },
ha: { header: gettext('Managed by HA'), required: true, renderer: PVE.Utils.format_ha }
};
if (template) {
rows = {
name: { header: gettext('Name'), defaultValue: 'no name specified' },
cpus: { header: gettext('CPU limit'), required: true},
maxmem: { header: gettext('Memory'), required: true, renderer: PVE.Utils.render_size },
maxswap: { header: gettext('VSwap'), required: true, renderer: PVE.Utils.render_size },
maxdisk: { header: gettext('Bootdisk size'), renderer: PVE.Utils.render_size, required: true}
};
} else {
rows = {
name: { header: gettext('Name'), defaultValue: 'no name specified' },
status: { header: gettext('Status'), defaultValue: 'unknown', renderer: render_status },
failcnt: { visible: false },
cpu: { header: gettext('CPU usage'), required: true, renderer: render_cpu },
cpus: { visible: false },
mem: { header: gettext('Memory usage'), required: true, renderer: render_mem },
maxmem: { visible: false },
swap: { header: gettext('VSwap usage'), required: true, renderer: render_swap },
maxswap: { visible: false },
maxdisk: { header: gettext('Bootdisk size'), renderer: PVE.Utils.render_size, required: true},
uptime: { header: gettext('Uptime'), required: true, renderer: PVE.Utils.render_uptime },
ha: { header: gettext('Managed by HA'), required: true, renderer: PVE.Utils.format_ha }
};
}
Ext.applyIf(me, { Ext.applyIf(me, {
cwidth1: 150, cwidth1: 150,
rows: rows rows: rows

View File

@ -2,7 +2,6 @@ Ext.define('PVE.lxc.Summary', {
extend: 'Ext.panel.Panel', extend: 'Ext.panel.Panel',
alias: 'widget.pveLxcSummary', alias: 'widget.pveLxcSummary',
tbar: [ '->' , { xtype: 'pveRRDTypeSelector' } ],
scrollable: true, scrollable: true,
bodyPadding: 10, bodyPadding: 10,
@ -27,30 +26,27 @@ Ext.define('PVE.lxc.Summary', {
throw "no status storage specified"; throw "no status storage specified";
} }
var template = !!me.pveSelNode.data.template;
var rstore = me.statusStore; var rstore = me.statusStore;
var statusview = Ext.create('PVE.lxc.StatusView', { var statusview = Ext.create('PVE.lxc.StatusView', {
title: gettext('Status'), title: gettext('Status'),
pveSelNode: me.pveSelNode, pveSelNode: me.pveSelNode,
width: 400, width: template ? 800 : 400,
rstore: rstore rstore: rstore
}); });
var notesview = Ext.create('PVE.panel.NotesView', { var notesview = Ext.create('PVE.panel.NotesView', {
pveSelNode: me.pveSelNode, pveSelNode: me.pveSelNode,
padding: '0 0 0 10', padding: template ? '10 0 0 0' : '0 0 0 10',
flex: 1 flex: 1
}); });
var rrdstore = Ext.create('PVE.data.RRDStore', { if (template) {
rrdurl: "/api2/json/nodes/" + nodename + "/lxc/" + vmid + "/rrddata" Ext.apply(me, {
}); plugins: {
ptype: 'lazyitems',
Ext.apply(me, { items: [{
plugins: {
ptype: 'lazyitems',
items: [
{
xtype: 'container', xtype: 'container',
layout: { layout: {
type: 'column' type: 'column'
@ -58,57 +54,91 @@ Ext.define('PVE.lxc.Summary', {
defaults: { defaults: {
padding: '0 10 10 0' padding: '0 10 10 0'
}, },
items: [ items: [{
{
width: 800, width: 800,
height: 300,
layout: { layout: {
type: 'hbox', type: 'vbox',
align: 'stretch' align: 'stretch'
}, },
border: false, border: false,
items: [ statusview, notesview ] items: [ statusview, notesview ]
}]
}]
},
listeners: {
activate: function() { notesview.load(); }
}
});
} else {
var rrdstore = Ext.create('PVE.data.RRDStore', {
rrdurl: "/api2/json/nodes/" + nodename + "/lxc/" + vmid + "/rrddata"
});
Ext.apply(me, {
tbar: [ '->' , { xtype: 'pveRRDTypeSelector' } ],
plugins: {
ptype: 'lazyitems',
items: [
{
xtype: 'container',
layout: {
type: 'column'
}, },
{ defaults: {
xtype: 'pveRRDChart', padding: '0 10 10 0'
title: gettext('CPU usage'),
pveSelNode: me.pveSelNode,
fields: ['cpu'],
fieldTitles: [gettext('CPU usage')],
store: rrdstore
}, },
{ items: [
xtype: 'pveRRDChart', {
title: gettext('Memory usage'), width: 800,
pveSelNode: me.pveSelNode, height: 300,
fields: ['maxmem', 'mem'], layout: {
fieldTitles: [gettext('Total'), gettext('RAM usage')], type: 'hbox',
store: rrdstore align: 'stretch'
}, },
{ border: false,
xtype: 'pveRRDChart', items: [ statusview, notesview ]
title: gettext('Network traffic'), },
pveSelNode: me.pveSelNode, {
fields: ['netin','netout'], xtype: 'pveRRDChart',
store: rrdstore title: gettext('CPU usage'),
}, pveSelNode: me.pveSelNode,
{ fields: ['cpu'],
xtype: 'pveRRDChart', fieldTitles: [gettext('CPU usage')],
title: gettext('Disk IO'), store: rrdstore
pveSelNode: me.pveSelNode, },
fields: ['diskread','diskwrite'], {
store: rrdstore xtype: 'pveRRDChart',
} title: gettext('Memory usage'),
] pveSelNode: me.pveSelNode,
} fields: ['maxmem', 'mem'],
] fieldTitles: [gettext('Total'), gettext('RAM usage')],
}, store: rrdstore
listeners: { },
activate: function() { notesview.load(); rrdstore.startUpdate(); }, {
hide: rrdstore.stopUpdate, xtype: 'pveRRDChart',
destroy: rrdstore.stopUpdate title: gettext('Network traffic'),
} pveSelNode: me.pveSelNode,
}); fields: ['netin','netout'],
store: rrdstore
},
{
xtype: 'pveRRDChart',
title: gettext('Disk IO'),
pveSelNode: me.pveSelNode,
fields: ['diskread','diskwrite'],
store: rrdstore
}
]
}
]
},
listeners: {
activate: function() { notesview.load(); rrdstore.startUpdate(); },
hide: rrdstore.stopUpdate,
destroy: rrdstore.stopUpdate
}
});
}
me.callParent(); me.callParent();
} }