CLOUDSTACK-9020: Metrics UI fixes

- Allow all users to see resource metrics
- Fix instance count issue on host metrics view
- Fix sorting issue

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
(cherry picked from commit 53084c4c8a87ccbdb1a7017e0a4cc66dbc386220)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
Rohit Yadav 2015-11-07 18:06:05 +05:30
parent 0d73788464
commit ebee0f0c9d
5 changed files with 17 additions and 28 deletions

View File

@ -296,9 +296,6 @@
label: 'label.metrics',
isHeader: true,
addRow: false,
preFilter: function(args) {
return isAdmin();
},
action: {
custom: cloudStack.uiCustom.metricsView({resource: 'vms'})
},

View File

@ -159,7 +159,7 @@
items[idx].clusters += parseInt(json.listclustersresponse.count);
$.each(json.listclustersresponse.cluster, function(i, cluster) {
if (cluster.allocationstate == 'Enabled' && cluster.managedstate == 'Managed') {
items[idx].clustersUp++;
items[idx].clustersUp += 1;
}
$.ajax({
url: createURL('listHosts'),
@ -714,12 +714,14 @@
success: function(json) {
if (json && json.listvirtualmachinesresponse && json.listvirtualmachinesresponse.virtualmachine) {
var vms = json.listvirtualmachinesresponse.virtualmachine;
$.each(vms, function(idx, vm) {
items[idx].instances++;
if (vm.state == 'Running') {
items[idx].instancesUp++;
}
});
if (vms) {
$.each(vms, function(_, vm) {
items[idx].instances += 1;
if (vm.state == 'Running') {
items[idx].instancesUp += 1;
}
});
}
}
},
async: false

View File

@ -257,9 +257,6 @@
label: 'label.metrics',
isHeader: true,
addRow: false,
preFilter: function(args) {
return isAdmin();
},
action: {
custom: cloudStack.uiCustom.metricsView({resource: 'volumes'})
},

View File

@ -7710,9 +7710,6 @@
label: 'label.metrics',
isHeader: true,
addRow: false,
preFilter: function(args) {
return isAdmin();
},
action: {
custom: cloudStack.uiCustom.metricsView({resource: 'zones'})
},
@ -14392,9 +14389,6 @@
label: 'label.metrics',
isHeader: true,
addRow: false,
preFilter: function(args) {
return isAdmin();
},
action: {
custom: cloudStack.uiCustom.metricsView({resource: 'clusters'})
},
@ -15646,9 +15640,6 @@
label: 'label.metrics',
isHeader: true,
addRow: false,
preFilter: function(args) {
return isAdmin();
},
action: {
custom: cloudStack.uiCustom.metricsView({resource: 'hosts'})
},
@ -17468,9 +17459,6 @@
label: 'label.metrics',
isHeader: true,
addRow: false,
preFilter: function(args) {
return isAdmin();
},
action: {
custom: cloudStack.uiCustom.metricsView({resource: 'storagepool'})
},

View File

@ -177,14 +177,19 @@
var sortData = [];
var numericDataCount = 0;
$elems.each(function() {
var text = $(this).html();
var text = $(this);
if (hasAllRowsSameValue) {
if (firstElem !== text) {
if (firstElem !== text.html()) {
hasAllRowsSameValue = false;
}
}
if (text.children()) {
text = text.children().html();
} else {
text = text.html();
}
if (isNumeric(text) || !text) {
numericDataCount++;
numericDataCount += 1;
}
sortData.push($(this));
});