fix mobile datacenter bugs resulting from API return changes

Adapt the mobile UI code to the slightly different returned data
from the '/cluster/status/' API call.
Also sort the node list to get an consistent staying UI, this
mirrors the behaviour of the 'desktop' UI.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2015-09-21 10:22:37 +02:00 committed by Dietmar Maurer
parent 1daa93803f
commit db3f0058ed

View File

@ -75,13 +75,14 @@ Ext.define('PVE.Datacenter', {
xtype: 'list',
flex: 1,
disableSelection: true,
sorters: 'name',
listeners: {
itemsingletap: function(list, index, target, record) {
PVE.Workspace.gotoPage('nodes/' + record.get('name'));
}
},
itemTpl: '{name}' +
'<br><small>Online: {[PVE.Utils.format_boolean(values.state)]}</small>' +
'<br><small>Online: {[PVE.Utils.format_boolean(values.online)]}</small>' +
'<br><small>Support: {[PVE.Utils.render_support_level(values.level)]}</small>'
}
]
@ -115,21 +116,18 @@ Ext.define('PVE.Datacenter', {
var d = response.result.data;
list.setData(d.filter(function(el) { return (el.type === "node"); }));
var node_count = 0;
d.forEach(function(el) {
if (el.type === "node") {
node_count++;
if (el.local) {
me.summary.local_node = el.name;
}
} else if (el.type === "cluster") {
me.summary.nodes = el.nodes;
me.summary.quorate = PVE.Utils.format_boolean(el.quorate);
me.summary.cluster_name = el.name;
} else if (el.type === "quorum") {
me.summary.quorate = el.quorate;
}
});
me.summary.nodes = node_count;
ci.setData(me.summary);
},
failure: function(response) {