]>
git.proxmox.com Git - pve-manager.git/blob - www/manager6/dc/Health.js
18ea5afa0c4ae48059c34ea456b31e44942c2259
1 Ext
.define('PVE.dc.Health', {
2 extend
: 'Ext.panel.Panel',
3 alias
: 'widget.pveDcHealth',
5 title
: gettext('Health'),
25 updateStatus: function(store
, records
, success
) {
32 iconCls
: PVE
.Utils
.get_health_icon('good', true),
33 text
: gettext("Standalone node - no cluster defined")
41 // by default we have one node
45 for (i
= 0; i
< records
.length
; i
++) {
46 var item
= records
[i
];
47 if (item
.data
.type
=== 'node') {
48 nodes
[item
.data
.online
=== 1 ? 'online':'offline']++;
49 } else if(item
.data
.type
=== 'cluster') {
50 cluster
.text
= gettext("Cluster") + ": ";
51 cluster
.text
+= item
.data
.name
+ ", ";
52 cluster
.text
+= gettext("Quorate") + ": ";
53 cluster
.text
+= Proxmox
.Utils
.format_boolean(item
.data
.quorate
);
54 if (item
.data
.quorate
!= 1) {
55 cluster
.iconCls
= PVE
.Utils
.get_health_icon('critical', true);
58 numNodes
= item
.data
.nodes
;
62 if (numNodes
!== (nodes
.online
+ nodes
.offline
)) {
63 nodes
.offline
= numNodes
- nodes
.online
;
66 me
.getComponent('clusterstatus').updateHealth(cluster
);
67 me
.getComponent('nodestatus').update(nodes
);
70 updateCeph: function(store
, records
, success
) {
72 var cephstatus
= me
.getComponent('ceph');
73 if (!success
|| records
.length
< 1) {
75 // if ceph status is already visible
76 // dont stop to update
77 if (cephstatus
.isVisible()) {
81 // try all nodes until we either get a successfull api call,
82 // or we tried all nodes
83 if (++me
.nodeIndex
>= me
.nodeList
.length
) {
84 me
.cephstore
.stopUpdate();
86 store
.getProxy().setUrl('/api2/json/nodes/' + me
.nodeList
[me
.nodeIndex
].node
+ '/ceph/status');
92 var state
= PVE
.Utils
.render_ceph_health(records
[0].data
.health
|| {});
93 cephstatus
.updateHealth(state
);
94 cephstatus
.setVisible(true);
100 me
.cephstore
.stopUpdate();
106 itemId
: 'clusterstatus',
107 xtype
: 'pveHealthWidget',
108 title
: gettext('Status')
111 itemId
: 'nodestatus',
117 '<h3>' + gettext('Nodes') + '</h3><br />',
118 '<div style="width: 150px;margin: auto;font-size: 12pt">',
119 '<div class="left-aligned">',
120 '<i class="good fa fa-fw fa-check"> </i>',
123 '<div class="right-aligned">{online}</div>',
125 '<div class="left-aligned">',
126 '<i class="critical fa fa-fw fa-times"> </i>',
129 '<div class="right-aligned">{offline}</div>',
136 columnWidth
: undefined,
139 xtype
: 'pveHealthWidget',
144 var sp
= Ext
.state
.Manager
.getProvider();
145 sp
.set('dctab', {value
:'ceph'}, true);
151 initComponent: function() {
154 me
.nodeList
= PVE
.data
.ResourceStore
.getNodes();
156 me
.cephstore
= Ext
.create('Proxmox.data.UpdateStore', {
158 storeid
: 'pve-cluster-ceph',
161 url
: '/api2/json/nodes/' + me
.nodeList
[me
.nodeIndex
].node
+ '/ceph/status'
165 me
.mon(me
.cephstore
, 'load', me
.updateCeph
, me
);
166 me
.cephstore
.startUpdate();