diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/queue-usage-donut-chart.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/queue-usage-donut-chart.js index 5426838b2f32f..b0f28a016933e 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/queue-usage-donut-chart.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/queue-usage-donut-chart.js @@ -16,29 +16,36 @@ * limitations under the License. */ -import BaseUsageDonutChart from 'yarn-ui/components/base-usage-donut-chart'; +import DonutChart from 'yarn-ui/components/donut-chart'; import ColorUtils from 'yarn-ui/utils/color-utils'; import HrefAddressUtils from 'yarn-ui/utils/href-address-utils'; -export default BaseUsageDonutChart.extend({ +export default DonutChart.extend({ colors: d3.scale.category20().range(), draw: function() { var usageByQueues = []; var avail = 100; - this.get("data").forEach(function (queue) { - var v = queue.get("absUsedCapacity"); + let partitionFilter = this.partition; + this.get("data").forEach(function (queue) { if (queue.get("isLeafQueue")) { - if (v > 1e-2) { - usageByQueues.push({ - label: queue.get("id"), - link: HrefAddressUtils.getQueueLink(queue.get("id")), - value: v.toFixed(2) - }); + let partitionMap = queue.get("partitionMap"); + console.log("partitionMap dump: ", partitionMap[partitionFilter]); + let absUsedForPartition = 0; + if(partitionMap[partitionFilter]){ + let v = partitionMap[partitionFilter].absoluteUsedCapacity; + + if (v > 1e-2) { + usageByQueues.push({ + label: queue.get("id"), + link: HrefAddressUtils.getQueueLink(queue.get("id")), + value: v.toFixed(2) + }); - avail = avail - v; + avail = avail - v; + } } } }); @@ -47,21 +54,14 @@ export default BaseUsageDonutChart.extend({ return b.value - a.value; }); - usageByQueues = this.mergeLongTails(usageByQueues, 8); - usageByQueues.push({ label: "Available", value: avail.toFixed(2) }); - this.colors = ColorUtils.getColors(usageByQueues.length, ["others", "good"], true); + this.colors = ColorUtils.getColors(usageByQueues.length, [ "good"], true); this.renderDonutChart(usageByQueues, this.get("title"), this.get("showLabels"), this.get("middleLabel"), "100%", "%"); }, - - didInsertElement: function() { - this.initChart(); - this.draw(); - }, -}); +}); \ No newline at end of file diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/cluster-overview.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/cluster-overview.hbs index e7752ea0980c8..4046026d8a929 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/cluster-overview.hbs +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/cluster-overview.hbs @@ -20,39 +20,24 @@ {{#if model}} -