You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by su...@apache.org on 2016/10/12 15:08:00 UTC
[46/50] [abbrv] hadoop git commit: YARN-4849. [YARN-3368] cleanup
code base, integrate web UI related build to mvn, and fix licenses. (wangda)
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/tree-selector.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/tree-selector.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/tree-selector.js
new file mode 100644
index 0000000..f7ec020
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/tree-selector.js
@@ -0,0 +1,275 @@
+/**
+ * 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 Ember from 'ember';
+
+export default Ember.Component.extend({
+ // Map: <queue-name, queue>
+ map : undefined,
+
+ // Normalized data for d3
+ treeData: undefined,
+
+ // folded queues, folded[<queue-name>] == true means <queue-name> is folded
+ foldedQueues: { },
+
+ // maxDepth
+ maxDepth: 0,
+
+ // num of leaf queue, folded queue is treated as leaf queue
+ numOfLeafQueue: 0,
+
+ // mainSvg
+ mainSvg: undefined,
+
+ // Init data
+ initData: function() {
+ this.map = { };
+ this.treeData = { };
+ this.maxDepth = 0;
+ this.numOfLeafQueue = 0;
+
+ this.get("model")
+ .forEach(function(o) {
+ this.map[o.id] = o;
+ }.bind(this));
+
+ var selected = this.get("selected");
+
+ this.initQueue("root", 1, this.treeData);
+ },
+
+ // get Children array of given queue
+ getChildrenNamesArray: function(q) {
+ var namesArr = [];
+
+ // Folded queue's children is empty
+ if (this.foldedQueues[q.get("name")]) {
+ return namesArr;
+ }
+
+ var names = q.get("children");
+ if (names) {
+ names.forEach(function(name) {
+ namesArr.push(name);
+ });
+ }
+
+ return namesArr;
+ },
+
+ // Init queues
+ initQueue: function(queueName, depth, node) {
+ if ((!queueName) || (!this.map[queueName])) {
+ // Queue is not existed
+ return;
+ }
+
+ if (depth > this.maxDepth) {
+ this.maxDepth = this.maxDepth + 1;
+ }
+
+ var queue = this.map[queueName];
+
+ var names = this.getChildrenNamesArray(queue);
+
+ node.name = queueName;
+ node.parent = queue.get("parent");
+ node.queueData = queue;
+
+ if (names.length > 0) {
+ node.children = [];
+
+ names.forEach(function(name) {
+ var childQueueData = {};
+ node.children.push(childQueueData);
+ this.initQueue(name, depth + 1, childQueueData);
+ }.bind(this));
+ } else {
+ this.numOfLeafQueue = this.numOfLeafQueue + 1;
+ }
+ },
+
+ update: function(source, root, tree, diagonal) {
+ var duration = 300;
+ var i = 0;
+
+ // Compute the new tree layout.
+ var nodes = tree.nodes(root).reverse();
+ var links = tree.links(nodes);
+
+ // Normalize for fixed-depth.
+ nodes.forEach(function(d) { d.y = d.depth * 200; });
+
+ // Update the nodes\u2026
+ var node = this.mainSvg.selectAll("g.node")
+ .data(nodes, function(d) { return d.id || (d.id = ++i); });
+
+ // Enter any new nodes at the parent's previous position.
+ var nodeEnter = node.enter().append("g")
+ .attr("class", "node")
+ .attr("transform", function(d) { return "translate(" + source.y0 + "," + source.x0 + ")"; })
+ .on("click", function(d,i){
+ if (d.queueData.get("name") != this.get("selected")) {
+ document.location.href = "yarnQueue/" + d.queueData.get("name");
+ }
+ }.bind(this));
+ // .on("click", click);
+
+ nodeEnter.append("circle")
+ .attr("r", 1e-6)
+ .style("fill", function(d) {
+ var usedCap = d.queueData.get("usedCapacity");
+ if (usedCap <= 60.0) {
+ return "LimeGreen";
+ } else if (usedCap <= 100.0) {
+ return "DarkOrange";
+ } else {
+ return "LightCoral";
+ }
+ });
+
+ // append percentage
+ nodeEnter.append("text")
+ .attr("x", function(d) { return 0; })
+ .attr("dy", ".35em")
+ .attr("text-anchor", function(d) { return "middle"; })
+ .text(function(d) {
+ var usedCap = d.queueData.get("usedCapacity");
+ if (usedCap >= 100.0) {
+ return usedCap.toFixed(0) + "%";
+ } else {
+ return usedCap.toFixed(1) + "%";
+ }
+ })
+ .style("fill-opacity", 1e-6);
+
+ // append queue name
+ nodeEnter.append("text")
+ .attr("x", function(d) { return 40; })
+ .attr("dy", ".35em")
+ .attr("text-anchor", function(d) { return "start"; })
+ .text(function(d) { return d.name; })
+ .style("fill-opacity", 1e-6);
+
+ // Transition nodes to their new position.
+ var nodeUpdate = node.transition()
+ .duration(duration)
+ .attr("transform", function(d) { return "translate(" + d.y + "," + d.x + ")"; });
+
+ nodeUpdate.select("circle")
+ .attr("r", 20)
+ .attr("href",
+ function(d) {
+ return "yarnQueues/" + d.queueData.get("name");
+ })
+ .style("stroke", function(d) {
+ if (d.queueData.get("name") == this.get("selected")) {
+ return "red";
+ } else {
+ return "gray";
+ }
+ }.bind(this));
+
+ nodeUpdate.selectAll("text")
+ .style("fill-opacity", 1);
+
+ // Transition exiting nodes to the parent's new position.
+ var nodeExit = node.exit().transition()
+ .duration(duration)
+ .attr("transform", function(d) { return "translate(" + source.y + "," + source.x + ")"; })
+ .remove();
+
+ nodeExit.select("circle")
+ .attr("r", 1e-6);
+
+ nodeExit.select("text")
+ .style("fill-opacity", 1e-6);
+
+ // Update the links\u2026
+ var link = this.mainSvg.selectAll("path.link")
+ .data(links, function(d) { return d.target.id; });
+
+ // Enter any new links at the parent's previous position.
+ link.enter().insert("path", "g")
+ .attr("class", "link")
+ .attr("d", function(d) {
+ var o = {x: source.x0, y: source.y0};
+ return diagonal({source: o, target: o});
+ });
+
+ // Transition links to their new position.
+ link.transition()
+ .duration(duration)
+ .attr("d", diagonal);
+
+ // Transition exiting nodes to the parent's new position.
+ link.exit().transition()
+ .duration(duration)
+ .attr("d", function(d) {
+ var o = {x: source.x, y: source.y};
+ return diagonal({source: o, target: o});
+ })
+ .remove();
+
+ // Stash the old positions for transition.
+ nodes.forEach(function(d) {
+ d.x0 = d.x;
+ d.y0 = d.y;
+ });
+ },
+
+ reDraw: function() {
+ this.initData();
+
+ var margin = {top: 20, right: 120, bottom: 20, left: 120};
+ var treeWidth = this.maxDepth * 200;
+ var treeHeight = this.numOfLeafQueue * 80;
+ var width = treeWidth + margin.left + margin.right;
+ var height = treeHeight + margin.top + margin.bottom;
+ var layout = { };
+
+ if (this.mainSvg) {
+ this.mainSvg.remove();
+ }
+
+ this.mainSvg = d3.select("#" + this.get("parentId")).append("svg")
+ .attr("width", width)
+ .attr("height", height)
+ .attr("class", "tree-selector")
+ .append("g")
+ .attr("transform", "translate(" + margin.left + "," + margin.top + ")");
+
+ var tree = d3.layout.tree().size([treeHeight, treeWidth]);
+
+ var diagonal = d3.svg.diagonal()
+ .projection(function(d) { return [d.y, d.x]; });
+
+ var root = this.treeData;
+ root.x0 = height / 2;
+ root.y0 = 0;
+
+ d3.select(self.frameElement).style("height", height);
+
+ this.update(root, root, tree, diagonal);
+ },
+
+ didInsertElement: function() {
+ this.reDraw();
+ }
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/config.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/config.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/config.js
new file mode 100644
index 0000000..224c65a
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/config.js
@@ -0,0 +1,27 @@
+/**
+ * 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.
+ */
+
+/**
+ * Host and port configurations
+ */
+export default {
+ RM_HOST: 'localhost',
+ RM_PORT: '8088',
+ TS_HOST: 'localhost',
+ TS_PORT: '8188',
+};
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/constants.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/constants.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/constants.js
new file mode 100644
index 0000000..d2937a0
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/constants.js
@@ -0,0 +1,24 @@
+/**
+ * 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.
+ */
+
+/**
+ * Application level global constants go here.
+ */
+export default {
+ PARAM_SEPARATOR: '!',
+};
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/application.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/application.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/application.js
new file mode 100644
index 0000000..3c68365
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/application.js
@@ -0,0 +1,55 @@
+/**
+ * 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 Ember from 'ember';
+
+/**
+ * Base controller for application.
+ */
+export default Ember.Controller.extend({
+ /**
+ * Output main top UI menu which is common across all pages.
+ * Menu item will be made active based on current path.
+ */
+ outputMainMenu: function(){
+ var path = this.get('currentPath');
+ var html = '<li';
+ if (path == 'yarnQueue') {
+ html = html + ' class="active"';
+ }
+ html = html + '><a href="yarnQueue/root">Queues<span class="sr-only">' +
+ '(current)</span></a></li><li';
+ if (path.lastIndexOf('yarnApp', 0) == 0) {
+ html = html + ' class="active"';
+ }
+ html = html + '><a href="yarnApps">Applications<span class="sr-only">' +
+ '(current)</span></a></li><li';
+ if (path == 'clusterOverview') {
+ html = html + ' class="active"';
+ }
+ html = html + '><a href="clusterOverview">Cluster Overview<span class=' +
+ '"sr-only">(current)</span></a></li><li';
+ if (path.lastIndexOf('yarnNode', 0) == 0) {
+ html = html + ' class="active"';
+ }
+ html = html + '><a href="yarnNodes">Nodes<span class="sr-only">' +
+ '(current)</span></a></li>';
+ return Ember.String.htmlSafe(html);
+ }.property('currentPath')
+});
+
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/cluster-overview.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/cluster-overview.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/cluster-overview.js
new file mode 100644
index 0000000..dc2f6e4
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/cluster-overview.js
@@ -0,0 +1,23 @@
+/**
+ * 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 Ember from 'ember';
+
+export default Ember.Controller.extend({
+ loading: true,
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-apps.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-apps.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-apps.js
new file mode 100644
index 0000000..dc99fd1
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-apps.js
@@ -0,0 +1,22 @@
+/**
+ * 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 Ember from 'ember';
+
+export default Ember.Controller.extend({
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-queue.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-queue.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-queue.js
new file mode 100644
index 0000000..38cf352
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-queue.js
@@ -0,0 +1,24 @@
+/**
+ * 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 Ember from 'ember';
+
+export default Ember.Controller.extend({
+ needReload: true,
+ selectedQueue: undefined,
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/divide.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/divide.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/divide.js
new file mode 100644
index 0000000..fcf64dd
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/divide.js
@@ -0,0 +1,31 @@
+/**
+ * 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 Ember from 'ember';
+
+/**
+ * Helper assumes values are numeric. num means numerator and
+ * den means denominator.
+ */
+export default Ember.Helper.helper(function(params,hash) {
+ var num = hash.num;
+ var den = hash.den;
+ if (den == 0) {
+ return 0;
+ }
+ return Math.floor(num/den);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/log-files-comma.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/log-files-comma.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/log-files-comma.js
new file mode 100644
index 0000000..8c29b34
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/log-files-comma.js
@@ -0,0 +1,48 @@
+/**
+ * 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 Ember from 'ember';
+
+/**
+ * Represent log files as comma separated list.
+ */
+export default Ember.Helper.helper(function(params,hash) {
+ var logFiles = hash.logFiles;
+ if (logFiles == null) {
+ return "";
+ }
+ var logFilesLen = logFiles.length;
+ if (logFilesLen == 0) {
+ return "";
+ }
+ var nodeId = hash.nodeId;
+ var nodeAddr = hash.nodeAddr;
+ var containerId = hash.containerId;
+ var html = '<td>';
+ var logFilesCommaSeparated = "";
+ for (var i = 0; i < logFilesLen; i++) {
+ html = html + '<a href="yarnContainerLog/' + nodeId + '/' +
+ nodeAddr + '/' + containerId + '/' + logFiles[i] + '">' + logFiles[i] +
+ '</a>';
+ if (i != logFilesLen - 1) {
+ html = html + ",";
+ }
+ }
+ html = html + '</td>';
+ return Ember.String.htmlSafe(html);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-link.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-link.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-link.js
new file mode 100644
index 0000000..99d975b
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-link.js
@@ -0,0 +1,37 @@
+/**
+ * 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 Ember from 'ember';
+
+/**
+ * Generate link to node page if its not SHUTDOWN or LOST.
+ */
+export default Ember.Helper.helper(function(params,hash) {
+ var nodeState = hash.nodeState;
+ var nodeHTTPAddress = hash.nodeHTTPAddress;
+ var nodeId = hash.nodeId;
+ var html = '<td>';
+ if (nodeState == "SHUTDOWN" || nodeState == "LOST") {
+ html = html + nodeHTTPAddress;
+ } else {
+ html = html + '<a href="yarnNode/' + nodeId + "/" + nodeHTTPAddress + '">' +
+ nodeHTTPAddress + '</a>';
+ }
+ html = html + '</td>';
+ return Ember.String.htmlSafe(html);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-menu.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-menu.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-menu.js
new file mode 100644
index 0000000..589111f
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-menu.js
@@ -0,0 +1,66 @@
+/**
+ * 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 Ember from 'ember';
+
+/**
+ * Create left hand side node manager menu with menu item activated based
+ * on page being accessed.
+ */
+export default Ember.Helper.helper(function(params,hash) {
+ // Place a menu within a panel inside col-md-2 container.
+ var nodeIdSplitAtPort = hash.nodeId;
+ var portIndex = nodeIdSplitAtPort.indexOf(':');
+ if (portIndex != -1) {
+ nodeIdSplitAtPort = nodeIdSplitAtPort.substring(0, portIndex) +
+ ':​' + nodeIdSplitAtPort.substring(portIndex + 1);
+ }
+ var normalizedNodeId = '';
+ var splitsAlongDots = nodeIdSplitAtPort.split('.');
+ if (splitsAlongDots) {
+ var len = splitsAlongDots.length;
+ for (var i = 0; i < len; i++) {
+ normalizedNodeId = normalizedNodeId + splitsAlongDots[i];
+ if (i != len - 1) {
+ normalizedNodeId = normalizedNodeId + '.​';
+ }
+ }
+ } else {
+ normalizedNodeId = nodeIdSplitAtPort;
+ }
+
+ var html = '<div class="col-md-2 container-fluid"><div class="panel panel-default">'+
+ '<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">' +
+ '<ul class="nav nav-pills nav-stacked collapse in"><li';
+ if (hash.path == 'yarnNode') {
+ html = html + ' class="active"';
+ }
+ html = html + '><a href="yarnNode/' + hash.nodeId + '/' + hash.nodeAddr +
+ '">Node Information</a></li><li';
+ if (hash.path == 'yarnNodeApps') {
+ html = html + ' class="active"';
+ }
+ html = html + '><a href="yarnNodeApps/' + hash.nodeId + '/' + hash.nodeAddr +
+ '">List of Applications</a></li><li';
+ if (hash.path == 'yarnNodeContainers') {
+ html = html + ' class="active"';
+ }
+ html = html + '><a href="yarnNodeContainers/' +hash.nodeId + '/' + hash.nodeAddr +
+ '">List of Containers</a></li></ul></ul></div>';
+ return Ember.String.htmlSafe(html);
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/index.html
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/index.html b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/index.html
new file mode 100644
index 0000000..969ea2f
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/index.html
@@ -0,0 +1,43 @@
+<!--
+* 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.
+-->
+
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <title>YarnUi</title>
+ <meta name="description" content="">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+
+ {{content-for 'head'}}
+
+ <link rel="stylesheet" href="assets/vendor.css">
+ <link rel="stylesheet" href="assets/yarn-ui.css">
+
+ {{content-for 'head-footer'}}
+ </head>
+ <body>
+ {{content-for 'body'}}
+
+ <script src="assets/vendor.js"></script>
+ <script src="assets/yarn-ui.js"></script>
+
+ {{content-for 'body-footer'}}
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/cluster-info.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/cluster-info.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/cluster-info.js
new file mode 100644
index 0000000..332fdf3
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/cluster-info.js
@@ -0,0 +1,31 @@
+/**
+ * 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';
+
+export default DS.Model.extend({
+ startedOn: DS.attr('string'),
+ state: DS.attr('string'),
+ haState: DS.attr('string'),
+ rmStateStoreName: DS.attr('string'),
+ resourceManagerVersion: DS.attr('string'),
+ resourceManagerBuildVersion: DS.attr('string'),
+ hadoopVersion: DS.attr('string'),
+ hadoopBuildVersion: DS.attr('string'),
+ hadoopVersionBuiltOn: DS.attr('string')
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/cluster-metric.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/cluster-metric.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/cluster-metric.js
new file mode 100644
index 0000000..981375a
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/cluster-metric.js
@@ -0,0 +1,133 @@
+/**
+ * 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';
+
+export default DS.Model.extend({
+ appsSubmitted: DS.attr('number'),
+ appsCompleted: DS.attr('number'),
+ appsPending: DS.attr('number'),
+ appsRunning: DS.attr('number'),
+ appsFailed: DS.attr('number'),
+ appsKilled: DS.attr('number'),
+ reservedMB: DS.attr('number'),
+ availableMB: DS.attr('number'),
+ allocatedMB: DS.attr('number'),
+ reservedVirtualCores: DS.attr('number'),
+ availableVirtualCores: DS.attr('number'),
+ allocatedVirtualCores: DS.attr('number'),
+ containersAllocated: DS.attr('number'),
+ containersReserved: DS.attr('number'),
+ containersPending: DS.attr('number'),
+ totalMB: DS.attr('number'),
+ totalVirtualCores: DS.attr('number'),
+ totalNodes: DS.attr('number'),
+ lostNodes: DS.attr('number'),
+ unhealthyNodes: DS.attr('number'),
+ decommissionedNodes: DS.attr('number'),
+ rebootedNodes: DS.attr('number'),
+ activeNodes: DS.attr('number'),
+
+ getFinishedAppsDataForDonutChart: function() {
+ var arr = [];
+ arr.push({
+ label: "Completed",
+ value: this.get("appsCompleted")
+ });
+ arr.push({
+ label: "Killed",
+ value: this.get("appsKilled")
+ });
+ arr.push({
+ label: "Failed",
+ value: this.get("appsFailed")
+ });
+
+ return arr;
+ }.property("appsCompleted", "appsKilled", "appsFailed"),
+
+ getRunningAppsDataForDonutChart: function() {
+ var arr = [];
+
+ arr.push({
+ label: "Pending",
+ value: this.get("appsPending")
+ });
+ arr.push({
+ label: "Running",
+ value: this.get("appsRunning")
+ });
+
+ return arr;
+ }.property("appsPending", "appsRunning"),
+
+ getNodesDataForDonutChart: function() {
+ var arr = [];
+ arr.push({
+ label: "Active",
+ value: this.get("activeNodes")
+ });
+ arr.push({
+ label: "Unhealthy",
+ value: this.get("unhealthyNodes")
+ });
+ arr.push({
+ label: "Decomissioned",
+ value: this.get("decommissionedNodes")
+ });
+ return arr;
+ }.property("activeNodes", "unhealthyNodes", "decommissionedNodes"),
+
+ getMemoryDataForDonutChart: function() {
+ var type = "MB";
+ var arr = [];
+ arr.push({
+ label: "Allocated",
+ value: this.get("allocated" + type)
+ });
+ arr.push({
+ label: "Reserved",
+ value: this.get("reserved" + type)
+ });
+ arr.push({
+ label: "Available",
+ value: this.get("available" + type)
+ });
+
+ return arr;
+ }.property("allocatedMB", "reservedMB", "availableMB"),
+
+ getVCoreDataForDonutChart: function() {
+ var type = "VirtualCores";
+ var arr = [];
+ arr.push({
+ label: "Allocated",
+ value: this.get("allocated" + type)
+ });
+ arr.push({
+ label: "Reserved",
+ value: this.get("reserved" + type)
+ });
+ arr.push({
+ label: "Available",
+ value: this.get("available" + type)
+ });
+
+ return arr;
+ }.property("allocatedVirtualCores", "reservedVirtualCores", "availableVirtualCores"),
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app-attempt.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app-attempt.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app-attempt.js
new file mode 100644
index 0000000..b699bb3
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app-attempt.js
@@ -0,0 +1,62 @@
+/**
+ * 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 Converter from 'yarn-ui/utils/converter';
+
+export default DS.Model.extend({
+ startTime: DS.attr('string'),
+ finishedTime: DS.attr('string'),
+ containerId: DS.attr('string'),
+ nodeHttpAddress: DS.attr('string'),
+ nodeId: DS.attr('string'),
+ logsLink: DS.attr('string'),
+
+ startTs: function() {
+ return Converter.dateToTimeStamp(this.get("startTime"));
+ }.property("startTime"),
+
+ finishedTs: function() {
+ var ts = Converter.dateToTimeStamp(this.get("finishedTime"));
+ return ts;
+ }.property("finishedTime"),
+
+ shortAppAttemptId: function() {
+ return "attempt_" +
+ parseInt(Converter.containerIdToAttemptId(this.get("containerId")).split("_")[3]);
+ }.property("containerId"),
+
+ elapsedTime: function() {
+ var elapsedMs = this.get("finishedTs") - this.get("startTs");
+ if (elapsedMs <= 0) {
+ elapsedMs = Date.now() - this.get("startTs");
+ }
+
+ return Converter.msToElapsedTime(elapsedMs);
+ }.property(),
+
+ tooltipLabel: function() {
+ return "<p>Id:" + this.get("id") +
+ "</p><p>ElapsedTime:" +
+ String(this.get("elapsedTime")) + "</p>";
+ }.property(),
+
+ link: function() {
+ return "/yarnAppAttempt/" + this.get("id");
+ }.property(),
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app.js
new file mode 100644
index 0000000..1d506c2
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-app.js
@@ -0,0 +1,83 @@
+/**
+ * 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 Converter from 'yarn-ui/utils/converter';
+import DS from 'ember-data';
+
+export default DS.Model.extend({
+ appName: DS.attr('string'),
+ user: DS.attr('string'),
+ queue: DS.attr('string'),
+ state: DS.attr('string'),
+ startTime: DS.attr('string'),
+ elapsedTime: DS.attr('string'),
+ finalStatus: DS.attr('string'),
+ finishedTime: DS.attr('finishedTime'),
+ progress: DS.attr('number'),
+ diagnostics: DS.attr('string'),
+ amContainerLogs: DS.attr('string'),
+ amHostHttpAddress: DS.attr('string'),
+ logAggregationStatus: DS.attr('string'),
+ unmanagedApplication: DS.attr('string'),
+ amNodeLabelExpression: DS.attr('string'),
+ applicationTags: DS.attr('string'),
+ priority: DS.attr('number'),
+ allocatedMB: DS.attr('number'),
+ allocatedVCores: DS.attr('number'),
+ runningContainers: DS.attr('number'),
+ memorySeconds: DS.attr('number'),
+ vcoreSeconds: DS.attr('number'),
+ preemptedResourceMB: DS.attr('number'),
+ preemptedResourceVCores: DS.attr('number'),
+ numNonAMContainerPreempted: DS.attr('number'),
+ numAMContainerPreempted: DS.attr('number'),
+
+ isFailed: function() {
+ return this.get('finalStatus') == "FAILED"
+ }.property("finalStatus"),
+
+ allocatedResource: function() {
+ return Converter.resourceToString(this.get("allocatedMB"), this.get("allocatedVCores"));
+ }.property("allocatedMB", "allocatedVCores"),
+
+ preemptedResource: function() {
+ return Converter.resourceToString(this.get("preemptedResourceMB"), this.get("preemptedResourceVCores"));
+ }.property("preemptedResourceMB", "preemptedResourceVCores"),
+
+ aggregatedResourceUsage: function() {
+ return Converter.resourceToString(this.get("memorySeconds"), this.get("vcoreSeconds")) + " (� Secs)";
+ }.property("memorySeconds", "vcoreSeconds"),
+
+ progressStyle: function() {
+ return "width: " + this.get("progress") + "%";
+ }.property("progress"),
+
+ finalStatusStyle: function() {
+ var style = "default";
+ var finalStatus = this.get("finalStatus");
+ if (finalStatus == "KILLED") {
+ style = "warning";
+ } else if (finalStatus == "FAILED") {
+ style = "danger";
+ } else {
+ style = "success";
+ }
+
+ return "label label-" + style;
+ }.property("finalStatus")
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-container-log.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-container-log.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-container-log.js
new file mode 100644
index 0000000..31cf61e
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-container-log.js
@@ -0,0 +1,25 @@
+/**
+ * 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';
+
+export default DS.Model.extend({
+ logs: DS.attr('string'),
+ containerID: DS.attr('string'),
+ logFileName: DS.attr('string')
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-container.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-container.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-container.js
new file mode 100644
index 0000000..b745296
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-container.js
@@ -0,0 +1,57 @@
+/**
+ * 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 Converter from 'yarn-ui/utils/converter';
+
+export default DS.Model.extend({
+ allocatedMB: DS.attr('number'),
+ allocatedVCores: DS.attr('number'),
+ assignedNodeId: DS.attr('string'),
+ priority: DS.attr('number'),
+ startedTime: DS.attr('number'),
+ finishedTime: DS.attr('number'),
+ logUrl: DS.attr('string'),
+ containerExitStatus: DS.attr('number'),
+ containerState: DS.attr('string'),
+ nodeHttpAddress: DS.attr('string'),
+
+ startTs: function() {
+ return Converter.dateToTimeStamp(this.get("startedTime"));
+ }.property("startedTime"),
+
+ finishedTs: function() {
+ var ts = Converter.dateToTimeStamp(this.get("finishedTime"));
+ return ts;
+ }.property("finishedTime"),
+
+ elapsedTime: function() {
+ var elapsedMs = this.get("finishedTs") - this.get("startTs");
+ if (elapsedMs <= 0) {
+ elapsedMs = Date.now() - this.get("startTs");
+ }
+
+ return Converter.msToElapsedTime(elapsedMs);
+ }.property(),
+
+ tooltipLabel: function() {
+ return "<p>Id:" + this.get("id") +
+ "</p><p>ElapsedTime:" +
+ String(this.get("elapsedTime")) + "</p>";
+ }.property(),
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-node-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-node-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-node-app.js
new file mode 100644
index 0000000..6dc69ae
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-node-app.js
@@ -0,0 +1,44 @@
+/**
+ * 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';
+
+export default DS.Model.extend({
+ appId: DS.attr('string'),
+ state: DS.attr('string'),
+ user: DS.attr('string'),
+ containers: DS.attr('array'),
+ /**
+ * Indicates no rows were retrieved from backend
+ */
+ isDummyApp: function() {
+ return this.get('id') == "dummy";
+ }.property("id"),
+
+ appStateStyle: function() {
+ var style = "default";
+ var appState = this.get("state");
+ if (appState == "RUNNING" || appState == "FINISHING_CONTAINERS_WAIT" ||
+ appState == "APPLICATION_RESOURCES_CLEANINGUP") {
+ style = "primary";
+ } else if (appState == "FINISHED") {
+ style = "success";
+ }
+ return "label label-" + style;
+ }.property("state")
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-node-container.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-node-container.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-node-container.js
new file mode 100644
index 0000000..3ba3216
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-node-container.js
@@ -0,0 +1,57 @@
+/**
+ * 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';
+
+export default DS.Model.extend({
+ containerId: DS.attr('string'),
+ state: DS.attr('string'),
+ user: DS.attr('string'),
+ exitCode: DS.attr('string'),
+ diagnostics: DS.attr('string'),
+ totalMemoryNeeded: DS.attr('number'),
+ totalVCoresNeeded: DS.attr('number'),
+ containerLogFiles: DS.attr('array'),
+
+ /**
+ * Indicates that there was no container retrieved from backend.
+ */
+ isDummyContainer: function() {
+ return this.get('id') == "dummy";
+ }.property("id"),
+
+ containerStateStyle: function() {
+ var style = "primary";
+ var containerState = this.get('state');
+ var containerExitCode = this.get('exitCode');
+ if (containerState == "DONE") {
+ if (containerExitCode == "0") {
+ style = "success";
+ } else if (containerExitCode != "N/A") {
+ style = "danger";
+ }
+ }
+ if (containerState == "EXITED_WITH_SUCCESS") {
+ style = "success";
+ }
+ if (containerState == "EXITED_WITH_FAILURE") {
+ style = "danger";
+ }
+ return "label label-" + style;
+ }.property("state", "exitCode")
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-node.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-node.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-node.js
new file mode 100644
index 0000000..4753983
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-node.js
@@ -0,0 +1,33 @@
+/**
+ * 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';
+
+export default DS.Model.extend({
+ totalVmemAllocatedContainersMB: DS.attr('number'),
+ totalPmemAllocatedContainersMB: DS.attr('number'),
+ totalVCoresAllocatedContainers: DS.attr('number'),
+ vmemCheckEnabled: DS.attr('boolean'),
+ pmemCheckEnabled: DS.attr('boolean'),
+ nodeHealthy: DS.attr('boolean'),
+ lastNodeUpdateTime: DS.attr('string'),
+ healthReport: DS.attr('string'),
+ nmStartupTime: DS.attr('string'),
+ nodeManagerBuildVersion: DS.attr('string'),
+ hadoopBuildVersion: DS.attr('string'),
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-queue.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-queue.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-queue.js
new file mode 100644
index 0000000..7de4ccc
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-queue.js
@@ -0,0 +1,94 @@
+/**
+ * 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';
+
+export default DS.Model.extend({
+ name: DS.attr('string'),
+ children: DS.attr('array'),
+ parent: DS.attr('string'),
+ capacity: DS.attr('number'),
+ maxCapacity: DS.attr('number'),
+ usedCapacity: DS.attr('number'),
+ absCapacity: DS.attr('number'),
+ absMaxCapacity: DS.attr('number'),
+ absUsedCapacity: DS.attr('number'),
+ state: DS.attr('string'),
+ userLimit: DS.attr('number'),
+ userLimitFactor: DS.attr('number'),
+ preemptionDisabled: DS.attr('number'),
+ numPendingApplications: DS.attr('number'),
+ numActiveApplications: DS.attr('number'),
+ users: DS.hasMany('YarnUser'),
+
+ isLeafQueue: function() {
+ var len = this.get("children.length");
+ if (!len) {
+ return true;
+ }
+ return len <= 0;
+ }.property("children"),
+
+ capacitiesBarChartData: function() {
+ return [
+ {
+ label: "Absolute Capacity",
+ value: this.get("name") == "root" ? 100 : this.get("absCapacity")
+ },
+ {
+ label: "Absolute Used",
+ value: this.get("name") == "root" ? this.get("usedCapacity") : this.get("absUsedCapacity")
+ },
+ {
+ label: "Absolute Max Capacity",
+ value: this.get("name") == "root" ? 100 : this.get("absMaxCapacity")
+ }
+ ]
+ }.property("absCapacity", "absUsedCapacity", "absMaxCapacity"),
+
+ userUsagesDonutChartData: function() {
+ var data = [];
+ if (this.get("users")) {
+ this.get("users").forEach(function(o) {
+ data.push({
+ label: o.get("name"),
+ value: o.get("usedMemoryMB")
+ })
+ });
+ }
+
+ return data;
+ }.property("users"),
+
+ hasUserUsages: function() {
+ return this.get("userUsagesDonutChartData").length > 0;
+ }.property(),
+
+ numOfApplicationsDonutChartData: function() {
+ return [
+ {
+ label: "Pending Apps",
+ value: this.get("numPendingApplications") || 0 // TODO, fix the REST API so root will return #applications as well.
+ },
+ {
+ label: "Active Apps",
+ value: this.get("numActiveApplications") || 0
+ }
+ ]
+ }.property(),
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-rm-node.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-rm-node.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-rm-node.js
new file mode 100644
index 0000000..9a1082c
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-rm-node.js
@@ -0,0 +1,92 @@
+/**
+ * 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';
+
+export default DS.Model.extend({
+ rack: DS.attr('string'),
+ state: DS.attr('string'),
+ nodeHostName: DS.attr('string'),
+ nodeHTTPAddress: DS.attr('string'),
+ lastHealthUpdate: DS.attr('string'),
+ healthReport: DS.attr('string'),
+ numContainers: DS.attr('number'),
+ usedMemoryMB: DS.attr('number'),
+ availMemoryMB: DS.attr('number'),
+ usedVirtualCores: DS.attr('number'),
+ availableVirtualCores: DS.attr('number'),
+ version: DS.attr('string'),
+ nodeLabels: DS.attr('array'),
+
+ nodeLabelsAsString: function() {
+ var labels = this.get("nodeLabels");
+ var labelToReturn = "";
+ // Only one label per node supported.
+ if (labels && labels.length > 0) {
+ labelToReturn = labels[0];
+ }
+ return labelToReturn;
+ }.property("nodeLabels"),
+
+ /**
+ * Indicates no rows were retrieved from backend
+ */
+ isDummyNode: function() {
+ return this.get('id') == "dummy";
+ }.property("id"),
+
+ nodeStateStyle: function() {
+ var style = "default";
+ var nodeState = this.get("state");
+ if (nodeState == "REBOOTED") {
+ style = "warning";
+ } else if (nodeState == "UNHEALTHY" || nodeState == "DECOMMISSIONED" ||
+ nodeState == "LOST" || nodeState == "SHUTDOWN") {
+ style = "danger";
+ } else if (nodeState == "RUNNING") {
+ style = "success";
+ }
+ return "label label-" + style;
+ }.property("state"),
+
+ getMemoryDataForDonutChart: function() {
+ var arr = [];
+ arr.push({
+ label: "Used",
+ value: this.get("usedMemoryMB")
+ });
+ arr.push({
+ label: "Available",
+ value: this.get("availMemoryMB")
+ });
+ return arr;
+ }.property("availMemoryMB", "usedMemoryMB"),
+
+ getVCoreDataForDonutChart: function() {
+ var arr = [];
+ arr.push({
+ label: "Used",
+ value: this.get("usedVirtualCores")
+ });
+ arr.push({
+ label: "Available",
+ value: this.get("availableVirtualCores")
+ });
+ return arr;
+ }.property("availableVirtualCores", "usedVirtualCores"),
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-user.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-user.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-user.js
new file mode 100644
index 0000000..7cfd182
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-user.js
@@ -0,0 +1,26 @@
+/**
+ * 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';
+
+export default DS.Model.extend({
+ name: DS.attr('string'),
+ queueName: DS.attr('string'),
+ usedMemoryMB: DS.attr('number'),
+ usedVCore: DS.attr('number')
+})
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/router.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/router.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/router.js
new file mode 100644
index 0000000..67e9d2c
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/router.js
@@ -0,0 +1,47 @@
+/**
+ * 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 Ember from 'ember';
+import config from './config/environment';
+
+var Router = Ember.Router.extend({
+ location: config.locationType
+});
+
+Router.map(function() {
+ this.route('yarnApps');
+ this.route('yarnNodes');
+ this.route('yarnNode', { path: '/yarnNode/:node_id/:node_addr' });
+ this.route('yarnNodeApps', { path: '/yarnNodeApps/:node_id/:node_addr' });
+ this.route('yarnNodeApp',
+ { path: '/yarnNodeApp/:node_id/:node_addr/:app_id' });
+ this.route('yarnNodeContainers',
+ { path: '/yarnNodeContainers/:node_id/:node_addr' });
+ this.route('yarnNodeContainer',
+ { path: '/yarnNodeContainer/:node_id/:node_addr/:container_id' });
+ this.route('yarnContainerLog', { path:
+ '/yarnContainerLog/:node_id/:node_addr/:container_id/:filename' });
+ this.route('yarnQueue', { path: '/yarnQueue/:queue_name' });
+ this.route('clusterOverview');
+ this.route('yarnApp', { path: '/yarnApp/:app_id' });
+ this.route('yarnAppAttempt', { path: '/yarnAppAttempt/:app_attempt_id'});
+ this.route('error');
+ this.route('notfound', { path: '*:' });
+});
+
+export default Router;
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/application.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/application.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/application.js
new file mode 100644
index 0000000..b7a5754
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/application.js
@@ -0,0 +1,38 @@
+/**
+ * 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 Ember from 'ember';
+
+export default Ember.Route.extend({
+ actions: {
+ /**
+ * Base error handler for the application.
+ * If specific routes do not handle the error, it will bubble up to
+ * this handler. Here we redirect to either 404 page or a generic
+ * error handler page.
+ */
+ error: function (error) {
+ if (error && error.errors[0] &&
+ error.errors[0].status == 404) {
+ this.intermediateTransitionTo('/notfound');
+ } else {
+ this.intermediateTransitionTo('/error');
+ }
+ }
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/cluster-overview.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/cluster-overview.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/cluster-overview.js
new file mode 100644
index 0000000..4b4e554
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/cluster-overview.js
@@ -0,0 +1,29 @@
+/**
+ * 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 Ember from 'ember';
+
+export default Ember.Route.extend({
+ model() {
+ return this.store.findAll('ClusterMetric');
+ },
+
+ afterModel() {
+ this.controllerFor("ClusterOverview").set("loading", false);
+ }
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/index.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/index.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/index.js
new file mode 100644
index 0000000..b228ff4
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/index.js
@@ -0,0 +1,29 @@
+/**
+ * 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 Ember from 'ember';
+
+export default Ember.Route.extend({
+ /**
+ * Redirect root URL to cluster overview page.
+ */
+ beforeModel: function() {
+ this.replaceWith('clusterOverview');
+ }
+});
+
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app-attempt.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app-attempt.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app-attempt.js
new file mode 100644
index 0000000..72a001c
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app-attempt.js
@@ -0,0 +1,39 @@
+/**
+ * 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 Ember from 'ember';
+
+export default Ember.Route.extend({
+ model(param) {
+ return Ember.RSVP.hash({
+ attempt: this.store.findRecord('yarnAppAttempt', param.app_attempt_id),
+
+ rmContainers: this.store.query('yarnContainer',
+ {
+ app_attempt_id: param.app_attempt_id,
+ is_rm: true
+ }),
+
+ tsContainers: this.store.query('yarnContainer',
+ {
+ app_attempt_id: param.app_attempt_id,
+ is_rm: false
+ }),
+ });
+ }
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app.js
new file mode 100644
index 0000000..fcdfad8
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-app.js
@@ -0,0 +1,28 @@
+/**
+ * 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 Ember from 'ember';
+
+export default Ember.Route.extend({
+ model(param) {
+ return Ember.RSVP.hash({
+ app: this.store.find('yarnApp', param.app_id),
+ attempts: this.store.query('yarnAppAttempt', { appId: param.app_id})
+ });
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-apps.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-apps.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-apps.js
new file mode 100644
index 0000000..083f62d
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-apps.js
@@ -0,0 +1,26 @@
+/**
+ * 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 Ember from 'ember';
+
+export default Ember.Route.extend({
+ model() {
+ var apps = this.store.findAll('yarnApp');
+ return apps;
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-container-log.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-container-log.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-container-log.js
new file mode 100644
index 0000000..c324025
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-container-log.js
@@ -0,0 +1,55 @@
+/**
+ * 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 Ember from 'ember';
+import Constants from 'yarn-ui/constants';
+
+export default Ember.Route.extend({
+ model(param) {
+ var id = param.node_addr + Constants.PARAM_SEPARATOR + param.container_id +
+ Constants.PARAM_SEPARATOR + param.filename;
+ return Ember.RSVP.hash({
+ containerLog: this.store.findRecord('yarnContainerLog', id),
+ nodeInfo: { id: param.node_id, addr: param.node_addr }
+ }).then(function(hash) {
+ // Just return as its success.
+ return hash;
+ }, function(reason) {
+ if (reason.errors && reason.errors[0]) {
+ // This means HTTP error response was sent by adapter.
+ return reason;
+ } else {
+ // Assume empty response received from server.
+ return { nodeInfo: { id: param.node_id, addr: param.node_addr },
+ containerLog: { logs: "", containerID: param.container_id,
+ logFileName: param.filename}};
+ }
+ });
+ },
+
+ afterModel(model) {
+ // Handle errors and redirect if promise is rejected.
+ if (model.errors && model.errors[0]) {
+ if (model.errors[0].status == 404) {
+ this.replaceWith('/notfound');
+ } else {
+ this.replaceWith('/error');
+ }
+ }
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-app.js
new file mode 100644
index 0000000..63b1f2a
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-app.js
@@ -0,0 +1,29 @@
+/**
+ * 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 Ember from 'ember';
+
+export default Ember.Route.extend({
+ model(param) {
+ return Ember.RSVP.hash({
+ nodeApp: this.store.queryRecord('yarnNodeApp',
+ { nodeAddr : param.node_addr, appId: param.app_id }),
+ nodeInfo: { id: param.node_id, addr: param.node_addr }
+ });
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-apps.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-apps.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-apps.js
new file mode 100644
index 0000000..ffb5b7b
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-apps.js
@@ -0,0 +1,29 @@
+/**
+ * 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 Ember from 'ember';
+
+export default Ember.Route.extend({
+ model(param) {
+ // Get all apps running on a specific node. Node is contacted by using node_addr.
+ return Ember.RSVP.hash({
+ apps: this.store.query('yarnNodeApp', { nodeAddr: param.node_addr }),
+ nodeInfo: { id: param.node_id, addr: param.node_addr }
+ });
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-container.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-container.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-container.js
new file mode 100644
index 0000000..2022662
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-container.js
@@ -0,0 +1,30 @@
+/**
+ * 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 Ember from 'ember';
+
+export default Ember.Route.extend({
+ model(param) {
+ // Get a specific container running on a specific node.
+ return Ember.RSVP.hash({
+ nodeContainer: this.store.queryRecord('yarnNodeContainer',
+ { nodeHttpAddr: param.node_addr, containerId: param.container_id }),
+ nodeInfo: { id: param.node_id, addr: param.node_addr }
+ });
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-containers.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-containers.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-containers.js
new file mode 100644
index 0000000..9a69729
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-containers.js
@@ -0,0 +1,28 @@
+/**
+ * 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 Ember from 'ember';
+
+export default Ember.Route.extend({
+ model(param) {
+ // Get all containers running on specific node.
+ return Ember.RSVP.hash({
+ containers: this.store.query('yarnNodeContainer', { nodeHttpAddr: param.node_addr }),
+ nodeInfo: { id: param.node_id, addr: param.node_addr }
+ });
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node.js
new file mode 100644
index 0000000..7c58b94
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node.js
@@ -0,0 +1,29 @@
+/**
+ * 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 Ember from 'ember';
+
+export default Ember.Route.extend({
+ model(param) {
+ // Fetches data from both NM and RM. RM is queried to get node usage info.
+ return Ember.RSVP.hash({
+ node: this.store.findRecord('yarnNode', param.node_addr),
+ rmNode: this.store.findRecord('yarnRmNode', param.node_id)
+ });
+ }
+});
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9b93975/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-nodes.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-nodes.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-nodes.js
new file mode 100644
index 0000000..f33eef8
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-nodes.js
@@ -0,0 +1,25 @@
+/**
+ * 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 Ember from 'ember';
+
+export default Ember.Route.extend({
+ model() {
+ return this.store.findAll('yarnRmNode');
+ }
+});
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org