]>
Commit | Line | Data |
---|---|---|
c0a14978 DC |
1 | Ext.define('PVE.panel.GuestStatusView', { |
2 | extend: 'PVE.panel.StatusView', | |
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 DC |
21 | defaults: { |
22 | xtype: 'pveInfoWidget', | |
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 | { | |
5ba37d7c | 55 | xtype: 'pveInfoWidget', |
c0a14978 | 56 | itemId: 'node', |
3ff9bf5a | 57 | iconCls: 'fa fa-building fa-fw', |
c0a14978 | 58 | title: gettext('Node'), |
5ba37d7c | 59 | cbind: { |
f6710aac | 60 | text: '{pveSelNode.data.node}', |
5ba37d7c | 61 | }, |
f6710aac | 62 | printBar: false, |
c0a14978 DC |
63 | }, |
64 | { | |
65 | xtype: 'box', | |
f6710aac | 66 | height: 15, |
c0a14978 DC |
67 | }, |
68 | { | |
69 | itemId: 'cpu', | |
3ff9bf5a | 70 | iconCls: 'fa fa-fw pve-itype-icon-processor pve-icon', |
c0a14978 DC |
71 | title: gettext('CPU usage'), |
72 | valueField: 'cpu', | |
73 | maxField: 'cpus', | |
74 | renderer: PVE.Utils.render_cpu_usage, | |
75 | // in this specific api call | |
76 | // we already have the correct value for the usage | |
f6710aac | 77 | calculate: Ext.identityFn, |
c0a14978 DC |
78 | }, |
79 | { | |
80 | itemId: 'memory', | |
3ff9bf5a | 81 | iconCls: 'fa fa-fw pve-itype-icon-memory pve-icon', |
c0a14978 DC |
82 | title: gettext('Memory usage'), |
83 | valueField: 'mem', | |
f6710aac | 84 | maxField: 'maxmem', |
c0a14978 DC |
85 | }, |
86 | { | |
87 | itemId: 'swap', | |
5ba37d7c | 88 | xtype: 'pveInfoWidget', |
3ff9bf5a | 89 | iconCls: 'fa fa-refresh fa-fw', |
c0a14978 DC |
90 | title: gettext('SWAP usage'), |
91 | valueField: 'swap', | |
5ba37d7c DC |
92 | maxField: 'maxswap', |
93 | cbind: { | |
94 | hidden: '{isQemu}', | |
f6710aac TL |
95 | disabled: '{isQemu}', |
96 | }, | |
c0a14978 DC |
97 | }, |
98 | { | |
99 | itemId: 'rootfs', | |
3ff9bf5a | 100 | iconCls: 'fa fa-hdd-o fa-fw', |
4198e16f | 101 | title: gettext('Bootdisk size'), |
5ce972f6 DC |
102 | valueField: 'disk', |
103 | maxField: 'maxdisk', | |
c0a14978 | 104 | printBar: false, |
5ce972f6 DC |
105 | renderer: function(used, max) { |
106 | var me = this; | |
107 | me.setPrintBar(used > 0); | |
108 | if (used === 0) { | |
109 | return PVE.Utils.render_size(max); | |
110 | } else { | |
f6710aac | 111 | return PVE.Utils.render_size_usage(used, max); |
5ce972f6 | 112 | } |
f6710aac | 113 | }, |
e7f07a2e DC |
114 | }, |
115 | { | |
116 | xtype: 'box', | |
f6710aac | 117 | height: 15, |
e7f07a2e DC |
118 | }, |
119 | { | |
120 | itemId: 'ips', | |
121 | xtype: 'pveAgentIPView', | |
122 | cbind: { | |
123 | rstore: '{rstore}', | |
5ba37d7c DC |
124 | pveSelNode: '{pveSelNode}', |
125 | hidden: '{isLxc}', | |
f6710aac TL |
126 | disabled: '{isLxc}', |
127 | }, | |
128 | }, | |
c0a14978 DC |
129 | ], |
130 | ||
131 | updateTitle: function() { | |
132 | var me = this; | |
133 | var uptime = me.getRecordValue('uptime'); | |
134 | ||
135 | var text = ""; | |
136 | if (Number(uptime) > 0) { | |
e7ade592 | 137 | text = " (" + gettext('Uptime') + ': ' + Proxmox.Utils.format_duration_long(uptime) |
c0a14978 DC |
138 | + ')'; |
139 | } | |
140 | ||
141 | me.setTitle(me.getRecordValue('name') + text); | |
f6710aac | 142 | }, |
c0a14978 | 143 | }); |