]> git.proxmox.com Git - pve-manager.git/blob - www/manager6/panel/GuestStatusView.js
ui: eslint: enforce "no-extra-parens" rule
[pve-manager.git] / www / manager6 / panel / GuestStatusView.js
1 Ext.define('PVE.panel.GuestStatusView', {
2 extend: 'PVE.panel.StatusView',
3 alias: 'widget.pveGuestStatusView',
4 mixins: ['Proxmox.Mixin.CBind'],
5
6 height: 300,
7
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
16 layout: {
17 type: 'vbox',
18 align: 'stretch',
19 },
20
21 defaults: {
22 xtype: 'pveInfoWidget',
23 padding: '2 25',
24 },
25 items: [
26 {
27 xtype: 'box',
28 height: 20,
29 },
30 {
31 itemId: 'status',
32 title: gettext('Status'),
33 iconCls: 'fa fa-info fa-fw',
34 printBar: false,
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 },
45 },
46 {
47 itemId: 'hamanaged',
48 iconCls: 'fa fa-heartbeat fa-fw',
49 title: gettext('HA State'),
50 printBar: false,
51 textField: 'ha',
52 renderer: PVE.Utils.format_ha,
53 },
54 {
55 xtype: 'pveInfoWidget',
56 itemId: 'node',
57 iconCls: 'fa fa-building fa-fw',
58 title: gettext('Node'),
59 cbind: {
60 text: '{pveSelNode.data.node}',
61 },
62 printBar: false,
63 },
64 {
65 xtype: 'box',
66 height: 15,
67 },
68 {
69 itemId: 'cpu',
70 iconCls: 'fa fa-fw pve-itype-icon-processor pve-icon',
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',
81 iconCls: 'fa fa-fw pve-itype-icon-memory pve-icon',
82 title: gettext('Memory usage'),
83 valueField: 'mem',
84 maxField: 'maxmem',
85 },
86 {
87 itemId: 'swap',
88 xtype: 'pveInfoWidget',
89 iconCls: 'fa fa-refresh fa-fw',
90 title: gettext('SWAP usage'),
91 valueField: 'swap',
92 maxField: 'maxswap',
93 cbind: {
94 hidden: '{isQemu}',
95 disabled: '{isQemu}',
96 },
97 },
98 {
99 itemId: 'rootfs',
100 iconCls: 'fa fa-hdd-o fa-fw',
101 title: gettext('Bootdisk size'),
102 valueField: 'disk',
103 maxField: 'maxdisk',
104 printBar: false,
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 },
114 },
115 {
116 xtype: 'box',
117 height: 15,
118 },
119 {
120 itemId: 'ips',
121 xtype: 'pveAgentIPView',
122 cbind: {
123 rstore: '{rstore}',
124 pveSelNode: '{pveSelNode}',
125 hidden: '{isLxc}',
126 disabled: '{isLxc}',
127 },
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) {
137 text = " (" + gettext('Uptime') + ': ' + Proxmox.Utils.format_duration_long(uptime)
138 + ')';
139 }
140
141 me.setTitle(me.getRecordValue('name') + text);
142 },
143 });