mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-8592: display negative balance in red
This commit is contained in:
parent
0b3fc1bf5a
commit
837a822ea5
|
|
@ -19,6 +19,7 @@
|
|||
var now = new Date();
|
||||
var newstartdate;
|
||||
var newenddate;
|
||||
var currency;
|
||||
cloudStack.plugins.quota = function(plugin) {
|
||||
plugin.ui.addSection({
|
||||
id: 'quota',
|
||||
|
|
@ -49,6 +50,14 @@
|
|||
},
|
||||
balance: {
|
||||
label: 'label.quota.balance',
|
||||
limitcolor: true,
|
||||
limits: {
|
||||
upperlimit: 'upperlimit',
|
||||
lowerlimit: 'lowerlimit'
|
||||
},
|
||||
converter: function(args){
|
||||
return currency + args.toString();
|
||||
}
|
||||
},
|
||||
quota: {
|
||||
label: 'label.quota.totalusage',
|
||||
|
|
@ -72,6 +81,7 @@
|
|||
|
||||
// FIXME: add logic in mgmt server to filter by account
|
||||
if (args.filterBy.search.value) {
|
||||
console.log(args.filterBy.search.value);
|
||||
data.account = args.filterBy.search.value;
|
||||
}
|
||||
|
||||
|
|
@ -83,8 +93,11 @@
|
|||
success: function(json) {
|
||||
var items = json.quotasummaryresponse.summary;
|
||||
$.each(items, function(idx, item) {
|
||||
currency = items[idx].currency;
|
||||
items[idx].quota = items[idx].currency + ' ' + items[idx].quota;
|
||||
items[idx].balance = items[idx].currency + ' ' + items[idx].balance;
|
||||
//items[idx].balance = items[idx].currency + ' ' + items[idx].balance;
|
||||
items[idx].lowerlimit = -1;
|
||||
items[idx].upperlimit = 0;
|
||||
});
|
||||
args.response.success({
|
||||
data: items
|
||||
|
|
@ -106,9 +119,6 @@
|
|||
label: 'label.quota.statement.balance'
|
||||
}],
|
||||
actions: {
|
||||
|
||||
|
||||
|
||||
|
||||
add: {
|
||||
label: 'label.quota.add.credits',
|
||||
|
|
@ -122,7 +132,7 @@
|
|||
},
|
||||
|
||||
createForm: {
|
||||
title: 'label.migrate.volume',
|
||||
title: 'label.quota.credits',
|
||||
desc: '',
|
||||
fields: {
|
||||
value: {
|
||||
|
|
|
|||
|
|
@ -1255,6 +1255,20 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (field.limitcolor && field.limits) {
|
||||
if ((field.limits.lowerlimit in dataItem) && (field.limits.upperlimit in dataItem)) {
|
||||
var upperlimit = parseFloat(dataItem[field.limits.upperlimit]);
|
||||
var lowerlimit = parseFloat(dataItem[field.limits.lowerlimit ]);
|
||||
var value = parseFloat(content);
|
||||
if (value <= lowerlimit) {
|
||||
$td.addClass('alert-disable-threshold');
|
||||
} else if (value <= upperlimit) {
|
||||
$td.addClass('alert-notification-threshold');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (field.id == true) id = field.id;
|
||||
if ($td.index()) $td.addClass('reduced-hide');
|
||||
|
|
|
|||
Loading…
Reference in New Issue