]>
git.proxmox.com Git - pve-manager.git/blob - www/manager6/dc/Health.js
1 Ext
.define('PVE.dc.Health', {
2 extend
: 'Ext.panel.Panel',
3 alias
: 'widget.pveDcHealth',
5 title
: gettext('Datacenter Health'),
7 bodyPadding
: '0 20 0 20',
21 updateStatus: function(store
, records
, success
) {
28 iconCls
: PVE
.Utils
.get_health_icon('good', true),
29 text
: gettext("Standalone node - no cluster defined")
37 // by default we have one node
41 for (i
= 0; i
< records
.length
; i
++) {
42 var item
= records
[i
];
43 if (item
.data
.type
=== 'node') {
44 nodes
[item
.data
.online
=== 1 ? 'online':'offline']++;
45 } else if(item
.data
.type
=== 'cluster') {
46 cluster
.text
= gettext("Cluster") + ": ";
47 cluster
.text
+= item
.data
.name
+ ", ";
48 cluster
.text
+= gettext("Quorate") + ": ";
49 cluster
.text
+= PVE
.Utils
.format_boolean(item
.data
.quorate
);
50 if (item
.data
.quorate
!= 1) {
51 cluster
.iconCls
= PVE
.Utils
.get_health_icon('critical', true);
54 numNodes
= item
.data
.nodes
;
58 if (numNodes
!== (nodes
.online
+ nodes
.offline
)) {
59 nodes
.offline
= numNodes
- nodes
.online
;
62 me
.getComponent('clusterstatus').update(cluster
);
63 me
.getComponent('nodestatus').update(nodes
);
66 updateCeph: function(store
, records
, success
) {
68 var cephstatus
= me
.getComponent('ceph');
69 if (!success
|| records
.length
< 1) {
71 cephstatus
.setVisible(false);
73 // after 3 unsuccessful tries of
74 // /nodes/localhost/ceph/status
75 // we give up (there probably is no ceph installed)
76 if (me
.cepherrors
>= 3) {
77 me
.cephstore
.stopUpdate();
85 iconCls
: 'faded fa-question-circle',
89 switch (records
[0].data
.health
.overall_status
) {
91 cephstate
.iconCls
= 'good fa-check-circle';
94 cephstate
.iconCls
= 'warning fa-info-circle';
97 cephstate
.iconCls
= 'critical fa-times-circle';
100 cephstate
.iconCls
= 'faded fa-question-circle';
103 cephstate
.text
= records
[0].data
.health
.overall_status
;
104 cephstatus
.update(cephstate
);
105 cephstatus
.setVisible(true);
109 destroy: function() {
111 me
.cephstore
.stopUpdate();
117 itemId
: 'clusterstatus',
119 iconCls
: 'faded fa-question-circle',
123 '<h3>' + gettext('Status') + '</h3>',
124 '<i class="fa fa-5x {iconCls}"></i>',
130 itemId
: 'nodestatus',
136 '<h3>' + gettext('Nodes') + '</h3><br />',
137 '<div style="width: 150px;margin: auto;font-size: 12pt">',
138 '<div class="left-aligned">',
139 '<i class="good fa fa-fw fa-check"> </i>',
142 '<div class="right-aligned">{online}</div>',
144 '<div class="left-aligned">',
145 '<i class="critical fa fa-fw fa-times"> </i>',
148 '<div class="right-aligned">{offline}</div>',
155 columnWidth
: undefined,
158 iconCls
: 'faded fa-question-circle'
162 '<i class="fa fa-5x {iconCls}"></i><br /><br />',
163 gettext("Health") + ': {text}'
169 initComponent: function() {
172 me
.cephstore
= Ext
.create('PVE.data.UpdateStore', {
174 storeid
: 'pve-cluster-ceph',
177 url
: '/api2/json/nodes/localhost/ceph/status'
181 me
.cephstore
.startUpdate();
182 me
.mon(me
.cephstore
, 'load', me
.updateCeph
, me
);