]> git.proxmox.com Git - pve-manager.git/blame - www/manager6/panel/GuestStatusView.js
show qmpstatus if available
[pve-manager.git] / www / manager6 / panel / GuestStatusView.js
CommitLineData
c0a14978
DC
1Ext.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
5ba37d7c
DC
8 cbindData: function (initialConfig) {
9 var me = this;
10 return {
11 isQemu: me.pveSelNode.data.type === 'qemu',
12 isLxc: me.pveSelNode.data.type === 'lxc'
13 };
14 },
15
3ff9bf5a
DC
16 layout: {
17 type: 'vbox',
18 align: 'stretch'
19 },
20
c0a14978
DC
21 defaults: {
22 xtype: 'pveInfoWidget',
3ff9bf5a 23 padding: '2 25'
c0a14978
DC
24 },
25 items: [
26 {
27 xtype: 'box',
3ff9bf5a 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;
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',
52 renderer: PVE.Utils.format_ha
53 },
54 {
5ba37d7c 55 xtype: 'pveInfoWidget',
c0a14978 56 itemId: 'node',
3ff9bf5a 57 iconCls: 'fa fa-building fa-fw',
c0a14978 58 title: gettext('Node'),
5ba37d7c
DC
59 cbind: {
60 text: '{pveSelNode.data.node}'
61 },
c0a14978
DC
62 printBar: false
63 },
64 {
65 xtype: 'box',
3ff9bf5a 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
77 calculate: Ext.identityFn
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',
84 maxField: 'maxmem'
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}',
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 {
111 return PVE.Utils.render_size_usage(used,max);
112 }
113 }
e7f07a2e
DC
114 },
115 {
116 xtype: 'box',
117 height: 15
118 },
119 {
120 itemId: 'ips',
121 xtype: 'pveAgentIPView',
122 cbind: {
123 rstore: '{rstore}',
5ba37d7c
DC
124 pveSelNode: '{pveSelNode}',
125 hidden: '{isLxc}',
126 disabled: '{isLxc}'
e7f07a2e 127 }
c0a14978
DC
128 }
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);
c0a14978
DC
142 }
143});