improve node/lxc/qemu summary pages

let them use a one/two column layout depending on browser width
optimize stylings/padding values
get rid of the (now long) unecessary lazyitems plugin
(this was necessary for performance when we still used tabpanels instead
of our own configpanel with treelist)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2018-02-23 10:32:01 +01:00 committed by Thomas Lamprecht
parent 413613df95
commit 33f459ca5c
3 changed files with 248 additions and 270 deletions

View File

@ -3,7 +3,7 @@ Ext.define('PVE.lxc.Summary', {
alias: 'widget.pveLxcSummary',
scrollable: true,
bodyPadding: '10 0 0 0',
bodyPadding: 5,
initComponent: function() {
var me = this;
@ -29,82 +29,47 @@ Ext.define('PVE.lxc.Summary', {
var template = !!me.pveSelNode.data.template;
var rstore = me.statusStore;
var notesview = Ext.create('PVE.panel.NotesView', {
pveSelNode: me.pveSelNode,
padding: '0 0 0 10',
flex: 1
});
if (template) {
Ext.apply(me, {
plugins: {
ptype: 'lazyitems',
items: [{
xtype: 'container',
layout: {
type: 'column'
},
items: [{
width: 800,
layout: {
type: 'vbox',
align: 'stretch'
},
border: false,
items: [
var width = template ? 1 : 0.5;
var items = [
{
xtype: 'pveTemplateStatusView',
xtype: template ? 'pveTemplateStatusView' : 'pveGuestStatusView',
responsiveConfig: {
'width < 1900': {
columnWidth: width
},
'width >= 1900': {
columnWidth: width / 2
}
},
itemId: 'gueststatus',
pveSelNode: me.pveSelNode,
padding: '0 0 10 10',
rstore: rstore
},
notesview
]
}]
}]
{
xtype: 'pveNotesView',
maxHeight: 320,
itemId: 'notesview',
pveSelNode: me.pveSelNode,
responsiveConfig: {
'width < 1900': {
columnWidth: width
},
listeners: {
activate: function() { notesview.load(); }
'width >= 1900': {
columnWidth: width / 2
}
});
} else {
var rrdstore = Ext.create('Proxmox.data.RRDStore', {
}
}
];
var rrdstore;
if (!template) {
rrdstore = Ext.create('Proxmox.data.RRDStore', {
rrdurl: "/api2/json/nodes/" + nodename + "/lxc/" + vmid + "/rrddata",
model: 'pve-rrd-guest'
});
Ext.apply(me, {
tbar: [ '->' , { xtype: 'proxmoxRRDTypeSelector' } ],
plugins: {
ptype: 'lazyitems',
items: [
{
xtype: 'container',
layout: {
type: 'column'
},
defaults: {
padding: '0 0 10 10'
},
items: [
{
width: 770,
height: 300,
layout: {
type: 'hbox',
align: 'stretch'
},
border: false,
items: [
{
xtype: 'pveGuestStatusView',
pveSelNode: me.pveSelNode,
width: 400,
rstore: rstore
},
notesview
]
},
items.push(
{
xtype: 'proxmoxRRDChart',
title: gettext('CPU usage'),
@ -135,17 +100,41 @@ Ext.define('PVE.lxc.Summary', {
fields: ['diskread','diskwrite'],
store: rrdstore
}
]
}
]
},
listeners: {
activate: function() { notesview.load(); rrdstore.startUpdate(); },
destroy: rrdstore.stopUpdate
}
});
);
}
Ext.apply(me, {
tbar: [ '->', { xtype: 'proxmoxRRDTypeSelector' } ],
items: [
{
xtype: 'container',
layout: {
type: 'column'
},
defaults: {
minHeight: 320,
padding: 5,
plugins: 'responsive',
responsiveConfig: {
'width < 1900': {
columnWidth: 1
},
'width >= 1900': {
columnWidth: 0.5
}
}
},
items: items
}
]
});
me.callParent();
me.down('#notesview').load();
if (!template) {
rrdstore.startUpdate();
me.on('destroy', rrdstore.stopUpdate);
}
}
});

View File

@ -3,7 +3,7 @@ Ext.define('PVE.node.Summary', {
alias: 'widget.pveNodeSummary',
scrollable: true,
bodyPadding: '10 0 0 0',
bodyPadding: 5,
showVersions: function() {
var me = this;
@ -15,11 +15,11 @@ Ext.define('PVE.node.Summary', {
var view = Ext.createWidget('component', {
autoScroll: true,
padding: 5,
style: {
'background-color': 'white',
'white-space': 'pre',
'font-family': 'monospace',
padding: '5px'
'font-family': 'monospace'
}
});
@ -94,14 +94,22 @@ Ext.define('PVE.node.Summary', {
Ext.apply(me, {
tbar: [version_btn, '->', { xtype: 'proxmoxRRDTypeSelector' } ],
plugins: {
ptype: 'lazyitems',
items: [
{
xtype: 'container',
layout: 'column',
defaults: {
padding: '0 0 10 10'
minHeight: 320,
padding: 5,
plugins: 'responsive',
responsiveConfig: {
'width < 1900': {
columnWidth: 1
},
'width >= 1900': {
columnWidth: 0.5
}
}
},
items: [
{
@ -139,8 +147,7 @@ Ext.define('PVE.node.Summary', {
}
]
}
]
},
],
listeners: {
activate: function() { rstore.startUpdate(); rrdstore.startUpdate(); },
destroy: function() { rstore.stopUpdate(); rrdstore.stopUpdate(); }

View File

@ -3,7 +3,7 @@ Ext.define('PVE.qemu.Summary', {
alias: 'widget.pveQemuSummary',
scrollable: true,
bodyPadding: '10 0 0 0',
bodyPadding: 5,
initComponent: function() {
var me = this;
@ -29,89 +29,47 @@ Ext.define('PVE.qemu.Summary', {
var template = !!me.pveSelNode.data.template;
var rstore = me.statusStore;
var notesview = Ext.create('PVE.panel.NotesView', {
pveSelNode: me.pveSelNode,
padding: '0 0 0 10',
flex: 1
});
if (template) {
Ext.apply(me, {
plugins: {
ptype: 'lazyitems',
items: [
var width = template ? 1 : 0.5;
var items = [
{
xtype: 'container',
layout: {
type: 'column'
xtype: template ? 'pveTemplateStatusView' : 'pveGuestStatusView',
responsiveConfig: {
'width < 1900': {
columnWidth: width
},
defaults: {
padding: '0 0 10 0'
'width >= 1900': {
columnWidth: width / 2
}
},
items: [{
width: 770,
layout: {
type: 'vbox',
align: 'stretch'
},
border: false,
items: [
{
xtype: 'pveTemplateStatusView',
itemId: 'gueststatus',
pveSelNode: me.pveSelNode,
padding: '0 0 10 10',
rstore: rstore
},
notesview
]
}]
}
]
{
xtype: 'pveNotesView',
maxHeight: 330,
itemId: 'notesview',
pveSelNode: me.pveSelNode,
responsiveConfig: {
'width < 1900': {
columnWidth: width
},
listeners: {
activate: function() { notesview.load(); }
'width >= 1900': {
columnWidth: width / 2
}
});
}
}
];
} else {
var rrdstore = Ext.create('Proxmox.data.RRDStore', {
var rrdstore;
if (!template) {
rrdstore = Ext.create('Proxmox.data.RRDStore', {
rrdurl: "/api2/json/nodes/" + nodename + "/qemu/" + vmid + "/rrddata",
model: 'pve-rrd-guest'
});
Ext.apply(me, {
tbar: [ '->', { xtype: 'proxmoxRRDTypeSelector' } ],
plugins: {
ptype: 'lazyitems',
items: [
{
xtype: 'container',
layout: {
type: 'column'
},
defaults: {
padding: '0 0 10 10'
},
items: [
{
width: 770,
height: 330,
layout: {
type: 'hbox',
align: 'stretch'
},
border: false,
items: [
{
xtype: 'pveGuestStatusView',
pveSelNode: me.pveSelNode,
width: 400,
rstore: rstore
},
notesview
]
},
items.push(
{
xtype: 'proxmoxRRDChart',
title: gettext('CPU usage'),
@ -142,17 +100,41 @@ Ext.define('PVE.qemu.Summary', {
fields: ['diskread','diskwrite'],
store: rrdstore
}
]
}
]
},
listeners: {
activate: function() {notesview.load(); rrdstore.startUpdate();},
destroy: rrdstore.stopUpdate
}
});
);
}
Ext.apply(me, {
tbar: [ '->', { xtype: 'proxmoxRRDTypeSelector' } ],
items: [
{
xtype: 'container',
layout: {
type: 'column'
},
defaults: {
minHeight: 330,
padding: 5,
plugins: 'responsive',
responsiveConfig: {
'width < 1900': {
columnWidth: 1
},
'width >= 1900': {
columnWidth: 0.5
}
}
},
items: items
}
]
});
me.callParent();
me.down('#notesview').load();
if (!template) {
rrdstore.startUpdate();
me.on('destroy', rrdstore.stopUpdate);
}
}
});