YARN-6182. Fix alignment issues and missing information in new YARN UI's Queue page. Contributed by Akhil PB.

This commit is contained in:
Sunil G 2017-10-05 11:34:44 +05:30
parent 592bf2d550
commit f702c95754
14 changed files with 44 additions and 21 deletions

View File

@ -258,7 +258,6 @@ export default BaseChartComponent.extend({
}, },
didInsertElement: function () { didInsertElement: function () {
var parentId = this.get("parentId");
var self = this; var self = this;
var optionsData = [this.memoryLabel, this.cpuLabel, this.containersLabel]; var optionsData = [this.memoryLabel, this.cpuLabel, this.containersLabel];
d3.select("#heatmap-select") d3.select("#heatmap-select")

View File

@ -153,7 +153,7 @@ export default Ember.Component.extend({
.attr("r", 1e-6) .attr("r", 1e-6)
.style("fill", function(d) { .style("fill", function(d) {
var maxCap = d.queueData.get(this.max); var maxCap = d.queueData.get(this.max);
maxCap = maxCap == undefined ? 100 : maxCap; maxCap = maxCap === undefined ? 100 : maxCap;
var usedCap = d.queueData.get(this.used) / maxCap * 100.0; var usedCap = d.queueData.get(this.used) / maxCap * 100.0;
if (usedCap <= 60.0) { if (usedCap <= 60.0) {
return "LimeGreen"; return "LimeGreen";
@ -172,7 +172,7 @@ export default Ember.Component.extend({
.attr("text-anchor", function() { return "middle"; }) .attr("text-anchor", function() { return "middle"; })
.text(function(d) { .text(function(d) {
var maxCap = d.queueData.get(this.max); var maxCap = d.queueData.get(this.max);
maxCap = maxCap == undefined ? 100 : maxCap; maxCap = maxCap === undefined ? 100 : maxCap;
var usedCap = d.queueData.get(this.used) / maxCap * 100.0; var usedCap = d.queueData.get(this.used) / maxCap * 100.0;
if (usedCap >= 100.0) { if (usedCap >= 100.0) {
return usedCap.toFixed(0) + "%"; return usedCap.toFixed(0) + "%";

View File

@ -50,6 +50,13 @@ export default Ember.Controller.extend({
html = html + '><a href="yarn-nodes">Nodes<span class="sr-only">' + html = html + '><a href="yarn-nodes">Nodes<span class="sr-only">' +
'(current)</span></a></li>'; '(current)</span></a></li>';
return Ember.String.htmlSafe(html); return Ember.String.htmlSafe(html);
}.property('currentPath'),
isQueuesTabActive: function() {
var path = this.get('currentPath');
if (path === 'yarn-queues') {
return true;
}
return false;
}.property('currentPath') }.property('currentPath')
}); });

View File

@ -17,6 +17,7 @@
*/ */
import DS from 'ember-data'; import DS from 'ember-data';
import Converter from 'yarn-ui/utils/converter';
export default DS.Model.extend({ export default DS.Model.extend({
name: DS.attr('string'), name: DS.attr('string'),
@ -46,18 +47,19 @@ export default DS.Model.extend({
}.property("children"), }.property("children"),
capacitiesBarChartData: function() { capacitiesBarChartData: function() {
var floatToFixed = Converter.floatToFixed;
return [ return [
{ {
label: "Absolute Capacity", label: "Absolute Capacity",
value: this.get("name") === "root" ? 100 : this.get("absCapacity") value: this.get("name") === "root" ? 100 : floatToFixed(this.get("absCapacity"))
}, },
{ {
label: "Absolute Used", label: "Absolute Used",
value: this.get("name") === "root" ? this.get("usedCapacity") : this.get("absUsedCapacity") value: this.get("name") === "root" ? floatToFixed(this.get("usedCapacity")) : floatToFixed(this.get("absUsedCapacity"))
}, },
{ {
label: "Absolute Max Capacity", label: "Absolute Max Capacity",
value: this.get("name") === "root" ? 100 : this.get("absMaxCapacity") value: this.get("name") === "root" ? 100 : floatToFixed(this.get("absMaxCapacity"))
} }
]; ];
}.property("absCapacity", "usedCapacity", "absMaxCapacity"), }.property("absCapacity", "usedCapacity", "absMaxCapacity"),

View File

@ -17,6 +17,7 @@
*/ */
import DS from 'ember-data'; import DS from 'ember-data';
import Converter from 'yarn-ui/utils/converter';
export default DS.Model.extend({ export default DS.Model.extend({
name: DS.attr('string'), name: DS.attr('string'),
@ -48,18 +49,19 @@ export default DS.Model.extend({
}.property("children"), }.property("children"),
capacitiesBarChartData: function() { capacitiesBarChartData: function() {
var floatToFixed = Converter.floatToFixed;
return [ return [
{ {
label: "Steady Fair Memory", label: "Steady Fair Memory",
value: this.get("steadyFairResources.memory") value: floatToFixed(this.get("steadyFairResources.memory"))
}, },
{ {
label: "Used Memory", label: "Used Memory",
value: this.get("usedResources.memory") value: floatToFixed(this.get("usedResources.memory"))
}, },
{ {
label: "Maximum Memory", label: "Maximum Memory",
value: this.get("maxResources.memory") value: floatToFixed(this.get("maxResources.memory"))
} }
]; ];
}.property("maxResources.memory", "usedResources.memory", "maxResources.memory"), }.property("maxResources.memory", "usedResources.memory", "maxResources.memory"),

View File

@ -17,6 +17,7 @@
*/ */
import DS from 'ember-data'; import DS from 'ember-data';
import Converter from 'yarn-ui/utils/converter';
export default DS.Model.extend({ export default DS.Model.extend({
name: DS.attr('string'), name: DS.attr('string'),
@ -33,18 +34,19 @@ export default DS.Model.extend({
type: DS.attr('string'), type: DS.attr('string'),
capacitiesBarChartData: function() { capacitiesBarChartData: function() {
var floatToFixed = Converter.floatToFixed;
return [ return [
{ {
label: "Available Capacity", label: "Available Capacity",
value: this.get("availNodeCapacity") value: floatToFixed(this.get("availNodeCapacity"))
}, },
{ {
label: "Used Capacity", label: "Used Capacity",
value: this.get("usedNodeCapacity") value: floatToFixed(this.get("usedNodeCapacity"))
}, },
{ {
label: "Total Capacity", label: "Total Capacity",
value: this.get("totalNodeCapacity") value: floatToFixed(this.get("totalNodeCapacity"))
} }
]; ];
}.property("availNodeCapacity", "usedNodeCapacity", "totalNodeCapacity") }.property("availNodeCapacity", "usedNodeCapacity", "totalNodeCapacity")

View File

@ -59,8 +59,9 @@ export default DS.JSONAPISerializer.extend({
handleQueue(store, primaryModelClass, payload, id, requestType) { handleQueue(store, primaryModelClass, payload, id, requestType) {
var data = []; var data = [];
var includedData = []; if (!payload) {
if(!payload) return data; return data;
}
var result = this.normalizeSingleResponse(store, primaryModelClass, var result = this.normalizeSingleResponse(store, primaryModelClass,
payload, id, requestType); payload, id, requestType);

View File

@ -41,7 +41,7 @@
<span class="sr-only">(current)</span> <span class="sr-only">(current)</span>
{{/link-to}} {{/link-to}}
{{/link-to}} {{/link-to}}
{{#link-to 'yarn-queues' 'root' tagName="li"}} {{#link-to 'yarn-queues' 'root' tagName="li" classNameBindings="isQueuesTabActive:active"}}
{{#link-to 'yarn-queues' 'root' class="navigation-link"}}Queues {{#link-to 'yarn-queues' 'root' class="navigation-link"}}Queues
<span class="sr-only">(current)</span> <span class="sr-only">(current)</span>
{{/link-to}} {{/link-to}}

View File

@ -20,7 +20,7 @@
<thead> <thead>
<tr> <tr>
<td><b>Configurations</b></td> <td><b>Configurations</b></td>
<td>Value</td> <td><b>Value</b></td>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -32,10 +32,12 @@
<td>Configured Max Capacity</td> <td>Configured Max Capacity</td>
<td>{{queue.maxCapacity}}</td> <td>{{queue.maxCapacity}}</td>
</tr> </tr>
{{#if queue.state}}
<tr> <tr>
<td>State</td> <td>State</td>
<td>{{queue.state}}</td> <td>{{queue.state}}</td>
</tr> </tr>
{{/if}}
{{#if queue.isLeafQueue}} {{#if queue.isLeafQueue}}
<tr> <tr>
<td>User Limit Percent</td> <td>User Limit Percent</td>

View File

@ -20,7 +20,7 @@
<thead> <thead>
<tr> <tr>
<td><b>Configurations</b></td> <td><b>Configurations</b></td>
<td>Value</td> <td><b>Value</b></td>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>

View File

@ -39,7 +39,7 @@
{{bar-chart data=model.selectedQueue.capacitiesBarChartData {{bar-chart data=model.selectedQueue.capacitiesBarChartData
title="" title=""
parentId="capacity-bar-chart" parentId="capacity-bar-chart"
textWidth=150 textWidth=175
ratio=0.55 ratio=0.55
maxHeight=350}} maxHeight=350}}
</div> </div>

View File

@ -20,7 +20,7 @@
<thead> <thead>
<tr> <tr>
<td><b>Configurations</b></td> <td><b>Configurations</b></td>
<td>Value</td> <td><b>Value</b></td>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -32,10 +32,12 @@
<td>Used Capacity</td> <td>Used Capacity</td>
<td>{{queue.usedCapacity}}</td> <td>{{queue.usedCapacity}}</td>
</tr> </tr>
{{#if queue.state}}
<tr> <tr>
<td>State</td> <td>State</td>
<td>{{queue.state}}</td> <td>{{queue.state}}</td>
</tr> </tr>
{{/if}}
<tr> <tr>
<td>Minimum Queue Memory Capacity</td> <td>Minimum Queue Memory Capacity</td>
<td>{{queue.minQueueMemoryCapacity}}</td> <td>{{queue.minQueueMemoryCapacity}}</td>

View File

@ -39,7 +39,7 @@
{{bar-chart data=model.selectedQueue.capacitiesBarChartData {{bar-chart data=model.selectedQueue.capacitiesBarChartData
title="" title=""
parentId="capacity-bar-chart" parentId="capacity-bar-chart"
textWidth=150 textWidth=175
ratio=0.55 ratio=0.55
maxHeight=350}} maxHeight=350}}
</div> </div>

View File

@ -165,5 +165,11 @@ export default {
unit = "GB"; unit = "GB";
} }
return value.toFixed(1) + " " + unit; return value.toFixed(1) + " " + unit;
},
floatToFixed: function(value, fixed=2) {
if (value && value.toFixed) {
return parseFloat(value.toFixed(fixed));
}
return value;
} }
}; };