]>
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 | ||
3ff9bf5a DC |
8 | layout: { |
9 | type: 'vbox', | |
10 | align: 'stretch' | |
11 | }, | |
12 | ||
c0a14978 DC |
13 | defaults: { |
14 | xtype: 'pveInfoWidget', | |
3ff9bf5a | 15 | padding: '2 25' |
c0a14978 DC |
16 | }, |
17 | items: [ | |
18 | { | |
19 | xtype: 'box', | |
3ff9bf5a | 20 | height: 20 |
c0a14978 DC |
21 | }, |
22 | { | |
23 | itemId: 'status', | |
24 | title: gettext('Status'), | |
3ff9bf5a | 25 | iconCls: 'fa fa-info fa-fw', |
c0a14978 DC |
26 | printBar: false, |
27 | textField: 'status' | |
28 | }, | |
29 | { | |
30 | itemId: 'hamanaged', | |
3ff9bf5a | 31 | iconCls: 'fa fa-heartbeat fa-fw', |
50713765 | 32 | title: gettext('HA State'), |
c0a14978 DC |
33 | printBar: false, |
34 | textField: 'ha', | |
35 | renderer: PVE.Utils.format_ha | |
36 | }, | |
37 | { | |
38 | itemId: 'node', | |
3ff9bf5a | 39 | iconCls: 'fa fa-building fa-fw', |
c0a14978 DC |
40 | title: gettext('Node'), |
41 | printBar: false | |
42 | }, | |
43 | { | |
44 | xtype: 'box', | |
3ff9bf5a | 45 | height: 15 |
c0a14978 DC |
46 | }, |
47 | { | |
48 | itemId: 'cpu', | |
3ff9bf5a | 49 | iconCls: 'fa fa-fw pve-itype-icon-processor pve-icon', |
c0a14978 DC |
50 | title: gettext('CPU usage'), |
51 | valueField: 'cpu', | |
52 | maxField: 'cpus', | |
53 | renderer: PVE.Utils.render_cpu_usage, | |
54 | // in this specific api call | |
55 | // we already have the correct value for the usage | |
56 | calculate: Ext.identityFn | |
57 | }, | |
58 | { | |
59 | itemId: 'memory', | |
3ff9bf5a | 60 | iconCls: 'fa fa-fw pve-itype-icon-memory pve-icon', |
c0a14978 DC |
61 | title: gettext('Memory usage'), |
62 | valueField: 'mem', | |
63 | maxField: 'maxmem' | |
64 | }, | |
65 | { | |
66 | itemId: 'swap', | |
3ff9bf5a | 67 | iconCls: 'fa fa-refresh fa-fw', |
c0a14978 DC |
68 | title: gettext('SWAP usage'), |
69 | valueField: 'swap', | |
70 | maxField: 'maxswap' | |
71 | }, | |
72 | { | |
73 | itemId: 'rootfs', | |
3ff9bf5a | 74 | iconCls: 'fa fa-hdd-o fa-fw', |
4198e16f | 75 | title: gettext('Bootdisk size'), |
5ce972f6 DC |
76 | valueField: 'disk', |
77 | maxField: 'maxdisk', | |
c0a14978 | 78 | printBar: false, |
5ce972f6 DC |
79 | renderer: function(used, max) { |
80 | var me = this; | |
81 | me.setPrintBar(used > 0); | |
82 | if (used === 0) { | |
83 | return PVE.Utils.render_size(max); | |
84 | } else { | |
85 | return PVE.Utils.render_size_usage(used,max); | |
86 | } | |
87 | } | |
e7f07a2e DC |
88 | }, |
89 | { | |
90 | xtype: 'box', | |
91 | height: 15 | |
92 | }, | |
93 | { | |
94 | itemId: 'ips', | |
95 | xtype: 'pveAgentIPView', | |
96 | cbind: { | |
97 | rstore: '{rstore}', | |
98 | pveSelNode: '{pveSelNode}' | |
99 | } | |
c0a14978 DC |
100 | } |
101 | ], | |
102 | ||
103 | updateTitle: function() { | |
104 | var me = this; | |
105 | var uptime = me.getRecordValue('uptime'); | |
106 | ||
107 | var text = ""; | |
108 | if (Number(uptime) > 0) { | |
e7ade592 | 109 | text = " (" + gettext('Uptime') + ': ' + Proxmox.Utils.format_duration_long(uptime) |
c0a14978 DC |
110 | + ')'; |
111 | } | |
112 | ||
113 | me.setTitle(me.getRecordValue('name') + text); | |
114 | }, | |
115 | ||
116 | initComponent: function() { | |
117 | var me = this; | |
118 | ||
119 | me.callParent(); | |
120 | if (me.pveSelNode.data.type !== 'lxc') { | |
121 | me.remove(me.getComponent('swap')); | |
e7f07a2e DC |
122 | } else { |
123 | me.remove(me.getComponent('ips')); | |
c0a14978 DC |
124 | } |
125 | me.getComponent('node').updateValue(me.pveSelNode.data.node); | |
126 | } | |
127 | }); |