YARN-5866. Fix few issues reported by jshint in new YARN UI. Contributed by Akhil P B.
This commit is contained in:
parent
87852b6ef4
commit
4c6bae5a22
|
@ -2,7 +2,10 @@
|
||||||
"predef": [
|
"predef": [
|
||||||
"document",
|
"document",
|
||||||
"window",
|
"window",
|
||||||
"-Promise"
|
"-Promise",
|
||||||
|
"d3",
|
||||||
|
"$",
|
||||||
|
"moment"
|
||||||
],
|
],
|
||||||
"browser": true,
|
"browser": true,
|
||||||
"boss": true,
|
"boss": true,
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import Ember from 'ember';
|
import Ember from 'ember';
|
||||||
|
import DS from 'ember-data';
|
||||||
|
|
||||||
export default DS.JSONAPIAdapter.extend({
|
export default DS.JSONAPIAdapter.extend({
|
||||||
address: null, //Must be set by inheriting classes
|
address: null, //Must be set by inheriting classes
|
||||||
|
|
|
@ -24,7 +24,7 @@ export default AbstractAdapter.extend({
|
||||||
serverName: "RM",
|
serverName: "RM",
|
||||||
|
|
||||||
// Any cluster-info specific adapter changes must be added here
|
// Any cluster-info specific adapter changes must be added here
|
||||||
pathForType(modelName) {
|
pathForType(/*modelName*/) {
|
||||||
return ''; // move to some common place, return path by modelname.
|
return ''; // move to some common place, return path by modelname.
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -24,7 +24,7 @@ export default AbstractAdapter.extend({
|
||||||
serverName: "RM",
|
serverName: "RM",
|
||||||
|
|
||||||
// Any cluster-metric specific adapter changes must be added here
|
// Any cluster-metric specific adapter changes must be added here
|
||||||
pathForType(modelName) {
|
pathForType(/*modelName*/) {
|
||||||
return ''; // move to some common place, return path by modelname.
|
return ''; // move to some common place, return path by modelname.
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -24,12 +24,12 @@ export default AbstractAdapter.extend({
|
||||||
restNameSpace: "cluster",
|
restNameSpace: "cluster",
|
||||||
serverName: "RM",
|
serverName: "RM",
|
||||||
|
|
||||||
urlForQuery(query, modelName) {
|
urlForQuery(query/*, modelName*/) {
|
||||||
var url = this._buildURL();
|
var url = this._buildURL();
|
||||||
return url + '/apps/' + query.appId + "/appattempts";
|
return url + '/apps/' + query.appId + "/appattempts";
|
||||||
},
|
},
|
||||||
|
|
||||||
urlForFindRecord(id, modelName, snapshot) {
|
urlForFindRecord(id/*, modelName, snapshot*/) {
|
||||||
var url = this._buildURL();
|
var url = this._buildURL();
|
||||||
return url + '/apps/' +
|
return url + '/apps/' +
|
||||||
Converter.attemptIdToAppId(id) + "/appattempts/" + id;
|
Converter.attemptIdToAppId(id) + "/appattempts/" + id;
|
||||||
|
|
|
@ -23,7 +23,7 @@ export default AbstractAdapter.extend({
|
||||||
restNameSpace: "cluster",
|
restNameSpace: "cluster",
|
||||||
serverName: "RM",
|
serverName: "RM",
|
||||||
|
|
||||||
urlForQuery(query, modelName) {
|
urlForQuery(query/*, modelName*/) {
|
||||||
var url = this._buildURL();
|
var url = this._buildURL();
|
||||||
if (query.state) {
|
if (query.state) {
|
||||||
url = url + '/apps/?state=' + query.state;
|
url = url + '/apps/?state=' + query.state;
|
||||||
|
@ -31,13 +31,13 @@ export default AbstractAdapter.extend({
|
||||||
return url;
|
return url;
|
||||||
},
|
},
|
||||||
|
|
||||||
urlForFindRecord(id, modelName, snapshot) {
|
urlForFindRecord(id/*, modelName, snapshot*/) {
|
||||||
var url = this._buildURL();
|
var url = this._buildURL();
|
||||||
url = url + '/apps/' + id;
|
url = url + '/apps/' + id;
|
||||||
return url;
|
return url;
|
||||||
},
|
},
|
||||||
|
|
||||||
pathForType(modelName) {
|
pathForType(/*modelName*/) {
|
||||||
return 'apps'; // move to some common place, return path by modelname.
|
return 'apps'; // move to some common place, return path by modelname.
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -37,7 +37,7 @@ export default DS.RESTAdapter.extend({
|
||||||
return this.get(`env.app.namespaces.node`);
|
return this.get(`env.app.namespaces.node`);
|
||||||
}),
|
}),
|
||||||
|
|
||||||
urlForFindRecord(id, modelName, snapshot) {
|
urlForFindRecord(id/*, modelName, snapshot*/) {
|
||||||
var splits = Converter.splitForContainerLogs(id);
|
var splits = Converter.splitForContainerLogs(id);
|
||||||
var nodeHttpAddr = splits[0];
|
var nodeHttpAddr = splits[0];
|
||||||
var containerId = splits[1];
|
var containerId = splits[1];
|
||||||
|
@ -68,7 +68,7 @@ export default DS.RESTAdapter.extend({
|
||||||
hash.context = this;
|
hash.context = this;
|
||||||
|
|
||||||
var headers = Ember.get(this, 'headers');
|
var headers = Ember.get(this, 'headers');
|
||||||
if (headers != undefined) {
|
if (headers !== undefined) {
|
||||||
hash.beforeSend = function (xhr) {
|
hash.beforeSend = function (xhr) {
|
||||||
Object.keys(headers).forEach(function (key) {
|
Object.keys(headers).forEach(function (key) {
|
||||||
return xhr.setRequestHeader(key, headers[key]);
|
return xhr.setRequestHeader(key, headers[key]);
|
||||||
|
|
|
@ -25,14 +25,14 @@ export default DS.JSONAPIAdapter.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
host: function() {
|
host: function() {
|
||||||
return undefined
|
return undefined;
|
||||||
}.property(),
|
}.property(),
|
||||||
|
|
||||||
namespace: function() {
|
namespace: function() {
|
||||||
return undefined
|
return undefined;
|
||||||
}.property(),
|
}.property(),
|
||||||
|
|
||||||
urlForQuery(query, modelName) {
|
urlForQuery(query/*, modelName*/) {
|
||||||
var rmHosts = this.get(`hosts.rmWebAddress`);
|
var rmHosts = this.get(`hosts.rmWebAddress`);
|
||||||
var tsHosts = this.get(`hosts.timelineWebAddress`);
|
var tsHosts = this.get(`hosts.timelineWebAddress`);
|
||||||
var rmNamespaces = this.get(`env.app.namespaces.cluster`);
|
var rmNamespaces = this.get(`env.app.namespaces.cluster`);
|
||||||
|
@ -47,8 +47,8 @@ export default DS.JSONAPIAdapter.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
var url = this._buildURL();
|
var url = this._buildURL();
|
||||||
url = url + '/apps/' + Converter.attemptIdToAppId(query.app_attempt_id)
|
url = url + '/apps/' + Converter.attemptIdToAppId(query.app_attempt_id) +
|
||||||
+ "/appattempts/" + query.app_attempt_id + "/containers";
|
"/appattempts/" + query.app_attempt_id + "/containers";
|
||||||
console.log(url);
|
console.log(url);
|
||||||
return url;
|
return url;
|
||||||
},
|
},
|
||||||
|
@ -58,6 +58,6 @@ export default DS.JSONAPIAdapter.extend({
|
||||||
hash.crossDomain = true;
|
hash.crossDomain = true;
|
||||||
hash.xhrFields = {withCredentials: true};
|
hash.xhrFields = {withCredentials: true};
|
||||||
hash.targetServer = "RM";
|
hash.targetServer = "RM";
|
||||||
return this._super(url, method, hash);
|
return this._super(url, method, hash);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -24,10 +24,10 @@ export default AbstractAdapter.extend({
|
||||||
restNameSpace: "node",
|
restNameSpace: "node",
|
||||||
serverName: "NM",
|
serverName: "NM",
|
||||||
|
|
||||||
urlForFindRecord(id, modelName, snapshot) {
|
urlForFindRecord(id/*, modelName, snapshot*/) {
|
||||||
var url = this._buildURL();
|
var url = this._buildURL();
|
||||||
url = url.replace("{nodeAddress}", id);
|
url = url.replace("{nodeAddress}", id);
|
||||||
return url;
|
return url;
|
||||||
},
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -23,8 +23,8 @@ export default AbstractAdapter.extend({
|
||||||
restNameSpace: "cluster",
|
restNameSpace: "cluster",
|
||||||
serverName: "RM",
|
serverName: "RM",
|
||||||
|
|
||||||
pathForType(modelName) {
|
pathForType(/*modelName*/) {
|
||||||
return 'scheduler'; // move to some common place, return path by modelname.
|
return 'scheduler'; // move to some common place, return path by modelname.
|
||||||
},
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -23,14 +23,14 @@ export default AbstractAdapter.extend({
|
||||||
restNameSpace: "cluster",
|
restNameSpace: "cluster",
|
||||||
serverName: "RM",
|
serverName: "RM",
|
||||||
|
|
||||||
pathForType(modelName) {
|
pathForType(/*modelName*/) {
|
||||||
return 'nodes';
|
return 'nodes';
|
||||||
},
|
},
|
||||||
|
|
||||||
urlForFindRecord(id, modelName, snapshot) {
|
urlForFindRecord(id/*, modelName, snapshot*/) {
|
||||||
var url = this._buildURL();
|
var url = this._buildURL();
|
||||||
url = url + "/nodes/" + id;
|
url = url + "/nodes/" + id;
|
||||||
return url;
|
return url;
|
||||||
},
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import Ember from 'ember';
|
|
||||||
import DonutChart from 'yarn-ui/components/donut-chart';
|
|
||||||
import BaseUsageDonutChart from 'yarn-ui/components/base-usage-donut-chart';
|
import BaseUsageDonutChart from 'yarn-ui/components/base-usage-donut-chart';
|
||||||
import ColorUtils from 'yarn-ui/utils/color-utils';
|
import ColorUtils from 'yarn-ui/utils/color-utils';
|
||||||
import HrefAddressUtils from 'yarn-ui/utils/href-address-utils';
|
import HrefAddressUtils from 'yarn-ui/utils/href-address-utils';
|
||||||
|
@ -52,11 +50,11 @@ export default BaseUsageDonutChart.extend({
|
||||||
usageByApps.push({
|
usageByApps.push({
|
||||||
label: "Available",
|
label: "Available",
|
||||||
value: avail.toFixed(4)
|
value: avail.toFixed(4)
|
||||||
})
|
});
|
||||||
|
|
||||||
this.colors = ColorUtils.getColors(usageByApps.length, ["others", "good"], true);
|
this.colors = ColorUtils.getColors(usageByApps.length, ["others", "good"], true);
|
||||||
|
|
||||||
this.renderDonutChart(usageByApps, this.get("title"), this.get("showLabels"),
|
this.renderDonutChart(usageByApps, this.get("title"), this.get("showLabels"),
|
||||||
this.get("middleLabel"), "100%", "%");
|
this.get("middleLabel"), "100%", "%");
|
||||||
},
|
},
|
||||||
})
|
});
|
|
@ -55,17 +55,15 @@ export default BaseChartComponent.extend({
|
||||||
.domain([0, maxValue])
|
.domain([0, maxValue])
|
||||||
.range([0, maxBarWidth]);
|
.range([0, maxBarWidth]);
|
||||||
|
|
||||||
|
var getBarText = function(i) {
|
||||||
|
return data[i].label;
|
||||||
|
};
|
||||||
// show bar text
|
// show bar text
|
||||||
for (var i = 0; i < data.length; i++) {
|
for (i = 0; i < data.length; i++) {
|
||||||
g.append("text")
|
g.append("text")
|
||||||
.text(
|
.text(getBarText(i))
|
||||||
function() {
|
.attr("y", layout.y1 + singleBarHeight / 2 + layout.margin +
|
||||||
return data[i].label;
|
(gap + singleBarHeight) * i + 30)
|
||||||
})
|
|
||||||
.attr("y", function() {
|
|
||||||
return layout.y1 + singleBarHeight / 2 + layout.margin + (gap +
|
|
||||||
singleBarHeight) * i + 30;
|
|
||||||
})
|
|
||||||
.attr("x", layout.x1 + layout.margin);
|
.attr("x", layout.x1 + layout.margin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,17 +94,15 @@ export default BaseChartComponent.extend({
|
||||||
return w;
|
return w;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var getBarValue = function(i) {
|
||||||
|
return data[i].value;
|
||||||
|
};
|
||||||
// show bar value
|
// show bar value
|
||||||
for (var i = 0; i < data.length; i++) {
|
for (i = 0; i < data.length; i++) {
|
||||||
g.append("text")
|
g.append("text")
|
||||||
.text(
|
.text(getBarValue(i))
|
||||||
function() {
|
.attr("y", layout.y1 + singleBarHeight / 2 + layout.margin +
|
||||||
return data[i].value;
|
(gap + singleBarHeight) * i + 30)
|
||||||
})
|
|
||||||
.attr("y", function() {
|
|
||||||
return layout.y1 + singleBarHeight / 2 + layout.margin + (gap +
|
|
||||||
singleBarHeight) * i + 30;
|
|
||||||
})
|
|
||||||
.attr("x", layout.x1 + layout.margin + textWidth + 15 + xScaler(data[i].value));
|
.attr("x", layout.x1 + layout.margin + textWidth + 15 + xScaler(data[i].value));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -123,5 +119,5 @@ export default BaseChartComponent.extend({
|
||||||
didInsertElement: function() {
|
didInsertElement: function() {
|
||||||
this.initChart();
|
this.initChart();
|
||||||
this.draw();
|
this.draw();
|
||||||
},
|
}
|
||||||
})
|
});
|
|
@ -96,7 +96,7 @@ export default Ember.Component.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
bindTooltip: function(d) {
|
bindTooltip: function(d) {
|
||||||
d.on("mouseover", function(d) {
|
d.on("mouseover", function() {
|
||||||
this.tooltip
|
this.tooltip
|
||||||
.style("left", (d3.event.pageX) + "px")
|
.style("left", (d3.event.pageX) + "px")
|
||||||
.style("top", (d3.event.pageY - 28) + "px");
|
.style("top", (d3.event.pageY - 28) + "px");
|
||||||
|
@ -108,16 +108,16 @@ export default Ember.Component.extend({
|
||||||
data = d.data;
|
data = d.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.tooltip.style("opacity", .9);
|
this.tooltip.style("opacity", 0.9);
|
||||||
var value = data.value;
|
var value = data.value;
|
||||||
if (this.get("type") == "memory") {
|
if (this.get("type") === "memory") {
|
||||||
value = Converter.memoryToSimpliedUnit(value);
|
value = Converter.memoryToSimpliedUnit(value);
|
||||||
}
|
}
|
||||||
this.tooltip.html(data.label + " = " + value)
|
this.tooltip.html(data.label + " = " + value)
|
||||||
.style("left", (d3.event.pageX) + "px")
|
.style("left", (d3.event.pageX) + "px")
|
||||||
.style("top", (d3.event.pageY - 28) + "px");
|
.style("top", (d3.event.pageY - 28) + "px");
|
||||||
}.bind(this))
|
}.bind(this))
|
||||||
.on("mouseout", function(d) {
|
.on("mouseout", function() {
|
||||||
this.tooltip.style("opacity", 0);
|
this.tooltip.style("opacity", 0);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
},
|
},
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import Ember from 'ember';
|
|
||||||
import DonutChart from 'yarn-ui/components/donut-chart';
|
import DonutChart from 'yarn-ui/components/donut-chart';
|
||||||
|
|
||||||
export default DonutChart.extend({
|
export default DonutChart.extend({
|
||||||
|
@ -29,15 +28,15 @@ export default DonutChart.extend({
|
||||||
var others = {
|
var others = {
|
||||||
label: "Used by others",
|
label: "Used by others",
|
||||||
value: 0
|
value: 0
|
||||||
}
|
};
|
||||||
|
|
||||||
for (var i = nItemsKept; i < usages.length; i++) {
|
for (i = nItemsKept; i < usages.length; i++) {
|
||||||
others.value += Number(usages[i].value);
|
others.value += Number(usages[i].value);
|
||||||
}
|
}
|
||||||
others.value = others.value.toFixed(2);
|
others.value = others.value.toFixed(2);
|
||||||
|
|
||||||
arr.push(others)
|
arr.push(others);
|
||||||
|
|
||||||
return arr;
|
return arr;
|
||||||
},
|
}
|
||||||
})
|
});
|
|
@ -41,7 +41,7 @@ export default BaseChartComponent.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!middleValue) {
|
if (!middleValue) {
|
||||||
if (this.get("type") == "memory") {
|
if (this.get("type") === "memory") {
|
||||||
middleValue = Converter.memoryToSimpliedUnit(total);
|
middleValue = Converter.memoryToSimpliedUnit(total);
|
||||||
} else {
|
} else {
|
||||||
middleValue = total;
|
middleValue = total;
|
||||||
|
@ -111,7 +111,7 @@ export default BaseChartComponent.extend({
|
||||||
if (allZero) {
|
if (allZero) {
|
||||||
return this.colors[i];
|
return this.colors[i];
|
||||||
}
|
}
|
||||||
}.bind(this))
|
}.bind(this));
|
||||||
this.bindTooltip(path);
|
this.bindTooltip(path);
|
||||||
path.on("click", function (d) {
|
path.on("click", function (d) {
|
||||||
var data = d.data;
|
var data = d.data;
|
||||||
|
@ -119,7 +119,7 @@ export default BaseChartComponent.extend({
|
||||||
this.tooltip.remove();
|
this.tooltip.remove();
|
||||||
document.location.href = data.link;
|
document.location.href = data.link;
|
||||||
}
|
}
|
||||||
}.bind(this))
|
}.bind(this));
|
||||||
|
|
||||||
// Show labels
|
// Show labels
|
||||||
if (showLabels) {
|
if (showLabels) {
|
||||||
|
@ -147,7 +147,7 @@ export default BaseChartComponent.extend({
|
||||||
})
|
})
|
||||||
.text(function(d) {
|
.text(function(d) {
|
||||||
var value = d.value;
|
var value = d.value;
|
||||||
if (this.get("type") == "memory") {
|
if (this.get("type") === "memory") {
|
||||||
value = Converter.memoryToSimpliedUnit(value);
|
value = Converter.memoryToSimpliedUnit(value);
|
||||||
}
|
}
|
||||||
return d.label + ' = ' + value + suffix;
|
return d.label + ' = ' + value + suffix;
|
||||||
|
@ -190,4 +190,4 @@ export default BaseChartComponent.extend({
|
||||||
this.initChart();
|
this.initChart();
|
||||||
this.draw();
|
this.draw();
|
||||||
},
|
},
|
||||||
})
|
});
|
|
@ -17,7 +17,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import BaseChartComponent from 'yarn-ui/components/base-chart-component';
|
import BaseChartComponent from 'yarn-ui/components/base-chart-component';
|
||||||
import Mock from 'yarn-ui/utils/mock';
|
|
||||||
|
|
||||||
export default BaseChartComponent.extend({
|
export default BaseChartComponent.extend({
|
||||||
CELL_WIDTH: 250,
|
CELL_WIDTH: 250,
|
||||||
|
@ -39,7 +38,7 @@ export default BaseChartComponent.extend({
|
||||||
// Handle pie chart case
|
// Handle pie chart case
|
||||||
var text = element.attr("tooltiptext");
|
var text = element.attr("tooltiptext");
|
||||||
|
|
||||||
this.tooltip.style("opacity", .9);
|
this.tooltip.style("opacity", 0.9);
|
||||||
this.tooltip.html(text)
|
this.tooltip.html(text)
|
||||||
.style("left", (d3.event.pageX) + "px")
|
.style("left", (d3.event.pageX) + "px")
|
||||||
.style("top", (d3.event.pageY - 28) + "px");
|
.style("top", (d3.event.pageY - 28) + "px");
|
||||||
|
@ -82,10 +81,10 @@ export default BaseChartComponent.extend({
|
||||||
2 * this.CELL_MARGIN;
|
2 * this.CELL_MARGIN;
|
||||||
var sampleYOffset = layout.margin * 2;
|
var sampleYOffset = layout.margin * 2;
|
||||||
|
|
||||||
for (var i = 1; i <= 5; i++) {
|
for (i = 1; i <= 5; i++) {
|
||||||
var ratio = i * 0.2 - 0.1;
|
var ratio = i * 0.2 - 0.1;
|
||||||
|
|
||||||
var rect = g.append("rect")
|
g.append("rect")
|
||||||
.attr("x", sampleXOffset)
|
.attr("x", sampleXOffset)
|
||||||
.attr("y", sampleYOffset)
|
.attr("y", sampleYOffset)
|
||||||
.attr("fill", colorFunc(ratio))
|
.attr("fill", colorFunc(ratio))
|
||||||
|
@ -101,14 +100,14 @@ export default BaseChartComponent.extend({
|
||||||
|
|
||||||
var chartXOffset = -1;
|
var chartXOffset = -1;
|
||||||
|
|
||||||
for (var i = 0; i < racksArray.length; i++) {
|
for (i = 0; i < racksArray.length; i++) {
|
||||||
var text = g.append("text")
|
var text = g.append("text")
|
||||||
.text(racksArray[i])
|
.text(racksArray[i])
|
||||||
.attr("y", yOffset + this.CELL_HEIGHT / 2 + 5)
|
.attr("y", yOffset + this.CELL_HEIGHT / 2 + 5)
|
||||||
.attr("x", layout.margin)
|
.attr("x", layout.margin)
|
||||||
.attr("class", "heatmap-rack");
|
.attr("class", "heatmap-rack");
|
||||||
|
|
||||||
if (-1 == chartXOffset) {
|
if (-1 === chartXOffset) {
|
||||||
chartXOffset = layout.margin + text.node().getComputedTextLength() + 30;
|
chartXOffset = layout.margin + text.node().getComputedTextLength() + 30;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,10 +117,10 @@ export default BaseChartComponent.extend({
|
||||||
var rack = data[j].get("rack");
|
var rack = data[j].get("rack");
|
||||||
var host = data[j].get("nodeHostName");
|
var host = data[j].get("nodeHostName");
|
||||||
|
|
||||||
if (rack == racksArray[i]) {
|
if (rack === racksArray[i]) {
|
||||||
if (!rack.includes(this.filter) && !host.includes(this.filter)) {
|
if (!rack.includes(this.filter) && !host.includes(this.filter)) {
|
||||||
this.addNode(g, xOffset, yOffset, colorFunc, data[j], false);
|
this.addNode(g, xOffset, yOffset, colorFunc, data[j], false);
|
||||||
var text = g.append("text")
|
g.append("text")
|
||||||
.text(host)
|
.text(host)
|
||||||
.attr("y", yOffset + this.CELL_HEIGHT / 2 + 5)
|
.attr("y", yOffset + this.CELL_HEIGHT / 2 + 5)
|
||||||
.attr("x", xOffset + this.CELL_WIDTH / 2)
|
.attr("x", xOffset + this.CELL_WIDTH / 2)
|
||||||
|
@ -151,7 +150,7 @@ export default BaseChartComponent.extend({
|
||||||
xOffset += this.CELL_MARGIN + this.CELL_WIDTH;
|
xOffset += this.CELL_MARGIN + this.CELL_WIDTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xOffset != chartXOffset) {
|
if (xOffset !== chartXOffset) {
|
||||||
xOffset = chartXOffset;
|
xOffset = chartXOffset;
|
||||||
yOffset += this.CELL_MARGIN + this.CELL_HEIGHT;
|
yOffset += this.CELL_MARGIN + this.CELL_HEIGHT;
|
||||||
}
|
}
|
||||||
|
@ -182,7 +181,7 @@ export default BaseChartComponent.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
addPlaceholderNode: function(g, xOffset, yOffset) {
|
addPlaceholderNode: function(g, xOffset, yOffset) {
|
||||||
var rect = g.append("rect")
|
g.append("rect")
|
||||||
.attr("y", yOffset)
|
.attr("y", yOffset)
|
||||||
.attr("x", xOffset)
|
.attr("x", xOffset)
|
||||||
.attr("height", this.CELL_HEIGHT)
|
.attr("height", this.CELL_HEIGHT)
|
||||||
|
@ -206,4 +205,4 @@ export default BaseChartComponent.extend({
|
||||||
this.didInsertElement();
|
this.didInsertElement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
});
|
|
@ -28,7 +28,7 @@ export default StackedBarchart.extend({
|
||||||
{
|
{
|
||||||
used: Number(n.get("usedMemoryMB")),
|
used: Number(n.get("usedMemoryMB")),
|
||||||
avail: Number(n.get("availMemoryMB"))
|
avail: Number(n.get("availMemoryMB"))
|
||||||
}
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
containers.forEach(function(c) {
|
containers.forEach(function(c) {
|
||||||
|
@ -85,4 +85,4 @@ export default StackedBarchart.extend({
|
||||||
data, this.get("title"), ["Used by this app", "Used by other apps",
|
data, this.get("title"), ["Used by this app", "Used by other apps",
|
||||||
"Available"]);
|
"Available"]);
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
|
|
|
@ -29,7 +29,7 @@ export default StackedBarchart.extend({
|
||||||
containers.forEach(function(c) {
|
containers.forEach(function(c) {
|
||||||
var nodeId = c.get("assignedNodeId");
|
var nodeId = c.get("assignedNodeId");
|
||||||
var n = nodeToContainers[nodeId];
|
var n = nodeToContainers[nodeId];
|
||||||
if (undefined != n) {
|
if (undefined !== n) {
|
||||||
nodeToContainers[nodeId] += 1;
|
nodeToContainers[nodeId] += 1;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -64,4 +64,4 @@ export default StackedBarchart.extend({
|
||||||
this.show(
|
this.show(
|
||||||
data, this.get("title"), ["Running containers from this app"]);
|
data, this.get("title"), ["Running containers from this app"]);
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import Ember from 'ember';
|
|
||||||
import DonutChart from 'yarn-ui/components/donut-chart';
|
|
||||||
import BaseUsageDonutChart from 'yarn-ui/components/base-usage-donut-chart';
|
import BaseUsageDonutChart from 'yarn-ui/components/base-usage-donut-chart';
|
||||||
import ColorUtils from 'yarn-ui/utils/color-utils';
|
import ColorUtils from 'yarn-ui/utils/color-utils';
|
||||||
import HrefAddressUtils from 'yarn-ui/utils/href-address-utils';
|
import HrefAddressUtils from 'yarn-ui/utils/href-address-utils';
|
||||||
|
@ -66,4 +64,4 @@ export default BaseUsageDonutChart.extend({
|
||||||
this.initChart();
|
this.initChart();
|
||||||
this.draw();
|
this.draw();
|
||||||
},
|
},
|
||||||
})
|
});
|
|
@ -92,7 +92,7 @@ export default Ember.Component.extend(ChartUtilsMixin, {
|
||||||
circle.on('mouseover', function () {
|
circle.on('mouseover', function () {
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
circle.on('mouseout', function () {
|
circle.on('mouseout', function () {
|
||||||
if (circle != this.queues.selectedQueueCircle) {
|
if (circle !== this.queues.selectedQueueCircle) {
|
||||||
circle.style("fill", this.queueColors[0]);
|
circle.style("fill", this.queueColors[0]);
|
||||||
}
|
}
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
@ -143,7 +143,6 @@ export default Ember.Component.extend(ChartUtilsMixin, {
|
||||||
// render queues
|
// render queues
|
||||||
this.queues.dataGroup = this.canvas.svg.append("g")
|
this.queues.dataGroup = this.canvas.svg.append("g")
|
||||||
.attr("id", "queues-g");
|
.attr("id", "queues-g");
|
||||||
var rootQueue = undefined;
|
|
||||||
|
|
||||||
if (this.queues.data) {
|
if (this.queues.data) {
|
||||||
this.renderQueue(this.queues.data['root'], 0, 0);
|
this.renderQueue(this.queues.data['root'], 0, 0);
|
||||||
|
@ -185,7 +184,7 @@ export default Ember.Component.extend(ChartUtilsMixin, {
|
||||||
/*
|
/*
|
||||||
* data = [{label="xx", value=},{...}]
|
* data = [{label="xx", value=},{...}]
|
||||||
*/
|
*/
|
||||||
renderTable: function (data, title, layout) {
|
renderTable: function (data) {
|
||||||
d3.select("#main-svg")
|
d3.select("#main-svg")
|
||||||
.append('table')
|
.append('table')
|
||||||
.selectAll('tr')
|
.selectAll('tr')
|
||||||
|
@ -254,7 +253,7 @@ export default Ember.Component.extend(ChartUtilsMixin, {
|
||||||
for (var queueName in this.queues.data) {
|
for (var queueName in this.queues.data) {
|
||||||
var q = this.queues.data[queueName];
|
var q = this.queues.data[queueName];
|
||||||
if ((!q.get("children")) || q.get("children")
|
if ((!q.get("children")) || q.get("children")
|
||||||
.length == 0) {
|
.length === 0) {
|
||||||
// it's a leafqueue
|
// it's a leafqueue
|
||||||
leafQueueUsedCaps.push({
|
leafQueueUsedCaps.push({
|
||||||
label: q.get("name"),
|
label: q.get("name"),
|
||||||
|
@ -274,10 +273,10 @@ export default Ember.Component.extend(ChartUtilsMixin, {
|
||||||
var queue = this.queues.data[queueName];
|
var queue = this.queues.data[queueName];
|
||||||
var idx = 0;
|
var idx = 0;
|
||||||
|
|
||||||
if (queue.get("name") == "root") {
|
if (queue.get("name") === "root") {
|
||||||
this.renderLeafQueueUsedCapacities(this.getLayout(idx++));
|
this.renderLeafQueueUsedCapacities(this.getLayout(idx++));
|
||||||
}
|
}
|
||||||
if (queue.get("name") != "root") {
|
if (queue.get("name") !== "root") {
|
||||||
this.renderQueueCapacities(queue, this.getLayout(idx++));
|
this.renderQueueCapacities(queue, this.getLayout(idx++));
|
||||||
}
|
}
|
||||||
if (queue.get("children") && queue.get("children")
|
if (queue.get("children") && queue.get("children")
|
||||||
|
|
|
@ -48,11 +48,11 @@ export default Ember.Component.extend({
|
||||||
var cols = this.get("colsOrder").split(' ');
|
var cols = this.get("colsOrder").split(' ');
|
||||||
for (i = 0; i < cols.length; i++) {
|
for (i = 0; i < cols.length; i++) {
|
||||||
var col = cols[i].split(',');
|
var col = cols[i].split(',');
|
||||||
if (col.length != 2) {
|
if (col.length !== 2) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
var order = col[1].trim();
|
var order = col[1].trim();
|
||||||
if (order != 'asc' && order != 'desc') {
|
if (order !== 'asc' && order !== 'desc') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
var colOrder = [];
|
var colOrder = [];
|
||||||
|
@ -61,7 +61,7 @@ export default Ember.Component.extend({
|
||||||
orderArr.push(colOrder);
|
orderArr.push(colOrder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (orderArr.length == 0) {
|
if (orderArr.length === 0) {
|
||||||
var defaultOrder = [0, 'asc'];
|
var defaultOrder = [0, 'asc'];
|
||||||
orderArr.push(defaultOrder);
|
orderArr.push(defaultOrder);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import BaseChartComponent from 'yarn-ui/components/base-chart-component';
|
import BaseChartComponent from 'yarn-ui/components/base-chart-component';
|
||||||
import Mock from 'yarn-ui/utils/mock';
|
|
||||||
|
|
||||||
export default BaseChartComponent.extend({
|
export default BaseChartComponent.extend({
|
||||||
MAX_BAR_HEIGHT: 120,
|
MAX_BAR_HEIGHT: 120,
|
||||||
|
@ -37,7 +36,7 @@ export default BaseChartComponent.extend({
|
||||||
// Handle pie chart case
|
// Handle pie chart case
|
||||||
var text = element.attr("tooltiptext");
|
var text = element.attr("tooltiptext");
|
||||||
|
|
||||||
this.tooltip.style("opacity", .9);
|
this.tooltip.style("opacity", 0.9);
|
||||||
this.tooltip.html(text)
|
this.tooltip.html(text)
|
||||||
.style("left", (d3.event.pageX) + "px")
|
.style("left", (d3.event.pageX) + "px")
|
||||||
.style("top", (d3.event.pageY - 28) + "px");
|
.style("top", (d3.event.pageY - 28) + "px");
|
||||||
|
@ -99,9 +98,13 @@ export default BaseChartComponent.extend({
|
||||||
|
|
||||||
var maxValue = 0;
|
var maxValue = 0;
|
||||||
var maxN = 0;
|
var maxN = 0;
|
||||||
for (var i = 0; i < data.length; i++) {
|
|
||||||
|
var i = 0;
|
||||||
|
var j = 0;
|
||||||
|
|
||||||
|
for (i = 0; i < data.length; i++) {
|
||||||
var total = 0;
|
var total = 0;
|
||||||
for (var j = 0; j < data[i].length; j++) {
|
for (j = 0; j < data[i].length; j++) {
|
||||||
total += data[i][j].value;
|
total += data[i][j].value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,14 +124,14 @@ export default BaseChartComponent.extend({
|
||||||
return b[0].value - a[0].value;
|
return b[0].value - a[0].value;
|
||||||
});
|
});
|
||||||
|
|
||||||
for (var i = 0; i < data.length; i++) {
|
for (i = 0; i < data.length; i++) {
|
||||||
if (i % nBarPerRow == 0) {
|
if (i % nBarPerRow === 0) {
|
||||||
xOffset = layout.margin;
|
xOffset = layout.margin;
|
||||||
yOffset += layout.margin + height;
|
yOffset += layout.margin + height;
|
||||||
}
|
}
|
||||||
|
|
||||||
var leftTopY = yOffset;
|
var leftTopY = yOffset;
|
||||||
for (var j = 0; j < data[i].length; j++) {
|
for (j = 0; j < data[i].length; j++) {
|
||||||
var dy = data[i][j].value * height / maxValue;
|
var dy = data[i][j].value * height / maxValue;
|
||||||
if (dy > 0) {
|
if (dy > 0) {
|
||||||
leftTopY = leftTopY - dy;
|
leftTopY = leftTopY - dy;
|
||||||
|
@ -148,7 +151,7 @@ export default BaseChartComponent.extend({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data[i].length == 1) {
|
if (data[i].length === 1) {
|
||||||
g.append("text")
|
g.append("text")
|
||||||
.text(data[i][0].value)
|
.text(data[i][0].value)
|
||||||
.attr("y", leftTopY - 10)
|
.attr("y", leftTopY - 10)
|
||||||
|
@ -165,7 +168,7 @@ export default BaseChartComponent.extend({
|
||||||
this.renderTitleAndBG(g, title, layout, false);
|
this.renderTitleAndBG(g, title, layout, false);
|
||||||
},
|
},
|
||||||
|
|
||||||
draw: function(data, title, textWidth) {
|
draw: function() {
|
||||||
this.initChart(true);
|
this.initChart(true);
|
||||||
//Mock.initMockNodesData(this);
|
//Mock.initMockNodesData(this);
|
||||||
|
|
||||||
|
@ -195,4 +198,4 @@ export default BaseChartComponent.extend({
|
||||||
this.didInsertElement();
|
this.didInsertElement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
});
|
|
@ -41,13 +41,15 @@ export default Ember.Component.extend({
|
||||||
}.property(),
|
}.property(),
|
||||||
|
|
||||||
setSelected: function(d) {
|
setSelected: function(d) {
|
||||||
if (this._selected == d) {
|
var dom;
|
||||||
|
|
||||||
|
if (this._selected === d) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// restore color
|
// restore color
|
||||||
if (this._selected) {
|
if (this._selected) {
|
||||||
var dom = d3.select("#timeline-bar-" + this._selected.get("id"));
|
dom = d3.select("#timeline-bar-" + this._selected.get("id"));
|
||||||
dom.attr("fill", this.colors[0]);
|
dom.attr("fill", this.colors[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,19 +166,19 @@ export default Ember.Component.extend({
|
||||||
.attr("y", function(d, i) {
|
.attr("y", function(d, i) {
|
||||||
return border + (gap + singleBarHeight) * i;
|
return border + (gap + singleBarHeight) * i;
|
||||||
})
|
})
|
||||||
.attr("x", function(d, i) {
|
.attr("x", function(d) {
|
||||||
return border + textWidth + xScaler(d.get("startTs"));
|
return border + textWidth + xScaler(d.get("startTs"));
|
||||||
})
|
})
|
||||||
.attr("height", singleBarHeight)
|
.attr("height", singleBarHeight)
|
||||||
.attr("fill", function(d, i) {
|
.attr("fill", function() {
|
||||||
return this.colors[0];
|
return this.colors[0];
|
||||||
}.bind(this))
|
}.bind(this))
|
||||||
.attr("width", function(d, i) {
|
.attr("width", function(d) {
|
||||||
var finishedTs = xScaler(d.get("finishedTs"));
|
var finishedTs = xScaler(d.get("finishedTs"));
|
||||||
finishedTs = finishedTs > 0 ? finishedTs : xScaler(end);
|
finishedTs = finishedTs > 0 ? finishedTs : xScaler(end);
|
||||||
return finishedTs - xScaler(d.get("startTs"));
|
return finishedTs - xScaler(d.get("startTs"));
|
||||||
})
|
})
|
||||||
.attr("id", function(d, i) {
|
.attr("id", function(d) {
|
||||||
return "timeline-bar-" + d.get("id");
|
return "timeline-bar-" + d.get("id");
|
||||||
});
|
});
|
||||||
bar.on("click", function(d) {
|
bar.on("click", function(d) {
|
||||||
|
@ -198,18 +200,18 @@ export default Ember.Component.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
bindTooltip: function(d) {
|
bindTooltip: function(d) {
|
||||||
d.on("mouseover", function(d) {
|
d.on("mouseover", function() {
|
||||||
this.tooltip
|
this.tooltip
|
||||||
.style("left", (d3.event.pageX) + "px")
|
.style("left", (d3.event.pageX) + "px")
|
||||||
.style("top", (d3.event.pageY - 28) + "px");
|
.style("top", (d3.event.pageY - 28) + "px");
|
||||||
}.bind(this))
|
}.bind(this))
|
||||||
.on("mousemove", function(d) {
|
.on("mousemove", function(d) {
|
||||||
this.tooltip.style("opacity", .9);
|
this.tooltip.style("opacity", 0.9);
|
||||||
this.tooltip.html(d.get("tooltipLabel"))
|
this.tooltip.html(d.get("tooltipLabel"))
|
||||||
.style("left", (d3.event.pageX) + "px")
|
.style("left", (d3.event.pageX) + "px")
|
||||||
.style("top", (d3.event.pageY - 28) + "px");
|
.style("top", (d3.event.pageY - 28) + "px");
|
||||||
}.bind(this))
|
}.bind(this))
|
||||||
.on("mouseout", function(d) {
|
.on("mouseout", function() {
|
||||||
this.tooltip.style("opacity", 0);
|
this.tooltip.style("opacity", 0);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
},
|
},
|
||||||
|
@ -244,7 +246,7 @@ export default Ember.Component.extend({
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.modelArr.length == 0) {
|
if(this.modelArr.length === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,8 +256,9 @@ export default Ember.Component.extend({
|
||||||
|
|
||||||
return tsA - tsB;
|
return tsA - tsB;
|
||||||
});
|
});
|
||||||
|
var begin = 0;
|
||||||
if (this.modelArr.length > 0) {
|
if (this.modelArr.length > 0) {
|
||||||
var begin = this.modelArr[0].get("startTs");
|
begin = this.modelArr[0].get("startTs");
|
||||||
}
|
}
|
||||||
var end = 0;
|
var end = 0;
|
||||||
for (var i = 0; i < this.modelArr.length; i++) {
|
for (var i = 0; i < this.modelArr.length; i++) {
|
||||||
|
|
|
@ -51,7 +51,7 @@ export default Ember.Component.extend({
|
||||||
this.map[o.id] = o;
|
this.map[o.id] = o;
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
var selected = this.get("selected");
|
// var selected = this.get("selected");
|
||||||
|
|
||||||
this.initQueue("root", 1, this.treeData);
|
this.initQueue("root", 1, this.treeData);
|
||||||
},
|
},
|
||||||
|
@ -125,9 +125,9 @@ export default Ember.Component.extend({
|
||||||
// Enter any new nodes at the parent's previous position.
|
// Enter any new nodes at the parent's previous position.
|
||||||
var nodeEnter = node.enter().append("g")
|
var nodeEnter = node.enter().append("g")
|
||||||
.attr("class", "node")
|
.attr("class", "node")
|
||||||
.attr("transform", function(d) { return "translate(" + source.y0 + "," + source.x0 + ")"; })
|
.attr("transform", function() { return "translate(" + source.y0 + "," + source.x0 + ")"; })
|
||||||
.on("mouseover", function(d,i){
|
.on("mouseover", function(d){
|
||||||
if (d.queueData.get("name") != this.get("selected")) {
|
if (d.queueData.get("name") !== this.get("selected")) {
|
||||||
document.location.href = "#/yarn-queues/" + d.queueData.get("name");
|
document.location.href = "#/yarn-queues/" + d.queueData.get("name");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,10 +161,10 @@ export default Ember.Component.extend({
|
||||||
|
|
||||||
// append percentage
|
// append percentage
|
||||||
nodeEnter.append("text")
|
nodeEnter.append("text")
|
||||||
.attr("x", function(d) { return 0; })
|
.attr("x", function() { return 0; })
|
||||||
.attr("dy", ".35em")
|
.attr("dy", ".35em")
|
||||||
.attr("fill", "white")
|
.attr("fill", "white")
|
||||||
.attr("text-anchor", function(d) { return "middle"; })
|
.attr("text-anchor", function() { return "middle"; })
|
||||||
.text(function(d) {
|
.text(function(d) {
|
||||||
var usedCap = d.queueData.get("usedCapacity");
|
var usedCap = d.queueData.get("usedCapacity");
|
||||||
if (usedCap >= 100.0) {
|
if (usedCap >= 100.0) {
|
||||||
|
@ -195,14 +195,14 @@ export default Ember.Component.extend({
|
||||||
return "#/yarn-queues/" + d.queueData.get("name");
|
return "#/yarn-queues/" + d.queueData.get("name");
|
||||||
})
|
})
|
||||||
.style("stroke-width", function(d) {
|
.style("stroke-width", function(d) {
|
||||||
if (d.queueData.get("name") == this.get("selected")) {
|
if (d.queueData.get("name") === this.get("selected")) {
|
||||||
return 7;
|
return 7;
|
||||||
} else {
|
} else {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
}.bind(this))
|
}.bind(this))
|
||||||
.style("stroke", function(d) {
|
.style("stroke", function(d) {
|
||||||
if (d.queueData.get("name") == this.get("selected")) {
|
if (d.queueData.get("name") === this.get("selected")) {
|
||||||
return "gray";
|
return "gray";
|
||||||
} else {
|
} else {
|
||||||
return "gray";
|
return "gray";
|
||||||
|
@ -215,7 +215,7 @@ export default Ember.Component.extend({
|
||||||
// Transition exiting nodes to the parent's new position.
|
// Transition exiting nodes to the parent's new position.
|
||||||
var nodeExit = node.exit().transition()
|
var nodeExit = node.exit().transition()
|
||||||
.duration(duration)
|
.duration(duration)
|
||||||
.attr("transform", function(d) { return "translate(" + source.y + "," + source.x + ")"; })
|
.attr("transform", function() { return "translate(" + source.y + "," + source.x + ")"; })
|
||||||
.remove();
|
.remove();
|
||||||
|
|
||||||
nodeExit.select("circle")
|
nodeExit.select("circle")
|
||||||
|
@ -231,9 +231,9 @@ export default Ember.Component.extend({
|
||||||
// Enter any new links at the parent's previous position.
|
// Enter any new links at the parent's previous position.
|
||||||
link.enter().insert("path", "g")
|
link.enter().insert("path", "g")
|
||||||
.attr("class", "link")
|
.attr("class", "link")
|
||||||
.attr("d", function(d) {
|
.attr("d", function() {
|
||||||
var o = {x: source.x0, y: source.y0};
|
var o = {x: source.x0, y: source.y0};
|
||||||
return diagonal({source: o, target: o});
|
return diagonal({source: o, target: o});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Transition links to their new position.
|
// Transition links to their new position.
|
||||||
|
@ -244,9 +244,9 @@ export default Ember.Component.extend({
|
||||||
// Transition exiting nodes to the parent's new position.
|
// Transition exiting nodes to the parent's new position.
|
||||||
link.exit().transition()
|
link.exit().transition()
|
||||||
.duration(duration)
|
.duration(duration)
|
||||||
.attr("d", function(d) {
|
.attr("d", function() {
|
||||||
var o = {x: source.x, y: source.y};
|
var o = {x: source.x, y: source.y};
|
||||||
return diagonal({source: o, target: o});
|
return diagonal({source: o, target: o});
|
||||||
})
|
})
|
||||||
.remove();
|
.remove();
|
||||||
|
|
||||||
|
@ -265,7 +265,6 @@ export default Ember.Component.extend({
|
||||||
var treeHeight = this.numOfLeafQueue * INBETWEEN_HEIGHT;
|
var treeHeight = this.numOfLeafQueue * INBETWEEN_HEIGHT;
|
||||||
var width = treeWidth + margin.left + margin.right;
|
var width = treeWidth + margin.left + margin.right;
|
||||||
var height = treeHeight + margin.top + margin.bottom;
|
var height = treeHeight + margin.top + margin.bottom;
|
||||||
var layout = { };
|
|
||||||
|
|
||||||
if (this.mainSvg) {
|
if (this.mainSvg) {
|
||||||
this.mainSvg.remove();
|
this.mainSvg.remove();
|
||||||
|
@ -287,7 +286,7 @@ export default Ember.Component.extend({
|
||||||
root.x0 = height / 2;
|
root.x0 = height / 2;
|
||||||
root.y0 = 0;
|
root.y0 = 0;
|
||||||
|
|
||||||
d3.select(self.frameElement).style("height", height);
|
d3.select(window.frameElement).style("height", height);
|
||||||
|
|
||||||
this.update(root, root, tree, diagonal);
|
this.update(root, root, tree, diagonal);
|
||||||
},
|
},
|
||||||
|
|
|
@ -29,22 +29,22 @@ export default Ember.Controller.extend({
|
||||||
outputMainMenu: function(){
|
outputMainMenu: function(){
|
||||||
var path = this.get('currentPath');
|
var path = this.get('currentPath');
|
||||||
var html = '<li';
|
var html = '<li';
|
||||||
if (path == 'yarn-queue') {
|
if (path === 'yarn-queue') {
|
||||||
html = html + ' class="active"';
|
html = html + ' class="active"';
|
||||||
}
|
}
|
||||||
html = html + '><a href="yarn-queue/root">Queues<span class="sr-only">' +
|
html = html + '><a href="yarn-queue/root">Queues<span class="sr-only">' +
|
||||||
'(current)</span></a></li><li';
|
'(current)</span></a></li><li';
|
||||||
if (path.lastIndexOf('yarn-app', 0) == 0) {
|
if (path.lastIndexOf('yarn-app', 0) === 0) {
|
||||||
html = html + ' class="active"';
|
html = html + ' class="active"';
|
||||||
}
|
}
|
||||||
html = html + '><a href="yarn-apps">Applications<span class="sr-only">' +
|
html = html + '><a href="yarn-apps">Applications<span class="sr-only">' +
|
||||||
'(current)</span></a></li><li';
|
'(current)</span></a></li><li';
|
||||||
if (path == 'cluster-overview') {
|
if (path === 'cluster-overview') {
|
||||||
html = html + ' class="active"';
|
html = html + ' class="active"';
|
||||||
}
|
}
|
||||||
html = html + '><a href="cluster-overview">Cluster Overview<span class=' +
|
html = html + '><a href="cluster-overview">Cluster Overview<span class=' +
|
||||||
'"sr-only">(current)</span></a></li><li';
|
'"sr-only">(current)</span></a></li><li';
|
||||||
if (path.lastIndexOf('yarn-node', 0) == 0) {
|
if (path.lastIndexOf('yarn-node', 0) === 0) {
|
||||||
html = html + ' class="active"';
|
html = html + ' class="active"';
|
||||||
}
|
}
|
||||||
html = html + '><a href="yarn-nodes">Nodes<span class="sr-only">' +
|
html = html + '><a href="yarn-nodes">Nodes<span class="sr-only">' +
|
||||||
|
|
|
@ -24,7 +24,7 @@ import Ember from 'ember';
|
||||||
export default Ember.Helper.helper(function(params,hash) {
|
export default Ember.Helper.helper(function(params,hash) {
|
||||||
var num = hash.num;
|
var num = hash.num;
|
||||||
var den = hash.den;
|
var den = hash.den;
|
||||||
if (den == 0) {
|
if (den === 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return Math.floor(num/den);
|
return Math.floor(num/den);
|
||||||
|
|
|
@ -27,19 +27,18 @@ export default Ember.Helper.helper(function(params,hash) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
var logFilesLen = logFiles.length;
|
var logFilesLen = logFiles.length;
|
||||||
if (logFilesLen == 0) {
|
if (logFilesLen === 0) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
var nodeId = hash.nodeId;
|
var nodeId = hash.nodeId;
|
||||||
var nodeAddr = hash.nodeAddr;
|
var nodeAddr = hash.nodeAddr;
|
||||||
var containerId = hash.containerId;
|
var containerId = hash.containerId;
|
||||||
var html = '<td>';
|
var html = '<td>';
|
||||||
var logFilesCommaSeparated = "";
|
|
||||||
for (var i = 0; i < logFilesLen; i++) {
|
for (var i = 0; i < logFilesLen; i++) {
|
||||||
html = html + '<a href="#/yarn-container-log/' + nodeId + '/' +
|
html = html + '<a href="#/yarn-container-log/' + nodeId + '/' +
|
||||||
nodeAddr + '/' + containerId + '/' + logFiles[i] + '">' + logFiles[i] +
|
nodeAddr + '/' + containerId + '/' + logFiles[i] + '">' + logFiles[i] +
|
||||||
'</a>';
|
'</a>';
|
||||||
if (i != logFilesLen - 1) {
|
if (i !== logFilesLen - 1) {
|
||||||
html = html + ",";
|
html = html + ",";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ export default Ember.Helper.helper(function(params,hash) {
|
||||||
var nodeHTTPAddress = hash.nodeHTTPAddress;
|
var nodeHTTPAddress = hash.nodeHTTPAddress;
|
||||||
var nodeId = hash.nodeId;
|
var nodeId = hash.nodeId;
|
||||||
var html = '<td>';
|
var html = '<td>';
|
||||||
if (nodeState == "SHUTDOWN" || nodeState == "LOST") {
|
if (nodeState === "SHUTDOWN" || nodeState === "LOST") {
|
||||||
html = html + nodeHTTPAddress;
|
html = html + nodeHTTPAddress;
|
||||||
} else {
|
} else {
|
||||||
html = html + '<a href="#/yarn-node/' + nodeId + "/" + nodeHTTPAddress + '">' +
|
html = html + '<a href="#/yarn-node/' + nodeId + "/" + nodeHTTPAddress + '">' +
|
||||||
|
|
|
@ -25,7 +25,7 @@ export default Ember.Helper.helper(function(params,hash) {
|
||||||
// Place a menu within a panel inside col-md-2 container.
|
// Place a menu within a panel inside col-md-2 container.
|
||||||
var nodeIdSplitAtPort = hash.nodeId;
|
var nodeIdSplitAtPort = hash.nodeId;
|
||||||
var portIndex = nodeIdSplitAtPort.indexOf(':');
|
var portIndex = nodeIdSplitAtPort.indexOf(':');
|
||||||
if (portIndex != -1) {
|
if (portIndex !== -1) {
|
||||||
nodeIdSplitAtPort = nodeIdSplitAtPort.substring(0, portIndex) +
|
nodeIdSplitAtPort = nodeIdSplitAtPort.substring(0, portIndex) +
|
||||||
':​' + nodeIdSplitAtPort.substring(portIndex + 1);
|
':​' + nodeIdSplitAtPort.substring(portIndex + 1);
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ export default Ember.Helper.helper(function(params,hash) {
|
||||||
var len = splitsAlongDots.length;
|
var len = splitsAlongDots.length;
|
||||||
for (var i = 0; i < len; i++) {
|
for (var i = 0; i < len; i++) {
|
||||||
normalizedNodeId = normalizedNodeId + splitsAlongDots[i];
|
normalizedNodeId = normalizedNodeId + splitsAlongDots[i];
|
||||||
if (i != len - 1) {
|
if (i !== len - 1) {
|
||||||
normalizedNodeId = normalizedNodeId + '.​';
|
normalizedNodeId = normalizedNodeId + '.​';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,17 +47,17 @@ export default Ember.Helper.helper(function(params,hash) {
|
||||||
'<div class="panel-heading"><h4>Node Manager<br>(' + normalizedNodeId + ')</h4></div>'+
|
'<div class="panel-heading"><h4>Node Manager<br>(' + normalizedNodeId + ')</h4></div>'+
|
||||||
'<div class="panel-body"><ul class="nav nav-pills nav-stacked" id="stacked-menu">' +
|
'<div class="panel-body"><ul class="nav nav-pills nav-stacked" id="stacked-menu">' +
|
||||||
'<ul class="nav nav-pills nav-stacked collapse in"><li';
|
'<ul class="nav nav-pills nav-stacked collapse in"><li';
|
||||||
if (hash.path == 'yarn-node') {
|
if (hash.path === 'yarn-node') {
|
||||||
html = html + ' class="active"';
|
html = html + ' class="active"';
|
||||||
}
|
}
|
||||||
html = html + '><a href="#/yarn-node/' + hash.nodeId + '/' + hash.nodeAddr +
|
html = html + '><a href="#/yarn-node/' + hash.nodeId + '/' + hash.nodeAddr +
|
||||||
'">Node Information</a></li><li';
|
'">Node Information</a></li><li';
|
||||||
if (hash.path == 'yarn-node-apps') {
|
if (hash.path === 'yarn-node-apps') {
|
||||||
html = html + ' class="active"';
|
html = html + ' class="active"';
|
||||||
}
|
}
|
||||||
html = html + '><a href="#/yarn-node-apps/' + hash.nodeId + '/' + hash.nodeAddr +
|
html = html + '><a href="#/yarn-node-apps/' + hash.nodeId + '/' + hash.nodeAddr +
|
||||||
'">List of Applications</a></li><li';
|
'">List of Applications</a></li><li';
|
||||||
if (hash.path == 'yarn-node-containers') {
|
if (hash.path === 'yarn-node-containers') {
|
||||||
html = html + ' class="active"';
|
html = html + ' class="active"';
|
||||||
}
|
}
|
||||||
html = html + '><a href="#/yarn-node-containers/' +hash.nodeId + '/' + hash.nodeAddr +
|
html = html + '><a href="#/yarn-node-containers/' +hash.nodeId + '/' + hash.nodeAddr +
|
||||||
|
|
|
@ -23,7 +23,7 @@ export function nodeName(params/*, hash*/) {
|
||||||
console.log('nodes-uid', params[0]);
|
console.log('nodes-uid', params[0]);
|
||||||
var nodeIdSplitAtPort = params[0];
|
var nodeIdSplitAtPort = params[0];
|
||||||
var portIndex = nodeIdSplitAtPort.indexOf(':');
|
var portIndex = nodeIdSplitAtPort.indexOf(':');
|
||||||
if (portIndex != -1) {
|
if (portIndex !== -1) {
|
||||||
nodeIdSplitAtPort = nodeIdSplitAtPort.substring(0, portIndex) +
|
nodeIdSplitAtPort = nodeIdSplitAtPort.substring(0, portIndex) +
|
||||||
':​' + nodeIdSplitAtPort.substring(portIndex + 1);
|
':​' + nodeIdSplitAtPort.substring(portIndex + 1);
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ export function nodeName(params/*, hash*/) {
|
||||||
var len = splitsAlongDots.length;
|
var len = splitsAlongDots.length;
|
||||||
for (var i = 0; i < len; i++) {
|
for (var i = 0; i < len; i++) {
|
||||||
normalizedNodeId = normalizedNodeId + splitsAlongDots[i];
|
normalizedNodeId = normalizedNodeId + splitsAlongDots[i];
|
||||||
if (i != len - 1) {
|
if (i !== len - 1) {
|
||||||
normalizedNodeId = normalizedNodeId + '.​';
|
normalizedNodeId = normalizedNodeId + '.​';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,11 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* globals ENV: true */
|
||||||
|
|
||||||
function getTimeLineURL(parameters) {
|
import Ember from 'ember';
|
||||||
|
|
||||||
|
function getTimeLineURL() {
|
||||||
return '/conf?name=yarn.timeline-service.webapp.address';
|
return '/conf?name=yarn.timeline-service.webapp.address';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +40,6 @@ function updateConfigs(application) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!ENV.hosts.timelineWebAddress) {
|
if(!ENV.hosts.timelineWebAddress) {
|
||||||
var result = [];
|
|
||||||
var timelinehost = "";
|
var timelinehost = "";
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
|
@ -54,7 +56,7 @@ function updateConfigs(application) {
|
||||||
|
|
||||||
Ember.Logger.log("Timeline Address from RM:" + address + ":" + port);
|
Ember.Logger.log("Timeline Address from RM:" + address + ":" + port);
|
||||||
|
|
||||||
if(address == "0.0.0.0" || address == "localhost") {
|
if(address === "0.0.0.0" || address === "localhost") {
|
||||||
var updatedAddress = hostname + ":" + port;
|
var updatedAddress = hostname + ":" + port;
|
||||||
|
|
||||||
/* Timeline v2 is not supporting CORS, so make as default*/
|
/* Timeline v2 is not supporting CORS, so make as default*/
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
import DS from 'ember-data';
|
import DS from 'ember-data';
|
||||||
import Converter from 'yarn-ui/utils/converter';
|
import Converter from 'yarn-ui/utils/converter';
|
||||||
|
|
||||||
|
@ -45,8 +46,8 @@ export default DS.Model.extend({
|
||||||
attemptStartedTime: function() {
|
attemptStartedTime: function() {
|
||||||
var startTime = this.get("startTime");
|
var startTime = this.get("startTime");
|
||||||
// If startTime variable is not present, get from startedTime
|
// If startTime variable is not present, get from startedTime
|
||||||
if (startTime == undefined ||
|
if (startTime === undefined ||
|
||||||
startTime == "Invalid date") {
|
startTime === "Invalid date") {
|
||||||
startTime = this.get("startedTime");
|
startTime = this.get("startedTime");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +81,7 @@ export default DS.Model.extend({
|
||||||
appMasterContainerId: function() {
|
appMasterContainerId: function() {
|
||||||
var id = this.get("containerId");
|
var id = this.get("containerId");
|
||||||
// If containerId variable is not present, get from amContainerId
|
// If containerId variable is not present, get from amContainerId
|
||||||
if (id == undefined) {
|
if (id === undefined) {
|
||||||
id = this.get("amContainerId");
|
id = this.get("amContainerId");
|
||||||
}
|
}
|
||||||
return id;
|
return id;
|
||||||
|
@ -89,16 +90,16 @@ export default DS.Model.extend({
|
||||||
IsAmNodeUrl: function() {
|
IsAmNodeUrl: function() {
|
||||||
var url = this.get("nodeHttpAddress");
|
var url = this.get("nodeHttpAddress");
|
||||||
// If nodeHttpAddress variable is not present, hardcode it.
|
// If nodeHttpAddress variable is not present, hardcode it.
|
||||||
if (url == undefined) {
|
if (url === undefined) {
|
||||||
url = "Not Available";
|
url = "Not Available";
|
||||||
}
|
}
|
||||||
return url != "Not Available";
|
return url !== "Not Available";
|
||||||
}.property("nodeHttpAddress"),
|
}.property("nodeHttpAddress"),
|
||||||
|
|
||||||
amNodeId : function() {
|
amNodeId : function() {
|
||||||
var id = this.get("nodeId");
|
var id = this.get("nodeId");
|
||||||
// If nodeId variable is not present, get from host
|
// If nodeId variable is not present, get from host
|
||||||
if (id == undefined) {
|
if (id === undefined) {
|
||||||
id = this.get("hosts");
|
id = this.get("hosts");
|
||||||
}
|
}
|
||||||
return id;
|
return id;
|
||||||
|
@ -107,10 +108,10 @@ export default DS.Model.extend({
|
||||||
IsLinkAvailable: function() {
|
IsLinkAvailable: function() {
|
||||||
var url = this.get("logsLink");
|
var url = this.get("logsLink");
|
||||||
// If logsLink variable is not present, hardcode its.
|
// If logsLink variable is not present, hardcode its.
|
||||||
if (url == undefined) {
|
if (url === undefined) {
|
||||||
url = "Not Available";
|
url = "Not Available";
|
||||||
}
|
}
|
||||||
return url != "Not Available";
|
return url !== "Not Available";
|
||||||
}.property("logsLink"),
|
}.property("logsLink"),
|
||||||
|
|
||||||
elapsedTime: function() {
|
elapsedTime: function() {
|
||||||
|
|
|
@ -54,7 +54,7 @@ export default DS.Model.extend({
|
||||||
applicationExpiryTime: DS.attr('string'),
|
applicationExpiryTime: DS.attr('string'),
|
||||||
|
|
||||||
isFailed: function() {
|
isFailed: function() {
|
||||||
return this.get('finalStatus') == "FAILED"
|
return this.get('finalStatus') == "FAILED";
|
||||||
}.property("finalStatus"),
|
}.property("finalStatus"),
|
||||||
|
|
||||||
validatedFinishedTs: function() {
|
validatedFinishedTs: function() {
|
||||||
|
@ -91,11 +91,11 @@ export default DS.Model.extend({
|
||||||
var finalStatus = this.get("finalStatus");
|
var finalStatus = this.get("finalStatus");
|
||||||
var style = "";
|
var style = "";
|
||||||
|
|
||||||
if (finalStatus == "KILLED") {
|
if (finalStatus === "KILLED") {
|
||||||
style = "warning";
|
style = "warning";
|
||||||
} else if (finalStatus == "FAILED") {
|
} else if (finalStatus === "FAILED") {
|
||||||
style = "danger";
|
style = "danger";
|
||||||
} else if (finalStatus == "SUCCEEDED") {
|
} else if (finalStatus === "SUCCEEDED") {
|
||||||
style = "success";
|
style = "success";
|
||||||
} else {
|
} else {
|
||||||
style = "default";
|
style = "default";
|
||||||
|
|
|
@ -27,16 +27,16 @@ export default DS.Model.extend({
|
||||||
* Indicates no rows were retrieved from backend
|
* Indicates no rows were retrieved from backend
|
||||||
*/
|
*/
|
||||||
isDummyApp: function() {
|
isDummyApp: function() {
|
||||||
return this.get('id') == "dummy";
|
return this.get('id') === "dummy";
|
||||||
}.property("id"),
|
}.property("id"),
|
||||||
|
|
||||||
appStateStyle: function() {
|
appStateStyle: function() {
|
||||||
var style = "default";
|
var style = "default";
|
||||||
var appState = this.get("state");
|
var appState = this.get("state");
|
||||||
if (appState == "RUNNING" || appState == "FINISHING_CONTAINERS_WAIT" ||
|
if (appState === "RUNNING" || appState === "FINISHING_CONTAINERS_WAIT" ||
|
||||||
appState == "APPLICATION_RESOURCES_CLEANINGUP") {
|
appState === "APPLICATION_RESOURCES_CLEANINGUP") {
|
||||||
style = "primary";
|
style = "primary";
|
||||||
} else if (appState == "FINISHED") {
|
} else if (appState === "FINISHED") {
|
||||||
style = "success";
|
style = "success";
|
||||||
}
|
}
|
||||||
return "label label-" + style;
|
return "label label-" + style;
|
||||||
|
|
|
@ -32,24 +32,24 @@ export default DS.Model.extend({
|
||||||
* Indicates that there was no container retrieved from backend.
|
* Indicates that there was no container retrieved from backend.
|
||||||
*/
|
*/
|
||||||
isDummyContainer: function() {
|
isDummyContainer: function() {
|
||||||
return this.get('id') == "dummy";
|
return this.get('id') === "dummy";
|
||||||
}.property("id"),
|
}.property("id"),
|
||||||
|
|
||||||
containerStateStyle: function() {
|
containerStateStyle: function() {
|
||||||
var style = "primary";
|
var style = "primary";
|
||||||
var containerState = this.get('state');
|
var containerState = this.get('state');
|
||||||
var containerExitCode = this.get('exitCode');
|
var containerExitCode = this.get('exitCode');
|
||||||
if (containerState == "DONE") {
|
if (containerState === "DONE") {
|
||||||
if (containerExitCode == "0") {
|
if (parseInt(containerExitCode) === 0) {
|
||||||
style = "success";
|
style = "success";
|
||||||
} else if (containerExitCode != "N/A") {
|
} else if (containerExitCode !== "N/A") {
|
||||||
style = "danger";
|
style = "danger";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (containerState == "EXITED_WITH_SUCCESS") {
|
if (containerState === "EXITED_WITH_SUCCESS") {
|
||||||
style = "success";
|
style = "success";
|
||||||
}
|
}
|
||||||
if (containerState == "EXITED_WITH_FAILURE") {
|
if (containerState === "EXITED_WITH_FAILURE") {
|
||||||
style = "danger";
|
style = "danger";
|
||||||
}
|
}
|
||||||
return "label label-" + style;
|
return "label label-" + style;
|
||||||
|
|
|
@ -48,17 +48,17 @@ export default DS.Model.extend({
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
label: "Absolute Capacity",
|
label: "Absolute Capacity",
|
||||||
value: this.get("name") == "root" ? 100 : this.get("absCapacity")
|
value: this.get("name") === "root" ? 100 : 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" ? this.get("usedCapacity") : 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 : this.get("absMaxCapacity")
|
||||||
}
|
}
|
||||||
]
|
];
|
||||||
}.property("absCapacity", "absUsedCapacity", "absMaxCapacity"),
|
}.property("absCapacity", "absUsedCapacity", "absMaxCapacity"),
|
||||||
|
|
||||||
userUsagesDonutChartData: function() {
|
userUsagesDonutChartData: function() {
|
||||||
|
@ -68,7 +68,7 @@ export default DS.Model.extend({
|
||||||
data.push({
|
data.push({
|
||||||
label: o.get("name"),
|
label: o.get("name"),
|
||||||
value: o.get("usedMemoryMB")
|
value: o.get("usedMemoryMB")
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,6 +89,6 @@ export default DS.Model.extend({
|
||||||
label: "Active Apps",
|
label: "Active Apps",
|
||||||
value: this.get("numActiveApplications") || 0
|
value: this.get("numActiveApplications") || 0
|
||||||
}
|
}
|
||||||
]
|
];
|
||||||
}.property(),
|
}.property()
|
||||||
});
|
});
|
||||||
|
|
|
@ -47,18 +47,18 @@ export default DS.Model.extend({
|
||||||
* Indicates no rows were retrieved from backend
|
* Indicates no rows were retrieved from backend
|
||||||
*/
|
*/
|
||||||
isDummyNode: function() {
|
isDummyNode: function() {
|
||||||
return this.get('id') == "dummy";
|
return this.get('id') === "dummy";
|
||||||
}.property("id"),
|
}.property("id"),
|
||||||
|
|
||||||
nodeStateStyle: function() {
|
nodeStateStyle: function() {
|
||||||
var style = "default";
|
var style = "default";
|
||||||
var nodeState = this.get("state");
|
var nodeState = this.get("state");
|
||||||
if (nodeState == "REBOOTED") {
|
if (nodeState === "REBOOTED") {
|
||||||
style = "warning";
|
style = "warning";
|
||||||
} else if (nodeState == "UNHEALTHY" || nodeState == "DECOMMISSIONED" ||
|
} else if (nodeState === "UNHEALTHY" || nodeState === "DECOMMISSIONED" ||
|
||||||
nodeState == "LOST" || nodeState == "SHUTDOWN") {
|
nodeState === "LOST" || nodeState === "SHUTDOWN") {
|
||||||
style = "danger";
|
style = "danger";
|
||||||
} else if (nodeState == "RUNNING") {
|
} else if (nodeState === "RUNNING") {
|
||||||
style = "success";
|
style = "success";
|
||||||
}
|
}
|
||||||
return "label label-" + style;
|
return "label label-" + style;
|
||||||
|
|
|
@ -23,4 +23,4 @@ export default DS.Model.extend({
|
||||||
queueName: DS.attr('string'),
|
queueName: DS.attr('string'),
|
||||||
usedMemoryMB: DS.attr('number'),
|
usedMemoryMB: DS.attr('number'),
|
||||||
usedVCore: DS.attr('number')
|
usedVCore: DS.attr('number')
|
||||||
})
|
});
|
|
@ -29,8 +29,7 @@ export default Ember.Route.extend({
|
||||||
error: function (error) {
|
error: function (error) {
|
||||||
Ember.Logger.log(error.stack);
|
Ember.Logger.log(error.stack);
|
||||||
|
|
||||||
if (error && error.errors[0] &&
|
if (error && error.errors[0] && parseInt(error.errors[0].status) === 404) {
|
||||||
error.errors[0].status == 404) {
|
|
||||||
this.intermediateTransitionTo('/notfound');
|
this.intermediateTransitionTo('/notfound');
|
||||||
} else {
|
} else {
|
||||||
this.intermediateTransitionTo('/error');
|
this.intermediateTransitionTo('/error');
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import Ember from 'ember';
|
|
||||||
|
|
||||||
import AbstractRoute from './abstract';
|
import AbstractRoute from './abstract';
|
||||||
|
|
||||||
export default AbstractRoute.extend({
|
export default AbstractRoute.extend({
|
||||||
|
|
|
@ -25,7 +25,7 @@ export default AbstractRoute.extend({
|
||||||
return Ember.RSVP.hash({
|
return Ember.RSVP.hash({
|
||||||
app: this.store.find('yarn-app', param.app_id),
|
app: this.store.find('yarn-app', param.app_id),
|
||||||
|
|
||||||
rmContainers: this.store.find('yarn-app', param.app_id).then(function(app) {
|
rmContainers: this.store.find('yarn-app', param.app_id).then(function() {
|
||||||
return this.store.query('yarn-app-attempt', {appId: param.app_id}).then(function (attempts) {
|
return this.store.query('yarn-app-attempt', {appId: param.app_id}).then(function (attempts) {
|
||||||
if (attempts && attempts.get('firstObject')) {
|
if (attempts && attempts.get('firstObject')) {
|
||||||
var appAttemptId = attempts.get('firstObject').get('appAttemptId');
|
var appAttemptId = attempts.get('firstObject').get('appAttemptId');
|
||||||
|
|
|
@ -49,7 +49,7 @@ export default AbstractRoute.extend({
|
||||||
afterModel(model) {
|
afterModel(model) {
|
||||||
// Handle errors and redirect if promise is rejected.
|
// Handle errors and redirect if promise is rejected.
|
||||||
if (model.errors && model.errors[0]) {
|
if (model.errors && model.errors[0]) {
|
||||||
if (model.errors[0].status == 404) {
|
if (parseInt(model.errors[0].status) === 404) {
|
||||||
this.replaceWith('/notfound');
|
this.replaceWith('/notfound');
|
||||||
} else {
|
} else {
|
||||||
this.replaceWith('/error');
|
this.replaceWith('/error');
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
export default Ember.Route.extend({
|
export default Ember.Route.extend({
|
||||||
beforeModel() {
|
beforeModel() {
|
||||||
this.transitionTo('yarn-queues.root');
|
this.transitionTo('yarn-queues.root');
|
||||||
|
|
|
@ -20,13 +20,12 @@ import DS from 'ember-data';
|
||||||
import Converter from 'yarn-ui/utils/converter';
|
import Converter from 'yarn-ui/utils/converter';
|
||||||
|
|
||||||
export default DS.JSONAPISerializer.extend({
|
export default DS.JSONAPISerializer.extend({
|
||||||
internalNormalizeSingleResponse(store, primaryModelClass, payload, id,
|
internalNormalizeSingleResponse(store, primaryModelClass, payload) {
|
||||||
requestType) {
|
|
||||||
|
|
||||||
if (payload.appAttempt) {
|
if (payload.appAttempt) {
|
||||||
payload = payload.appAttempt;
|
payload = payload.appAttempt;
|
||||||
}
|
}
|
||||||
|
|
||||||
var fixedPayload = {
|
var fixedPayload = {
|
||||||
id: payload.appAttemptId,
|
id: payload.appAttemptId,
|
||||||
type: primaryModelClass.modelName, // yarn-app
|
type: primaryModelClass.modelName, // yarn-app
|
||||||
|
@ -48,15 +47,13 @@ export default DS.JSONAPISerializer.extend({
|
||||||
return fixedPayload;
|
return fixedPayload;
|
||||||
},
|
},
|
||||||
|
|
||||||
normalizeSingleResponse(store, primaryModelClass, payload, id,
|
normalizeSingleResponse(store, primaryModelClass, payload/*, id, requestType*/) {
|
||||||
requestType) {
|
var p = this.internalNormalizeSingleResponse(store,
|
||||||
var p = this.internalNormalizeSingleResponse(store,
|
primaryModelClass, payload);
|
||||||
primaryModelClass, payload, id, requestType);
|
|
||||||
return { data: p };
|
return { data: p };
|
||||||
},
|
},
|
||||||
|
|
||||||
normalizeArrayResponse(store, primaryModelClass, payload, id,
|
normalizeArrayResponse(store, primaryModelClass, payload/*, id, requestType*/) {
|
||||||
requestType) {
|
|
||||||
// return expected is { data: [ {}, {} ] }
|
// return expected is { data: [ {}, {} ] }
|
||||||
var normalizedArrayResponse = {};
|
var normalizedArrayResponse = {};
|
||||||
|
|
||||||
|
@ -65,11 +62,11 @@ export default DS.JSONAPISerializer.extend({
|
||||||
// need some error handling for ex apps or app may not be defined.
|
// need some error handling for ex apps or app may not be defined.
|
||||||
normalizedArrayResponse.data = payload.appAttempts.appAttempt.map(singleApp => {
|
normalizedArrayResponse.data = payload.appAttempts.appAttempt.map(singleApp => {
|
||||||
return this.internalNormalizeSingleResponse(store, primaryModelClass,
|
return this.internalNormalizeSingleResponse(store, primaryModelClass,
|
||||||
singleApp, singleApp.id, requestType);
|
singleApp);
|
||||||
}, this);
|
}, this);
|
||||||
} else {
|
} else {
|
||||||
normalizedArrayResponse.data = [];
|
normalizedArrayResponse.data = [];
|
||||||
}
|
}
|
||||||
return normalizedArrayResponse;
|
return normalizedArrayResponse;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -20,8 +20,7 @@ import DS from 'ember-data';
|
||||||
import Converter from 'yarn-ui/utils/converter';
|
import Converter from 'yarn-ui/utils/converter';
|
||||||
|
|
||||||
export default DS.JSONAPISerializer.extend({
|
export default DS.JSONAPISerializer.extend({
|
||||||
internalNormalizeSingleResponse(store, primaryModelClass, payload, id,
|
internalNormalizeSingleResponse(store, primaryModelClass, payload, id) {
|
||||||
requestType) {
|
|
||||||
if (payload.app) {
|
if (payload.app) {
|
||||||
payload = payload.app;
|
payload = payload.app;
|
||||||
}
|
}
|
||||||
|
@ -76,15 +75,13 @@ export default DS.JSONAPISerializer.extend({
|
||||||
return fixedPayload;
|
return fixedPayload;
|
||||||
},
|
},
|
||||||
|
|
||||||
normalizeSingleResponse(store, primaryModelClass, payload, id,
|
normalizeSingleResponse(store, primaryModelClass, payload, id/*, requestType*/) {
|
||||||
requestType) {
|
|
||||||
var p = this.internalNormalizeSingleResponse(store,
|
var p = this.internalNormalizeSingleResponse(store,
|
||||||
primaryModelClass, payload, id, requestType);
|
primaryModelClass, payload, id);
|
||||||
return { data: p };
|
return { data: p };
|
||||||
},
|
},
|
||||||
|
|
||||||
normalizeArrayResponse(store, primaryModelClass, payload, id,
|
normalizeArrayResponse(store, primaryModelClass, payload/*, id, requestType*/) {
|
||||||
requestType) {
|
|
||||||
// return expected is { data: [ {}, {} ] }
|
// return expected is { data: [ {}, {} ] }
|
||||||
var normalizedArrayResponse = {};
|
var normalizedArrayResponse = {};
|
||||||
|
|
||||||
|
@ -93,7 +90,7 @@ export default DS.JSONAPISerializer.extend({
|
||||||
if(payload.apps && payload.apps.app) {
|
if(payload.apps && payload.apps.app) {
|
||||||
normalizedArrayResponse.data = payload.apps.app.map(singleApp => {
|
normalizedArrayResponse.data = payload.apps.app.map(singleApp => {
|
||||||
return this.internalNormalizeSingleResponse(store, primaryModelClass,
|
return this.internalNormalizeSingleResponse(store, primaryModelClass,
|
||||||
singleApp, singleApp.id, requestType);
|
singleApp, singleApp.id);
|
||||||
}, this);
|
}, this);
|
||||||
} else {
|
} else {
|
||||||
normalizedArrayResponse.data = [];
|
normalizedArrayResponse.data = [];
|
||||||
|
|
|
@ -20,8 +20,7 @@ import DS from 'ember-data';
|
||||||
import Converter from 'yarn-ui/utils/converter';
|
import Converter from 'yarn-ui/utils/converter';
|
||||||
|
|
||||||
export default DS.JSONAPISerializer.extend({
|
export default DS.JSONAPISerializer.extend({
|
||||||
normalizeSingleResponse(store, primaryModelClass, payload, id,
|
normalizeSingleResponse(store, primaryModelClass, payload, id/*, requestType*/) {
|
||||||
requestType) {
|
|
||||||
// Convert plain text response into JSON.
|
// Convert plain text response into JSON.
|
||||||
// ID is of the form nodeAddress!containerId!fileName
|
// ID is of the form nodeAddress!containerId!fileName
|
||||||
var splits = Converter.splitForContainerLogs(id);
|
var splits = Converter.splitForContainerLogs(id);
|
||||||
|
|
|
@ -20,9 +20,8 @@ import DS from 'ember-data';
|
||||||
import Converter from 'yarn-ui/utils/converter';
|
import Converter from 'yarn-ui/utils/converter';
|
||||||
|
|
||||||
export default DS.JSONAPISerializer.extend({
|
export default DS.JSONAPISerializer.extend({
|
||||||
internalNormalizeSingleResponse(store, primaryModelClass, payload, id,
|
internalNormalizeSingleResponse(store, primaryModelClass, payload) {
|
||||||
requestType) {
|
|
||||||
|
|
||||||
var fixedPayload = {
|
var fixedPayload = {
|
||||||
id: payload.containerId,
|
id: payload.containerId,
|
||||||
type: primaryModelClass.modelName, // yarn-app
|
type: primaryModelClass.modelName, // yarn-app
|
||||||
|
@ -44,15 +43,13 @@ export default DS.JSONAPISerializer.extend({
|
||||||
return fixedPayload;
|
return fixedPayload;
|
||||||
},
|
},
|
||||||
|
|
||||||
normalizeSingleResponse(store, primaryModelClass, payload, id,
|
normalizeSingleResponse(store, primaryModelClass, payload/*, id, requestType*/) {
|
||||||
requestType) {
|
var p = this.internalNormalizeSingleResponse(store,
|
||||||
var p = this.internalNormalizeSingleResponse(store,
|
primaryModelClass, payload);
|
||||||
primaryModelClass, payload, id, requestType);
|
|
||||||
return { data: p };
|
return { data: p };
|
||||||
},
|
},
|
||||||
|
|
||||||
normalizeArrayResponse(store, primaryModelClass, payload, id,
|
normalizeArrayResponse(store, primaryModelClass, payload/*, id, requestType*/) {
|
||||||
requestType) {
|
|
||||||
// return expected is { data: [ {}, {} ] }
|
// return expected is { data: [ {}, {} ] }
|
||||||
var normalizedArrayResponse = {};
|
var normalizedArrayResponse = {};
|
||||||
|
|
||||||
|
@ -62,12 +59,11 @@ export default DS.JSONAPISerializer.extend({
|
||||||
// need some error handling for ex apps or app may not be defined.
|
// need some error handling for ex apps or app may not be defined.
|
||||||
normalizedArrayResponse.data = payload.container.map(singleContainer => {
|
normalizedArrayResponse.data = payload.container.map(singleContainer => {
|
||||||
return this.internalNormalizeSingleResponse(store, primaryModelClass,
|
return this.internalNormalizeSingleResponse(store, primaryModelClass,
|
||||||
singleContainer, singleContainer.id, requestType);
|
singleContainer);
|
||||||
}, this);
|
}, this);
|
||||||
} else {
|
} else {
|
||||||
normalizedArrayResponse.data = [this.internalNormalizeSingleResponse(
|
normalizedArrayResponse.data = [this.internalNormalizeSingleResponse(
|
||||||
store, primaryModelClass, payload.container, payload.container.id,
|
store, primaryModelClass, payload.container)];
|
||||||
requestType)];
|
|
||||||
}
|
}
|
||||||
return normalizedArrayResponse;
|
return normalizedArrayResponse;
|
||||||
} else {
|
} else {
|
||||||
|
@ -76,4 +72,4 @@ export default DS.JSONAPISerializer.extend({
|
||||||
|
|
||||||
return normalizedArrayResponse;
|
return normalizedArrayResponse;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -15,26 +15,8 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
/**
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import DS from 'ember-data';
|
import DS from 'ember-data';
|
||||||
import Ember from 'ember';
|
|
||||||
|
|
||||||
export default DS.JSONAPISerializer.extend({
|
export default DS.JSONAPISerializer.extend({
|
||||||
internalNormalizeSingleResponse(store, primaryModelClass, payload) {
|
internalNormalizeSingleResponse(store, primaryModelClass, payload) {
|
||||||
|
@ -55,16 +37,14 @@ export default DS.JSONAPISerializer.extend({
|
||||||
return fixedPayload;
|
return fixedPayload;
|
||||||
},
|
},
|
||||||
|
|
||||||
normalizeSingleResponse(store, primaryModelClass, payload, id,
|
normalizeSingleResponse(store, primaryModelClass, payload/*, id, requestType*/) {
|
||||||
requestType) {
|
|
||||||
// payload is of the form {"app":{}}
|
// payload is of the form {"app":{}}
|
||||||
var p = this.internalNormalizeSingleResponse(store,
|
var p = this.internalNormalizeSingleResponse(store,
|
||||||
primaryModelClass, payload);
|
primaryModelClass, payload);
|
||||||
return { data: p };
|
return { data: p };
|
||||||
},
|
},
|
||||||
|
|
||||||
normalizeArrayResponse(store, primaryModelClass, payload, id,
|
normalizeArrayResponse(store, primaryModelClass, payload/*, id, requestType*/) {
|
||||||
requestType) {
|
|
||||||
// expected return response is of the form { data: [ {}, {} ] }
|
// expected return response is of the form { data: [ {}, {} ] }
|
||||||
var normalizedArrayResponse = {};
|
var normalizedArrayResponse = {};
|
||||||
// payload is of the form { "apps" : { "app": [ {},{},{} ] } }
|
// payload is of the form { "apps" : { "app": [ {},{},{} ] } }
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import DS from 'ember-data';
|
import DS from 'ember-data';
|
||||||
import Ember from 'ember';
|
|
||||||
|
|
||||||
export default DS.JSONAPISerializer.extend({
|
export default DS.JSONAPISerializer.extend({
|
||||||
internalNormalizeSingleResponse(store, primaryModelClass, payload) {
|
internalNormalizeSingleResponse(store, primaryModelClass, payload) {
|
||||||
|
@ -42,16 +41,14 @@ export default DS.JSONAPISerializer.extend({
|
||||||
return fixedPayload;
|
return fixedPayload;
|
||||||
},
|
},
|
||||||
|
|
||||||
normalizeSingleResponse(store, primaryModelClass, payload, id,
|
normalizeSingleResponse(store, primaryModelClass, payload/*, id, requestType*/) {
|
||||||
requestType) {
|
|
||||||
// payload is of the form {"container":{}}
|
// payload is of the form {"container":{}}
|
||||||
var p = this.internalNormalizeSingleResponse(store,
|
var p = this.internalNormalizeSingleResponse(store,
|
||||||
primaryModelClass, payload);
|
primaryModelClass, payload);
|
||||||
return { data: p };
|
return { data: p };
|
||||||
},
|
},
|
||||||
|
|
||||||
normalizeArrayResponse(store, primaryModelClass, payload, id,
|
normalizeArrayResponse(store, primaryModelClass, payload/*, id, requestType*/) {
|
||||||
requestType) {
|
|
||||||
// expected return response is of the form { data: [ {}, {} ] }
|
// expected return response is of the form { data: [ {}, {} ] }
|
||||||
var normalizedArrayResponse = {};
|
var normalizedArrayResponse = {};
|
||||||
if (payload.containers && payload.containers.container) {
|
if (payload.containers && payload.containers.container) {
|
||||||
|
|
|
@ -20,8 +20,7 @@ import DS from 'ember-data';
|
||||||
import Converter from 'yarn-ui/utils/converter';
|
import Converter from 'yarn-ui/utils/converter';
|
||||||
|
|
||||||
export default DS.JSONAPISerializer.extend({
|
export default DS.JSONAPISerializer.extend({
|
||||||
internalNormalizeSingleResponse(store, primaryModelClass, payload, id,
|
internalNormalizeSingleResponse(store, primaryModelClass, payload, id) {
|
||||||
requestType) {
|
|
||||||
if (payload.nodeInfo) {
|
if (payload.nodeInfo) {
|
||||||
payload = payload.nodeInfo;
|
payload = payload.nodeInfo;
|
||||||
}
|
}
|
||||||
|
@ -46,11 +45,10 @@ export default DS.JSONAPISerializer.extend({
|
||||||
return fixedPayload;
|
return fixedPayload;
|
||||||
},
|
},
|
||||||
|
|
||||||
normalizeSingleResponse(store, primaryModelClass, payload, id,
|
normalizeSingleResponse(store, primaryModelClass, payload, id/*, requestType*/) {
|
||||||
requestType) {
|
|
||||||
// payload is of the form {"nodeInfo":{}}
|
// payload is of the form {"nodeInfo":{}}
|
||||||
var p = this.internalNormalizeSingleResponse(store,
|
var p = this.internalNormalizeSingleResponse(store,
|
||||||
primaryModelClass, payload, id, requestType);
|
primaryModelClass, payload, id);
|
||||||
return { data: p };
|
return { data: p };
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -49,7 +49,7 @@ export default DS.JSONAPISerializer.extend({
|
||||||
relationshipUserData.push({
|
relationshipUserData.push({
|
||||||
type: "YarnUser",
|
type: "YarnUser",
|
||||||
id: u.username + "_" + payload.queueName,
|
id: u.username + "_" + payload.queueName,
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,12 +85,12 @@ export default DS.JSONAPISerializer.extend({
|
||||||
return {
|
return {
|
||||||
queue: this._super(store, primaryModelClass, fixedPayload, id, requestType),
|
queue: this._super(store, primaryModelClass, fixedPayload, id, requestType),
|
||||||
includedData: includedData
|
includedData: includedData
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
handleQueue(store, primaryModelClass, payload, id, requestType) {
|
handleQueue(store, primaryModelClass, payload, id, requestType) {
|
||||||
var data = [];
|
var data = [];
|
||||||
var includedData = []
|
var includedData = [];
|
||||||
var result = this.normalizeSingleResponse(store, primaryModelClass,
|
var result = this.normalizeSingleResponse(store, primaryModelClass,
|
||||||
payload, id, requestType);
|
payload, id, requestType);
|
||||||
|
|
||||||
|
@ -112,8 +112,8 @@ export default DS.JSONAPISerializer.extend({
|
||||||
|
|
||||||
return {
|
return {
|
||||||
data: data,
|
data: data,
|
||||||
includedData, includedData
|
includedData: includedData
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
normalizeArrayResponse(store, primaryModelClass, payload, id,
|
normalizeArrayResponse(store, primaryModelClass, payload, id,
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import Ember from 'ember';
|
|
||||||
import DS from 'ember-data';
|
import DS from 'ember-data';
|
||||||
import Converter from 'yarn-ui/utils/converter';
|
import Converter from 'yarn-ui/utils/converter';
|
||||||
|
|
||||||
|
@ -48,16 +47,14 @@ export default DS.JSONAPISerializer.extend({
|
||||||
return fixedPayload;
|
return fixedPayload;
|
||||||
},
|
},
|
||||||
|
|
||||||
normalizeSingleResponse(store, primaryModelClass, payload, id,
|
normalizeSingleResponse(store, primaryModelClass, payload, id/*, requestType*/) {
|
||||||
requestType) {
|
|
||||||
// payload is of the form {"nodeInfo":{}}
|
// payload is of the form {"nodeInfo":{}}
|
||||||
var p = this.internalNormalizeSingleResponse(store,
|
var p = this.internalNormalizeSingleResponse(store,
|
||||||
primaryModelClass, payload, id);
|
primaryModelClass, payload, id);
|
||||||
return { data: p };
|
return { data: p };
|
||||||
},
|
},
|
||||||
|
|
||||||
normalizeArrayResponse(store, primaryModelClass, payload, id,
|
normalizeArrayResponse(store, primaryModelClass, payload/*, id, requestType*/) {
|
||||||
requestType) {
|
|
||||||
// expected response is of the form { data: [ {}, {} ] }
|
// expected response is of the form { data: [ {}, {} ] }
|
||||||
var normalizedArrayResponse = {};
|
var normalizedArrayResponse = {};
|
||||||
if (payload.nodes) {
|
if (payload.nodes) {
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import Constants from 'yarn-ui/constants';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
preDefinedColors : ["#1f77b4", "#aec7e8", "#ffbb78",
|
preDefinedColors : ["#1f77b4", "#aec7e8", "#ffbb78",
|
||||||
"#98df8a", "#ff9896", "#9467bd", "#c5b0d5", "#8c564b",
|
"#98df8a", "#ff9896", "#9467bd", "#c5b0d5", "#8c564b",
|
||||||
|
@ -43,14 +41,14 @@ export default {
|
||||||
startIdx = Math.max(nColors - colorsTarget.length, 0);
|
startIdx = Math.max(nColors - colorsTarget.length, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i = 0; i < colorsTarget.length; i++) {
|
for (i = 0; i < colorsTarget.length; i++) {
|
||||||
if (i + startIdx < nColors) {
|
if (i + startIdx < nColors) {
|
||||||
colors[i + startIdx] = this.getColorByTarget(colorsTarget[i]);
|
colors[i + startIdx] = this.getColorByTarget(colorsTarget[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var idx = 0;
|
var idx = 0;
|
||||||
for (var i = 0; i < nColors; i++) {
|
for (i = 0; i < nColors; i++) {
|
||||||
if (!colors[i]) {
|
if (!colors[i]) {
|
||||||
colors[i] = this.preDefinedColors[i % this.preDefinedColors.length];
|
colors[i] = this.preDefinedColors[i % this.preDefinedColors.length];
|
||||||
idx ++;
|
idx ++;
|
||||||
|
|
|
@ -110,7 +110,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
memoryToSimpliedUnit: function(mb) {
|
memoryToSimpliedUnit: function(mb) {
|
||||||
var unit = "MB"
|
var unit = "MB";
|
||||||
var value = mb;
|
var value = mb;
|
||||||
if (value / 1024 >= 0.9) {
|
if (value / 1024 >= 0.9) {
|
||||||
value = value / 1024;
|
value = value / 1024;
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import Constants from 'yarn-ui/constants';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
getApplicationLink: function(applicationId) {
|
getApplicationLink: function(applicationId) {
|
||||||
return "#/yarn-app/" + applicationId;
|
return "#/yarn-app/" + applicationId;
|
||||||
|
|
|
@ -32,5 +32,5 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
ref.set("model", data);
|
ref.set("model", data);
|
||||||
},
|
}
|
||||||
}
|
};
|
|
@ -51,19 +51,19 @@ export default {
|
||||||
*/
|
*/
|
||||||
function naturalSort(a, b) {
|
function naturalSort(a, b) {
|
||||||
var diff = a.length - b.length;
|
var diff = a.length - b.length;
|
||||||
if (diff != 0) {
|
if (diff !== 0) {
|
||||||
var splitA = a.split("_");
|
var splitA = a.split("_");
|
||||||
var splitB = b.split("_");
|
var splitB = b.split("_");
|
||||||
if (splitA.length != splitB.length) {
|
if (splitA.length !== splitB.length) {
|
||||||
return a.localeCompare(b);
|
return a.localeCompare(b);
|
||||||
}
|
}
|
||||||
for (var i = 1; i < splitA.length; i++) {
|
for (var i = 1; i < splitA.length; i++) {
|
||||||
var splitdiff = splitA[i].length - splitB[i].length;
|
var splitdiff = splitA[i].length - splitB[i].length;
|
||||||
if (splitdiff != 0) {
|
if (splitdiff !== 0) {
|
||||||
return splitdiff;
|
return splitdiff;
|
||||||
}
|
}
|
||||||
var splitCompare = splitA[i].localeCompare(splitB[i]);
|
var splitCompare = splitA[i].localeCompare(splitB[i]);
|
||||||
if (splitCompare != 0) {
|
if (splitCompare !== 0) {
|
||||||
return splitCompare;
|
return splitCompare;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ var EmberApp = require('ember-cli/lib/broccoli/ember-app');
|
||||||
|
|
||||||
module.exports = function(defaults) {
|
module.exports = function(defaults) {
|
||||||
var app = new EmberApp(defaults, {
|
var app = new EmberApp(defaults, {
|
||||||
hinting: false
|
hinting: true
|
||||||
});
|
});
|
||||||
|
|
||||||
app.import("bower_components/datatables/media/css/jquery.dataTables.min.css");
|
app.import("bower_components/datatables/media/css/jquery.dataTables.min.css");
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { moduleForModel, test } from 'ember-qunit';
|
import { moduleForModel, test } from 'ember-qunit';
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
moduleForModel('yarn-container-log', 'Unit | Model | ContainerLog', {
|
moduleForModel('yarn-container-log', 'Unit | Model | ContainerLog', {
|
||||||
// Specify the other units that are required for this test.
|
// Specify the other units that are required for this test.
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { moduleForModel, test } from 'ember-qunit';
|
import { moduleForModel, test } from 'ember-qunit';
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
moduleForModel('yarn-node-app', 'Unit | Model | NodeApp', {
|
moduleForModel('yarn-node-app', 'Unit | Model | NodeApp', {
|
||||||
// Specify the other units that are required for this test.
|
// Specify the other units that are required for this test.
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { moduleForModel, test } from 'ember-qunit';
|
import { moduleForModel, test } from 'ember-qunit';
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
moduleForModel('yarn-node-container', 'Unit | Model | NodeContainer', {
|
moduleForModel('yarn-node-container', 'Unit | Model | NodeContainer', {
|
||||||
// Specify the other units that are required for this test.
|
// Specify the other units that are required for this test.
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { moduleForModel, test } from 'ember-qunit';
|
import { moduleForModel, test } from 'ember-qunit';
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
moduleForModel('yarn-node', 'Unit | Model | Node', {
|
moduleForModel('yarn-node', 'Unit | Model | Node', {
|
||||||
// Specify the other units that are required for this test.
|
// Specify the other units that are required for this test.
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { moduleForModel, test } from 'ember-qunit';
|
import { moduleForModel, test } from 'ember-qunit';
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
moduleForModel('yarn-rm-node', 'Unit | Model | RMNode', {
|
moduleForModel('yarn-rm-node', 'Unit | Model | RMNode', {
|
||||||
// Specify the other units that are required for this test.
|
// Specify the other units that are required for this test.
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { moduleFor, test } from 'ember-qunit';
|
import { moduleFor, test } from 'ember-qunit';
|
||||||
import Constants from 'yarn-ui/constants';
|
import Ember from 'ember';
|
||||||
|
|
||||||
moduleFor('route:yarn-container-log', 'Unit | Route | ContainerLog', {
|
moduleFor('route:yarn-container-log', 'Unit | Route | ContainerLog', {
|
||||||
});
|
});
|
||||||
|
@ -34,11 +34,11 @@ test('Test getting container log', function(assert) {
|
||||||
containerID: "container_e32_1456000363780_0002_01_000001",
|
containerID: "container_e32_1456000363780_0002_01_000001",
|
||||||
logFileName: "syslog"};
|
logFileName: "syslog"};
|
||||||
var store = {
|
var store = {
|
||||||
findRecord: function(type) {
|
findRecord: function() {
|
||||||
return new Ember.RSVP.Promise(function(resolve) {
|
return new Ember.RSVP.Promise(function(resolve) {
|
||||||
resolve(response);
|
resolve(response);
|
||||||
}
|
});
|
||||||
)}
|
}
|
||||||
};
|
};
|
||||||
assert.expect(6);
|
assert.expect(6);
|
||||||
var route = this.subject();
|
var route = this.subject();
|
||||||
|
@ -67,11 +67,11 @@ test('Test non HTTP error while getting container log', function(assert) {
|
||||||
containerID: "container_e32_1456000363780_0002_01_000001",
|
containerID: "container_e32_1456000363780_0002_01_000001",
|
||||||
logFileName: "syslog"};
|
logFileName: "syslog"};
|
||||||
var store = {
|
var store = {
|
||||||
findRecord: function(type) {
|
findRecord: function() {
|
||||||
return new Ember.RSVP.Promise(function(resolve, reject) {
|
return new Ember.RSVP.Promise(function(resolve, reject) {
|
||||||
reject(error);
|
reject(error);
|
||||||
}
|
});
|
||||||
)}
|
}
|
||||||
};
|
};
|
||||||
assert.expect(6);
|
assert.expect(6);
|
||||||
var route = this.subject();
|
var route = this.subject();
|
||||||
|
@ -92,16 +92,12 @@ test('Test non HTTP error while getting container log', function(assert) {
|
||||||
|
|
||||||
test('Test HTTP error while getting container log', function(assert) {
|
test('Test HTTP error while getting container log', function(assert) {
|
||||||
var error = {errors: [{status: 404, responseText: 'Not Found'}]};
|
var error = {errors: [{status: 404, responseText: 'Not Found'}]};
|
||||||
var response = {
|
|
||||||
logs: "",
|
|
||||||
containerID: "container_e32_1456000363780_0002_01_000001",
|
|
||||||
logFileName: "syslog"};
|
|
||||||
var store = {
|
var store = {
|
||||||
findRecord: function(type) {
|
findRecord: function() {
|
||||||
return new Ember.RSVP.Promise(function(resolve, reject) {
|
return new Ember.RSVP.Promise(function(resolve, reject) {
|
||||||
reject(error);
|
reject(error);
|
||||||
}
|
});
|
||||||
)}
|
}
|
||||||
};
|
};
|
||||||
assert.expect(5);
|
assert.expect(5);
|
||||||
var route = this.subject();
|
var route = this.subject();
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { moduleFor, test } from 'ember-qunit';
|
import { moduleFor, test } from 'ember-qunit';
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
moduleFor('route:yarn-node-app', 'Unit | Route | NodeApp', {
|
moduleFor('route:yarn-node-app', 'Unit | Route | NodeApp', {
|
||||||
});
|
});
|
||||||
|
@ -31,7 +32,7 @@ test('Test getting specific app on a node', function(assert) {
|
||||||
var response =
|
var response =
|
||||||
{id:"application_1456251210105_0001", state:"FINISHED", user:"root"};
|
{id:"application_1456251210105_0001", state:"FINISHED", user:"root"};
|
||||||
var store = {
|
var store = {
|
||||||
queryRecord: function(type, query) {
|
queryRecord: function() {
|
||||||
return new Ember.RSVP.Promise(function(resolve) {
|
return new Ember.RSVP.Promise(function(resolve) {
|
||||||
resolve(response);
|
resolve(response);
|
||||||
});
|
});
|
||||||
|
@ -40,17 +41,16 @@ test('Test getting specific app on a node', function(assert) {
|
||||||
assert.expect(6);
|
assert.expect(6);
|
||||||
var route = this.subject();
|
var route = this.subject();
|
||||||
route.set('store', store);
|
route.set('store', store);
|
||||||
var model =
|
route.model({node_id:"localhost:64318", node_addr:"localhost:8042",
|
||||||
route.model({node_id:"localhost:64318", node_addr:"localhost:8042",
|
app_id:"application_1456251210105_0001"})
|
||||||
app_id:"application_1456251210105_0001"}).
|
.then(
|
||||||
then(
|
function(value){
|
||||||
function(value){
|
assert.ok(value);
|
||||||
assert.ok(value);
|
assert.ok(value.nodeApp);
|
||||||
assert.ok(value.nodeApp);
|
assert.deepEqual(value.nodeApp, response);
|
||||||
assert.deepEqual(value.nodeApp, response);
|
assert.ok(value.nodeInfo);
|
||||||
assert.ok(value.nodeInfo);
|
assert.equal(value.nodeInfo.addr, 'localhost:8042');
|
||||||
assert.equal(value.nodeInfo.addr, 'localhost:8042');
|
assert.equal(value.nodeInfo.id, 'localhost:64318');
|
||||||
assert.equal(value.nodeInfo.id, 'localhost:64318');
|
}
|
||||||
}
|
);
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { moduleFor, test } from 'ember-qunit';
|
import { moduleFor, test } from 'ember-qunit';
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
moduleFor('route:yarn-node-apps', 'Unit | Route | NodeApps', {
|
moduleFor('route:yarn-node-apps', 'Unit | Route | NodeApps', {
|
||||||
});
|
});
|
||||||
|
@ -34,7 +35,7 @@ test('Test getting apps on a node', function(assert) {
|
||||||
containerids:["container_e38_1456251210105_0002_01_000001",
|
containerids:["container_e38_1456251210105_0002_01_000001",
|
||||||
"container_e38_1456251210105_0002_01_000002"]}];
|
"container_e38_1456251210105_0002_01_000002"]}];
|
||||||
var store = {
|
var store = {
|
||||||
query: function(type, query) {
|
query: function() {
|
||||||
return new Ember.RSVP.Promise(function(resolve) {
|
return new Ember.RSVP.Promise(function(resolve) {
|
||||||
resolve(response.slice());
|
resolve(response.slice());
|
||||||
});
|
});
|
||||||
|
@ -43,18 +44,17 @@ test('Test getting apps on a node', function(assert) {
|
||||||
assert.expect(8);
|
assert.expect(8);
|
||||||
var route = this.subject();
|
var route = this.subject();
|
||||||
route.set('store', store);
|
route.set('store', store);
|
||||||
var model =
|
route.model({node_id:"localhost:64318", node_addr:"localhost:8042"})
|
||||||
route.model({node_id:"localhost:64318", node_addr:"localhost:8042"}).
|
.then(
|
||||||
then(
|
function(value){
|
||||||
function(value){
|
assert.ok(value);
|
||||||
assert.ok(value);
|
assert.ok(value.apps);
|
||||||
assert.ok(value.apps);
|
assert.equal(value.apps.length, 2);
|
||||||
assert.equal(value.apps.length, 2);
|
assert.deepEqual(response[0], value.apps[0]);
|
||||||
assert.deepEqual(response[0], value.apps[0]);
|
assert.deepEqual(response[1], value.apps[1]);
|
||||||
assert.deepEqual(response[1], value.apps[1]);
|
assert.ok(value.nodeInfo);
|
||||||
assert.ok(value.nodeInfo);
|
assert.equal(value.nodeInfo.addr, 'localhost:8042');
|
||||||
assert.equal(value.nodeInfo.addr, 'localhost:8042');
|
assert.equal(value.nodeInfo.id, 'localhost:64318');
|
||||||
assert.equal(value.nodeInfo.id, 'localhost:64318');
|
}
|
||||||
}
|
);
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { moduleFor, test } from 'ember-qunit';
|
import { moduleFor, test } from 'ember-qunit';
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
moduleFor('route:yarn-node-container', 'Unit | Route | NodeContainer', {
|
moduleFor('route:yarn-node-container', 'Unit | Route | NodeContainer', {
|
||||||
});
|
});
|
||||||
|
@ -36,7 +37,7 @@ test('Test getting specific container on a node', function(assert) {
|
||||||
nodeId: "localhost:64318", containerLogFiles:["syslog","stderr",
|
nodeId: "localhost:64318", containerLogFiles:["syslog","stderr",
|
||||||
"stdout"]};
|
"stdout"]};
|
||||||
var store = {
|
var store = {
|
||||||
queryRecord: function(type, query) {
|
queryRecord: function() {
|
||||||
return new Ember.RSVP.Promise(function(resolve) {
|
return new Ember.RSVP.Promise(function(resolve) {
|
||||||
resolve(response);
|
resolve(response);
|
||||||
});
|
});
|
||||||
|
@ -45,17 +46,16 @@ test('Test getting specific container on a node', function(assert) {
|
||||||
assert.expect(6);
|
assert.expect(6);
|
||||||
var route = this.subject();
|
var route = this.subject();
|
||||||
route.set('store', store);
|
route.set('store', store);
|
||||||
var model =
|
route.model({node_id:"localhost:64318", node_addr:"localhost:8042",
|
||||||
route.model({node_id:"localhost:64318", node_addr:"localhost:8042",
|
container_id:"container_e32_1456000363780_0002_01_000001"})
|
||||||
container_id:"container_e32_1456000363780_0002_01_000001"}).
|
.then(
|
||||||
then(
|
function(value){
|
||||||
function(value){
|
assert.ok(value);
|
||||||
assert.ok(value);
|
assert.ok(value.nodeContainer);
|
||||||
assert.ok(value.nodeContainer);
|
assert.deepEqual(value.nodeContainer, response);
|
||||||
assert.deepEqual(value.nodeContainer, response);
|
assert.ok(value.nodeInfo);
|
||||||
assert.ok(value.nodeInfo);
|
assert.equal(value.nodeInfo.addr, 'localhost:8042');
|
||||||
assert.equal(value.nodeInfo.addr, 'localhost:8042');
|
assert.equal(value.nodeInfo.id, 'localhost:64318');
|
||||||
assert.equal(value.nodeInfo.id, 'localhost:64318');
|
}
|
||||||
}
|
);
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { moduleFor, test } from 'ember-qunit';
|
import { moduleFor, test } from 'ember-qunit';
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
moduleFor('route:yarn-node-containers', 'Unit | Route | NodeContainers', {
|
moduleFor('route:yarn-node-containers', 'Unit | Route | NodeContainers', {
|
||||||
});
|
});
|
||||||
|
@ -42,7 +43,7 @@ test('Test getting apps on a node', function(assert) {
|
||||||
nodeId:"localhost:64318",containerLogFiles:["syslog","stderr",
|
nodeId:"localhost:64318",containerLogFiles:["syslog","stderr",
|
||||||
"syslog.shuffle","stdout"]}];
|
"syslog.shuffle","stdout"]}];
|
||||||
var store = {
|
var store = {
|
||||||
query: function(type, query) {
|
query: function() {
|
||||||
return new Ember.RSVP.Promise(function(resolve) {
|
return new Ember.RSVP.Promise(function(resolve) {
|
||||||
resolve(response.slice());
|
resolve(response.slice());
|
||||||
});
|
});
|
||||||
|
@ -51,18 +52,17 @@ test('Test getting apps on a node', function(assert) {
|
||||||
assert.expect(8);
|
assert.expect(8);
|
||||||
var route = this.subject();
|
var route = this.subject();
|
||||||
route.set('store', store);
|
route.set('store', store);
|
||||||
var model =
|
route.model({node_id:"localhost:64318", node_addr:"localhost:8042"})
|
||||||
route.model({node_id:"localhost:64318", node_addr:"localhost:8042"}).
|
.then(
|
||||||
then(
|
function(value){
|
||||||
function(value){
|
assert.ok(value);
|
||||||
assert.ok(value);
|
assert.ok(value.containers);
|
||||||
assert.ok(value.containers);
|
assert.equal(value.containers.length, 2);
|
||||||
assert.equal(value.containers.length, 2);
|
assert.deepEqual(value.containers[0], response[0]);
|
||||||
assert.deepEqual(value.containers[0], response[0]);
|
assert.deepEqual(value.containers[1], response[1]);
|
||||||
assert.deepEqual(value.containers[1], response[1]);
|
assert.ok(value.nodeInfo);
|
||||||
assert.ok(value.nodeInfo);
|
assert.equal(value.nodeInfo.addr, 'localhost:8042');
|
||||||
assert.equal(value.nodeInfo.addr, 'localhost:8042');
|
assert.equal(value.nodeInfo.id, 'localhost:64318');
|
||||||
assert.equal(value.nodeInfo.id, 'localhost:64318');
|
}
|
||||||
}
|
);
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -61,11 +61,11 @@ test('Test getting a node', function(assert) {
|
||||||
// Create store which returns appropriate responses.
|
// Create store which returns appropriate responses.
|
||||||
var store = {
|
var store = {
|
||||||
findRecord: function(type) {
|
findRecord: function(type) {
|
||||||
if (type == 'yarnNode') {
|
if (type === 'yarnNode') {
|
||||||
return new Ember.RSVP.Promise(function(resolve) {
|
return new Ember.RSVP.Promise(function(resolve) {
|
||||||
resolve(nodeResponse);
|
resolve(nodeResponse);
|
||||||
});
|
});
|
||||||
} else if (type == 'yarnRmNode') {
|
} else if (type === 'yarnRmNode') {
|
||||||
return new Ember.RSVP.Promise(function(resolve) {
|
return new Ember.RSVP.Promise(function(resolve) {
|
||||||
resolve(rmNodeResponse);
|
resolve(rmNodeResponse);
|
||||||
});
|
});
|
||||||
|
|
|
@ -57,7 +57,7 @@ test('Test getting nodes', function(assert) {
|
||||||
containersCPUUsage: 0
|
containersCPUUsage: 0
|
||||||
}}];
|
}}];
|
||||||
var store = {
|
var store = {
|
||||||
findAll: function(type) {
|
findAll: function() {
|
||||||
return new Ember.RSVP.Promise(function(resolve) {
|
return new Ember.RSVP.Promise(function(resolve) {
|
||||||
resolve(response);
|
resolve(response);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue