]> git.proxmox.com Git - pve-manager.git/blame - www/manager6/panel/GuestSummary.js
ui: fix Guest Summary Notes height
[pve-manager.git] / www / manager6 / panel / GuestSummary.js
CommitLineData
426d7f74
DM
1Ext.define('PVE.qemu.Summary', {
2 extend: 'Ext.panel.Panel',
df0875c2 3 xtype: 'pveGuestSummary',
426d7f74 4
6f68dcbe 5 scrollable: true,
33f459ca 6 bodyPadding: 5,
64ff6a19 7
426d7f74
DM
8 initComponent: function() {
9 var me = this;
10
11 var nodename = me.pveSelNode.data.node;
12 if (!nodename) {
13 throw "no node name specified";
14 }
15
16 var vmid = me.pveSelNode.data.vmid;
17 if (!vmid) {
18 throw "no VM ID specified";
19 }
20
21 if (!me.workspace) {
22 throw "no workspace specified";
23 }
24
25 if (!me.statusStore) {
26 throw "no status storage specified";
27 }
28
df0875c2 29 var type = me.pveSelNode.data.type;
a4d292d9 30 var template = !!me.pveSelNode.data.template;
426d7f74
DM
31 var rstore = me.statusStore;
32
33f459ca
DC
33 var items = [
34 {
35 xtype: template ? 'pveTemplateStatusView' : 'pveGuestStatusView',
bbc83309
DC
36 flex: 1,
37 padding: template ? '5' : '0 5 0 0',
33f459ca
DC
38 itemId: 'gueststatus',
39 pveSelNode: me.pveSelNode,
f6710aac 40 rstore: rstore,
33f459ca
DC
41 },
42 {
43 xtype: 'pveNotesView',
bbc83309
DC
44 flex: 1,
45 padding: template ? '5' : '0 0 0 5',
33f459ca
DC
46 itemId: 'notesview',
47 pveSelNode: me.pveSelNode,
bbc83309 48 },
33f459ca
DC
49 ];
50
51 var rrdstore;
52 if (!template) {
bbc83309
DC
53 // in non-template mode put the two panels always together
54 items = [
55 {
56 xtype: 'container',
164a86ab 57 height: 300,
bbc83309
DC
58 layout: {
59 type: 'hbox',
60 align: 'stretch',
61 },
f6710aac
TL
62 items: items,
63 },
bbc83309
DC
64 ];
65
33f459ca 66 rrdstore = Ext.create('Proxmox.data.RRDStore', {
df0875c2 67 rrdurl: `/api2/json/nodes/${nodename}/${type}/${vmid}/rrddata`,
f6710aac 68 model: 'pve-rrd-guest',
a4d292d9
DC
69 });
70
33f459ca
DC
71 items.push(
72 {
73 xtype: 'proxmoxRRDChart',
74 title: gettext('CPU usage'),
75 pveSelNode: me.pveSelNode,
76 fields: ['cpu'],
77 fieldTitles: [gettext('CPU usage')],
f6710aac 78 store: rrdstore,
a4d292d9 79 },
33f459ca
DC
80 {
81 xtype: 'proxmoxRRDChart',
82 title: gettext('Memory usage'),
83 pveSelNode: me.pveSelNode,
84 fields: ['maxmem', 'mem'],
85 fieldTitles: [gettext('Total'), gettext('RAM usage')],
e67d454a
TL
86 unit: 'bytes',
87 powerOfTwo: true,
f6710aac 88 store: rrdstore,
33f459ca
DC
89 },
90 {
91 xtype: 'proxmoxRRDChart',
92 title: gettext('Network traffic'),
93 pveSelNode: me.pveSelNode,
f6710aac
TL
94 fields: ['netin', 'netout'],
95 store: rrdstore,
33f459ca
DC
96 },
97 {
98 xtype: 'proxmoxRRDChart',
99 title: gettext('Disk IO'),
100 pveSelNode: me.pveSelNode,
f6710aac
TL
101 fields: ['diskread', 'diskwrite'],
102 store: rrdstore,
103 },
33f459ca 104 );
a4d292d9 105 }
426d7f74 106
33f459ca 107 Ext.apply(me, {
8058410f 108 tbar: ['->', { xtype: 'proxmoxRRDTypeSelector' }],
33f459ca
DC
109 items: [
110 {
111 xtype: 'container',
bbc83309 112 itemId: 'itemcontainer',
33f459ca 113 layout: {
f6710aac 114 type: 'column',
33f459ca 115 },
ed3e711e 116 minWidth: 700,
33f459ca
DC
117 defaults: {
118 minHeight: 330,
119 padding: 5,
33f459ca 120 },
bbc83309
DC
121 items: items,
122 listeners: {
123 resize: function(container) {
2874be00 124 Proxmox.Utils.updateColumns(container);
f6710aac
TL
125 },
126 },
127 },
128 ],
33f459ca
DC
129 });
130
426d7f74 131 me.callParent();
33f459ca
DC
132 if (!template) {
133 rrdstore.startUpdate();
134 me.on('destroy', rrdstore.stopUpdate);
135 }
f973c5b2
DC
136 let sp = Ext.state.Manager.getProvider();
137 me.mon(sp, 'statechange', function(provider, key, value) {
138 if (key !== 'summarycolumns') {
139 return;
140 }
2874be00 141 Proxmox.Utils.updateColumns(me.getComponent('itemcontainer'));
f973c5b2 142 });
f6710aac 143 },
426d7f74 144});