From f08ab3b962db66c905ced114518ddcd18c34ff57 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Thu, 3 Feb 2011 12:03:44 -0800 Subject: [PATCH] bug 8351: round dashboard percentages --- ui/scripts/cloud.core.dashboard.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/ui/scripts/cloud.core.dashboard.js b/ui/scripts/cloud.core.dashboard.js index 5ae33d052ef..084afddf840 100644 --- a/ui/scripts/cloud.core.dashboard.js +++ b/ui/scripts/cloud.core.dashboard.js @@ -378,15 +378,19 @@ function showDashboard(dashboardToShow) { //*** dashboard admin (begin) *** function capacityBarChart($capacity, percentused) { // e.g. percentused == "51.27" (no % inside) - var percentused2 = (percentused + "%"); - $capacity.find("#percentused").text(percentused2); var percentusedFloat = parseFloat(percentused); // e.g. percentusedFloat == 51.27 - if (percentusedFloat <= 60) + var percentusedRound = Math.round(percentusedFloat); //e.g. percentusedRound == 51 + + var percentused2 = (percentusedRound.toString() + "%"); //e.g. percentused2 == "51%" + $capacity.find("#percentused").text(percentused2); + + //e.g. percentusedRound == 51 + if (percentusedRound <= 60) $capacity.find("#bar_chart").removeClass().addClass("db_barbox low").css("width", percentused2); - else if (percentusedFloat > 60 && percentusedFloat <= 80 ) + else if (percentusedRound > 60 && percentusedRound <= 80 ) $capacity.find("#bar_chart").removeClass().addClass("db_barbox mid").css("width", percentused2); - else if (percentusedFloat > 80 ) + else if (percentusedRound > 80 ) $capacity.find("#bar_chart").removeClass().addClass("db_barbox high").css("width", percentused2); } //*** dashboard admin (end) ***