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