]>
Commit | Line | Data |
---|---|---|
c0a14978 | 1 | Ext.define('PVE.panel.GuestStatusView', { |
e3c4b75d | 2 | extend: 'Proxmox.panel.StatusView', |
c0a14978 | 3 | alias: 'widget.pveGuestStatusView', |
e7f07a2e | 4 | mixins: ['Proxmox.Mixin.CBind'], |
c0a14978 DC |
5 | |
6 | height: 300, | |
7 | ||
8058410f | 8 | cbindData: function(initialConfig) { |
5ba37d7c DC |
9 | var me = this; |
10 | return { | |
11 | isQemu: me.pveSelNode.data.type === 'qemu', | |
f6710aac | 12 | isLxc: me.pveSelNode.data.type === 'lxc', |
5ba37d7c DC |
13 | }; |
14 | }, | |
15 | ||
3ff9bf5a DC |
16 | layout: { |
17 | type: 'vbox', | |
f6710aac | 18 | align: 'stretch', |
3ff9bf5a DC |
19 | }, |
20 | ||
c0a14978 | 21 | defaults: { |
c95917c2 | 22 | xtype: 'pmxInfoWidget', |
f6710aac | 23 | padding: '2 25', |
c0a14978 DC |
24 | }, |
25 | items: [ | |
26 | { | |
27 | xtype: 'box', | |
f6710aac | 28 | height: 20, |
c0a14978 DC |
29 | }, |
30 | { | |
31 | itemId: 'status', | |
32 | title: gettext('Status'), | |
3ff9bf5a | 33 | iconCls: 'fa fa-info fa-fw', |
c0a14978 | 34 | printBar: false, |
09153eaf DC |
35 | multiField: true, |
36 | renderer: function(record) { | |
37 | var me = this; | |
38 | var text = record.data.status; | |
39 | var qmpstatus = record.data.qmpstatus; | |
40 | if (qmpstatus && qmpstatus !== record.data.status) { | |
41 | text += ' (' + qmpstatus + ')'; | |
42 | } | |
43 | return text; | |
f6710aac | 44 | }, |
c0a14978 DC |
45 | }, |
46 | { | |
47 | itemId: 'hamanaged', | |
3ff9bf5a | 48 | iconCls: 'fa fa-heartbeat fa-fw', |
50713765 | 49 | title: gettext('HA State'), |
c0a14978 DC |
50 | printBar: false, |
51 | textField: 'ha', | |
f6710aac | 52 | renderer: PVE.Utils.format_ha, |
c0a14978 DC |
53 | }, |
54 | { | |
55 | itemId: 'node', | |
3ff9bf5a | 56 | iconCls: 'fa fa-building fa-fw', |
c0a14978 | 57 | title: gettext('Node'), |
5ba37d7c | 58 | cbind: { |
f6710aac | 59 | text: '{pveSelNode.data.node}', |
5ba37d7c | 60 | }, |
f6710aac | 61 | printBar: false, |
c0a14978 DC |
62 | }, |
63 | { | |
64 | xtype: 'box', | |
f6710aac | 65 | height: 15, |
c0a14978 DC |
66 | }, |
67 | { | |
68 | itemId: 'cpu', | |
a8ea1b68 | 69 | iconCls: 'fa fa-fw pmx-itype-icon-processor pmx-icon', |
c0a14978 DC |
70 | title: gettext('CPU usage'), |
71 | valueField: 'cpu', | |
72 | maxField: 'cpus', | |
1bd7bcdb | 73 | renderer: Proxmox.Utils.render_cpu_usage, |
c0a14978 DC |
74 | // in this specific api call |
75 | // we already have the correct value for the usage | |
f6710aac | 76 | calculate: Ext.identityFn, |
c0a14978 DC |
77 | }, |
78 | { | |
79 | itemId: 'memory', | |
a8ea1b68 | 80 | iconCls: 'fa fa-fw pmx-itype-icon-memory pmx-icon', |
c0a14978 DC |
81 | title: gettext('Memory usage'), |
82 | valueField: 'mem', | |
f6710aac | 83 | maxField: 'maxmem', |
c0a14978 DC |
84 | }, |
85 | { | |
86 | itemId: 'swap', | |
3ff9bf5a | 87 | iconCls: 'fa fa-refresh fa-fw', |
c0a14978 DC |
88 | title: gettext('SWAP usage'), |
89 | valueField: 'swap', | |
5ba37d7c DC |
90 | maxField: 'maxswap', |
91 | cbind: { | |
92 | hidden: '{isQemu}', | |
f6710aac TL |
93 | disabled: '{isQemu}', |
94 | }, | |
c0a14978 DC |
95 | }, |
96 | { | |
97 | itemId: 'rootfs', | |
3ff9bf5a | 98 | iconCls: 'fa fa-hdd-o fa-fw', |
4198e16f | 99 | title: gettext('Bootdisk size'), |
5ce972f6 DC |
100 | valueField: 'disk', |
101 | maxField: 'maxdisk', | |
c0a14978 | 102 | printBar: false, |
5ce972f6 DC |
103 | renderer: function(used, max) { |
104 | var me = this; | |
105 | me.setPrintBar(used > 0); | |
106 | if (used === 0) { | |
1bd7bcdb | 107 | return Proxmox.Utils.render_size(max); |
5ce972f6 | 108 | } else { |
1bd7bcdb | 109 | return Proxmox.Utils.render_size_usage(used, max); |
5ce972f6 | 110 | } |
f6710aac | 111 | }, |
e7f07a2e DC |
112 | }, |
113 | { | |
114 | xtype: 'box', | |
f6710aac | 115 | height: 15, |
e7f07a2e DC |
116 | }, |
117 | { | |
118 | itemId: 'ips', | |
119 | xtype: 'pveAgentIPView', | |
120 | cbind: { | |
121 | rstore: '{rstore}', | |
5ba37d7c DC |
122 | pveSelNode: '{pveSelNode}', |
123 | hidden: '{isLxc}', | |
f6710aac TL |
124 | disabled: '{isLxc}', |
125 | }, | |
126 | }, | |
c0a14978 DC |
127 | ], |
128 | ||
129 | updateTitle: function() { | |
130 | var me = this; | |
131 | var uptime = me.getRecordValue('uptime'); | |
132 | ||
133 | var text = ""; | |
134 | if (Number(uptime) > 0) { | |
e7ade592 | 135 | text = " (" + gettext('Uptime') + ': ' + Proxmox.Utils.format_duration_long(uptime) |
c0a14978 DC |
136 | + ')'; |
137 | } | |
138 | ||
139 | me.setTitle(me.getRecordValue('name') + text); | |
f6710aac | 140 | }, |
c0a14978 | 141 | }); |