Selaa lähdekoodia

YARN-3368 YARN-7169 New YARN UI backported from trunk. See branch YARN-3368_branch2 for commits

vrushali 7 vuotta sitten
vanhempi
commit
769087288a
100 muutettua tiedostoa jossa 7196 lisäystä ja 125 poistoa
  1. 13 0
      .gitignore
  2. 49 42
      BUILDING.txt
  3. 580 65
      LICENSE.txt
  4. 1 1
      dev-support/bin/create-release
  5. 19 3
      dev-support/docker/Dockerfile
  6. 7 0
      hadoop-assemblies/src/main/resources/assemblies/hadoop-yarn-dist.xml
  7. 5 1
      hadoop-project/pom.xml
  8. 11 1
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java
  9. 30 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/WebApps.java
  10. 14 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/yarn-default.xml
  11. 79 12
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java
  12. 55 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/YarnUI2.md
  13. 64 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/README.md
  14. 259 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/pom.xml
  15. 15 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/public/crossdomain.xml
  16. 4 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/.bowerrc
  17. 9 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/.ember-cli
  18. 35 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/.jshintrc
  19. 3 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/.watchmanconfig
  20. 25 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/WEB-INF/web.xml
  21. 9 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/WEB-INF/wro.xml
  22. 49 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/abstract.js
  23. 30 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/cluster-info.js
  24. 30 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/cluster-metric.js
  25. 40 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-app-attempt.js
  26. 33 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-app-flowrun.js
  27. 35 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-app-timeline.js
  28. 41 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-app.js
  29. 80 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-container-log.js
  30. 49 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-container.js
  31. 35 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-entity.js
  32. 30 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-flow-activity.js
  33. 32 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-flowrun-brief.js
  34. 38 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-flowrun.js
  35. 53 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node-app.js
  36. 54 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node-container.js
  37. 33 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node.js
  38. 23 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-queue/capacity-queue.js
  39. 23 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-queue/fair-queue.js
  40. 23 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-queue/fifo-queue.js
  41. 30 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-queue/yarn-queue.js
  42. 36 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-rm-node.js
  43. 41 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-timeline-appattempt.js
  44. 40 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-timeline-container.js
  45. 38 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/app.js
  46. 22 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/app-attempt-table.js
  47. 22 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/app-table.js
  48. 60 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/app-timeout-bar.js
  49. 59 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/app-usage-donut-chart.js
  50. 123 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/bar-chart.js
  51. 148 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/base-chart-component.js
  52. 42 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/base-usage-donut-chart.js
  53. 31 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/breadcrumb-bar.js
  54. 22 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/container-table.js
  55. 195 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/donut-chart.js
  56. 23 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/em-table-html-cell.js
  57. 39 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/item-selector.js
  58. 306 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/nodes-heatmap.js
  59. 88 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/per-app-memusage-by-nodes-stacked-barchart.js
  60. 67 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/per-app-ncontainers-by-nodes-stacked-barchart.js
  61. 22 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/queue-configuration-table.js
  62. 22 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/queue-navigator.js
  63. 67 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/queue-usage-donut-chart.js
  64. 288 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/queue-view.js
  65. 206 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/simple-bar-chart.js
  66. 81 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/simple-table.js
  67. 201 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/stacked-barchart.js
  68. 261 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/sunburst-chart.js
  69. 480 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/timeline-view.js
  70. 304 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/tree-selector.js
  71. 24 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/config.js
  72. 24 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/constants.js
  73. 163 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/app-table-columns.js
  74. 55 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/application.js
  75. 32 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/cluster-overview.js
  76. 64 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-app-attempt.js
  77. 62 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-app.js
  78. 24 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-app/attempts.js
  79. 28 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-app/charts.js
  80. 32 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-app/info.js
  81. 31 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-apps.js
  82. 31 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-apps/apps.js
  83. 43 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-container-log.js
  84. 125 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-flow-activity.js
  85. 36 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-flow.js
  86. 66 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-flow/info.js
  87. 178 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-flow/runs.js
  88. 50 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-flowrun.js
  89. 157 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-flowrun/info.js
  90. 126 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-flowrun/metrics.js
  91. 39 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node-app.js
  92. 39 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node-apps.js
  93. 39 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node-container.js
  94. 39 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node-containers.js
  95. 38 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node.js
  96. 36 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-nodes-heatmap.js
  97. 33 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-nodes.js
  98. 117 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-nodes/table.js
  99. 53 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-queue.js
  100. 31 0
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-queue/apps.js

+ 13 - 0
.gitignore

@@ -28,5 +28,18 @@ hadoop-common-project/hadoop-kms/downloads/
 hadoop-hdfs-project/hadoop-hdfs/downloads
 hadoop-hdfs-project/hadoop-hdfs/downloads
 hadoop-hdfs-project/hadoop-hdfs-httpfs/downloads
 hadoop-hdfs-project/hadoop-hdfs-httpfs/downloads
 hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/tla/yarnregistry.toolbox
 hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/tla/yarnregistry.toolbox
+hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/dist
+hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/tmp
+hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/node
+hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/node_modules
+hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/bower_components
+hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/.sass-cache
+hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/connect.lock
+hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/coverage/*
+hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/libpeerconnection.log
+hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/npm-debug.log
+hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/testem.log
+hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/dist
+hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/tmp
 yarnregistry.pdf
 yarnregistry.pdf
 patchprocess/
 patchprocess/

+ 49 - 42
BUILDING.txt

@@ -4,14 +4,18 @@ Build instructions for Hadoop
 Requirements:
 Requirements:
 
 
 * Unix System
 * Unix System
-* JDK 1.7+
+* JDK 1.8+
 * Maven 3.0 or later
 * Maven 3.0 or later
+* Findbugs 1.3.9 (if running findbugs)
 * ProtocolBuffer 2.5.0
 * ProtocolBuffer 2.5.0
 * CMake 2.6 or newer (if compiling native code), must be 3.0 or newer on Mac
 * CMake 2.6 or newer (if compiling native code), must be 3.0 or newer on Mac
 * Zlib devel (if compiling native code)
 * Zlib devel (if compiling native code)
 * openssl devel (if compiling native hadoop-pipes and to get the best HDFS encryption performance)
 * openssl devel (if compiling native hadoop-pipes and to get the best HDFS encryption performance)
 * Linux FUSE (Filesystem in Userspace) version 2.6 or above (if compiling fuse_dfs)
 * Linux FUSE (Filesystem in Userspace) version 2.6 or above (if compiling fuse_dfs)
 * Internet connection for first build (to fetch all Maven and Hadoop dependencies)
 * Internet connection for first build (to fetch all Maven and Hadoop dependencies)
+* python (for releasedocs)
+* bats (for shell code testing)
+* Node.js / bower / Ember-cli (for YARN UI v2 building)
 
 
 ----------------------------------------------------------------------------------
 ----------------------------------------------------------------------------------
 The easiest way to get an environment with all the appropriate tools is by means
 The easiest way to get an environment with all the appropriate tools is by means
@@ -53,12 +57,12 @@ Known issues:
 ----------------------------------------------------------------------------------
 ----------------------------------------------------------------------------------
 Installing required packages for clean install of Ubuntu 14.04 LTS Desktop:
 Installing required packages for clean install of Ubuntu 14.04 LTS Desktop:
 
 
-* Oracle JDK 1.7 (preferred)
+* Oracle JDK 1.8 (preferred)
   $ sudo apt-get purge openjdk*
   $ sudo apt-get purge openjdk*
   $ sudo apt-get install software-properties-common
   $ sudo apt-get install software-properties-common
   $ sudo add-apt-repository ppa:webupd8team/java
   $ sudo add-apt-repository ppa:webupd8team/java
   $ sudo apt-get update
   $ sudo apt-get update
-  $ sudo apt-get install oracle-java7-installer
+  $ sudo apt-get install oracle-java8-installer
 * Maven
 * Maven
   $ sudo apt-get -y install maven
   $ sudo apt-get -y install maven
 * Native libraries
 * Native libraries
@@ -70,14 +74,15 @@ Optional packages:
 
 
 * Snappy compression
 * Snappy compression
   $ sudo apt-get install snappy libsnappy-dev
   $ sudo apt-get install snappy libsnappy-dev
+* Intel ISA-L library for erasure coding
+  Please refer to https://01.org/intel%C2%AE-storage-acceleration-library-open-source-version
+  (OR https://github.com/01org/isa-l)
 * Bzip2
 * Bzip2
   $ sudo apt-get install bzip2 libbz2-dev
   $ sudo apt-get install bzip2 libbz2-dev
 * Jansson (C Library for JSON)
 * Jansson (C Library for JSON)
   $ sudo apt-get install libjansson-dev
   $ sudo apt-get install libjansson-dev
 * Linux FUSE
 * Linux FUSE
   $ sudo apt-get install fuse libfuse-dev
   $ sudo apt-get install fuse libfuse-dev
-* ZStandard compression
-    $ sudo apt-get install zstd
 
 
 ----------------------------------------------------------------------------------
 ----------------------------------------------------------------------------------
 Maven main modules:
 Maven main modules:
@@ -106,7 +111,7 @@ Maven build goals:
 
 
  * Clean                     : mvn clean [-Preleasedocs]
  * Clean                     : mvn clean [-Preleasedocs]
  * Compile                   : mvn compile [-Pnative]
  * Compile                   : mvn compile [-Pnative]
- * Run tests                 : mvn test [-Pnative]
+ * Run tests                 : mvn test [-Pnative] [-Pshelltest]
  * Create JAR                : mvn package
  * Create JAR                : mvn package
  * Run findbugs              : mvn compile findbugs:findbugs
  * Run findbugs              : mvn compile findbugs:findbugs
  * Run checkstyle            : mvn compile checkstyle:checkstyle
  * Run checkstyle            : mvn compile checkstyle:checkstyle
@@ -115,7 +120,7 @@ Maven build goals:
  * Run clover                : mvn test -Pclover [-DcloverLicenseLocation=${user.name}/.clover.license]
  * Run clover                : mvn test -Pclover [-DcloverLicenseLocation=${user.name}/.clover.license]
  * Run Rat                   : mvn apache-rat:check
  * Run Rat                   : mvn apache-rat:check
  * Build javadocs            : mvn javadoc:javadoc
  * Build javadocs            : mvn javadoc:javadoc
- * Build distribution        : mvn package [-Pdist][-Pdocs][-Psrc][-Pnative][-Dtar][-Preleasedocs]
+ * Build distribution        : mvn package [-Pdist][-Pdocs][-Psrc][-Pnative][-Dtar][-Preleasedocs][-Pyarn-ui]
  * Change Hadoop version     : mvn versions:set -DnewVersion=NEWVERSION
  * Change Hadoop version     : mvn versions:set -DnewVersion=NEWVERSION
 
 
  Build options:
  Build options:
@@ -125,6 +130,7 @@ Maven build goals:
   * Use -Psrc to create a project source TAR.GZ
   * Use -Psrc to create a project source TAR.GZ
   * Use -Dtar to create a TAR with the distribution (using -Pdist)
   * Use -Dtar to create a TAR with the distribution (using -Pdist)
   * Use -Preleasedocs to include the changelog and release docs (requires Internet connectivity)
   * Use -Preleasedocs to include the changelog and release docs (requires Internet connectivity)
+  * Use -Pyarn-ui to build YARN UI v2. (Requires Internet connectivity)
 
 
  Snappy build options:
  Snappy build options:
 
 
@@ -149,28 +155,6 @@ Maven build goals:
     and it ignores the -Dsnappy.prefix option. If -Dsnappy.lib isn't given, the
     and it ignores the -Dsnappy.prefix option. If -Dsnappy.lib isn't given, the
     bundling and building will fail.
     bundling and building will fail.
 
 
- ZStandard build options:
-
-   ZStandard is a compression library that can be utilized by the native code.
-   It is currently an optional component, meaning that Hadoop can be built with
-   or without this dependency.
-
-  * Use -Drequire.zstd to fail the build if libzstd.so is not found.
-    If this option is not specified and the zstd library is missing.
-
-  * Use -Dzstd.prefix to specify a nonstandard location for the libzstd
-    header files and library files. You do not need this option if you have
-    installed zstandard using a package manager.
-
-  * Use -Dzstd.lib to specify a nonstandard location for the libzstd library
-    files.  Similarly to zstd.prefix, you do not need this option if you have
-    installed using a package manager.
-
-  * Use -Dbundle.zstd to copy the contents of the zstd.lib directory into
-    the final tar file. This option requires that -Dzstd.lib is also given,
-    and it ignores the -Dzstd.prefix option. If -Dzstd.lib isn't given, the
-    bundling and building will fail.
-
  OpenSSL build options:
  OpenSSL build options:
 
 
    OpenSSL includes a crypto library that can be utilized by the native code.
    OpenSSL includes a crypto library that can be utilized by the native code.
@@ -205,6 +189,39 @@ Maven build goals:
   For example, to run test_bulk_crc32, you would use:
   For example, to run test_bulk_crc32, you would use:
   mvn test -Pnative -Dtest=test_bulk_crc32
   mvn test -Pnative -Dtest=test_bulk_crc32
 
 
+ Intel ISA-L build options:
+
+   Intel ISA-L is an erasure coding library that can be utilized by the native code.
+   It is currently an optional component, meaning that Hadoop can be built with
+   or without this dependency. Note the library is used via dynamic module. Please
+   reference the official site for the library details.
+   https://01.org/intel%C2%AE-storage-acceleration-library-open-source-version
+   (OR https://github.com/01org/isa-l)
+
+  * Use -Drequire.isal to fail the build if libisal.so is not found.
+    If this option is not specified and the isal library is missing,
+    we silently build a version of libhadoop.so that cannot make use of ISA-L and
+    the native raw erasure coders.
+    This option is recommended if you plan on making use of native raw erasure
+    coders and want to get more repeatable builds.
+  * Use -Disal.prefix to specify a nonstandard location for the libisal
+    library files. You do not need this option if you have installed ISA-L to the
+    system library path.
+  * Use -Disal.lib to specify a nonstandard location for the libisal library
+    files.
+  * Use -Dbundle.isal to copy the contents of the isal.lib directory into
+    the final tar file. This option requires that -Disal.lib is also given,
+    and it ignores the -Disal.prefix option. If -Disal.lib isn't given, the
+    bundling and building will fail.
+
+ Special plugins: OWASP's dependency-check:
+
+   OWASP's dependency-check plugin will scan the third party dependencies
+   of this project for known CVEs (security vulnerabilities against them).
+   It will produce a report in target/dependency-check-report.html. To
+   invoke, run 'mvn dependency-check:aggregate'. Note that this plugin
+   requires maven 3.1.1 or greater.
+
 ----------------------------------------------------------------------------------
 ----------------------------------------------------------------------------------
 Building components separately
 Building components separately
 
 
@@ -299,8 +316,9 @@ Building on Windows
 Requirements:
 Requirements:
 
 
 * Windows System
 * Windows System
-* JDK 1.7+
-* Maven 3.0 or later
+* JDK 1.8+
+* Maven 3.3 or later
+* Findbugs 1.3.9 (if running findbugs)
 * ProtocolBuffer 2.5.0
 * ProtocolBuffer 2.5.0
 * CMake 2.6 or newer
 * CMake 2.6 or newer
 * Windows SDK 7.1 or Visual Studio 2010 Professional
 * Windows SDK 7.1 or Visual Studio 2010 Professional
@@ -373,14 +391,3 @@ http://www.zlib.net/
 Building distributions:
 Building distributions:
 
 
  * Build distribution with native code    : mvn package [-Pdist][-Pdocs][-Psrc][-Dtar]
  * Build distribution with native code    : mvn package [-Pdist][-Pdocs][-Psrc][-Dtar]
-
-----------------------------------------------------------------------------------
-Running compatibility checks with checkcompatibility.py
-
-Invoke `./dev-support/bin/checkcompatibility.py` to run Java API Compliance Checker
-to compare the public Java APIs of two git objects. This can be used by release
-managers to compare the compatibility of a previous and current release.
-
-As an example, this invocation will check the compatibility of interfaces annotated as Public or LimitedPrivate:
-
-./dev-support/bin/checkcompatibility.py --annotation org.apache.hadoop.classification.InterfaceAudience.Public --annotation org.apache.hadoop.classification.InterfaceAudience.LimitedPrivate --include "hadoop.*" branch-2.7.2 trunk

+ 580 - 65
LICENSE.txt

@@ -246,48 +246,11 @@ For the org.apache.hadoop.util.bloom.* classes:
 For portions of the native implementation of slicing-by-8 CRC calculation
 For portions of the native implementation of slicing-by-8 CRC calculation
 in src/main/native/src/org/apache/hadoop/util:
 in src/main/native/src/org/apache/hadoop/util:
 
 
-Copyright (c) 2008,2009,2010 Massachusetts Institute of Technology.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-* Redistributions of source code must retain the above copyright
-  notice, this list of conditions and the following disclaimer.
-* Redistributions in binary form must reproduce the above copyright
-  notice, this list of conditions and the following disclaimer in the
-  documentation and/or other materials provided with the distribution.
-* Neither the name of the Massachusetts Institute of Technology nor
-  the names of its contributors may be used to endorse or promote
-  products derived from this software without specific prior written
-  permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-Other portions are under the same license from Intel:
-http://sourceforge.net/projects/slicing-by-8/
-/*++
- *
- * Copyright (c) 2004-2006 Intel Corporation - All Rights Reserved
- *
- * This software program is licensed subject to the BSD License, 
- * available at http://www.opensource.org/licenses/bsd-license.html
- *
- * Abstract: The main routine
- * 
- --*/
+/**
+ *   Copyright 2008,2009,2010 Massachusetts Institute of Technology.
+ *   All rights reserved. Use of this source code is governed by a
+ *   BSD-style license that can be found in the LICENSE file.
+ */
 
 
 For src/main/native/src/org/apache/hadoop/io/compress/lz4/{lz4.h,lz4.c,lz4hc.h,lz4hc.c},
 For src/main/native/src/org/apache/hadoop/io/compress/lz4/{lz4.h,lz4.c,lz4hc.h,lz4hc.c},
 
 
@@ -326,7 +289,7 @@ For src/main/native/src/org/apache/hadoop/io/compress/lz4/{lz4.h,lz4.c,lz4hc.h,l
 */
 */
 
 
 
 
-For hadoop-common-project/hadoop-common/src/main/native/gtest
+For hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/gtest
 ---------------------------------------------------------------------
 ---------------------------------------------------------------------
 Copyright 2008, Google Inc.
 Copyright 2008, Google Inc.
 All rights reserved.
 All rights reserved.
@@ -357,6 +320,43 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 
+The binary distribution of this product bundles these dependencies under the
+following license:
+re2j 1.0
+---------------------------------------------------------------------
+This is a work derived from Russ Cox's RE2 in Go, whose license
+http://golang.org/LICENSE is as follows:
+
+Copyright (c) 2009 The Go Authors. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+   * Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+
+   * Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in
+     the documentation and/or other materials provided with the
+     distribution.
+
+   * Neither the name of Google Inc. nor the names of its contributors
+     may be used to endorse or promote products derived from this
+     software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
 For hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/util/tree.h
 For hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/util/tree.h
 ---------------------------------------------------------------------
 ---------------------------------------------------------------------
 Copyright 2002 Niels Provos <provos@citi.umich.edu>
 Copyright 2002 Niels Provos <provos@citi.umich.edu>
@@ -585,9 +585,7 @@ hadoop-tools/hadoop-sls/src/main/html/css/bootstrap-responsive.min.css
 And the binary distribution of this product bundles these dependencies under the
 And the binary distribution of this product bundles these dependencies under the
 following license:
 following license:
 Mockito 1.8.5
 Mockito 1.8.5
-JUL to SLF4J bridge 1.7.25
-SLF4J API Module 1.7.25
-SLF4J LOG4J-12 Binding 1.7.25
+SLF4J 1.7.10
 JCodings 1.0.8
 JCodings 1.0.8
 Joni 2.1.2
 Joni 2.1.2
 --------------------------------------------------------------------------------
 --------------------------------------------------------------------------------
@@ -616,8 +614,6 @@ For:
 hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/jquery-1.10.2.min.js
 hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/jquery-1.10.2.min.js
 hadoop-tools/hadoop-sls/src/main/html/js/thirdparty/jquery.js
 hadoop-tools/hadoop-sls/src/main/html/js/thirdparty/jquery.js
 hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/webapps/static/jquery
 hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/webapps/static/jquery
-Apache HBase - Server which contains JQuery minified javascript library version 1.8.3
-Microsoft JDBC Driver for SQLServer - version 6.2.1.jre7
 --------------------------------------------------------------------------------
 --------------------------------------------------------------------------------
 
 
 Copyright jQuery Foundation and other contributors, https://jquery.org/
 Copyright jQuery Foundation and other contributors, https://jquery.org/
@@ -693,9 +689,8 @@ hadoop-tools/hadoop-sls/src/main/html/js/thirdparty/d3-LICENSE
 
 
 The binary distribution of this product bundles these dependencies under the
 The binary distribution of this product bundles these dependencies under the
 following license:
 following license:
-HSQLDB Database 2.3.4
+HSQLDB Database 2.0.0
 --------------------------------------------------------------------------------
 --------------------------------------------------------------------------------
-(HSQL License)
 "COPYRIGHTS AND LICENSES (based on BSD License)
 "COPYRIGHTS AND LICENSES (based on BSD License)
 
 
 For work developed by the HSQL Development Group:
 For work developed by the HSQL Development Group:
@@ -1648,6 +1643,12 @@ JLine 0.9.94
 leveldbjni-all 1.8
 leveldbjni-all 1.8
 Hamcrest Core 1.3
 Hamcrest Core 1.3
 xmlenc Library 0.52
 xmlenc Library 0.52
+StringTemplate 4 4.0.7
+ANTLR 3 Tool 3.5
+ANTLR 3 Runtime 3.5
+ANTLR StringTemplate 3.2.1
+ASM All 5.0.2
+sqlline 1.1.8
 --------------------------------------------------------------------------------
 --------------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
 modification, are permitted provided that the following conditions are met:
@@ -1878,24 +1879,538 @@ the Licensor and You.
 
 
 The binary distribution of this product bundles these dependencies under the
 The binary distribution of this product bundles these dependencies under the
 following license:
 following license:
-jamon-runtime 2.4.1
+jamon-runtime 2.3.1
 --------------------------------------------------------------------------------
 --------------------------------------------------------------------------------
+                          MOZILLA PUBLIC LICENSE
+                                Version 1.1
+
+                              ---------------
+
+1. Definitions.
+
+     1.0.1. "Commercial Use" means distribution or otherwise making the
+     Covered Code available to a third party.
+
+     1.1. "Contributor" means each entity that creates or contributes to
+     the creation of Modifications.
+
+     1.2. "Contributor Version" means the combination of the Original
+     Code, prior Modifications used by a Contributor, and the Modifications
+     made by that particular Contributor.
+
+     1.3. "Covered Code" means the Original Code or Modifications or the
+     combination of the Original Code and Modifications, in each case
+     including portions thereof.
+
+     1.4. "Electronic Distribution Mechanism" means a mechanism generally
+     accepted in the software development community for the electronic
+     transfer of data.
+
+     1.5. "Executable" means Covered Code in any form other than Source
+     Code.
+
+     1.6. "Initial Developer" means the individual or entity identified
+     as the Initial Developer in the Source Code notice required by Exhibit
+     A.
+
+     1.7. "Larger Work" means a work which combines Covered Code or
+     portions thereof with code not governed by the terms of this License.
+
+     1.8. "License" means this document.
+
+     1.8.1. "Licensable" means having the right to grant, to the maximum
+     extent possible, whether at the time of the initial grant or
+     subsequently acquired, any and all of the rights conveyed herein.
+
+     1.9. "Modifications" means any addition to or deletion from the
+     substance or structure of either the Original Code or any previous
+     Modifications. When Covered Code is released as a series of files, a
+     Modification is:
+          A. Any addition to or deletion from the contents of a file
+          containing Original Code or previous Modifications.
+
+          B. Any new file that contains any part of the Original Code or
+          previous Modifications.
+
+     1.10. "Original Code" means Source Code of computer software code
+     which is described in the Source Code notice required by Exhibit A as
+     Original Code, and which, at the time of its release under this
+     License is not already Covered Code governed by this License.
+
+     1.10.1. "Patent Claims" means any patent claim(s), now owned or
+     hereafter acquired, including without limitation,  method, process,
+     and apparatus claims, in any patent Licensable by grantor.
+
+     1.11. "Source Code" means the preferred form of the Covered Code for
+     making modifications to it, including all modules it contains, plus
+     any associated interface definition files, scripts used to control
+     compilation and installation of an Executable, or source code
+     differential comparisons against either the Original Code or another
+     well known, available Covered Code of the Contributor's choice. The
+     Source Code can be in a compressed or archival form, provided the
+     appropriate decompression or de-archiving software is widely available
+     for no charge.
+
+     1.12. "You" (or "Your")  means an individual or a legal entity
+     exercising rights under, and complying with all of the terms of, this
+     License or a future version of this License issued under Section 6.1.
+     For legal entities, "You" includes any entity which controls, is
+     controlled by, or is under common control with You. For purposes of
+     this definition, "control" means (a) the power, direct or indirect,
+     to cause the direction or management of such entity, whether by
+     contract or otherwise, or (b) ownership of more than fifty percent
+     (50%) of the outstanding shares or beneficial ownership of such
+     entity.
+
+2. Source Code License.
+
+     2.1. The Initial Developer Grant.
+     The Initial Developer hereby grants You a world-wide, royalty-free,
+     non-exclusive license, subject to third party intellectual property
+     claims:
+          (a)  under intellectual property rights (other than patent or
+          trademark) Licensable by Initial Developer to use, reproduce,
+          modify, display, perform, sublicense and distribute the Original
+          Code (or portions thereof) with or without Modifications, and/or
+          as part of a Larger Work; and
+
+          (b) under Patents Claims infringed by the making, using or
+          selling of Original Code, to make, have made, use, practice,
+          sell, and offer for sale, and/or otherwise dispose of the
+          Original Code (or portions thereof).
+
+          (c) the licenses granted in this Section 2.1(a) and (b) are
+          effective on the date Initial Developer first distributes
+          Original Code under the terms of this License.
+
+          (d) Notwithstanding Section 2.1(b) above, no patent license is
+          granted: 1) for code that You delete from the Original Code; 2)
+          separate from the Original Code;  or 3) for infringements caused
+          by: i) the modification of the Original Code or ii) the
+          combination of the Original Code with other software or devices.
+
+     2.2. Contributor Grant.
+     Subject to third party intellectual property claims, each Contributor
+     hereby grants You a world-wide, royalty-free, non-exclusive license
+
+          (a)  under intellectual property rights (other than patent or
+          trademark) Licensable by Contributor, to use, reproduce, modify,
+          display, perform, sublicense and distribute the Modifications
+          created by such Contributor (or portions thereof) either on an
+          unmodified basis, with other Modifications, as Covered Code
+          and/or as part of a Larger Work; and
+
+          (b) under Patent Claims infringed by the making, using, or
+          selling of  Modifications made by that Contributor either alone
+          and/or in combination with its Contributor Version (or portions
+          of such combination), to make, use, sell, offer for sale, have
+          made, and/or otherwise dispose of: 1) Modifications made by that
+          Contributor (or portions thereof); and 2) the combination of
+          Modifications made by that Contributor with its Contributor
+          Version (or portions of such combination).
+
+          (c) the licenses granted in Sections 2.2(a) and 2.2(b) are
+          effective on the date Contributor first makes Commercial Use of
+          the Covered Code.
+
+          (d)    Notwithstanding Section 2.2(b) above, no patent license is
+          granted: 1) for any code that Contributor has deleted from the
+          Contributor Version; 2)  separate from the Contributor Version;
+          3)  for infringements caused by: i) third party modifications of
+          Contributor Version or ii)  the combination of Modifications made
+          by that Contributor with other software  (except as part of the
+          Contributor Version) or other devices; or 4) under Patent Claims
+          infringed by Covered Code in the absence of Modifications made by
+          that Contributor.
+
+3. Distribution Obligations.
+
+     3.1. Application of License.
+     The Modifications which You create or to which You contribute are
+     governed by the terms of this License, including without limitation
+     Section 2.2. The Source Code version of Covered Code may be
+     distributed only under the terms of this License or a future version
+     of this License released under Section 6.1, and You must include a
+     copy of this License with every copy of the Source Code You
+     distribute. You may not offer or impose any terms on any Source Code
+     version that alters or restricts the applicable version of this
+     License or the recipients' rights hereunder. However, You may include
+     an additional document offering the additional rights described in
+     Section 3.5.
+
+     3.2. Availability of Source Code.
+     Any Modification which You create or to which You contribute must be
+     made available in Source Code form under the terms of this License
+     either on the same media as an Executable version or via an accepted
+     Electronic Distribution Mechanism to anyone to whom you made an
+     Executable version available; and if made available via Electronic
+     Distribution Mechanism, must remain available for at least twelve (12)
+     months after the date it initially became available, or at least six
+     (6) months after a subsequent version of that particular Modification
+     has been made available to such recipients. You are responsible for
+     ensuring that the Source Code version remains available even if the
+     Electronic Distribution Mechanism is maintained by a third party.
+
+     3.3. Description of Modifications.
+     You must cause all Covered Code to which You contribute to contain a
+     file documenting the changes You made to create that Covered Code and
+     the date of any change. You must include a prominent statement that
+     the Modification is derived, directly or indirectly, from Original
+     Code provided by the Initial Developer and including the name of the
+     Initial Developer in (a) the Source Code, and (b) in any notice in an
+     Executable version or related documentation in which You describe the
+     origin or ownership of the Covered Code.
+
+     3.4. Intellectual Property Matters
+          (a) Third Party Claims.
+          If Contributor has knowledge that a license under a third party's
+          intellectual property rights is required to exercise the rights
+          granted by such Contributor under Sections 2.1 or 2.2,
+          Contributor must include a text file with the Source Code
+          distribution titled "LEGAL" which describes the claim and the
+          party making the claim in sufficient detail that a recipient will
+          know whom to contact. If Contributor obtains such knowledge after
+          the Modification is made available as described in Section 3.2,
+          Contributor shall promptly modify the LEGAL file in all copies
+          Contributor makes available thereafter and shall take other steps
+          (such as notifying appropriate mailing lists or newsgroups)
+          reasonably calculated to inform those who received the Covered
+          Code that new knowledge has been obtained.
+
+          (b) Contributor APIs.
+          If Contributor's Modifications include an application programming
+          interface and Contributor has knowledge of patent licenses which
+          are reasonably necessary to implement that API, Contributor must
+          also include this information in the LEGAL file.
+
+               (c)    Representations.
+          Contributor represents that, except as disclosed pursuant to
+          Section 3.4(a) above, Contributor believes that Contributor's
+          Modifications are Contributor's original creation(s) and/or
+          Contributor has sufficient rights to grant the rights conveyed by
+          this License.
+
+     3.5. Required Notices.
+     You must duplicate the notice in Exhibit A in each file of the Source
+     Code.  If it is not possible to put such notice in a particular Source
+     Code file due to its structure, then You must include such notice in a
+     location (such as a relevant directory) where a user would be likely
+     to look for such a notice.  If You created one or more Modification(s)
+     You may add your name as a Contributor to the notice described in
+     Exhibit A.  You must also duplicate this License in any documentation
+     for the Source Code where You describe recipients' rights or ownership
+     rights relating to Covered Code.  You may choose to offer, and to
+     charge a fee for, warranty, support, indemnity or liability
+     obligations to one or more recipients of Covered Code. However, You
+     may do so only on Your own behalf, and not on behalf of the Initial
+     Developer or any Contributor. You must make it absolutely clear than
+     any such warranty, support, indemnity or liability obligation is
+     offered by You alone, and You hereby agree to indemnify the Initial
+     Developer and every Contributor for any liability incurred by the
+     Initial Developer or such Contributor as a result of warranty,
+     support, indemnity or liability terms You offer.
+
+     3.6. Distribution of Executable Versions.
+     You may distribute Covered Code in Executable form only if the
+     requirements of Section 3.1-3.5 have been met for that Covered Code,
+     and if You include a notice stating that the Source Code version of
+     the Covered Code is available under the terms of this License,
+     including a description of how and where You have fulfilled the
+     obligations of Section 3.2. The notice must be conspicuously included
+     in any notice in an Executable version, related documentation or
+     collateral in which You describe recipients' rights relating to the
+     Covered Code. You may distribute the Executable version of Covered
+     Code or ownership rights under a license of Your choice, which may
+     contain terms different from this License, provided that You are in
+     compliance with the terms of this License and that the license for the
+     Executable version does not attempt to limit or alter the recipient's
+     rights in the Source Code version from the rights set forth in this
+     License. If You distribute the Executable version under a different
+     license You must make it absolutely clear that any terms which differ
+     from this License are offered by You alone, not by the Initial
+     Developer or any Contributor. You hereby agree to indemnify the
+     Initial Developer and every Contributor for any liability incurred by
+     the Initial Developer or such Contributor as a result of any such
+     terms You offer.
+
+     3.7. Larger Works.
+     You may create a Larger Work by combining Covered Code with other code
+     not governed by the terms of this License and distribute the Larger
+     Work as a single product. In such a case, You must make sure the
+     requirements of this License are fulfilled for the Covered Code.
+
+4. Inability to Comply Due to Statute or Regulation.
+
+     If it is impossible for You to comply with any of the terms of this
+     License with respect to some or all of the Covered Code due to
+     statute, judicial order, or regulation then You must: (a) comply with
+     the terms of this License to the maximum extent possible; and (b)
+     describe the limitations and the code they affect. Such description
+     must be included in the LEGAL file described in Section 3.4 and must
+     be included with all distributions of the Source Code. Except to the
+     extent prohibited by statute or regulation, such description must be
+     sufficiently detailed for a recipient of ordinary skill to be able to
+     understand it.
+
+5. Application of this License.
+
+     This License applies to code to which the Initial Developer has
+     attached the notice in Exhibit A and to related Covered Code.
+
+6. Versions of the License.
+
+     6.1. New Versions.
+     Netscape Communications Corporation ("Netscape") may publish revised
+     and/or new versions of the License from time to time. Each version
+     will be given a distinguishing version number.
+
+     6.2. Effect of New Versions.
+     Once Covered Code has been published under a particular version of the
+     License, You may always continue to use it under the terms of that
+     version. You may also choose to use such Covered Code under the terms
+     of any subsequent version of the License published by Netscape. No one
+     other than Netscape has the right to modify the terms applicable to
+     Covered Code created under this License.
+
+     6.3. Derivative Works.
+     If You create or use a modified version of this License (which you may
+     only do in order to apply it to code which is not already Covered Code
+     governed by this License), You must (a) rename Your license so that
+     the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape",
+     "MPL", "NPL" or any confusingly similar phrase do not appear in your
+     license (except to note that your license differs from this License)
+     and (b) otherwise make it clear that Your version of the license
+     contains terms which differ from the Mozilla Public License and
+     Netscape Public License. (Filling in the name of the Initial
+     Developer, Original Code or Contributor in the notice described in
+     Exhibit A shall not of themselves be deemed to be modifications of
+     this License.)
+
+7. DISCLAIMER OF WARRANTY.
+
+     COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS,
+     WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+     WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF
+     DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING.
+     THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE
+     IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT,
+     YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE
+     COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER
+     OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
+     ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
+
+8. TERMINATION.
+
+     8.1.  This License and the rights granted hereunder will terminate
+     automatically if You fail to comply with terms herein and fail to cure
+     such breach within 30 days of becoming aware of the breach. All
+     sublicenses to the Covered Code which are properly granted shall
+     survive any termination of this License. Provisions which, by their
+     nature, must remain in effect beyond the termination of this License
+     shall survive.
+
+     8.2.  If You initiate litigation by asserting a patent infringement
+     claim (excluding declatory judgment actions) against Initial Developer
+     or a Contributor (the Initial Developer or Contributor against whom
+     You file such action is referred to as "Participant")  alleging that:
+
+     (a)  such Participant's Contributor Version directly or indirectly
+     infringes any patent, then any and all rights granted by such
+     Participant to You under Sections 2.1 and/or 2.2 of this License
+     shall, upon 60 days notice from Participant terminate prospectively,
+     unless if within 60 days after receipt of notice You either: (i)
+     agree in writing to pay Participant a mutually agreeable reasonable
+     royalty for Your past and future use of Modifications made by such
+     Participant, or (ii) withdraw Your litigation claim with respect to
+     the Contributor Version against such Participant.  If within 60 days
+     of notice, a reasonable royalty and payment arrangement are not
+     mutually agreed upon in writing by the parties or the litigation claim
+     is not withdrawn, the rights granted by Participant to You under
+     Sections 2.1 and/or 2.2 automatically terminate at the expiration of
+     the 60 day notice period specified above.
+
+     (b)  any software, hardware, or device, other than such Participant's
+     Contributor Version, directly or indirectly infringes any patent, then
+     any rights granted to You by such Participant under Sections 2.1(b)
+     and 2.2(b) are revoked effective as of the date You first made, used,
+     sold, distributed, or had made, Modifications made by that
+     Participant.
+
+     8.3.  If You assert a patent infringement claim against Participant
+     alleging that such Participant's Contributor Version directly or
+     indirectly infringes any patent where such claim is resolved (such as
+     by license or settlement) prior to the initiation of patent
+     infringement litigation, then the reasonable value of the licenses
+     granted by such Participant under Sections 2.1 or 2.2 shall be taken
+     into account in determining the amount or value of any payment or
+     license.
+
+     8.4.  In the event of termination under Sections 8.1 or 8.2 above,
+     all end user license agreements (excluding distributors and resellers)
+     which have been validly granted by You or any distributor hereunder
+     prior to termination shall survive termination.
+
+9. LIMITATION OF LIABILITY.
+
+     UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
+     (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL
+     DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE,
+     OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR
+     ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY
+     CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL,
+     WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
+     COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
+     INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
+     LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY
+     RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW
+     PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE
+     EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO
+     THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
+
+10. U.S. GOVERNMENT END USERS.
+
+     The Covered Code is a "commercial item," as that term is defined in
+     48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer
+     software" and "commercial computer software documentation," as such
+     terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48
+     C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995),
+     all U.S. Government End Users acquire Covered Code with only those
+     rights set forth herein.
+
+11. MISCELLANEOUS.
+
+     This License represents the complete agreement concerning subject
+     matter hereof. If any provision of this License is held to be
+     unenforceable, such provision shall be reformed only to the extent
+     necessary to make it enforceable. This License shall be governed by
+     California law provisions (except to the extent applicable law, if
+     any, provides otherwise), excluding its conflict-of-law provisions.
+     With respect to disputes in which at least one party is a citizen of,
+     or an entity chartered or registered to do business in the United
+     States of America, any litigation relating to this License shall be
+     subject to the jurisdiction of the Federal Courts of the Northern
+     District of California, with venue lying in Santa Clara County,
+     California, with the losing party responsible for costs, including
+     without limitation, court costs and reasonable attorneys' fees and
+     expenses. The application of the United Nations Convention on
+     Contracts for the International Sale of Goods is expressly excluded.
+     Any law or regulation which provides that the language of a contract
+     shall be construed against the drafter shall not apply to this
+     License.
+
+12. RESPONSIBILITY FOR CLAIMS.
+
+     As between Initial Developer and the Contributors, each party is
+     responsible for claims and damages arising, directly or indirectly,
+     out of its utilization of rights under this License and You agree to
+     work with Initial Developer and Contributors to distribute such
+     responsibility on an equitable basis. Nothing herein is intended or
+     shall be deemed to constitute any admission of liability.
+
+13. MULTIPLE-LICENSED CODE.
+
+     Initial Developer may designate portions of the Covered Code as
+     "Multiple-Licensed".  "Multiple-Licensed" means that the Initial
+     Developer permits you to utilize portions of the Covered Code under
+     Your choice of the MPL or the alternative licenses, if any, specified
+     by the Initial Developer in the file described in Exhibit A.
+
+The binary distribution of this product bundles these dependencies under the
+following license:
+bootstrap v3.3.6
+broccoli-asset-rev v2.4.2
+broccoli-funnel v1.0.1
+datatables v1.10.8
+em-helpers v0.5.13
+em-table v0.1.6
+ember v2.2.0
+ember-array-contains-helper v1.0.2
+ember-bootstrap v0.5.1
+ember-cli v1.13.13
+ember-cli-app-version v1.0.0
+ember-cli-babel v5.1.6
+ember-cli-content-security-policy v0.4.0
+ember-cli-dependency-checker v1.2.0
+ember-cli-htmlbars v1.0.2
+ember-cli-htmlbars-inline-precompile v0.3.1
+ember-cli-ic-ajax v0.2.1
+ember-cli-inject-live-reload v1.4.0
+ember-cli-jquery-ui v0.0.20
+ember-cli-qunit v1.2.1
+ember-cli-release v0.2.8
+ember-cli-shims v0.0.6
+ember-cli-sri v1.2.1
+ember-cli-test-loader v0.2.1
+ember-cli-uglify v1.2.0
+ember-d3 v0.1.0
+ember-data v2.1.0
+ember-disable-proxy-controllers v1.0.1
+ember-export-application-global v1.0.5
+ember-load-initializers v0.1.7
+ember-qunit v0.4.16
+ember-qunit-notifications v0.1.0
+ember-resolver v2.0.3
+ember-spin-spinner v0.2.3
+ember-truth-helpers v1.2.0
+jquery v2.1.4
+jquery-ui v1.11.4
+loader.js v3.3.0
+momentjs v2.10.6
+qunit v1.19.0
+select2 v4.0.0
+snippet-ss v1.11.0
+spin.js v2.3.2
+-------------------------------------------------------------------------------
+The MIT License (MIT)
 
 
-For: hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs
-/server/datanode/checker/AbstractFuture.java and
-hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs
-/server/datanode/checker/TimeoutFuture.java
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and assocated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
 
 
-Copyright (C) 2007 The Guava Authors
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
 
 
-Licensed 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
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
 
 
-http://www.apache.org/licenses/LICENSE-2.0
+The binary distribution of this product bundles these dependencies under the
+following license:
+D3 v3.5.6
+--------------------------------------------------------------------------------
+(3-clause BSD license)
+All rights reserved.
 
 
-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.
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this list
+   of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice, this
+   list of conditions and the following disclaimer in the documentation and/or
+   other materials provided with the distribution.
+
+3. Neither the name of the copyright holder nor the names of its contributors may
+   be used to endorse or promote products derived from this software without
+   specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.

+ 1 - 1
dev-support/bin/create-release

@@ -541,7 +541,7 @@ function makearelease
   # shellcheck disable=SC2046
   # shellcheck disable=SC2046
   run_and_redirect "${LOGDIR}/mvn_install.log" \
   run_and_redirect "${LOGDIR}/mvn_install.log" \
     "${MVN}" "${MVN_ARGS[@]}" install \
     "${MVN}" "${MVN_ARGS[@]}" install \
-      -Pdist,src \
+      -Pdist,src,yarn-ui \
       "${signflags[@]}" \
       "${signflags[@]}" \
       -DskipTests -Dtar $(hadoop_native_flags)
       -DskipTests -Dtar $(hadoop_native_flags)
 
 

+ 19 - 3
dev-support/docker/Dockerfile

@@ -65,9 +65,16 @@ RUN apt-get -q update && apt-get -q install --no-install-recommends -y \
     snappy \
     snappy \
     zlib1g-dev
     zlib1g-dev
 
 
-# Fixing the Apache commons / Maven dependency problem under Ubuntu:
-# See http://wiki.apache.org/commons/VfsProblems
-RUN cd /usr/share/maven/lib && ln -s ../../java/commons-lang.jar .
+######
+# Install Apache Maven
+######
+RUN mkdir -p /opt/maven && \
+    curl -L -s -S \
+         http://www-us.apache.org/dist/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz \
+         -o /opt/maven.tar.gz && \
+    tar xzf /opt/maven.tar.gz --strip-components 1 -C /opt/maven
+ENV MAVEN_HOME /opt/maven
+
 
 
 #######
 #######
 # Java OpenJDK
 # Java OpenJDK
@@ -126,6 +133,15 @@ RUN pip install python-dateutil
 ###
 ###
 ENV MAVEN_OPTS -Xms256m -Xmx512m
 ENV MAVEN_OPTS -Xms256m -Xmx512m
 
 
+###
+# Install node js tools for web UI frameowkr
+###
+RUN apt-get -y install nodejs && \
+    ln -s /usr/bin/nodejs /usr/bin/node && \
+    apt-get -y install npm && \
+    npm install -g bower && \
+    npm install -g ember-cli
+
 ###
 ###
 # Everything past this point is either not needed for testing or breaks Yetus.
 # Everything past this point is either not needed for testing or breaks Yetus.
 # So tell Yetus not to read the rest of the file:
 # So tell Yetus not to read the rest of the file:

+ 7 - 0
hadoop-assemblies/src/main/resources/assemblies/hadoop-yarn-dist.xml

@@ -193,6 +193,13 @@
       <directory>hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase/target/lib</directory>
       <directory>hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase/target/lib</directory>
       <outputDirectory>share/hadoop/${hadoop.component}/timelineservice/lib</outputDirectory>
       <outputDirectory>share/hadoop/${hadoop.component}/timelineservice/lib</outputDirectory>
     </fileSet>
     </fileSet>
+    <fileSet>
+      <directory>hadoop-yarn/hadoop-yarn-ui/target/hadoop-yarn-ui-${project.version}</directory>
+      <outputDirectory>/share/hadoop/${hadoop.component}/webapps/rm</outputDirectory>
+      <includes>
+        <include>**/*</include>
+      </includes>
+    </fileSet>
   </fileSets>
   </fileSets>
   <moduleSets>
   <moduleSets>
     <moduleSet>
     <moduleSet>

+ 5 - 1
hadoop-project/pom.xml

@@ -107,7 +107,7 @@
     for an open-ended enforcement
     for an open-ended enforcement
     -->
     -->
     <enforced.java.version>[${javac.version},)</enforced.java.version>
     <enforced.java.version>[${javac.version},)</enforced.java.version>
-    <enforced.maven.version>[3.0.2,)</enforced.maven.version>
+    <enforced.maven.version>[3.3.0,)</enforced.maven.version>
 
 
     <!-- Plugin versions and config -->
     <!-- Plugin versions and config -->
     <maven-surefire-plugin.argLine>-Xmx2048m -XX:MaxPermSize=768m -XX:+HeapDumpOnOutOfMemoryError</maven-surefire-plugin.argLine>
     <maven-surefire-plugin.argLine>-Xmx2048m -XX:MaxPermSize=768m -XX:+HeapDumpOnOutOfMemoryError</maven-surefire-plugin.argLine>
@@ -132,6 +132,10 @@
     <surefire.fork.timeout>900</surefire.fork.timeout>
     <surefire.fork.timeout>900</surefire.fork.timeout>
     <aws-java-sdk.version>1.11.199</aws-java-sdk.version>
     <aws-java-sdk.version>1.11.199</aws-java-sdk.version>
     <hsqldb.version>2.3.4</hsqldb.version>
     <hsqldb.version>2.3.4</hsqldb.version>
+    <frontend-maven-plugin.version>1.5</frontend-maven-plugin.version>
+    <!-- the version of Hadoop declared in the version resources; can be overridden
+    so that Hadoop 3.x can declare itself a 2.x artifact. -->
+    <declared.hadoop.version>${project.version}</declared.hadoop.version>
   </properties>
   </properties>
 
 
   <dependencyManagement>
   <dependencyManagement>

+ 11 - 1
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java

@@ -297,7 +297,17 @@ public class YarnConfiguration extends Configuration {
   public static final int DEFAULT_RM_WEBAPP_HTTPS_PORT = 8090;
   public static final int DEFAULT_RM_WEBAPP_HTTPS_PORT = 8090;
   public static final String DEFAULT_RM_WEBAPP_HTTPS_ADDRESS = "0.0.0.0:"
   public static final String DEFAULT_RM_WEBAPP_HTTPS_ADDRESS = "0.0.0.0:"
       + DEFAULT_RM_WEBAPP_HTTPS_PORT;
       + DEFAULT_RM_WEBAPP_HTTPS_PORT;
-  
+
+  /**
+   * Enable YARN WebApp V2.
+   */
+  public static final String YARN_WEBAPP_UI2_ENABLE = "yarn."
+      + "webapp.ui2.enable";
+  public static final boolean DEFAULT_YARN_WEBAPP_UI2_ENABLE = false;
+
+  public static final String YARN_WEBAPP_UI2_WARFILE_PATH = "yarn."
+      + "webapp.ui2.war-file-path";
+
   public static final String RM_RESOURCE_TRACKER_ADDRESS =
   public static final String RM_RESOURCE_TRACKER_ADDRESS =
     RM_PREFIX + "resource-tracker.address";
     RM_PREFIX + "resource-tracker.address";
   public static final int DEFAULT_RM_RESOURCE_TRACKER_PORT = 8031;
   public static final int DEFAULT_RM_RESOURCE_TRACKER_PORT = 8031;

+ 30 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/WebApps.java

@@ -44,6 +44,7 @@ import org.apache.hadoop.security.http.RestCsrfPreventionFilter;
 import org.apache.hadoop.security.http.XFrameOptionsFilter;
 import org.apache.hadoop.security.http.XFrameOptionsFilter;
 import org.apache.hadoop.yarn.conf.YarnConfiguration;
 import org.apache.hadoop.yarn.conf.YarnConfiguration;
 import org.apache.hadoop.yarn.webapp.util.WebAppUtils;
 import org.apache.hadoop.yarn.webapp.util.WebAppUtils;
+import org.mortbay.jetty.webapp.WebAppContext;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
 
 
@@ -393,8 +394,16 @@ public class WebApps {
     }
     }
 
 
     public WebApp start(WebApp webapp) {
     public WebApp start(WebApp webapp) {
+      return start(webapp, null);
+    }
+
+    public WebApp start(WebApp webapp, WebAppContext ui2Context) {
       WebApp webApp = build(webapp);
       WebApp webApp = build(webapp);
       HttpServer2 httpServer = webApp.httpServer();
       HttpServer2 httpServer = webApp.httpServer();
+      if (ui2Context != null) {
+        addFiltersForNewContext(ui2Context);
+        httpServer.addContext(ui2Context, true);
+      }
       try {
       try {
         httpServer.start();
         httpServer.start();
         LOG.info("Web app " + name + " started at "
         LOG.info("Web app " + name + " started at "
@@ -405,6 +414,27 @@ public class WebApps {
       return webApp;
       return webApp;
     }
     }
 
 
+    private void addFiltersForNewContext(WebAppContext ui2Context) {
+      Map<String, String> params = getConfigParameters(csrfConfigPrefix);
+
+      if (hasCSRFEnabled(params)) {
+        LOG.info("CSRF Protection has been enabled for the {} application. "
+            + "Please ensure that there is an authentication mechanism "
+            + "enabled (kerberos, custom, etc).", name);
+        String restCsrfClassName = RestCsrfPreventionFilter.class.getName();
+        HttpServer2.defineFilter(ui2Context, restCsrfClassName,
+            restCsrfClassName, params, new String[]{"/*"});
+      }
+
+      params = getConfigParameters(xfsConfigPrefix);
+
+      if (hasXFSEnabled()) {
+        String xfsClassName = XFrameOptionsFilter.class.getName();
+        HttpServer2.defineFilter(ui2Context, xfsClassName, xfsClassName, params,
+            new String[]{"/*"});
+      }
+    }
+
     private String inferHostClass() {
     private String inferHostClass() {
       String thisClass = this.getClass().getName();
       String thisClass = this.getClass().getName();
       Throwable t = new Throwable();
       Throwable t = new Throwable();

+ 14 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/yarn-default.xml

@@ -197,6 +197,20 @@
     <value>true</value>
     <value>true</value>
   </property>
   </property>
 
 
+  <property>
+    <description>To enable RM web ui2 application.</description>
+    <name>yarn.webapp.ui2.enable</name>
+    <value>false</value>
+  </property>
+
+  <property>
+    <description>
+      Explicitly provide WAR file path for ui2 if needed.
+    </description>
+    <name>yarn.webapp.ui2.war-file-path</name>
+    <value></value>
+  </property>
+
   <property>
   <property>
     <name>yarn.resourcemanager.resource-tracker.address</name>
     <name>yarn.resourcemanager.resource-tracker.address</name>
     <value>${yarn.resourcemanager.hostname}:8031</value>
     <value>${yarn.resourcemanager.hostname}:8031</value>

+ 79 - 12
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java

@@ -18,16 +18,6 @@
 
 
 package org.apache.hadoop.yarn.server.resourcemanager;
 package org.apache.hadoop.yarn.server.resourcemanager;
 
 
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintStream;
-import java.net.InetSocketAddress;
-import java.nio.charset.Charset;
-import java.security.PrivilegedExceptionAction;
-import java.security.SecureRandom;
-import java.util.ArrayList;
-import java.util.List;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.commons.logging.LogFactory;
 import org.apache.curator.framework.AuthInfo;
 import org.apache.curator.framework.AuthInfo;
@@ -39,6 +29,8 @@ import org.apache.hadoop.ha.HAServiceProtocol.HAServiceState;
 import org.apache.hadoop.metrics2.MetricsSystem;
 import org.apache.hadoop.metrics2.MetricsSystem;
 import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
 import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
 import org.apache.hadoop.metrics2.source.JvmMetrics;
 import org.apache.hadoop.metrics2.source.JvmMetrics;
+import org.apache.hadoop.http.HttpServer2;
+import org.apache.hadoop.net.NetUtils;
 import org.apache.hadoop.security.Groups;
 import org.apache.hadoop.security.Groups;
 import org.apache.hadoop.security.SecurityUtil;
 import org.apache.hadoop.security.SecurityUtil;
 import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.security.UserGroupInformation;
@@ -52,6 +44,7 @@ import org.apache.hadoop.util.ReflectionUtils;
 import org.apache.hadoop.util.ShutdownHookManager;
 import org.apache.hadoop.util.ShutdownHookManager;
 import org.apache.hadoop.util.StringUtils;
 import org.apache.hadoop.util.StringUtils;
 import org.apache.hadoop.util.curator.ZKCuratorManager;
 import org.apache.hadoop.util.curator.ZKCuratorManager;
+import org.apache.hadoop.util.VersionInfo;
 import org.apache.hadoop.yarn.YarnUncaughtExceptionHandler;
 import org.apache.hadoop.yarn.YarnUncaughtExceptionHandler;
 import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
 import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
@@ -116,9 +109,22 @@ import org.apache.hadoop.yarn.webapp.WebApps;
 import org.apache.hadoop.yarn.webapp.WebApps.Builder;
 import org.apache.hadoop.yarn.webapp.WebApps.Builder;
 import org.apache.hadoop.yarn.webapp.util.WebAppUtils;
 import org.apache.hadoop.yarn.webapp.util.WebAppUtils;
 import org.apache.zookeeper.server.auth.DigestAuthenticationProvider;
 import org.apache.zookeeper.server.auth.DigestAuthenticationProvider;
+import org.mortbay.jetty.webapp.WebAppContext;
 
 
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicBoolean;
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.annotations.VisibleForTesting;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintStream;
+import java.net.InetSocketAddress;
+import java.net.URI;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.nio.charset.Charset;
+import java.security.PrivilegedExceptionAction;
+import java.security.SecureRandom;
+import java.util.ArrayList;
+import java.util.List;
 
 
 /**
 /**
  * The ResourceManager is the main class that is a set of components.
  * The ResourceManager is the main class that is a set of components.
@@ -141,6 +147,11 @@ public class ResourceManager extends CompositeService implements Recoverable {
   private static final Log LOG = LogFactory.getLog(ResourceManager.class);
   private static final Log LOG = LogFactory.getLog(ResourceManager.class);
   private static long clusterTimeStamp = System.currentTimeMillis();
   private static long clusterTimeStamp = System.currentTimeMillis();
 
 
+  /*
+   * UI2 webapp name
+   */
+  public static final String UI2_WEBAPP_NAME = "/ui2";
+
   /**
   /**
    * "Always On" services. Services that need to run always irrespective of
    * "Always On" services. Services that need to run always irrespective of
    * the HA state of the RM.
    * the HA state of the RM.
@@ -1004,7 +1015,35 @@ public class ResourceManager extends CompositeService implements Recoverable {
       }
       }
     }
     }
   }
   }
-  
+
+  /**
+   * Return a HttpServer.Builder that the journalnode / namenode / secondary
+   * namenode can use to initialize their HTTP / HTTPS server.
+   *
+   * @param conf configuration object
+   * @param httpAddr HTTP address
+   * @param httpsAddr HTTPS address
+   * @param name  Name of the server
+   * @throws IOException from Builder
+   * @return builder object
+   */
+  public static HttpServer2.Builder httpServerTemplateForRM(Configuration conf,
+      final InetSocketAddress httpAddr, final InetSocketAddress httpsAddr,
+      String name) throws IOException {
+    HttpServer2.Builder builder = new HttpServer2.Builder().setName(name)
+        .setConf(conf).setSecurityEnabled(false);
+
+    if (httpAddr.getPort() == 0) {
+      builder.setFindPort(true);
+    }
+
+    URI uri = URI.create("http://" + NetUtils.getHostPortString(httpAddr));
+    builder.addEndpoint(uri);
+    LOG.info("Starting Web-server for " + name + " at: " + uri);
+
+    return builder;
+  }
+
   protected void startWepApp() {
   protected void startWepApp() {
 
 
     Configuration conf = getConfig();
     Configuration conf = getConfig();
@@ -1038,7 +1077,35 @@ public class ResourceManager extends CompositeService implements Recoverable {
       String[] proxyParts = proxyHostAndPort.split(":");
       String[] proxyParts = proxyHostAndPort.split(":");
       builder.withAttribute(WebAppProxy.PROXY_HOST_ATTRIBUTE, proxyParts[0]);
       builder.withAttribute(WebAppProxy.PROXY_HOST_ATTRIBUTE, proxyParts[0]);
     }
     }
-    webApp = builder.start(new RMWebApp(this));
+
+    WebAppContext uiWebAppContext = null;
+    if (getConfig().getBoolean(YarnConfiguration.YARN_WEBAPP_UI2_ENABLE,
+        YarnConfiguration.DEFAULT_YARN_WEBAPP_UI2_ENABLE)) {
+      String webPath = UI2_WEBAPP_NAME;
+      String onDiskPath = getConfig()
+          .get(YarnConfiguration.YARN_WEBAPP_UI2_WARFILE_PATH);
+
+      if (null == onDiskPath) {
+        String war = "hadoop-yarn-ui-" + VersionInfo.getVersion() + ".war";
+        URLClassLoader cl = (URLClassLoader) ClassLoader.getSystemClassLoader();
+        URL url = cl.findResource(war);
+
+        if (null == url) {
+          onDiskPath = "";
+        } else {
+          onDiskPath = url.getFile();
+        }
+
+        LOG.info(
+            "New web UI war file name:" + war + ", and path:" + onDiskPath);
+      }
+
+      uiWebAppContext = new WebAppContext();
+      uiWebAppContext.setContextPath(webPath);
+      uiWebAppContext.setWar(onDiskPath);
+    }
+
+    webApp = builder.start(new RMWebApp(this), uiWebAppContext);
   }
   }
 
 
   /**
   /**

+ 55 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/YarnUI2.md

@@ -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.
+-->
+
+Hadoop: YARN-UI V2
+=================
+
+Prerequisites
+-------------
+Please make sure Hadoop is built by passing -Pyarn-ui to Maven (reference to BUILDING.txt for more details)
+
+Configurations
+-------------
+
+*In `yarn-site.xml`*
+
+| Configuration Property | Description |
+|:---- |:---- |
+| `yarn.webapp.ui2.enable` | *(Required)* In the server side it indicates whether the new YARN-UI v2 is enabled or not. Defaults to `false`. |
+| `yarn.webapp.ui2.war-file-path` | *(Optional)* WAR file path for launching yarn UI2 web application. By default this is empty and YARN will lookup required war file from classpath |
+
+Please note that, If you run YARN daemons locally in your machine for test purpose,
+you need the following configurations added to `yarn-site.xml` to enable cross
+origin (CORS) support.
+
+| Configuration Property | Value | Description |
+|:---- |:---- |:---- |
+| `yarn.timeline-service.http-cross-origin.enabled` | true | Enable CORS support for Timeline Server  |
+| `yarn.resourcemanager.webapp.cross-origin.enabled` | true | Enable CORS support for Resource Manager  |
+| `yarn.nodemanager.webapp.cross-origin.enabled` | true | Enable CORS support for Node Manager  |
+
+Also please ensure that CORS related configurations are enabled in `core-site.xml`.
+Kindly refer [here](https://hadoop.apache.org/docs/stable/hadoop-project-dist/hadoop-common/HttpAuthentication.html)
+
+Use it
+-------------
+Open your browser, go to `rm-address:8088/ui2` and try it!
+
+Notes
+-------------
+
+- This UI framework is not verified under security environment, please use with caution under security environment.

+ 64 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/README.md

@@ -0,0 +1,64 @@
+<!--
+   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.
+-->
+
+# Yarn UI
+
+The Yarn UI is an Ember based web-app that provides visualization of the applications running on the Apache Hadoop YARN framework.
+
+## Configurations
+
+* You can point the UI to custom locations by setting the environment variables in `src/main/webapp/config/configs.env`
+
+## Development
+
+All the following commands must be run inside `src/main/webapp`.
+
+### Prerequisites
+
+You will need the following things properly installed on your computer.
+
+* Install [Yarn](https://yarnpkg.com) v0.21.3
+* Install [Bower](http://bower.io/) v1.7.7
+* Install all dependencies by running `yarn install` & `bower install`
+
+### Running UI
+
+* `yarn start`
+* Visit your app at [http://localhost:4200](http://localhost:4200).
+
+### Building
+
+* `yarn run build` (production)
+* Files would be stored in "dist/"
+
+### Adding new dependencies
+
+**Warning: Do not edit the _package.json_ or _bower.json_ files manually. This could make them out-of-sync with the respective lock or shrinkwrap files.**
+
+Yarn UI has replaced NPM with Yarn package manager. And hence Yarn would be used to manage dependencies defined in package.json.
+
+* Please use the Yarn and Bower command-line tools to add new dependencies. And the tool version must be same as those defined in Prerequisites section.
+* Once any dependency is added:
+  *  If it's in package.json. Make sure that the respective, and only those changes are reflected in yarn.lock file.
+  *  If it's in bower.json. Make sure that the respective, and only those changes are reflected in bower-shrinkwrap.json file.
+* Commands to add using CLI tools:
+  * Yarn: yarn add [package-name]
+  * Bower: bower install --save [package-name]
+
+### Adding new routes (pages), controllers, components etc.
+
+* Use ember-cli blueprint generator - [Ember CLI](http://ember-cli.com/extending/#generators-and-blueprints)

+ 259 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/pom.xml

@@ -0,0 +1,259 @@
+<!--
+   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.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <artifactId>hadoop-yarn</artifactId>
+    <groupId>org.apache.hadoop</groupId>
+    <version>2.9.0-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.hadoop</groupId>
+  <artifactId>hadoop-yarn-ui</artifactId>
+  <version>2.9.0-SNAPSHOT</version>
+  <name>Apache Hadoop YARN UI</name>
+  <packaging>${packagingType}</packaging>
+
+  <properties>
+    <packagingType>pom</packagingType>
+
+    <webappDir>${basedir}/target/webapp</webappDir>
+    <nodeExecutable>${basedir}/target/webapp/node/node</nodeExecutable>
+    <packageManagerScript>node/yarn/dist/bin/yarn.js</packageManagerScript>
+
+    <keepUIBuildCache>false</keepUIBuildCache>
+  </properties>
+
+  <build>
+    <plugins>
+      <!-- Apache RAT -->
+      <plugin>
+        <groupId>org.apache.rat</groupId>
+        <artifactId>apache-rat-plugin</artifactId>
+        <configuration>
+          <excludes>
+            <exclude>src/main/webapp/jsconfig.json</exclude>
+            <exclude>src/main/webapp/bower.json</exclude>
+            <exclude>src/main/webapp/bower-shrinkwrap.json</exclude>
+            <exclude>src/main/webapp/package.json</exclude>
+            <exclude>src/main/webapp/yarn.lock</exclude>
+            <exclude>src/main/webapp/testem.json</exclude>
+            <exclude>src/main/webapp/public/assets/images/**/*</exclude>
+            <exclude>src/main/webapp/public/assets/images/*</exclude>
+            <exclude>src/main/webapp/public/robots.txt</exclude>
+            <exclude>public/crossdomain.xml</exclude>
+            <exclude>src/main/webapp/.bowerrc</exclude>
+            <exclude>src/main/webapp/.ember-cli</exclude>
+            <exclude>src/main/webapp/.jshintrc</exclude>
+            <exclude>src/main/webapp/.watchmanconfig</exclude>
+            <exclude>src/main/webapp/WEB-INF/wro.xml</exclude>
+          </excludes>
+        </configuration>
+      </plugin>
+
+      <plugin>
+        <artifactId>maven-clean-plugin</artifactId>
+        <version>3.0.0</version>
+        <configuration>
+          <skip>${keepUIBuildCache}</skip>
+          <followSymLinks>false</followSymLinks>
+          <filesets>
+            <fileset>
+              <directory>${webappDir}/bower_components</directory>
+            </fileset>
+            <fileset>
+              <directory>${webappDir}/node_modules</directory>
+            </fileset>
+          </filesets>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+  <profiles>
+    <profile>
+      <id>yarn-ui</id>
+
+      <activation>
+        <activeByDefault>false</activeByDefault>
+      </activation>
+
+      <properties>
+        <packagingType>war</packagingType>
+      </properties>
+
+      <build>
+        <plugins>
+          <!-- Copy files into target for build -->
+          <plugin>
+            <artifactId>maven-resources-plugin</artifactId>
+            <executions>
+              <execution>
+                <id>copy-resources</id>
+                <!-- here the phase you need -->
+                <phase>validate</phase>
+                <goals>
+                  <goal>copy-resources</goal>
+                </goals>
+                <configuration>
+                  <outputDirectory>${webappDir}</outputDirectory>
+                  <resources>
+                    <resource>
+                      <directory>${basedir}/src/main/webapp</directory>
+                      <filtering>true</filtering>
+                      <excludes>
+                        <exclude>node_modules/**/*</exclude>
+                        <exclude>bower_components/**/*</exclude>
+                        <exclude>tmp/**/*</exclude>
+                        <exclude>dist/**/*</exclude>
+                      </excludes>
+                    </resource>
+                  </resources>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+
+          <!-- Install Node, Yarn, Bower & dependencies -->
+          <plugin>
+            <groupId>com.github.eirslett</groupId>
+            <artifactId>frontend-maven-plugin</artifactId>
+            <version>${frontend-maven-plugin.version}</version>
+            <configuration>
+              <workingDirectory>${webappDir}</workingDirectory>
+            </configuration>
+            <executions>
+
+              <!-- Install all dependencies -->
+              <execution>
+                <phase>generate-resources</phase>
+                <id>install node and yarn</id>
+                <goals>
+                  <goal>install-node-and-yarn</goal>
+                </goals>
+                <configuration>
+                  <nodeVersion>v5.12.0</nodeVersion>
+                  <yarnVersion>v0.21.3</yarnVersion>
+                </configuration>
+              </execution>
+              <execution>
+                <phase>generate-resources</phase>
+                <id>yarn install</id>
+                <goals>
+                  <goal>yarn</goal>
+                </goals>
+                <configuration>
+                  <arguments>install</arguments>
+                </configuration>
+              </execution>
+              <execution>
+                <phase>generate-resources</phase>
+                <id>bower install</id>
+                <configuration>
+                  <arguments>install</arguments>
+                </configuration>
+                <goals>
+                  <goal>bower</goal>
+                </goals>
+              </execution>
+            </executions>
+          </plugin>
+
+          <plugin>
+            <groupId>org.codehaus.mojo</groupId>
+            <artifactId>exec-maven-plugin</artifactId>
+            <executions>
+
+              <!-- Build -->
+              <execution>
+                <id>ember build</id>
+                <phase>generate-resources</phase>
+                <goals>
+                  <goal>exec</goal>
+                </goals>
+                <configuration>
+                  <workingDirectory>${webappDir}</workingDirectory>
+                  <executable>${nodeExecutable}</executable>
+                  <arguments>
+                    <argument>${packageManagerScript}</argument>
+                    <argument>run</argument>
+                    <argument>build:mvn</argument>
+                  </arguments>
+                </configuration>
+              </execution>
+
+            </executions>
+          </plugin>
+
+          <!-- Asset minifier -->
+          <plugin>
+            <groupId>ro.isdc.wro4j</groupId>
+            <artifactId>wro4j-maven-plugin</artifactId>
+            <version>1.7.9</version>
+            <executions>
+              <execution>
+                <phase>prepare-package</phase>
+                <goals>
+                  <goal>run</goal>
+                </goals>
+              </execution>
+            </executions>
+            <configuration>
+              <minimize>true</minimize>
+              <targetGroups>yarn-ui,vendor</targetGroups>
+              <destinationFolder>${basedir}/target/minified-resources/assets</destinationFolder>
+              <contextFolder>${webappDir}/dist/assets</contextFolder>
+              <wroFile>${webappDir}/WEB-INF/wro.xml</wroFile>
+            </configuration>
+          </plugin>
+
+          <!-- Package into war -->
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-war-plugin</artifactId>
+            <executions>
+              <execution>
+                <phase>package</phase>
+              </execution>
+            </executions>
+            <configuration>
+              <webXml>${webappDir}/WEB-INF/web.xml</webXml>
+              <warSourceDirectory>${webappDir}/dist</warSourceDirectory>
+              <webResources>
+                <resource>
+                  <filtering>false</filtering>
+                  <directory>${basedir}/target/minified-resources</directory>
+                </resource>
+              </webResources>
+            </configuration>
+          </plugin>
+
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-jar-plugin</artifactId>
+            <configuration>
+              <skipIfEmpty>true</skipIfEmpty>
+            </configuration>
+          </plugin>
+
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+
+</project>

+ 15 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/public/crossdomain.xml

@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
+<cross-domain-policy>
+  <!-- Read this: www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html -->
+
+  <!-- Most restrictive policy: -->
+  <site-control permitted-cross-domain-policies="none"/>
+
+  <!-- Least restrictive policy: -->
+  <!--
+  <site-control permitted-cross-domain-policies="all"/>
+  <allow-access-from domain="*" to-ports="*" secure="false"/>
+  <allow-http-request-headers-from domain="*" headers="*" secure="false"/>
+  -->
+</cross-domain-policy>

+ 4 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/.bowerrc

@@ -0,0 +1,4 @@
+{
+  "directory": "bower_components",
+  "analytics": false
+}

+ 9 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/.ember-cli

@@ -0,0 +1,9 @@
+{
+  /**
+    Ember CLI sends analytics information by default. The data is completely
+    anonymous, but there are times when you might want to disable this behavior.
+
+    Setting `disableAnalytics` to true will prevent any data from being sent.
+  */
+  "disableAnalytics": false
+}

+ 35 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/.jshintrc

@@ -0,0 +1,35 @@
+{
+  "predef": [
+    "document",
+    "window",
+    "-Promise",
+    "d3",
+    "$",
+    "moment"
+  ],
+  "browser": true,
+  "boss": true,
+  "curly": true,
+  "debug": false,
+  "devel": true,
+  "eqeqeq": true,
+  "evil": true,
+  "forin": false,
+  "immed": false,
+  "laxbreak": false,
+  "newcap": true,
+  "noarg": true,
+  "noempty": false,
+  "nonew": false,
+  "nomen": false,
+  "onevar": false,
+  "plusplus": false,
+  "regexp": false,
+  "undef": true,
+  "sub": true,
+  "strict": false,
+  "white": false,
+  "eqnull": true,
+  "esnext": true,
+  "unused": true
+}

+ 3 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/.watchmanconfig

@@ -0,0 +1,3 @@
+{
+  "ignore_dirs": ["tmp", "dist"]
+}

+ 25 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/WEB-INF/web.xml

@@ -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.
+-->
+
+<!DOCTYPE web-app PUBLIC
+ "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd" >
+
+<web-app>
+  <display-name>YARN UI</display-name>
+</web-app>

+ 9 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/WEB-INF/wro.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<groups xmlns="http://www.isdc.ro/wro">
+  <group name='vendor'>
+    <js>/vendor.js</js>
+  </group>
+  <group name='yarn-ui'>
+    <js>/yarn-ui.js</js>
+  </group>
+</groups>

+ 49 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/abstract.js

@@ -0,0 +1,49 @@
+/**
+ * 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 DS from 'ember-data';
+
+export default DS.JSONAPIAdapter.extend({
+  address: null, //Must be set by inheriting classes
+  restNameSpace: null, //Must be set by inheriting classes
+  serverName: null, //Must be set by inheriting classes
+
+  headers: {
+    Accept: 'application/json'
+  },
+
+  host: Ember.computed("address", function () {
+    var address = this.get("address");
+    return this.get(`hosts.${address}`);
+  }),
+
+  namespace: Ember.computed("restNameSpace", function () {
+    var serverName = this.get("restNameSpace");
+    return this.get(`env.app.namespaces.${serverName}`);
+  }),
+
+  ajax: function(url, method, options) {
+    options = options || {};
+    options.crossDomain = true;
+    options.xhrFields = {
+      withCredentials: true
+    };
+    options.targetServer = this.get('serverName');
+    return this._super(url, method, options);
+  }
+});

+ 30 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/cluster-info.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 AbstractAdapter from './abstract';
+
+export default AbstractAdapter.extend({
+  address: "rmWebAddress",
+  restNameSpace: "cluster",
+  serverName: "RM",
+
+  // Any cluster-info specific adapter changes must be added here
+  pathForType(/*modelName*/) {
+    return ''; // move to some common place, return path by modelname.
+  }
+});

+ 30 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/cluster-metric.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 AbstractAdapter from './abstract';
+
+export default AbstractAdapter.extend({
+  address: "rmWebAddress",
+  restNameSpace: "metrics",
+  serverName: "RM",
+
+  // Any cluster-metric specific adapter changes must be added here
+  pathForType(/*modelName*/) {
+    return ''; // move to some common place, return path by modelname.
+  }
+});

+ 40 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-app-attempt.js

@@ -0,0 +1,40 @@
+/**
+ * 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 AbstractAdapter from './abstract';
+import Converter from 'yarn-ui/utils/converter';
+
+export default AbstractAdapter.extend({
+  address: "rmWebAddress",
+  restNameSpace: "cluster",
+  serverName: "RM",
+
+  urlForQuery(query/*, modelName*/) {
+    var url = this._buildURL();
+    var appId = query.appId;
+    delete query.appId;
+    return url + '/apps/' + appId + "/appattempts";
+  },
+
+  urlForFindRecord(id/*, modelName, snapshot*/) {
+    var url = this._buildURL();
+    return url + '/apps/' +
+           Converter.attemptIdToAppId(id) + "/appattempts/" + id;
+  }
+
+});

+ 33 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-app-flowrun.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 AbstractAdapter from './abstract';
+
+export default AbstractAdapter.extend({
+  address: "timelineWebAddress",
+  restNameSpace: "timelineV2",
+  serverName: "ATS",
+
+  urlForQuery(query/*, modelName*/){
+    var url = this._buildURL();
+    var flowrunUid = query['flowrunUid'];
+    delete query.flowrunUid;
+    url = url + '/run-uid/' + flowrunUid + '/apps?fields=ALL';
+    return url;
+  }
+});

+ 35 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-app-timeline.js

@@ -0,0 +1,35 @@
+/**
+ * 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 AbstractAdapter from './abstract';
+
+export default AbstractAdapter.extend({
+  address: "timelineWebAddress",
+  restNameSpace: "timelineV2",
+  serverName: "ATS",
+
+  urlForFindRecord(id/*, modelName, snapshot*/) {
+    var url = this._buildURL();
+    url = url + '/apps/' + id + '?fields=ALL';
+    return url;
+  },
+
+  pathForType(/*modelName*/) {
+    return 'apps';
+  }
+});

+ 41 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-app.js

@@ -0,0 +1,41 @@
+/**
+ * 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 AbstractAdapter from './abstract';
+
+export default AbstractAdapter.extend({
+  address: "rmWebAddress",
+  restNameSpace: "cluster",
+  serverName: "RM",
+
+  urlForQuery(/*query, modelName*/) {
+    var url = this._buildURL();
+    url = url + '/apps';
+    return url;
+  },
+
+  urlForFindRecord(id/*, modelName, snapshot*/) {
+    var url = this._buildURL();
+    url = url + '/apps/' + id;
+    return url;
+  },
+
+  pathForType(/*modelName*/) {
+    return 'apps'; // move to some common place, return path by modelname.
+  },
+});

+ 80 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-container-log.js

@@ -0,0 +1,80 @@
+/**
+ * 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 Ember from 'ember';
+import Converter from 'yarn-ui/utils/converter';
+
+/**
+ * REST URL's response when fetching container logs will be
+ * in plain text format and not JSON.
+ */
+export default DS.RESTAdapter.extend({
+  headers: {
+    Accept: 'text/plain'
+  },
+
+  host: Ember.computed("address", function () {
+    return this.get(`hosts.localBaseAddress`);
+  }),
+
+  namespace: Ember.computed("restNameSpace", function () {
+    return this.get(`env.app.namespaces.node`);
+  }),
+
+  urlForFindRecord(id/*, modelName, snapshot*/) {
+    var splits = Converter.splitForContainerLogs(id);
+    var nodeHttpAddr = splits[0];
+    var containerId = splits[1];
+    var filename = splits[2];
+    this.host = this.get('host') + nodeHttpAddr;
+    var url = this._buildURL();
+    url = url + "/containerlogs/" + containerId + "/" + filename;
+    return url;
+  },
+
+  ajax(url, method, hash) {
+    hash = hash || {};
+    hash.crossDomain = true;
+    hash.xhrFields = {withCredentials: true};
+    hash.targetServer = "NM";
+    return this._super(url, method, hash);
+  },
+
+  /**
+   * Override options so that result is not expected to be JSON
+   */
+  ajaxOptions: function (url, type, options) {
+    var hash = options || {};
+    hash.url = url;
+    hash.type = type;
+    // Make sure jQuery does not try to convert response to JSON.
+    hash.dataType = 'text';
+    hash.context = this;
+
+    var headers = Ember.get(this, 'headers');
+    if (headers !== undefined) {
+      hash.beforeSend = function (xhr) {
+        Object.keys(headers).forEach(function (key) {
+          return xhr.setRequestHeader(key, headers[key]);
+        });
+      };
+    }
+    return hash;
+  },
+});

+ 49 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-container.js

@@ -0,0 +1,49 @@
+/**
+ * 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.JSONAPIAdapter.extend({
+  headers: {
+    Accept: 'application/json'
+  },
+
+  host: function() {
+    return this.get(`hosts.rmWebAddress`);
+  }.property(),
+
+  namespace: function() {
+    return this.get(`env.app.namespaces.cluster`);
+  }.property(),
+
+  urlForQuery(query/*, modelName*/) {
+    var url = this._buildURL();
+    url = url + '/apps/' + Converter.attemptIdToAppId(query.app_attempt_id) +
+          "/appattempts/" + query.app_attempt_id + "/containers";
+    return url;
+  },
+
+  ajax(url, method, hash) {
+    hash = {};
+    hash.crossDomain = true;
+    hash.xhrFields = {withCredentials: true};
+    hash.targetServer = "RM";
+    return this._super(url, method, hash);
+  }
+});

+ 35 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-entity.js

@@ -0,0 +1,35 @@
+/**
+ * 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 AbstractAdapter from './abstract';
+
+export default AbstractAdapter.extend({
+  address: "timelineWebAddress",
+  restNameSpace: "timelineV2",
+  serverName: "ATS",
+
+  urlForQuery(query/*, modelName*/){
+    var url = this._buildURL();
+    var appUid = query.app_uid;
+    var entityType = query.entity_type;
+    delete query.app_uid;
+    delete query.entity_type;
+    url = url + '/app-uid/' + appUid + '/entities/' + entityType + '?fields=INFO';
+    return url;
+  }
+});

+ 30 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-flow-activity.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 AbstractAdapter from './abstract';
+
+export default AbstractAdapter.extend({
+  address: "timelineWebAddress",
+  restNameSpace: "timelineV2",
+  serverName: "ATS",
+
+  pathForType(/*modelName*/) {
+    return 'flows'; // move to some common place, return path by modelname.
+  },
+});

+ 32 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-flowrun-brief.js

@@ -0,0 +1,32 @@
+/**
+ * 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 AbstractAdapter from './abstract';
+
+export default AbstractAdapter.extend({
+  address: "timelineWebAddress",
+  restNameSpace: "timelineV2",
+  serverName: "ATS",
+
+  urlForQuery(query/*, modelName*/){
+    var url = this._buildURL();
+    var flowuid = query['flowuid'];
+    delete query.flowuid;
+    return url + '/flow-uid/' + flowuid + '/runs?fields=ALL';
+  },
+});

+ 38 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-flowrun.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 AbstractAdapter from './abstract';
+
+export default AbstractAdapter.extend({
+  address: "timelineWebAddress",
+  restNameSpace: "timelineV2",
+  serverName: "ATS",
+
+  urlForQueryRecord(query/*, modelName*/){
+    var url = this._buildURL();
+    var flowrunuid = query.flowrun_uid;
+    delete query.flowrun_uid;
+    url = url + '/run-uid/' + flowrunuid;
+    return url;
+  },
+
+  pathForType(/*modelName*/) {
+    return 'run-uid'; // move to some common place, return path by modelname.
+  }
+});

+ 53 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node-app.js

@@ -0,0 +1,53 @@
+/**
+ * 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 AbstractAdapter from './abstract';
+
+export default AbstractAdapter.extend({
+
+  address: "localBaseAddress",
+  restNameSpace: "node",
+  serverName: "NM",
+
+  urlForQuery(query) {
+    var url = this._buildURL();
+    url = url.replace("{nodeAddress}", query.nodeAddr) + "/apps";
+    return url;
+  },
+
+  urlForQueryRecord: function (query) {
+    var url = this._buildURL();
+    url = url.replace("{nodeAddress}", query.nodeAddr) + "/apps/" + query.appId;
+    return url;
+  },
+
+  query: function (store, type, query) {
+    var url = this.urlForQuery(query);
+    // Query params not required.
+    query = null;
+    return this.ajax(url, 'GET', { data: query });
+  },
+
+  queryRecord: function (store, type, query) {
+    var url = this.urlForQueryRecord(query);
+    // Query params not required.
+    query = null;
+    return this.ajax(url, 'GET', { data: query });
+  },
+
+});

+ 54 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-node-container.js

@@ -0,0 +1,54 @@
+/**
+ * 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 AbstractAdapter from './abstract';
+
+export default AbstractAdapter.extend({
+
+  address: "localBaseAddress",
+  restNameSpace: "node",
+  serverName: "NM",
+
+  urlForQuery(query) {
+    var url = this._buildURL();
+    url = url.replace("{nodeAddress}", query.nodeHttpAddr) + "/containers";
+    return url;
+  },
+
+  urlForQueryRecord(query) {
+    var url = this._buildURL();
+    url = url.replace("{nodeAddress}", query.nodeHttpAddr) + "/containers/" + query.containerId;
+    return url;
+  },
+
+  query: function (store, type, query) {
+    var url = this.urlForQuery(query);
+    // Query params not required.
+    query = null;
+    return this.ajax(url, 'GET', { data: query });
+  },
+
+  queryRecord: function (store, type, query) {
+    var url = this.urlForQueryRecord(query);
+    // Query params not required.
+    query = null;
+    console.log(url);
+    return this.ajax(url, 'GET', { data: query });
+  },
+
+});

+ 33 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/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 AbstractAdapter from './abstract';
+
+export default AbstractAdapter.extend({
+
+  address: "localBaseAddress",
+  restNameSpace: "node",
+  serverName: "NM",
+
+  urlForFindRecord(id/*, modelName, snapshot*/) {
+    var url = this._buildURL();
+    url = url.replace("{nodeAddress}", id);
+    return url;
+  }
+
+});

+ 23 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-queue/capacity-queue.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 YarnQueueAdapter from './yarn-queue';
+
+export default YarnQueueAdapter.extend({
+
+});

+ 23 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-queue/fair-queue.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 YarnQueueAdapter from './yarn-queue';
+
+export default YarnQueueAdapter.extend({
+
+});

+ 23 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-queue/fifo-queue.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 YarnQueueAdapter from './yarn-queue';
+
+export default YarnQueueAdapter.extend({
+
+});

+ 30 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-queue/yarn-queue.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 AbstractAdapter from '../abstract';
+
+export default AbstractAdapter.extend({
+  address: "rmWebAddress",
+  restNameSpace: "cluster",
+  serverName: "RM",
+
+  pathForType(/*modelName*/) {
+    return 'scheduler'; // move to some common place, return path by modelname.
+  }
+
+});

+ 36 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-rm-node.js

@@ -0,0 +1,36 @@
+/**
+ * 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 AbstractAdapter from './abstract';
+
+export default AbstractAdapter.extend({
+  address: "rmWebAddress",
+  restNameSpace: "cluster",
+  serverName: "RM",
+
+  pathForType(/*modelName*/) {
+    return 'nodes';
+  },
+
+  urlForFindRecord(id/*, modelName, snapshot*/) {
+    var url = this._buildURL();
+    url = url + "/nodes/" + id;
+    return url;
+  }
+
+});

+ 41 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-timeline-appattempt.js

@@ -0,0 +1,41 @@
+/**
+ * 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 AbstractAdapter from './abstract';
+import Converter from 'yarn-ui/utils/converter';
+
+export default AbstractAdapter.extend({
+  address: "timelineWebAddress",
+  restNameSpace: "timelineV2",
+  serverName: "ATS",
+
+  urlForQuery(query/*, modelName*/) {
+    var url = this._buildURL();
+    var appId = query.appId;
+    query.fields = 'ALL';
+    delete query.appId;
+    return url + '/apps/' + appId + "/entities/YARN_APPLICATION_ATTEMPT";
+  },
+
+  urlForFindRecord(id/*, modelName, snapshot*/) {
+    var url = this._buildURL();
+    return url + '/apps/' + Converter.attemptIdToAppId(id) +
+      "/entities/YARN_APPLICATION_ATTEMPT/" + id + "?fields=ALL";
+  }
+
+});

+ 40 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-timeline-container.js

@@ -0,0 +1,40 @@
+/**
+ * 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 AbstractAdapter from './abstract';
+import Converter from 'yarn-ui/utils/converter';
+
+export default AbstractAdapter.extend({
+  address: "timelineWebAddress",
+  restNameSpace: "timelineV2",
+  serverName: "ATS",
+
+  urlForQuery(query/*, modelName*/){
+    var url = this._buildURL();
+    var app_attempt_id = query.app_attempt_id;
+    query.fields = 'ALL';
+    delete query.app_attempt_id;
+    url = url + '/apps/' + Converter.attemptIdToAppId(app_attempt_id) +
+        '/entities/YARN_CONTAINER';
+    return url;
+  },
+
+  pathForType(/*modelName*/) {
+    return '';
+  }
+});

+ 38 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/app.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';
+import Resolver from 'ember-resolver';
+import loadInitializers from 'ember/load-initializers';
+import config from './config/environment';
+import Sorter from 'yarn-ui/utils/sorter';
+
+var App;
+
+Ember.MODEL_FACTORY_INJECTIONS = true;
+
+App = Ember.Application.extend({
+  modulePrefix: config.modulePrefix,
+  podModulePrefix: config.podModulePrefix,
+  Resolver
+});
+
+loadInitializers(App, config.modulePrefix);
+Sorter.initDataTableSorter();
+
+export default App;

+ 22 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/app-attempt-table.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.Component.extend({
+});

+ 22 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/app-table.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.Component.extend({
+});

+ 60 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/app-timeout-bar.js

@@ -0,0 +1,60 @@
+/**
+ * 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 Converter from 'yarn-ui/utils/converter';
+
+export default Ember.Component.extend({
+  app: null,
+
+  appTimeoutValue: function() {
+    var timeoutValueInSecs = this.get("app.remainingTimeoutInSeconds");
+    if (timeoutValueInSecs > -1) {
+      return Converter.msToElapsedTime(timeoutValueInSecs * 1000);
+    } else {
+      return timeoutValueInSecs;
+    }
+  }.property("app.remainingTimeoutInSeconds"),
+
+  isAppTimedOut: function() {
+    if (this.get("app.remainingTimeoutInSeconds") > 0) {
+      return false;
+    } else {
+      return true;
+    }
+  }.property("app.remainingTimeoutInSeconds"),
+
+  appTimeoutBarStyle: function() {
+    var remainingInSecs = this.get("app.remainingTimeoutInSeconds"),
+        expiryTimestamp = Converter.dateToTimeStamp(this.get("app.applicationExpiryTime")),
+        expiryInSecs = expiryTimestamp / 1000,
+        startTimestamp = Converter.dateToTimeStamp(this.get("app.startTime")),
+        startInSecs = startTimestamp / 1000,
+        totalRunInSecs = 0,
+        appRunDurationInSecs = 0,
+        width = 0;
+
+    if (remainingInSecs > 0) {
+      totalRunInSecs = expiryInSecs - startInSecs;
+      appRunDurationInSecs = totalRunInSecs - remainingInSecs;
+      width = appRunDurationInSecs / totalRunInSecs * 100;
+    }
+
+    return "width: " + width + "%";
+  }.property("app.remainingTimeoutInSeconds", "app.applicationExpiryTime", "app.startTime")
+});

+ 59 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/app-usage-donut-chart.js

@@ -0,0 +1,59 @@
+/**
+ * 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 BaseUsageDonutChart from 'yarn-ui/components/base-usage-donut-chart';
+import ColorUtils from 'yarn-ui/utils/color-utils';
+import HrefAddressUtils from 'yarn-ui/utils/href-address-utils';
+
+export default BaseUsageDonutChart.extend({
+  colors: d3.scale.category20().range(),
+
+  draw: function() {
+    var usageByApps = [];
+    var avail = 100;
+
+    this.get("data").forEach(function (app) {
+      var v = app.get("clusterUsagePercentage");
+      if (v > 1e-2) {
+        usageByApps.push({
+          label: app.get("id"),
+          link: HrefAddressUtils.getApplicationLink(app.get("id")),
+          value: v.toFixed(2)
+        });
+
+        avail = avail - v;
+      }
+    }.bind(this));
+
+    usageByApps.sort(function(a,b) {
+      return b.value - a.value;
+    });
+
+    usageByApps = this.mergeLongTails(usageByApps, 8);
+
+    usageByApps.push({
+      label: "Available",
+      value: avail.toFixed(4)
+    });
+
+    this.colors = ColorUtils.getColors(usageByApps.length, ["others", "good"], true);
+
+    this.renderDonutChart(usageByApps, this.get("title"), this.get("showLabels"),
+      this.get("middleLabel"), "100%", "%");
+  },
+});

+ 123 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/bar-chart.js

@@ -0,0 +1,123 @@
+/**
+ * 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 BaseChartComponent from 'yarn-ui/components/base-chart-component';
+
+export default BaseChartComponent.extend({
+  // data:
+  //    [{label=label1, value=value1}, ...]
+  //    ...
+  renderBarChart: function(data, title, textWidth = 50) {
+    var g = this.chart.g;
+    var layout = this.getLayout();
+    this.renderTitleAndBG(g, title, layout);
+
+    var maxValue = -1;
+    for (var i = 0; i < data.length; i++) {
+      if (data[i] instanceof Array) {
+        if (data[i][0].value > maxValue) {
+          maxValue = data[i][0].value;
+        }
+      } else {
+        if (data[i].value > maxValue) {
+          maxValue = data[i].value;
+        }
+      }
+    }
+
+    var singleBarHeight = 30;
+
+    // 50 is for text
+    var maxBarWidth = layout.x2 - layout.x1 - 2 * layout.margin - textWidth - 50;
+
+    // 30 is for title
+    var maxBarsHeight = layout.y2 - layout.y1 - 2 * layout.margin - 30;
+    var gap = (maxBarsHeight - data.length * singleBarHeight) / (data.length -
+      1);
+
+    var xScaler = d3.scale.linear()
+      .domain([0, maxValue])
+      .range([0, maxBarWidth]);
+
+    var getBarText = function(i) {
+      return data[i].label;
+    };
+    // show bar text
+    for (i = 0; i < data.length; i++) {
+      g.append("text")
+        .text(getBarText(i))
+        .attr("y", layout.y1 + singleBarHeight / 2 + layout.margin +
+          (gap + singleBarHeight) * i + 30)
+        .attr("x", layout.x1 + layout.margin);
+    }
+
+    // show bar
+    var bar = g.selectAll("bars")
+      .data(data)
+      .enter()
+      .append("rect")
+      .attr("y", function(d, i) {
+        return layout.y1 + 30 + layout.margin + (gap + singleBarHeight) * i;
+      })
+      .attr("x", layout.x1 + layout.margin + textWidth)
+      .attr("height", singleBarHeight)
+      .attr("fill", function(d, i) {
+        return this.colors[i];
+      }.bind(this))
+      .attr("width", 0);
+
+    this.bindTooltip(bar);
+
+    bar.transition()
+      .duration(500)
+      .attr("width", function(d) {
+        var w;
+        w = xScaler(d.value);
+        // At least each item has 3 px
+        w = Math.max(w, 3);
+        return w;
+      });
+
+    var getBarValue = function(i) {
+      return data[i].value;
+    };
+    // show bar value
+    for (i = 0; i < data.length; i++) {
+      g.append("text")
+        .text(getBarValue(i))
+        .attr("y", layout.y1 + singleBarHeight / 2 + layout.margin +
+              (gap + singleBarHeight) * i + 30)
+        .attr("x", layout.x1 + layout.margin + textWidth + 15 + xScaler(data[i].value));
+    }
+  },
+
+  draw: function() {
+    this.renderBarChart(this.get("data"), this.get("title"), this.get("textWidth"));
+  },
+
+  _dataChange: Ember.observer("data", function() {
+    this.chart.g.selectAll("*").remove();
+    this.draw();
+  }),
+
+  didInsertElement: function() {
+    this.initChart();
+    this.draw();
+  }
+});

+ 148 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/base-chart-component.js

@@ -0,0 +1,148 @@
+/**
+ * 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 Converter from 'yarn-ui/utils/converter';
+
+export default Ember.Component.extend({
+  tooltip : undefined,
+  colors: d3.scale.category10().range(),
+
+  init: function () {
+    this._super();
+    this.set("chart", {
+      svg: undefined,
+      g: undefined,
+      h: 0,
+      w: 0,
+      tooltip: undefined
+    });
+  },
+
+  initChart: function(removeLast = false) {
+    // Init tooltip if it is not initialized
+    // this.tooltip = d3.select("#chart-tooltip");
+    if (!this.tooltip) {
+      this.tooltip = d3.select("body")
+        .append("div")
+        .attr("class", "tooltip")
+        .attr("id", "chart-tooltip")
+        .style("opacity", 0);
+    }
+
+    var parentId = this.get("parentId");
+
+    if (removeLast) {
+      // Init svg
+      var svg = d3.select("#" + parentId + "-svg");
+      if (svg) {
+        svg.remove();
+      }
+    }
+
+    var parent = d3.select("#" + parentId);
+    var bbox = parent.node().getBoundingClientRect();
+    this.chart.w = bbox.width - 30;
+
+    var ratio = 0.75; // 4:3 by default
+    if (this.get("ratio")) {
+      ratio = this.get("ratio");
+    }
+    this.chart.h = bbox.width * ratio;
+
+    if (this.get("maxHeight")) {
+      this.chart.h = Math.min(this.get("maxHeight"), this.chart.h);
+    }
+
+    this.chart.svg = parent.append("svg")
+      .attr("width", this.chart.w)
+      .attr("height", this.chart.h)
+      .attr("id", parentId + "-svg");
+
+    this.chart.g = this.chart.svg.append("g");
+  },
+
+  renderTitleAndBG: function(g, title, layout, background=true) {
+    var bg = g.append("g");
+    bg.append("text")
+      .text(title)
+      .attr("x", (layout.x1 + layout.x2) / 2)
+      .attr("y", layout.y1 + layout.margin + 20)
+      .attr("class", "chart-title");
+
+    if (background) {
+      bg.append("rect")
+        .attr("x", layout.x1)
+        .attr("y", layout.y1)
+        .attr("width", layout.x2 - layout.x1)
+        .attr("height", layout.y2 - layout.y1)
+        .attr("class", "chart-frame");
+    }
+  },
+
+  bindTooltip: function(d) {
+    d.on("mouseover", function() {
+        this.tooltip
+          .style("left", (d3.event.pageX) + "px")
+          .style("top", (d3.event.pageY - 28) + "px");
+      }.bind(this))
+      .on("mousemove", function(d) {
+        // Handle pie chart case
+        var data = d;
+        if (d.data) {
+          data = d.data;
+        }
+
+        this.tooltip.style("opacity", 0.9);
+        var value = data.value;
+        if (this.get("type") === "memory") {
+          value = Converter.memoryToSimpliedUnit(value);
+        }
+        this.tooltip.html(data.label + " = " + value)
+          .style("left", (d3.event.pageX) + "px")
+          .style("top", (d3.event.pageY - 28) + "px");
+      }.bind(this))
+      .on("mouseout", function() {
+        this.tooltip.style("opacity", 0);
+      }.bind(this));
+  },
+
+  adjustMaxHeight: function(h) {
+    this.chart.svg.attr("height", h);
+  },
+
+  getLayout: function() {
+    var x1 = 0;
+    var y1 = 0;
+    var x2 = this.chart.w;
+    var y2 = this.chart.h;
+
+    var layout = {
+      x1: x1,
+      y1: y1,
+      x2: x2 - 10,
+      y2: y2 - 10,
+      margin: 10
+    };
+    return layout;
+  },
+
+  willDestroy: function() {
+    this.tooltip.remove();
+  }
+});

+ 42 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/base-usage-donut-chart.js

@@ -0,0 +1,42 @@
+/**
+ * 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 DonutChart from 'yarn-ui/components/donut-chart';
+
+export default DonutChart.extend({
+  mergeLongTails: function(usages, nItemsKept) {
+    var arr = [];
+    for (var i = 0; i < Math.min(usages.length, nItemsKept); i++) {
+      arr.push(usages[i]);
+    }
+
+    var others = {
+      label: "Used by others",
+      value: 0
+    };
+
+    for (i = nItemsKept; i < usages.length; i++) {
+      others.value += Number(usages[i].value);
+    }
+    others.value = others.value.toFixed(2);
+
+    arr.push(others);
+
+    return arr;
+  }
+});

+ 31 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/breadcrumb-bar.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';
+
+export default Ember.Component.extend({
+
+  breadcrumbs: null,
+
+  actions:{
+    refresh: function () {
+      this.get("targetObject").send("refresh");
+    }
+  }
+
+});

+ 22 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/container-table.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.Component.extend({
+});

+ 195 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/donut-chart.js

@@ -0,0 +1,195 @@
+/**
+ * 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 BaseChartComponent from 'yarn-ui/components/base-chart-component';
+import ColorUtils from 'yarn-ui/utils/color-utils';
+import Converter from 'yarn-ui/utils/converter';
+
+export default BaseChartComponent.extend({
+  /*
+   * data = [{label="xx", value=},{...}]
+   */
+  renderDonutChart: function(data, title, showLabels = false,
+    middleLabel = "Total", middleValue = undefined, suffix = "") {
+    var g = this.chart.g;
+    var layout = this.getLayout();
+    this.renderTitleAndBG(g, title, layout);
+
+    var total = 0;
+    var allZero = true;
+    for (var i = 0; i < data.length; i++) {
+      total += data[i].value;
+      if (data[i].value > 1e-6) {
+        allZero = false;
+      }
+    }
+
+    if (!middleValue) {
+      if (this.get("type") === "memory") {
+        middleValue = Converter.memoryToSimpliedUnit(total);
+      } else {
+        middleValue = total;
+      }
+    }
+
+    //Width and height
+    var h = layout.y2 - layout.y1;
+
+    // 50 is for title
+    var outerRadius = (h - 50 - 2 * layout.margin) / 2;
+
+    // Ratio of inner radius to outer radius
+    var radiusRatio = 0.75;
+    var innerRadius = outerRadius * radiusRatio;
+
+    var arc = d3.svg.arc()
+      .innerRadius(innerRadius)
+      .outerRadius(outerRadius);
+
+    var cx;
+    var cy = layout.y1 + 50 + layout.margin + outerRadius;
+    if (showLabels) {
+      cx = layout.x1 + layout.margin + outerRadius;
+    } else {
+      cx = (layout.x1 + layout.x2) / 2;
+    }
+
+    var pie = d3.layout.pie();
+    pie.sort(null);
+    pie.value(function(d) {
+      var v = d.value;
+      // make sure it > 0
+      v = Math.max(v, 1e-6);
+      return v;
+    });
+
+    //Set up groups
+    var arcs = g
+      .selectAll("g.arc")
+      .data(pie(data))
+      .enter()
+      .append("g")
+      .attr("class", "arc")
+      .attr("transform", "translate(" + cx + "," + cy + ")");
+
+    function tweenPie(finish) {
+      var start = {
+        startAngle: 0,
+        endAngle: 0
+      };
+      var i = d3.interpolate(start, finish);
+      return function(d) {
+        return arc(i(d));
+      };
+    }
+
+    //Draw arc paths
+    var path = arcs.append("path")
+      .attr("fill", function(d, i) {
+        if (d.value > 1e-6) {
+          return this.colors[i];
+        } else {
+          return "white";
+        }
+      }.bind(this))
+      .attr("d", arc)
+      .attr("stroke", function(d, i) {
+        if (allZero) {
+          return this.colors[i];
+        }
+      }.bind(this));
+    this.bindTooltip(path);
+    path.on("click", function (d) {
+      var data = d.data;
+      if (data.link) {
+        this.tooltip.remove();
+        document.location.href = data.link;
+      }
+    }.bind(this));
+
+    // Show labels
+    if (showLabels) {
+      var lx = layout.x1 + layout.margin + outerRadius * 2 + 30;
+      var squareW = 15;
+      var margin = 10;
+
+      var select = g.selectAll(".rect")
+        .data(data)
+        .enter();
+      select.append("rect")
+        .attr("fill", function(d, i) {
+          return this.colors[i];
+        }.bind(this))
+        .attr("x", lx)
+        .attr("y", function(d, i) {
+          return layout.y1 + 75 + (squareW + margin) * i + layout.margin;
+        })
+        .attr("width", squareW)
+        .attr("height", squareW);
+      select.append("text")
+        .attr("x", lx + squareW + margin)
+        .attr("y", function(d, i) {
+          return layout.y1 + 80 + (squareW + margin) * i + layout.margin + squareW / 2;
+        })
+        .text(function(d) {
+          var value = d.value;
+          if (this.get("type") === "memory") {
+            value = Converter.memoryToSimpliedUnit(value);
+          }
+          return d.label + ' = ' + value + suffix;
+        }.bind(this));
+    }
+
+    if (middleLabel) {
+      var highLightColor = this.colors[0];
+      g.append("text").text(middleLabel).attr("x", cx).attr("y", cy - 10).
+        attr("class", "donut-highlight-text").attr("fill", highLightColor);
+      g.append("text").text(middleValue).attr("x", cx).attr("y", cy + 15).
+        attr("class", "donut-highlight-sub").attr("fill", highLightColor);
+    }
+
+    path.transition()
+      .duration(500)
+      .attrTween('d', tweenPie);
+  },
+
+  _dataChange: Ember.observer("data", function() {
+    this.chart.g.selectAll("*").remove();
+    if(this.get("data")) {
+      this.draw();
+    }
+  }),
+
+  draw: function() {
+    var colorTargets = this.get("colorTargets");
+    if (colorTargets) {
+      var colorTargetReverse = Boolean(this.get("colorTargetReverse"));
+      var targets = colorTargets.split(" ");
+      this.colors = ColorUtils.getColors(this.get("data").length, targets, colorTargetReverse);
+    }
+
+    this.renderDonutChart(this.get("data"), this.get("title"), this.get("showLabels"),
+                          this.get("middleLabel"), this.get("middleValue"));
+  },
+
+  didInsertElement: function() {
+    this.initChart();
+    this.draw();
+  },
+});

+ 23 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/em-table-html-cell.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.Component.extend({
+  content: null
+});

+ 39 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/item-selector.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.Component.extend({
+  didInsertElement: function() {
+    $(".js-example-basic-single").select2(
+      {
+        width: '100%',
+        placeholder: "Select a queue"
+      });
+    var elementId = this.get("element-id");
+    var prefix = this.get("prefix");
+
+    var element = d3.select("#" + elementId);
+
+    if (element) {
+      this.get("model").forEach(function(o) {
+        element.append("option").attr("value", o.get("name")).text(prefix + o.get("name"));
+      });
+    }
+  }
+});

+ 306 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/nodes-heatmap.js

@@ -0,0 +1,306 @@
+/**
+ * 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 BaseChartComponent from 'yarn-ui/components/base-chart-component';
+
+export default BaseChartComponent.extend({
+  CELL_WIDTH: 250,
+  SAMPLE_CELL_WIDTH: 100,
+  SAMPLE_HEIGHT: 30,
+  CELL_HEIGHT: 30,
+  CELL_MARGIN: 2,
+  RACK_MARGIN: 20,
+  filter: "",
+  selectedCategory: 0,
+  memoryLabel: "Memory",
+  cpuLabel: "VCores",
+  containersLabel: "Containers",
+  totalContainers: 0,
+
+  bindTP: function(element, cell) {
+    element.on("mouseover", function() {
+      this.tooltip
+        .style("left", (d3.event.pageX) + "px")
+        .style("top", (d3.event.pageY - 28) + "px");
+      cell.style("opacity", 1.0);
+    }.bind(this))
+      .on("mousemove", function() {
+        // Handle pie chart case
+        var text = cell.attr("tooltiptext");
+
+        this.tooltip.style("opacity", 0.9);
+        this.tooltip.html(text)
+          .style("left", (d3.event.pageX) + "px")
+          .style("top", (d3.event.pageY - 28) + "px");
+      }.bind(this))
+      .on("mouseout", function() {
+        this.tooltip.style("opacity", 0);
+        cell.style("opacity", 0.8);
+      }.bind(this));
+  },
+
+  bindSelectCategory: function(element, i) {
+    element.on("click", function() {
+      if (this.selectedCategory === i) {
+        // Remove selection for second click
+        this.selectedCategory = 0;
+      } else {
+        this.selectedCategory = i;
+      }
+      this.didInsertElement();
+    }.bind(this));
+  },
+
+  isNodeSelected: function(node) {
+    if (this.filter) {
+      var rack = node.get("rack");
+      var host = node.get("nodeHostName");
+      if (!rack.includes(this.filter) && !host.includes(this.filter)) {
+        return false;
+      }
+    }
+
+    if (this.selectedCategory === 0) {
+      return true;
+    }
+
+    var usage = this.calcUsage(node);
+    var lowerLimit = (this.selectedCategory - 1) * 0.2;
+    var upperLimit = this.selectedCategory * 0.2;
+    if (lowerLimit <= usage && usage <= upperLimit) {
+      return true;
+    }
+    return false;
+  },
+
+  // data:
+  //    [{label=label1, value=value1}, ...]
+  //    ...
+  renderCells: function (model, title) {
+    var selectedOption = d3.select("select").property("value");
+    var data = [];
+    model.forEach(function (o) {
+      data.push(o);
+    });
+
+    this.chart.g.remove();
+    this.chart.g = this.chart.svg.append("g");
+    var g = this.chart.g;
+    var layout = this.getLayout();
+    layout.margin = 50;
+
+    let racks = new Set();
+    for (var i = 0; i < data.length; i++) {
+      racks.add(data[i].get("rack"));
+    }
+
+    let racksArray = [];
+    racks.forEach(v => racksArray.push(v));
+
+    var xOffset = layout.margin;
+    var yOffset = layout.margin * 3;
+
+    var colorFunc = d3.interpolate(d3.rgb("#bdddf5"), d3.rgb("#0f3957"));
+
+    var sampleXOffset = (layout.x2 - layout.x1) / 2 - 2.5 * this.SAMPLE_CELL_WIDTH -
+      2 * this.CELL_MARGIN;
+    var sampleYOffset = layout.margin * 2;
+    var text;
+
+    for (i = 1; i <= 5; i++) {
+      var ratio = i * 0.2 - 0.1;
+
+      var rect = g.append("rect")
+        .attr("x", sampleXOffset)
+        .attr("y", sampleYOffset)
+        .attr("fill", this.selectedCategory === i ? "#2ca02c" : colorFunc(ratio))
+        .attr("width", this.SAMPLE_CELL_WIDTH)
+        .attr("height", this.SAMPLE_HEIGHT)
+        .attr("class", "hyperlink");
+      this.bindSelectCategory(rect, i);
+      text = g.append("text")
+        .text("" + (ratio * 100).toFixed(1) + "% Used")
+        .attr("y", sampleYOffset + this.SAMPLE_HEIGHT / 2 + 5)
+        .attr("x", sampleXOffset + this.SAMPLE_CELL_WIDTH / 2)
+        .attr("class", "heatmap-cell hyperlink");
+      this.bindSelectCategory(text, i);
+      sampleXOffset += this.CELL_MARGIN + this.SAMPLE_CELL_WIDTH;
+    }
+
+    if (this.selectedCategory !== 0) {
+      text = g.append("text")
+        .text("Clear")
+        .attr("y", sampleYOffset + this.SAMPLE_HEIGHT / 2 + 5)
+        .attr("x", sampleXOffset + 20)
+        .attr("class", "heatmap-clear hyperlink");
+      this.bindSelectCategory(text, 0);
+    }
+
+    var chartXOffset = -1;
+
+    this.totalContainers = 0;
+    for (i = 0; i < racksArray.length; i++) {
+      text = g.append("text")
+        .text(racksArray[i])
+        .attr("y", yOffset + this.CELL_HEIGHT / 2 + 5)
+        .attr("x", layout.margin)
+        .attr("class", "heatmap-rack");
+
+      if (-1 === chartXOffset) {
+        chartXOffset = layout.margin + text.node().getComputedTextLength() + 30;
+      }
+
+      xOffset = chartXOffset;
+
+      for (var j = 0; j < data.length; j++) {
+        var rack = data[j].get("rack");
+
+        if (rack === racksArray[i]) {
+          this.totalContainers += data[j].get("numContainers");
+          this.addNode(g, xOffset, yOffset, colorFunc, data[j]);
+          xOffset += this.CELL_MARGIN + this.CELL_WIDTH;
+          if (xOffset + this.CELL_MARGIN + this.CELL_WIDTH >= layout.x2 -
+            layout.margin) {
+            xOffset = chartXOffset;
+            yOffset = yOffset + this.CELL_MARGIN + this.CELL_HEIGHT;
+          }
+
+        }
+      }
+
+      while (xOffset > chartXOffset && xOffset + this.CELL_MARGIN +
+        this.CELL_WIDTH < layout.x2 - layout.margin) {
+        this.addPlaceholderNode(g, xOffset, yOffset);
+        xOffset += this.CELL_MARGIN + this.CELL_WIDTH;
+      }
+
+      if (xOffset !== chartXOffset) {
+        xOffset = chartXOffset;
+        yOffset += this.CELL_MARGIN + this.CELL_HEIGHT;
+      }
+      yOffset += this.RACK_MARGIN;
+    }
+
+    layout.y2 = yOffset + layout.margin;
+    this.adjustMaxHeight(layout.y2);
+    this.renderTitleAndBG(g, title + selectedOption + ")" , layout, false);
+  },
+
+  addNode: function (g, xOffset, yOffset, colorFunc, data) {
+    var rect = g.append("rect")
+      .attr("y", yOffset)
+      .attr("x", xOffset)
+      .attr("height", this.CELL_HEIGHT)
+      .attr("fill", colorFunc(this.calcUsage(data)))
+      .attr("width", this.CELL_WIDTH)
+      .attr("tooltiptext", data.get("toolTipText") + this.getToolTipText(data));
+
+    if (this.isNodeSelected(data)) {
+      rect.style("opacity", 0.8);
+      this.bindTP(rect, rect);
+    } else {
+      rect.style("opacity", 0.8);
+      rect.attr("fill", "DimGray");
+    }
+    var node_id = data.get("id"),
+        node_addr = data.get("nodeHTTPAddress"),
+        href = `#/yarn-node/${node_id}/${node_addr}`;
+    var a = g.append("a")
+      .attr("href", href);
+    a.append("text")
+      .text(data.get("nodeHostName"))
+      .attr("y", yOffset + this.CELL_HEIGHT / 2 + 5)
+      .attr("x", xOffset + this.CELL_WIDTH / 2)
+      .attr("class", this.isNodeSelected(data) ? "heatmap-cell" : "heatmap-cell-notselected");
+    if (this.isNodeSelected(data)) {
+      this.bindTP(a, rect);
+    }
+  },
+
+  addPlaceholderNode: function(g, xOffset, yOffset) {
+    g.append("rect")
+      .attr("y", yOffset)
+      .attr("x", xOffset)
+      .attr("height", this.CELL_HEIGHT)
+      .attr("fill", "grey")
+      .attr("width", this.CELL_WIDTH)
+      .style("opacity", 0.20);
+  },
+
+  draw: function() {
+    this.initChart(true);
+    this.renderCells(this.get("model"), this.get("title"), this.get("textWidth"));
+  },
+
+  didInsertElement: function () {
+    var parentId = this.get("parentId");
+    var self = this;
+    var optionsData = [this.memoryLabel, this.cpuLabel, this.containersLabel];
+    d3.select("#heatmap-select")
+      .on('change', function() {
+        self.renderCells(self.get("model"), self.get("title"), self.get("textWidth"));
+      })
+      .selectAll('option')
+      .data(optionsData).enter()
+      .append('option')
+      .text(function (d) { return d; });
+
+    this.draw();
+  },
+
+  actions: {
+    applyFilter: function(event) {
+      this.filter = event.srcElement.value;
+      this.selectedCategory = 0;
+      this.didInsertElement();
+    }
+  },
+
+  calcUsage: function(data) {
+    var selectedOption = d3.select('select').property("value");
+    if (selectedOption === this.memoryLabel) {
+      return data.get("usedMemoryMB") /
+        (data.get("usedMemoryMB") + data.get("availMemoryMB"));
+    }
+    else if (selectedOption === this.cpuLabel) {
+      return data.get("usedVirtualCores") /
+        (data.get("usedVirtualCores") + data.get("availableVirtualCores"));
+    }
+    else if (selectedOption === this.containersLabel) {
+      var totalContainers = this.totalContainers;
+      if (totalContainers === 0) { return 0; }
+      return data.get("numContainers") / totalContainers;
+    }
+  },
+
+  getToolTipText: function(data) {
+    var selectedOption = d3.select('select').property("value");
+    if (selectedOption === this.memoryLabel) {
+      return "<p>Used Memory: " + Math.round(data.get("usedMemoryMB")) + " MB</p>" +
+        "<p>Available Memory: " + Math.round(data.get("availMemoryMB")) + " MB</p>";
+    }
+    else if (selectedOption === this.cpuLabel) {
+      return "<p>Used VCores: " + Math.round(data.get("usedVirtualCores")) + " VCores</p>" +
+        "<p>Available VCores: " + Math.round(data.get("availableVirtualCores")) + " VCores</p>";
+    }
+    else if (selectedOption === this.containersLabel) {
+        return "<p>Containers: " + Math.round(data.get("numContainers")) + " Containers</p>" +
+          "<p>Total Containers: " + this.totalContainers + " Containers</p>";
+    }
+  }
+});

+ 88 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/per-app-memusage-by-nodes-stacked-barchart.js

@@ -0,0 +1,88 @@
+/**
+ * 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 StackedBarchart from 'yarn-ui/components/stacked-barchart';
+import Converter from 'yarn-ui/utils/converter';
+
+export default StackedBarchart.extend({
+  getDataForRender: function(containers, nodes) {
+    var arr = [];
+    var nodeToResources = {};
+    nodes.forEach(function(n) {
+      nodeToResources[n.id] =
+      {
+        used: Number(n.get("usedMemoryMB")),
+        avail: Number(n.get("availMemoryMB"))
+      };
+    });
+
+    containers.forEach(function(c) {
+      res = nodeToResources[c.get("assignedNodeId")];
+      if (res) {
+        if (!res.usedByTheApp) {
+          res.usedByTheApp = 0;
+        }
+        res.usedByTheApp += Number(c.get("allocatedMB"));
+      }
+    });
+
+    for (var nodeId in nodeToResources) {
+      var res = nodeToResources[nodeId];
+
+      var subArr = [];
+      var value = res.usedByTheApp ? res.usedByTheApp : 0;
+      subArr.push({
+        value: value,
+        bindText: "This app uses " + Converter.memoryToSimpliedUnit(value) + ". On node=" + nodeId,
+      });
+
+      value = res.used - value;
+      value = Math.max(value, 0);
+      subArr.push({
+        value: value,
+        bindText: "Other applications uses " + Converter.memoryToSimpliedUnit(value) + ". On node=" + nodeId,
+      });
+
+      subArr.push({
+        value: res.avail,
+        bindText: "Free resource " + Converter.memoryToSimpliedUnit(res.avail) + " . On node=" + nodeId
+      });
+
+      arr.push(subArr);
+    }
+
+    console.log(arr);
+
+    return arr;
+  },
+
+  didInsertElement: function() {
+    this.initChart(true);
+
+    this.colors = ["Orange", "Grey", "LimeGreen"];
+
+    var containers = this.get("rmContainers");
+    var nodes = this.get("nodes");
+
+    var data = this.getDataForRender(containers, nodes);
+
+    this.show(
+      data, this.get("title"), ["Used by this app", "Used by other apps",
+        "Available"]);
+  },
+});

+ 67 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/per-app-ncontainers-by-nodes-stacked-barchart.js

@@ -0,0 +1,67 @@
+/**
+ * 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 StackedBarchart from 'yarn-ui/components/stacked-barchart';
+
+export default StackedBarchart.extend({
+  getDataForRender: function(containers, nodes) {
+    var arr = [];
+    var nodeToContainers = {};
+    nodes.forEach(function(n) {
+      nodeToContainers[n.id] = 0;
+    });
+
+    containers.forEach(function(c) {
+      var nodeId = c.get("assignedNodeId");
+      var n = nodeToContainers[nodeId];
+      if (undefined !== n) {
+        nodeToContainers[nodeId] += 1;
+      }
+    });
+
+    for (var nodeId in nodeToContainers) {
+      var n = nodeToContainers[nodeId];
+
+      var subArr = [];
+      subArr.push({
+        value: n,
+        bindText: "This app has " + n + " containers running on node=" + nodeId
+      });
+
+      arr.push(subArr);
+    }
+
+    console.log(arr);
+
+    return arr;
+  },
+
+  didInsertElement: function() {
+    this.initChart(true);
+
+    this.colors = ["Orange", "Grey", "Gainsboro"];
+
+    var containers = this.get("rmContainers");
+    var nodes = this.get("nodes");
+
+    var data = this.getDataForRender(containers, nodes);
+
+    this.show(
+      data, this.get("title"), ["Running containers from this app"]);
+  },
+});

+ 22 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/queue-configuration-table.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.Component.extend({
+});

+ 22 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/queue-navigator.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.Component.extend({
+});

+ 67 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/queue-usage-donut-chart.js

@@ -0,0 +1,67 @@
+/**
+ * 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 BaseUsageDonutChart from 'yarn-ui/components/base-usage-donut-chart';
+import ColorUtils from 'yarn-ui/utils/color-utils';
+import HrefAddressUtils from 'yarn-ui/utils/href-address-utils';
+
+export default BaseUsageDonutChart.extend({
+  colors: d3.scale.category20().range(),
+
+  draw: function() {
+    var usageByQueues = [];
+    var avail = 100;
+
+    this.get("data").forEach(function (queue) {
+      var v = queue.get("absUsedCapacity");
+
+      if (queue.get("isLeafQueue")) {
+        if (v > 1e-2) {
+          usageByQueues.push({
+            label: queue.get("id"),
+            link: HrefAddressUtils.getQueueLink(queue.get("id")),
+            value: v.toFixed(2)
+          });
+
+          avail = avail - v;
+        }
+      }
+    });
+
+    usageByQueues.sort(function(a, b) {
+      return b.value - a.value;
+    });
+
+    usageByQueues = this.mergeLongTails(usageByQueues, 8);
+
+    usageByQueues.push({
+      label: "Available",
+      value: avail.toFixed(4)
+    });
+
+    this.colors = ColorUtils.getColors(usageByQueues.length, ["others", "good"], true);
+
+    this.renderDonutChart(usageByQueues, this.get("title"), this.get("showLabels"),
+      this.get("middleLabel"), "100%", "%");
+  },
+
+  didInsertElement: function() {
+    this.initChart();
+    this.draw();
+  },
+});

+ 288 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/queue-view.js

@@ -0,0 +1,288 @@
+/**
+ * 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 ChartUtilsMixin from 'yarn-ui/mixins/charts-utils';
+
+export default Ember.Component.extend(ChartUtilsMixin, {
+  queues: {
+    data: undefined,
+    foldedQueues: {},
+    selectedQueueCircle: undefined,
+    maxDepth: -1,
+  },
+
+  queueColors: d3.scale.category20().range(),
+
+  renderQueue: function (now, depth, sequence) {
+    if (depth > this.queues.maxDepth) {
+      this.queues.maxDepth = depth;
+    }
+
+    var cx = 20 + depth * 30;
+    var cy = 20 + sequence * 30;
+    var name = now.get("name");
+
+    var g = this.queues.dataGroup.append("g")
+      .attr("id", "queue-" + name + "-g");
+
+    var folded = this.queues.foldedQueues[name];
+    var isParentQueue = false;
+
+    // render its children
+    var children = [];
+    var childrenNames = now.get("children");
+    if (childrenNames) {
+      childrenNames.forEach(function (name) {
+        isParentQueue = true;
+        var child = this.queues.data[name];
+        if (child) {
+          children.push(child);
+        }
+      }.bind(this));
+    }
+    if (folded) {
+      children = [];
+    }
+    var linefunction = d3.svg.line()
+      .interpolate("basis")
+      .x(function (d) {
+        return d.x;
+      })
+      .y(function (d) {
+        return d.y;
+      });
+
+    for (var i = 0; i < children.length; i++) {
+      sequence = sequence + 1;
+      // Get center of children queue
+      var cc = this.renderQueue(children[i],
+        depth + 1, sequence);
+      g.append("path")
+        .attr("class", "queue")
+        .attr("d", linefunction([{
+          x: cx,
+          y: cy
+        }, {
+          x: cc.x - 20,
+          y: cc.y
+        }, cc]));
+    }
+
+    var circle = g.append("circle")
+      .attr("cx", cx)
+      .attr("cy", cy)
+      .attr("class", "queue");
+
+    circle.on('mouseover', function () {
+    }.bind(this));
+    circle.on('mouseout', function () {
+      if (circle !== this.queues.selectedQueueCircle) {
+        circle.style("fill", this.queueColors[0]);
+      }
+    }.bind(this));
+    circle.on('click', function () {
+      circle.style("fill", this.queueColors[2]);
+      var pre = this.queues.selectedQueueCircle;
+      this.queues.selectedQueueCircle = circle;
+      if (pre) {
+        pre.on('mouseout')();
+      }
+      this.renderCharts(name);
+    }.bind(this));
+    circle.on('dblclick', function () {
+      if (!isParentQueue) {
+        return;
+      }
+
+      if (this.queues.foldedQueues[name]) {
+        delete this.queues.foldedQueues[name];
+      } else {
+        this.queues.foldedQueues[name] = now;
+      }
+      this.renderQueues();
+    }.bind(this));
+
+    var text = name;
+    if (folded) {
+      text = name + " (+)";
+    }
+
+    // print queue's name
+    g.append("text")
+      .attr("x", cx + 30)
+      .attr("y", cy + 5)
+      .text(text)
+      .attr("class", "queue");
+
+    return {
+      x: cx,
+      y: cy
+    };
+  },
+
+  renderQueues: function () {
+    if (this.queues.dataGroup) {
+      this.queues.dataGroup.remove();
+    }
+    // render queues
+    this.queues.dataGroup = this.canvas.svg.append("g")
+      .attr("id", "queues-g");
+
+    if (this.queues.data) {
+      this.renderQueue(this.queues.data['root'], 0, 0);
+
+    }
+  },
+
+  draw: function () {
+    this.queues.data = {};
+    this.get("model")
+      .forEach(function (o) {
+        this.queues.data[o.id] = o;
+      }.bind(this));
+
+    // get w/h of the svg
+    var bbox = d3.select("#main-container")
+      .node()
+      .getBoundingClientRect();
+    this.canvas.w = bbox.width;
+    this.canvas.h = Math.max(Object.keys(this.queues.data)
+        .length * 35, 1500);
+
+    this.canvas.svg = d3.select("#main-container")
+      .append("svg")
+      .attr("width", this.canvas.w)
+      .attr("height", this.canvas.h)
+      .attr("id", "main-svg");
+
+    this.renderBackground();
+
+    this.renderQueues();
+    this.renderCharts("root");
+  },
+
+  didInsertElement: function () {
+    this.draw();
+  },
+
+  /*
+   * data = [{label="xx", value=},{...}]
+   */
+  renderTable: function (data) {
+    d3.select("#main-svg")
+      .append('table')
+      .selectAll('tr')
+      .data(data)
+      .enter()
+      .append('tr')
+      .selectAll('td')
+      .data(function (d) {
+        return d;
+      })
+      .enter()
+      .append('td')
+      .text(function (d) {
+        return d;
+      });
+  },
+
+  renderQueueCapacities: function (queue, layout) {
+    // Render bar chart
+    this.renderCells(this.charts.g, [{
+      label: "Cap",
+      value: queue.get("capacity")
+    }, {
+      label: "MaxCap",
+      value: queue.get("maxCapacity")
+    }, {
+      label: "UsedCap",
+      value: queue.get("usedCapacity")
+    }], "Queue Capacities", layout, 60);
+  },
+
+  renderChildrenCapacities: function (queue, layout) {
+    var data = [];
+    var children = queue.get("children");
+    if (children) {
+      for (var i = 0; i < children.length; i++) {
+        var child = this.queues.data[children[i]];
+        data.push({
+          label: child.get("name"),
+          value: child.get("capacity")
+        });
+      }
+    }
+
+    this.renderDonutChart(this.charts.g, data, "Children Capacities", layout, true);
+  },
+
+  renderChildrenUsedCapacities: function (queue, layout) {
+    var data = [];
+    var children = queue.get("children");
+    if (children) {
+      for (var i = 0; i < children.length; i++) {
+        var child = this.queues.data[children[i]];
+        data.push({
+          label: child.get("name"),
+          value: child.get("usedCapacity")
+        });
+      }
+    }
+
+    this.renderDonutChart(this.charts.g, data, "Children Used Capacities", layout, true);
+  },
+
+  renderLeafQueueUsedCapacities: function (layout) {
+    var leafQueueUsedCaps = [];
+    for (var queueName in this.queues.data) {
+      var q = this.queues.data[queueName];
+      if ((!q.get("children")) || q.get("children")
+          .length === 0) {
+        // it's a leafqueue
+        leafQueueUsedCaps.push({
+          label: q.get("name"),
+          value: q.get("usedCapacity")
+        });
+      }
+    }
+
+    this.renderDonutChart(this.charts.g, leafQueueUsedCaps, "LeafQueues Used Capacities",
+      layout, true);
+  },
+
+  renderCharts: function (queueName) {
+    this.charts.leftBannerLen = this.queues.maxDepth * 30 + 100;
+    this.initCharts();
+
+    var queue = this.queues.data[queueName];
+    var idx = 0;
+
+    if (queue.get("name") === "root") {
+      this.renderLeafQueueUsedCapacities(this.getLayout(idx++));
+    }
+    if (queue.get("name") !== "root") {
+      this.renderQueueCapacities(queue, this.getLayout(idx++));
+    }
+    if (queue.get("children") && queue.get("children")
+        .length > 0) {
+      this.renderChildrenCapacities(queue, this.getLayout(idx++));
+      this.renderChildrenUsedCapacities(queue, this.getLayout(idx++));
+    }
+  },
+});

+ 206 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/simple-bar-chart.js

@@ -0,0 +1,206 @@
+/**
+ * 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({
+  data: [],
+  xAxisTickFormatter: null,
+  yAxisTickFormatter: null,
+  xAxisText: '',
+  yAxisText: '',
+  enableTooltip: true,
+  onBarChartClickCallback: Ember.K,
+  hideTootlipOnBarChartClick: true,
+
+  initChart() {
+    this.height = 400;
+    this.barWidth = 30;
+    this.width = Math.max(500, 40 * this.data.length);
+  },
+
+  drawChart() {
+    var margin = {top: 20, right: 20, bottom: 100, left: 100},
+        axisLabelPadding = 10,
+        width = this.width - margin.left - margin.right - axisLabelPadding,
+        height = this.height - margin.top - margin.bottom - axisLabelPadding,
+        xAxisText = this.xAxisText? this.xAxisText : '',
+        yAxisText = this.yAxisText? this.yAxisText : '',
+        data = this.data,
+        self = this;
+
+    var xScale = d3.scale.ordinal().rangeRoundBands([0, width], 0.1);
+    var yScale = d3.scale.linear().range([height, 0]);
+
+    var xAxis = d3.svg.axis()
+        .scale(xScale)
+        .orient("bottom")
+        .tickFormat(function(tick) {
+          if (self.isFunction(self.xAxisTickFormatter)) {
+            return self.xAxisTickFormatter(tick);
+          } else {
+            return tick;
+          }
+        });
+
+    var yAxis = d3.svg.axis()
+        .scale(yScale)
+        .orient("left")
+        .tickFormat(function(tick) {
+          if (self.isFunction(self.yAxisTickFormatter)) {
+            return self.yAxisTickFormatter(tick);
+          } else {
+            return tick;
+          }
+        });
+
+    var svg = d3.select(this.element)
+      .append("svg")
+        .attr("class", "simple-bar-chart")
+        .attr("width", width + margin.left + margin.right + axisLabelPadding)
+        .attr("height", height + margin.top + margin.bottom + axisLabelPadding)
+      .append("g")
+        .attr("transform", "translate("+(margin.left+axisLabelPadding)+","+(margin.top)+")");
+
+    xScale.domain(data.map(function(d) { return d.label; }));
+    yScale.domain([0, d3.max(data, function(d) { return d.value; })]);
+
+    var gx = svg.append("g")
+        .attr("class", "x axis")
+        .attr("transform", "translate(0," + height + ")")
+        .call(xAxis);
+
+    gx.selectAll("text")
+        .style("text-anchor", "end")
+        .attr("dx", "-.8em")
+        .attr("dy", "-.3em")
+        .attr("transform", "rotate(-60)");
+
+    gx.append("text")
+        .attr("transform", "translate("+(width/2)+","+(margin.bottom)+")")
+        .style("text-anchor", "middle")
+        .text(xAxisText);
+
+    var gy = svg.append("g")
+        .attr("class", "y axis")
+        .call(yAxis);
+
+    gy.append("text")
+        .attr("transform", "translate("+(-margin.left)+","+(height/2)+")rotate(-90)")
+        .style("text-anchor", "middle")
+        .text(yAxisText);
+
+    var barWidth = this.barWidth;
+    var minBarWidth = Math.min(barWidth, xScale.rangeBand());
+    var bars = svg.selectAll("bar")
+        .data(data)
+      .enter().append("rect")
+        .attr("x", function(d) {
+          var padding = 0;
+          var rangeBand = xScale.rangeBand();
+          if ((rangeBand - barWidth) > 0) {
+            padding = (rangeBand - barWidth) / 2;
+          }
+          return xScale(d.label) + padding;
+        })
+        .attr("width", minBarWidth)
+        .attr("y", function() {
+          return yScale(0);
+        })
+        .attr("height", function() {
+          return height - yScale(0);
+        })
+        .on('click', function(d) {
+          if (self.enableTooltip && self.hideTootlipOnBarChartClick) {
+            self.hideTootlip();
+          }
+          if (self.isFunction(self.onBarChartClickCallback)) {
+            self.onBarChartClickCallback(d);
+          }
+        });
+
+    bars.transition()
+        .duration(1000)
+        .delay(100)
+        .attr("y", function(d) {
+          return yScale(d.value);
+        })
+        .attr("height", function(d) {
+          return height - yScale(d.value);
+        });
+
+    if (this.enableTooltip) {
+      this.bindTooltip(bars);
+    }
+  },
+
+  bindTooltip(bars) {
+    var self = this;
+    var tooltip = this.tooltip;
+    if (tooltip) {
+      bars.on("mouseenter", function(d) {
+        tooltip.html(d.tooltip);
+        self.showTooltip();
+      }).on("mousemove", function() {
+        tooltip.style("left", (d3.event.pageX + 5) + "px")
+            .style("top", (d3.event.pageY - 25) + "px");
+      }).on("mouseout", function() {
+        self.hideTootlip();
+      });
+    }
+  },
+
+  initTooltip() {
+    this.tooltip = d3.select("body")
+        .append("div")
+        .attr("class", "tooltip simple-barchart-tooltip")
+        .style("opacity", 1);
+
+    this.hideTootlip();
+  },
+
+  hideTootlip() {
+    if (this.tooltip) {
+     this.tooltip.style("display", "none");
+    }
+  },
+
+  showTooltip() {
+    if (this.tooltip) {
+     this.tooltip.style("display", "block");
+    }
+  },
+
+  isFunction(func) {
+    return Ember.typeOf(func) === "function";
+  },
+
+  didInsertElement() {
+    this.initChart();
+    if (this.enableTooltip) {
+      this.initTooltip();
+    }
+    this.drawChart();
+  },
+
+  willDestroyElement() {
+    if (this.tooltip) {
+      this.tooltip.remove();
+    }
+  }
+});

+ 81 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/simple-table.js

@@ -0,0 +1,81 @@
+
+/**
+ * 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({
+  didInsertElement: function() {
+    var paging = this.get("paging") ? true : this.get("paging");
+    var ordering = this.get("ordering") ? true : this.get("ordering");
+    var info = this.get("info") ? true : this.get("info");
+    var bFilter = this.get("bFilter") ? true : this.get("bFilter");
+    var defaultSearch = this.get("defaultSearch") ? this.get("defaultSearch") : "";
+
+    // Defines sorter for the columns if not default.
+    // Can also specify a custom sorter.
+    var i;
+    var colDefs = [];
+    if (this.get("colTypes")) {
+      var typesArr = this.get("colTypes").split(' ');
+      var targetsArr = this.get("colTargets").split(' ');
+      for (i = 0; i < typesArr.length; i++) {
+        console.log(typesArr[i] + " " + targetsArr[i]);
+        colDefs.push({
+          type: typesArr[i],
+          targets: parseInt(targetsArr[i])
+        });
+      }
+    }
+    // Defines initial column and sort order.
+    var orderArr = [];
+    if (this.get("colsOrder")) {
+      var cols = this.get("colsOrder").split(' ');
+      for (i = 0; i < cols.length; i++) {
+        var col = cols[i].split(',');
+        if (col.length !== 2) {
+          continue;
+        }
+        var order = col[1].trim();
+        if (order !== 'asc' && order !== 'desc') {
+          continue;
+        }
+        var colOrder = [];
+        colOrder.push(parseInt(col[0]));
+        colOrder.push(order);
+        orderArr.push(colOrder);
+      }
+    }
+    if (orderArr.length === 0) {
+      var defaultOrder = [0, 'asc'];
+      orderArr.push(defaultOrder);
+    }
+    console.log(orderArr[0]);
+    Ember.$('#' + this.get('table-id')).DataTable({
+      "paging":   paging,
+      "ordering": ordering,
+      "info":     info,
+      "bFilter": bFilter,
+      "order": orderArr,
+      "columnDefs": colDefs,
+      "oSearch": {
+        "sSearch": defaultSearch
+      }
+    });
+  }
+});

+ 201 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/stacked-barchart.js

@@ -0,0 +1,201 @@
+/**
+ * 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 BaseChartComponent from 'yarn-ui/components/base-chart-component';
+
+export default BaseChartComponent.extend({
+  MAX_BAR_HEIGHT: 120,
+  MAX_BAR_WIDTH: 30,
+  GAP: 5,
+  filter: "",
+  WIDTH_OF_SAMPLE: 200,
+
+  bindTP: function(element) {
+    element.on("mouseover", function() {
+      this.tooltip
+        .style("left", (d3.event.pageX) + "px")
+        .style("top", (d3.event.pageY - 28) + "px");
+      element.style("opacity", 1.0);
+    }.bind(this))
+      .on("mousemove", function() {
+        // Handle pie chart case
+        var text = element.attr("tooltiptext");
+
+        this.tooltip.style("opacity", 0.9);
+        this.tooltip.html(text)
+          .style("left", (d3.event.pageX) + "px")
+          .style("top", (d3.event.pageY - 28) + "px");
+      }.bind(this))
+      .on("mouseout", function() {
+        this.tooltip.style("opacity", 0);
+        element.style("opacity", 0.8);
+      }.bind(this));
+
+    element.on("click", function() {
+      if (element.attr("link")) {
+        this.tooltip.remove();
+        document.location.href = element.attr("link");
+      }
+    }.bind(this));
+  },
+
+  printSamples: function(n, layout, g, colorTitles) {
+    var yOffset = layout.margin * 3;
+
+    for (var i = 0; i < n; i++) {
+      var xOffset = layout.x2 - this.WIDTH_OF_SAMPLE - layout.margin;
+      g.append("rect").
+        attr("fill", this.colors[i]).
+        attr("x", xOffset).
+        attr("y", yOffset).
+        attr("width", 20).
+        attr("height", 20);
+
+      g.append("text").
+        attr("x", xOffset + 30).
+        attr("y", yOffset + 10).
+        text(colorTitles[i]);
+
+      yOffset = yOffset + 30;
+    }
+  },
+
+  // data:
+  //    [[{value=xx, bindText=xx}, {value=yy, bindText=yy}],  [  ...    ]]
+  //     __________________________________________________   ___________
+  //                          bar-1                              bar-2
+  show: function (data, title, colorTitles) {
+    var width = this.MAX_BAR_WIDTH;
+    var height = this.MAX_BAR_HEIGHT;
+
+    this.chart.g.remove();
+    this.chart.g = this.chart.svg.append("g");
+    var g = this.chart.g;
+    var layout = this.getLayout();
+    layout.margin = 50;
+
+    var nBarPerRow = Math.floor((layout.x2 - layout.x1 - 3 * layout.margin -
+      this.WIDTH_OF_SAMPLE) /
+      (width + this.GAP));
+
+    var xOffset;
+    var yOffset = layout.margin * 2;
+
+    var maxValue = 0;
+    var maxN = 0;
+
+    var i = 0;
+    var j = 0;
+
+    for (i = 0; i < data.length; i++) {
+      var total = 0;
+      for (j = 0; j < data[i].length; j++) {
+        total += data[i][j].value;
+      }
+
+      if (total > maxValue) {
+        maxValue = total;
+      }
+      if (data[i].length > maxN) {
+        maxN = data[i].length;
+      }
+    }
+
+    // print samples
+    this.printSamples(maxN, layout, g, colorTitles);
+
+    // print data
+    data.sort(function(a, b) {
+      return b[0].value - a[0].value;
+    });
+
+    for (i = 0; i < data.length; i++) {
+      if (i % nBarPerRow === 0) {
+        xOffset = layout.margin;
+        yOffset += layout.margin + height;
+      }
+
+      var leftTopY = yOffset;
+      for (j = 0; j < data[i].length; j++) {
+        var dy = data[i][j].value * height / maxValue;
+        if (dy > 0) {
+          leftTopY = leftTopY - dy;
+
+          var node = g.append("rect").
+            attr("fill", this.colors[j]).
+            attr("x", xOffset).
+            attr("y", leftTopY).
+            attr("width", width).
+            attr("height", dy).
+            attr("tooltiptext",
+              (data[i][j].bindText) ? data[i][j].bindText : data[i][j].value).
+            attr("link", data[i][j].link)
+            .style("opacity", 0.8);
+
+          this.bindTP(node);
+        }
+      }
+
+      if (data[i].length === 1) {
+        g.append("text")
+          .text(data[i][0].value)
+          .attr("y", leftTopY - 10)
+          .attr("x", xOffset + width / 2)
+          .attr("class", "heatmap-cell")
+          .style("fill", "black");
+      }
+
+      xOffset += width + this.GAP;
+    }
+
+    layout.y2 = yOffset + layout.margin;
+    this.adjustMaxHeight(layout.y2);
+    this.renderTitleAndBG(g, title, layout, false);
+  },
+
+  draw: function() {
+    this.initChart(true);
+    //Mock.initMockNodesData(this);
+
+    // mock data
+    var arr = [];
+    for (var i = 0; i < 5; i++) {
+      var subArr = [];
+      for (var j = 0; j < Math.random() * 4 + 1; j++) {
+        subArr.push({
+          value : Math.abs(Math.random())
+        });
+      }
+      arr.push(subArr);
+    }
+
+    this.show(
+      arr, this.get("title"));
+  },
+
+  didInsertElement: function () {
+    this.draw();
+  },
+
+  actions: {
+    applyFilter: function(event) {
+      this.filter = event.srcElement.value;
+      this.didInsertElement();
+    }
+  }
+});

+ 261 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/sunburst-chart.js

@@ -0,0 +1,261 @@
+/**
+ * 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({
+
+  didInsertElement: function() {
+    var json = buildHierarchy(this.get("arr"));
+    createVisualization(json);
+  },
+
+});
+// Dimensions of sunburst.
+var  width = 1000;
+var  height = 750;
+var  radius = Math.min(width, height) / 2;
+// Breadcrumb dimensions: width, height, spacing, width of tip/tail.
+var  b = { w: 225, h: 30, s: 3, t: 10 };
+// Total size of all segments; we set this later, after loading the data.
+var totalSize = 0;
+var vis = null;
+var  partition = null;
+var  arc = null;
+var colors = d3.scale.category20c();
+
+function colorMap(d) {
+  return colors(d.name);
+}
+
+// Given a node in a partition layout, return an array of all of its ancestor
+// nodes, highest first, but excluding the root.
+function  getAncestors(node) {
+  var path = [];
+  var current = node;
+  while (current.parent) {
+    path.unshift(current);
+    current = current.parent;
+  }
+  return path;
+}
+
+// Main function to draw and set up the visualization, once we have the data.
+function createVisualization(json) {
+  partition = d3.layout.partition()
+      .size([2 * Math.PI, radius * radius])
+      .value(function(d) { return d.size; });
+  arc = d3.svg.arc()
+      .startAngle(function(d) { return d.x; })
+      .endAngle(function(d) { return d.x + d.dx; })
+      .innerRadius(function(d) { return Math.sqrt(d.y); })
+      .outerRadius(function(d) { return Math.sqrt(d.y + d.dy); });
+  // Basic setup of page elements.
+  initializeBreadcrumbTrail();
+  //drawLegend();
+  //d3.select("#togglelegend").on("click", toggleLegend);
+
+  // Bounding circle underneath the sunburst, to make it easier to detect
+  // when the mouse leaves the parent g.
+  vis = d3.select("#chart").append("svg:svg")
+      .attr("width", width)
+      .attr("height", height)
+      .append("svg:g")
+      .attr("id", "container")
+      .attr("transform", "translate(" + width / 2 + "," + height / 2 + ")");
+  vis.append("svg:circle").attr("r", radius)
+      .style("opacity", 0);
+
+  // For efficiency, filter nodes to keep only those large enough to see.
+  var nodes = partition.nodes(json)
+    .filter(function(d) {
+      return (d.dx > 0.005); // 0.005 radians = 0.29 degrees
+    });
+
+  var path = vis.data([json]).selectAll("path")
+    .data(nodes)
+    .enter().append("svg:path")
+    .attr("display", function(d) { return d.depth ? null : "none"; })
+    .attr("d", arc)
+    .attr("fill-rule", "evenodd")
+    .attr("fill", colorMap)
+    .style("opacity", 1)
+    .on("mouseover", mouseover);
+  // Add the mouseleave handler to the bounding circle.
+  d3.select("#container").on("mouseleave", mouseleave);
+
+  // Get total size of the tree = value of root node from partition.
+  totalSize = path.node().__data__.value;
+}
+
+  // Take a 2-column CSV and transform it into a hierarchical structure suitable
+  // for a partition layout. The first column is a sequence of step names, from
+  // root to leaf, separated by hyphens. The second column is a count of how
+  // often that sequence occurred.
+function  buildHierarchy(csv) {
+  var root = {"name": "root", "children": []};
+  for (var i = 0; i < csv.length; i++) {
+    var sequence = csv[i][0];
+    var size = +csv[i][1];
+    if (isNaN(size)) { // e.g. if this is a header row
+      continue;
+    }
+    var parts = sequence.split("-");
+    var currentNode = root;
+    for (var j = 0; j < parts.length; j++) {
+      var children = currentNode["children"];
+      var nodeName = parts[j];
+      var childNode;
+      if (j + 1 < parts.length) {
+        // Not yet at the end of the sequence; move down the tree.
+        var foundChild = false;
+        for (var k = 0; k < children.length; k++) {
+          if (children[k]["name"] === nodeName) {
+            childNode = children[k];
+            foundChild = true;
+            break;
+          }
+        }
+        // If we don't already have a child node for this branch, create it.
+        if (!foundChild) {
+          childNode = {"name": nodeName, "children": []};
+          children.push(childNode);
+        }
+        currentNode = childNode;
+      } else {
+        // Reached the end of the sequence; create a leaf node.
+        childNode = {"name": nodeName, "size": size, "children": [], "sequence": sequence};
+        children.push(childNode);
+      }
+    }
+  }
+  return root;
+}
+
+// Fade all but the current sequence, and show it in the breadcrumb trail.
+function mouseover(d) {
+  //var percentage = (100 * d.value / totalSize).toPrecision(3);
+  //var percentageString = percentage + "%";
+  var percentageString = d.value;
+
+  d3.select("#percentage").html('<p align="center" style="font-size: 150%;"><b>' + percentageString +
+      '</b></p><br/><p align="center">(' + d.name + ')</p>');
+  d3.select("#explanation").style("visibility", "");
+
+  var sequenceArray = getAncestors(d);
+  updateBreadcrumbs(sequenceArray, percentageString);
+
+  // Fade all the segments.
+  d3.selectAll("path").style("opacity", 0.2);
+
+  // Then highlight only those that are an ancestor of the current segment.
+  vis.selectAll("path")
+    .filter(function(node) {
+        return (sequenceArray.indexOf(node) >= 0);
+    })
+    .style("opacity", 1);
+}
+
+// Restore everything to full opacity when moving off the visualization.
+function mouseleave() {
+  // Hide the breadcrumb trail
+  d3.select("#trail").style("visibility", "hidden");
+
+  // Deactivate all segments during transition.
+  d3.selectAll("path").on("mouseover", null);
+
+  // Transition each segment to full opacity and then reactivate it.
+  d3.selectAll("path")
+    .transition()
+    .duration(1000)
+    .style("opacity", 1)
+    .each("end", function() {
+      d3.select(this).on("mouseover", mouseover);
+    });
+
+  d3.select("#explanation")
+    .style("visibility", "hidden");
+}
+
+function initializeBreadcrumbTrail() {
+  // Add the svg area.
+  var trail = d3.select("#sequence").append("svg:svg")
+    .attr("width", width)
+    .attr("height", 50)
+    .attr("id", "trail");
+  // Add the label at the end, for the percentage.
+  trail.append("svg:text")
+    .attr("id", "endlabel")
+    .style("fill", "#000");
+}
+
+// Generate a string that describes the points of a breadcrumb polygon.
+function breadcrumbPoints(d, i) {
+  var points = [];
+  points.push("0,0");
+  points.push(b.w + ",0");
+  points.push(b.w + b.t + "," + (b.h / 2));
+  points.push(b.w + "," + b.h);
+  points.push("0," + b.h);
+  if (i > 0) { // Leftmost breadcrumb; don't include 6th vertex.
+    points.push(b.t + "," + (b.h / 2));
+  }
+  return points.join(" ");
+}
+
+// Update the breadcrumb trail to show the current sequence and percentage.
+function updateBreadcrumbs(nodeArray, percentageString) {
+  // Data join; key function combines name and depth (= position in sequence).
+  var g = d3.select("#trail")
+      .selectAll("g")
+      .data(nodeArray, function(d) { return d.name + d.depth; });
+
+  // Add breadcrumb and label for entering nodes.
+  var entering = g.enter().append("svg:g");
+
+  entering.append("svg:polygon")
+      .attr("points", breadcrumbPoints)
+      .attr("fill", colorMap);
+
+  entering.append("svg:text")
+      .attr("x", (b.w + b.t) / 2)
+      .attr("y", b.h / 2)
+      .attr("dy", "0.35em")
+      .attr("text-anchor", "middle")
+      .text(function(d) { return d.name; });
+
+  // Set position for entering and updating nodes.
+  g.attr("transform", function(d, i) {
+    return "translate(" + i * (b.w + b.s) + ", 0)";
+  });
+
+  // Remove exiting nodes.
+  g.exit().remove();
+
+  // Now move and update the percentage at the end.
+  d3.select("#trail").select("#endlabel")
+      .attr("x", (nodeArray.length + 0.5) * (b.w + b.s))
+      .attr("y", b.h / 2)
+      .attr("dy", "0.35em")
+      .attr("text-anchor", "middle")
+      .text(percentageString);
+
+  // Make the breadcrumb trail visible, if it's hidden.
+  d3.select("#trail")
+      .style("visibility", "");
+}

+ 480 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/timeline-view.js

@@ -0,0 +1,480 @@
+/**
+ * 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 Converter from 'yarn-ui/utils/converter';
+import ColumnDef from 'em-table/utils/column-definition';
+
+export default Ember.Component.extend({
+  canvas: {
+    svg: undefined,
+    h: 0,
+    w: 0,
+    tooltip: undefined
+  },
+
+  clusterMetrics: undefined,
+  modelArr: [],
+  colors: d3.scale.category10().range(),
+  _selected: undefined,
+  gridColumns: [],
+  gridRows: [],
+  serviceName: undefined,
+
+  selected: function() {
+    return this._selected;
+  }.property(),
+
+  tableComponentName: function() {
+    return "app-attempt-table";
+  }.property(),
+
+  setSelected: function(d) {
+    var dom;
+
+    if (this._selected === d) {
+      return;
+    }
+
+    // restore color
+    if (this._selected) {
+      dom = d3.select("#timeline-bar-" + this._selected.get("id"));
+      dom.attr("fill", this.colors[0]);
+    }
+
+    this._selected = d;
+    this.set("selected", d);
+    dom = d3.select("#timeline-bar-" + d.get("id"));
+    dom.attr("fill", this.colors[1]);
+  },
+
+  getPerItemHeight: function() {
+    var arrSize = this.modelArr.length;
+
+    if (arrSize < 20) {
+      return 30;
+    } else if (arrSize < 100) {
+      return 10;
+    } else {
+      return 2;
+    }
+  },
+
+  getPerItemGap: function() {
+    var arrSize = this.modelArr.length;
+
+    if (arrSize < 20) {
+      return 5;
+    } else if (arrSize < 100) {
+      return 1;
+    } else {
+      return 1;
+    }
+  },
+
+  getCanvasHeight: function() {
+    return (this.getPerItemHeight() + this.getPerItemGap()) * this.modelArr.length + 200;
+  },
+
+  draw: function(start, end) {
+    // get w/h of the svg
+    var bbox = d3.select("#" + this.get("parent-id"))
+      .node()
+      .getBoundingClientRect();
+    this.canvas.w = bbox.width;
+    this.canvas.h = this.getCanvasHeight();
+
+    this.canvas.svg = d3.select("#" + this.get("parent-id"))
+      .append("svg")
+      .attr("width", this.canvas.w)
+      .attr("height", this.canvas.h)
+      .attr("id", this.get("my-id"));
+    this.renderTimeline(start, end);
+  },
+
+  renderTimeline: function(start, end) {
+    var border = 30;
+    var singleBarHeight = this.getPerItemHeight();
+    var gap = this.getPerItemGap();
+    var textWidth = 200;
+    /*
+     start-time                              end-time
+      |--------------------------------------|
+         ==============
+                ==============
+                        ==============
+                              ===============
+     */
+    var xScaler = d3.scale.linear()
+      .domain([start, end])
+      .range([0, this.canvas.w - 2 * border - textWidth]);
+
+    /*
+     * Render frame of timeline view
+     */
+    this.canvas.svg.append("line")
+      .attr("x1", border + textWidth)
+      .attr("y1", border - 5)
+      .attr("x2", this.canvas.w - border)
+      .attr("y2", border - 5)
+      .attr("class", "chart");
+
+    this.canvas.svg.append("line")
+      .attr("x1", border + textWidth)
+      .attr("y1", border - 10)
+      .attr("x2", border + textWidth)
+      .attr("y2", border - 5)
+      .attr("class", "chart");
+
+    this.canvas.svg.append("line")
+      .attr("x1", this.canvas.w - border)
+      .attr("y1", border - 10)
+      .attr("x2", this.canvas.w - border)
+      .attr("y2", border - 5)
+      .attr("class", "chart");
+
+    this.canvas.svg.append("text")
+        .text(Converter.timeStampToDate(start))
+        .attr("y", border - 15)
+        .attr("x", border + textWidth)
+        .attr("class", "bar-chart-text")
+        .attr("text-anchor", "left");
+
+    this.canvas.svg.append("text")
+        .text(Converter.timeStampToDate(end))
+        .attr("y", border - 15)
+        .attr("x", this.canvas.w - border)
+        .attr("class", "bar-chart-text")
+        .attr("text-anchor", "end");
+
+    // show bar
+    var bar = this.canvas.svg.selectAll("bars")
+      .data(this.modelArr)
+      .enter()
+      .append("rect")
+      .attr("y", function(d, i) {
+        return border + (gap + singleBarHeight) * i;
+      })
+      .attr("x", function(d) {
+        return border + textWidth + xScaler(d.get("startTs"));
+      })
+      .attr("height", singleBarHeight)
+      .attr("fill", function() {
+        return this.colors[0];
+      }.bind(this))
+      .attr("width", function(d) {
+        var finishedTs = xScaler(d.get("finishedTs"));
+        finishedTs = finishedTs > 0 ? finishedTs : xScaler(end);
+        return finishedTs - xScaler(d.get("startTs"));
+      })
+      .attr("id", function(d) {
+        return "timeline-bar-" + d.get("id");
+      });
+    bar.on("click", function(d) {
+      this.setSelected(d);
+    }.bind(this));
+
+    this.bindTooltip(bar);
+
+    if (this.modelArr.length <= 20) {
+      // show bar texts
+      for (var i = 0; i < this.modelArr.length; i++) {
+        this.canvas.svg.append("text")
+          .text(this.modelArr[i].get(this.get("label")))
+          .attr("y", border + (gap + singleBarHeight) * i + singleBarHeight / 2)
+          .attr("x", border)
+          .attr("class", "bar-chart-text");
+      }
+    }
+  },
+
+  bindTooltip: function(d) {
+    d.on("mouseover", function() {
+        this.tooltip
+          .style("left", (d3.event.pageX) + "px")
+          .style("top", (d3.event.pageY - 28) + "px");
+      }.bind(this))
+      .on("mousemove", function(d) {
+        this.tooltip.style("opacity", 0.9);
+        this.tooltip.html(d.get("tooltipLabel"))
+          .style("left", (d3.event.pageX) + "px")
+          .style("top", (d3.event.pageY - 28) + "px");
+      }.bind(this))
+      .on("mouseout", function() {
+        this.tooltip.style("opacity", 0);
+      }.bind(this));
+  },
+
+  initTooltip: function() {
+    this.tooltip = d3.select("body")
+      .append("div")
+      .attr("class", "tooltip")
+      .attr("id", "chart-tooltip")
+      .style("opacity", 0);
+  },
+
+  didInsertElement: function() {
+    // init tooltip
+    this.initTooltip();
+    this.modelArr = [];
+
+    // init model
+    if (this.get("rmModel")) {
+      this.get("rmModel").forEach(function(o) {
+        if(!this.modelArr.contains(o)) {
+          this.modelArr.push(o);
+        }
+      }.bind(this));
+    }
+
+    if (this.get("tsModel")) {
+      this.get("tsModel").forEach(function(o) {
+        if(!this.modelArr.contains(o)) {
+          this.modelArr.push(o);
+        }
+      }.bind(this));
+    }
+
+    if(this.modelArr.length === 0) {
+      return;
+    }
+
+    this.modelArr.sort(function(a, b) {
+      var tsA = a.get("startTs");
+      var tsB = b.get("startTs");
+
+      return tsA - tsB;
+    });
+    var begin = 0;
+    if (this.modelArr.length > 0) {
+      begin = this.modelArr[0].get("startTs");
+    }
+    var end = 0;
+    for (var i = 0; i < this.modelArr.length; i++) {
+      var ts = this.modelArr[i].get("finishedTs");
+      if (ts > end) {
+        end = ts;
+      }
+    }
+    if (end < begin) {
+      end = Date.now();
+    }
+
+    this.draw(begin, end);
+
+    if (this.modelArr.length > 0) {
+      this.setSelected(this.modelArr[0]);
+    }
+
+    if (this.get('attemptModel')) {
+      this.setAttemptsGridColumnsAndRows();
+    } else {
+      this.setContainersGridColumnsAndRows();
+    }
+  },
+
+  setAttemptsGridColumnsAndRows: function() {
+    var self = this;
+    var columns = [];
+    var serviceName = this.get('serviceName');
+
+    columns.push({
+      id: 'id',
+      headerTitle: 'Attempt ID',
+      contentPath: 'id',
+      cellComponentName: 'em-table-linked-cell',
+      minWidth: '300px',
+      getCellContent: function(row) {
+        var attemptId = row.get('id');
+        var query = serviceName? '?service='+serviceName : '';
+        return {
+          displayText: attemptId,
+          href: `#/yarn-app-attempt/${attemptId}${query}`
+        };
+      }
+    }, {
+      id: 'attemptStartedTime',
+      headerTitle: 'Started Time',
+      contentPath: 'attemptStartedTime'
+    }, {
+      id: 'finishedTime',
+      headerTitle: 'Finished Time',
+      contentPath: 'finishedTime',
+      getCellContent: function(row) {
+        if (row.get('finishedTs')) {
+          return row.get('finishedTime');
+        }
+        return 'N/A';
+      }
+    }, {
+      id: 'elapsedTime',
+      headerTitle: 'Elapsed Time',
+      contentPath: 'elapsedTime'
+    }, {
+      id: 'appMasterContainerId',
+      headerTitle: 'AM Container ID',
+      contentPath: 'appMasterContainerId',
+      minWidth: '350px'
+    }, {
+      id: 'amNodeId',
+      headerTitle: 'AM Node ID',
+      contentPath: 'amNodeId'
+    }, {
+      id: 'attemptState',
+      headerTitle: 'State',
+      contentPath: 'attemptState',
+      getCellContent: function(row) {
+        var state = row.get('attemptState');
+        if (state) {
+          return state;
+        } else {
+          return 'N/A';
+        }
+      }
+    }, {
+      id: 'nodeHttpAddress',
+      headerTitle: 'NodeManager Web UI',
+      contentPath: 'nodeHttpAddress',
+      cellComponentName: 'em-table-html-cell',
+      getCellContent: function(row) {
+        var address = self.checkHttpProtocol(row.get('nodeHttpAddress'));
+        if (address) {
+          return `<a href="${address}" target="_blank">${address}</a>`;
+        } else {
+          return 'N/A';
+        }
+      }
+    }, {
+      id: 'logsLink',
+      headerTitle: 'Logs',
+      contentPath: 'logsLink',
+      cellComponentName: 'em-table-html-cell',
+      getCellContent: function(row) {
+        var logUrl = self.checkHttpProtocol(row.get('logsLink'));
+        if (logUrl) {
+          return `<a href="${logUrl}" target="_blank">Link</a>`;
+        } else {
+          return 'N/A';
+        }
+      }
+    });
+
+    var gridCols = ColumnDef.make(columns);
+    this.set('gridColumns', gridCols);
+    this.set('gridRows', this.modelArr);
+  },
+
+  setContainersGridColumnsAndRows: function() {
+    var self = this;
+    var columns = [];
+
+    columns.push({
+      id: 'id',
+      headerTitle: 'Container ID',
+      contentPath: 'id',
+      minWidth: '350px'
+    }, {
+      id: 'startedTime',
+      headerTitle: 'Started Time',
+      contentPath: 'startedTime'
+    }, {
+      id: 'finishedTime',
+      headerTitle: 'Finished Time',
+      contentPath: 'finishedTime',
+      getCellContent: function(row) {
+        if (row.get('finishedTs')) {
+          return row.get('finishedTime');
+        }
+        return 'N/A';
+      }
+    }, {
+      id: 'elapsedTime',
+      headerTitle: 'Elapsed Time',
+      contentPath: 'elapsedTime'
+    }, {
+      id: 'priority',
+      headerTitle: 'Priority',
+      contentPath: 'priority'
+    }, {
+      id: 'containerExitStatus',
+      headerTitle: 'Exit Status',
+      contentPath: 'containerExitStatus',
+      getCellContent: function(row) {
+        var status = row.get('containerExitStatus');
+        if (status) {
+          return status;
+        } else {
+          return 'N/A';
+        }
+      }
+    }, {
+      id: 'containerState',
+      headerTitle: 'State',
+      contentPath: 'containerState',
+      getCellContent: function(row) {
+        var state = row.get('containerState');
+        if (state) {
+          return state;
+        } else {
+          return 'N/A';
+        }
+      }
+    }, {
+      id: 'logUrl',
+      headerTitle: 'Logs',
+      contentPath: 'logUrl',
+      cellComponentName: 'em-table-html-cell',
+      getCellContent: function(row) {
+        var url = self.checkHttpProtocol(row.get('logUrl'));
+        if (url) {
+          return `<a href="${url}" target="_blank">${url}</a>`;
+        } else {
+          return 'N/A';
+        }
+      }
+    }, {
+      id: 'nodeHttpAddress',
+      headerTitle: 'Node Manager UI',
+      contentPath: 'nodeHttpAddress',
+      cellComponentName: 'em-table-html-cell',
+      getCellContent: function(row) {
+        var address = self.checkHttpProtocol(row.get('nodeHttpAddress'));
+        if (address) {
+          return `<a href="${address}" target="_blank">${address}</a>`;
+        } else {
+          return 'N/A';
+        }
+      }
+    });
+
+    var gridCols = ColumnDef.make(columns);
+    this.set('gridColumns', gridCols);
+    this.set('gridRows', this.modelArr);
+  },
+
+  checkHttpProtocol: function(prop) {
+    if (prop && prop.indexOf('://') < 0) {
+      prop = 'http://' + prop;
+    }
+    return prop;
+  },
+
+  isDataEmpty: Ember.computed(function() {
+    return this.modelArr.length === 0;
+  })
+});

+ 304 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/tree-selector.js

@@ -0,0 +1,304 @@
+/**
+ * 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';
+
+const INBETWEEN_HEIGHT = 130;
+
+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,
+
+  used: undefined,
+  max: 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.used = this.get("used");
+    this.max = this.get("max");
+    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…
+    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() { return "translate(" + source.y0 + "," + source.x0 + ")"; })
+      .on("click", function(d){
+        if (d.queueData.get("name") !== this.get("selected")) {
+            document.location.href = "#/yarn-queues/" + d.queueData.get("name") + "!";
+        }
+
+        Ember.run.later(this, function () {
+          var treeWidth = this.maxDepth * 200;
+          var treeHeight = this.numOfLeafQueue * INBETWEEN_HEIGHT;
+          var tree = d3.layout.tree().size([treeHeight, treeWidth]);
+          var diagonal = d3.svg.diagonal()
+            .projection(function(d) { return [d.y, d.x]; });
+
+          this.update(this.treeData, this.treeData, tree, diagonal);
+        }, 100);
+
+      }.bind(this))
+    .on("dblclick", function (d) {
+      document.location.href = "#/yarn-queue/" + d.queueData.get("name") + "/info";
+    });
+
+    nodeEnter.append("circle")
+      .attr("r", 1e-6)
+      .style("fill", function(d) {
+        var maxCap = d.queueData.get(this.max);
+        maxCap = maxCap == undefined ? 100 : maxCap;
+        var usedCap = d.queueData.get(this.used) / maxCap * 100.0;
+        if (usedCap <= 60.0) {
+          return "LimeGreen";
+        } else if (usedCap <= 100.0) {
+          return "DarkOrange";
+        } else {
+          return "LightCoral";
+        }
+      }.bind(this));
+
+    // append percentage
+    nodeEnter.append("text")
+      .attr("x", function() { return 0; })
+      .attr("dy", ".35em")
+      .attr("fill", "white")
+      .attr("text-anchor", function() { return "middle"; })
+      .text(function(d) {
+        var maxCap = d.queueData.get(this.max);
+        maxCap = maxCap == undefined ? 100 : maxCap;
+        var usedCap = d.queueData.get(this.used) / maxCap * 100.0;
+        if (usedCap >= 100.0) {
+          return usedCap.toFixed(0) + "%";
+        } else {
+          return usedCap.toFixed(1) + "%";
+        }
+      }.bind(this))
+      .style("fill-opacity", 1e-6);
+
+    // append queue name
+    nodeEnter.append("text")
+      .attr("x", "0px")
+      .attr("dy", "45px")
+      .attr("text-anchor", "middle")
+      .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", 30)
+      .attr("href",
+        function(d) {
+          return "#/yarn-queues/" + d.queueData.get("name");
+        })
+      .style("stroke-width", function(d) {
+        if (d.queueData.get("name") === this.get("selected")) {
+          return 7;
+        } else {
+          return 2;
+        }
+      }.bind(this))
+      .style("stroke", function(d) {
+        if (d.queueData.get("name") === this.get("selected")) {
+          return "gray";
+        } 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() { 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…
+    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() {
+        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() {
+        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 * INBETWEEN_HEIGHT;
+    var width = treeWidth + margin.left + margin.right;
+    var height = treeHeight + margin.top + margin.bottom;
+
+    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(window.frameElement).style("height", height);
+
+    this.update(root, root, tree, diagonal);
+  },
+
+  didInsertElement: function() {
+   this.reDraw();
+  }
+});

+ 24 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/config.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.
+ */
+
+/**
+ * Host and port configurations
+ */
+
+export default {
+};

+ 24 - 0
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: '!',
+};

+ 163 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/app-table-columns.js

@@ -0,0 +1,163 @@
+/**
+ * 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 ColumnDef from 'em-table/utils/column-definition';
+import TableDef from 'em-table/utils/table-definition';
+
+export default Ember.Controller.extend({
+  tableDefinition: TableDef.create({
+    sortColumnId: 'stTime',
+    sortOrder: 'desc'
+  }),
+
+  columns: function() {
+      var colums = [];
+      colums.push({
+          id: 'appId',
+          headerTitle: 'Application ID',
+          contentPath: 'id',
+          cellComponentName: 'em-table-linked-cell',
+          minWidth: "250px",
+          getCellContent: function(row) {
+            return {
+              displayText: row.id,
+              href: `#/yarn-app/${row.id}/info`
+            };
+          }
+      }, {
+          id: 'appType',
+          headerTitle: 'Application Type',
+          contentPath: 'applicationType',
+      }, {
+          id: 'appName',
+          headerTitle: 'Application Name',
+          contentPath: 'appName',
+      }, {
+          id: 'appUsr',
+          headerTitle: 'User',
+          contentPath: 'user',
+          minWidth: "50px"
+      }, {
+          id: 'queue',
+          headerTitle: 'Queue',
+          contentPath: 'queue',
+      }, {
+          id: 'state',
+          headerTitle: 'State',
+          contentPath: 'state',
+          cellComponentName: 'em-table-status-cell',
+          minWidth: "50px"
+      }, {
+          id: 'progress',
+          headerTitle: 'Progress',
+          contentPath: 'progress',
+          cellComponentName: 'em-table-progress-cell',
+          cellDefinition: {
+            valueMax: 100
+          }
+      }, {
+          id: 'stTime',
+          headerTitle: 'Start Time',
+          contentPath: 'startTime',
+      }, {
+          id: 'elTime',
+          headerTitle: 'Elapsed Time',
+          contentPath: 'elapsedTime',
+          cellDefinition: {
+            type: "duration"
+          }
+      }, {
+          id: 'finishTime',
+          headerTitle: 'Finished Time',
+          contentPath: 'validatedFinishedTs',
+          observePath: true
+      }, {
+          id: 'priority',
+          headerTitle: 'Priority',
+          contentPath: 'priority',
+      }, {
+          id: 'cluster',
+          headerTitle: '%Cluster',
+          contentPath: 'clusterUsagePercentage',
+          observePath: true
+      });
+      return ColumnDef.make(colums);
+  }.property(),
+
+  serviceColumns: function() {
+    var colums = [];
+    colums.push({
+      id: 'appName',
+      headerTitle: 'Service Name',
+      contentPath: 'appName',
+      minWidth: "200px",
+      cellComponentName: 'em-table-linked-cell',
+      getCellContent: function(row) {
+        return {
+          displayText: row.get('appName'),
+          href: `#/yarn-app/${row.id}/info?service=${row.get('appName')}`
+        };
+      }
+    }, {
+      id: 'appId',
+      headerTitle: 'Application ID',
+      contentPath: 'id',
+      minWidth: "250px"
+    }, {
+      id: 'state',
+      headerTitle: 'State',
+      contentPath: 'state',
+      cellComponentName: 'em-table-status-cell',
+      minWidth: "50px"
+    }, {
+      id: 'cluster',
+      headerTitle: '%Cluster',
+      contentPath: 'clusterUsagePercentage',
+      observePath: true
+    }, {
+      id: 'elTime',
+      headerTitle: 'Elapsed Time',
+      contentPath: 'elapsedTime',
+      cellDefinition: {
+        type: "duration"
+      },
+      minWidth: "200px"
+    }, {
+        id: 'appUsr',
+        headerTitle: 'User',
+        contentPath: 'user',
+        minWidth: "50px"
+    }, {
+        id: 'queue',
+        headerTitle: 'Queue',
+        contentPath: 'queue',
+    }, {
+      id: 'stTime',
+      headerTitle: 'Started Time',
+      contentPath: 'startTime',
+    }, {
+      id: 'finishTime',
+      headerTitle: 'Finished Time',
+      contentPath: 'validatedFinishedTs',
+      observePath: true
+    });
+    return ColumnDef.make(colums);
+  }.property(),
+});

+ 55 - 0
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 === 'yarn-queue') {
+      html = html + ' class="active"';
+    }
+    html = html + '><a href="yarn-queue/root">Queues<span class="sr-only">' +
+        '(current)</span></a></li><li';
+    if (path.lastIndexOf('yarn-app', 0) === 0) {
+      html = html + ' class="active"';
+    }
+    html = html + '><a href="yarn-apps">Applications<span class="sr-only">' +
+        '(current)</span></a></li><li';
+    if (path === 'cluster-overview') {
+      html = html + ' class="active"';
+    }
+    html = html + '><a href="cluster-overview">Cluster Overview<span class=' +
+        '"sr-only">(current)</span></a></li><li';
+    if (path.lastIndexOf('yarn-node', 0) === 0) {
+      html = html + ' class="active"';
+    }
+    html = html + '><a href="yarn-nodes">Nodes<span class="sr-only">' +
+        '(current)</span></a></li>';
+    return Ember.String.htmlSafe(html);
+  }.property('currentPath')
+});
+

+ 32 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/cluster-overview.js

@@ -0,0 +1,32 @@
+/**
+ * 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,
+
+  breadcrumbs: [{
+    text: "Home",
+    routeName: 'application'
+  }, {
+    text: "Cluster Overview",
+    routeName: 'cluster-overview',
+  }]
+
+});

+ 64 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-app-attempt.js

@@ -0,0 +1,64 @@
+/**
+ * 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({
+  queryParams: ["service"],
+  service: undefined,
+
+  breadcrumbs: Ember.computed("model.attempt.appId", function () {
+    var appId = this.get("model.attempt.appId");
+    var attemptId = this.get("model.attempt.id");
+    var serviceName = this.get('service');
+    var breadcrumbs = [{
+      text: "Home",
+      routeName: 'application'
+    },{
+      text: "Applications",
+      routeName: 'yarn-apps.apps'
+    }, {
+      text: `App [${appId}]`,
+      href: `#/yarn-app/${appId}/info`
+    }, {
+      text: "Attempts",
+      href: `#/yarn-app/${appId}/attempts`
+    }, {
+      text: `Attempt [${attemptId}]`
+    }];
+    if (serviceName) {
+      breadcrumbs = [{
+        text: "Home",
+        routeName: 'application'
+      }, {
+        text: "Services",
+        routeName: 'yarn-services'
+      }, {
+        text: `${serviceName} [${appId}]`,
+        href: `#/yarn-app/${appId}/info?service=${serviceName}`
+      }, {
+        text: "Attempts",
+        href: `#/yarn-app/${appId}/attempts?service=${serviceName}`
+      }, {
+        text: `Attempt [${attemptId}]`
+      }];
+    }
+    return breadcrumbs;
+  })
+
+});

+ 62 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-app.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 Ember from 'ember';
+
+export default Ember.Controller.extend({
+  appId: '',
+  serviceName: undefined,
+
+  breadcrumbs: [{
+    text: "Home",
+    routeName: 'application'
+  }, {
+    text: "Applications",
+    routeName: 'yarn-apps.apps'
+  }, {
+    text: 'App'
+  }],
+
+  updateBreadcrumbs(appId, serviceName, tailCrumbs) {
+    var breadcrumbs = [{
+      text: "Home",
+      routeName: 'application'
+    }];
+    if (appId && serviceName) {
+      breadcrumbs.push({
+        text: "Services",
+        routeName: 'yarn-services'
+      }, {
+        text: `${serviceName} [${appId}]`,
+        href: `#/yarn-app/${appId}/info?service=${serviceName}`
+      });
+    } else {
+      breadcrumbs.push({
+        text: "Applications",
+        routeName: 'yarn-apps.apps'
+      }, {
+        text: `App [${appId}]`,
+        href: `#/yarn-app/${appId}/info`
+      });
+    }
+    if (tailCrumbs) {
+      breadcrumbs.pushObjects(tailCrumbs);
+    }
+    this.set('breadcrumbs', breadcrumbs);
+  }
+});

+ 24 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-app/attempts.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({
+  queryParams: ["service"],
+  service: undefined
+});

+ 28 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-app/charts.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.Controller.extend({
+  queryParams: ["service"],
+  service: undefined,
+
+  isRunningApp: Ember.computed('model.app.state', function() {
+    return this.get('model.app.state') === "RUNNING";
+  })
+});

+ 32 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-app/info.js

@@ -0,0 +1,32 @@
+/**
+ * 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({
+  queryParams: ["service"],
+  service: undefined,
+
+  amHostHttpAddressFormatted: Ember.computed('model.app.amHostHttpAddress', function() {
+    var amHostAddress = this.get('model.app.amHostHttpAddress');
+    if (amHostAddress && amHostAddress.indexOf('://') < 0) {
+      amHostAddress = 'http://' + amHostAddress;
+    }
+    return amHostAddress;
+  })
+});

+ 31 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-apps.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';
+
+export default Ember.Controller.extend({
+
+  breadcrumbs: [{
+    text: "Home",
+    routeName: 'application'
+  }, {
+    text: "Applications",
+    routeName: 'yarn-apps.apps',
+  }]
+
+});

+ 31 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-apps/apps.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';
+import TableDefinition from 'em-table/utils/table-definition';
+import AppTableController from '../app-table-columns';
+
+export default AppTableController.extend({
+  queryParams: ['searchText', 'sortColumnId', 'sortOrder', 'pageNum', 'rowCount'],
+  tableDefinition: TableDefinition.create(),
+  searchText: Ember.computed.alias('tableDefinition.searchText'),
+  sortColumnId: Ember.computed.alias('tableDefinition.sortColumnId'),
+  sortOrder: Ember.computed.alias('tableDefinition.sortOrder'),
+  pageNum: Ember.computed.alias('tableDefinition.pageNum'),
+  rowCount: Ember.computed.alias('tableDefinition.rowCount')
+});

+ 43 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-container-log.js

@@ -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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Controller.extend({
+
+  breadcrumbs: Ember.computed('model.nodeInfo', 'model.containerInfo', function () {
+    var nodeInfo = this.get('model.nodeInfo'),
+        containerInfo = this.get('model.containerInfo');
+    return [{
+      text: "Home",
+      routeName: 'application'
+    }, {
+      text: "Nodes",
+      routeName: 'yarn-nodes.table'
+    }, {
+      text: `Node [ ${nodeInfo.id} ]`,
+      href: `#/yarn-node/${nodeInfo.id}/${nodeInfo.addr}`,
+    }, {
+      text: `Container [ ${containerInfo.id} ]`,
+      href: `#/yarn-node-container/${nodeInfo.id}/${nodeInfo.addr}/${containerInfo.id}`,
+    }, {
+      text: "Log",
+    }];
+  })
+
+});

+ 125 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-flow-activity.js

@@ -0,0 +1,125 @@
+/**
+ * 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 TableDef from 'em-table/utils/table-definition';
+import ColumnDef from 'em-table/utils/column-definition';
+import lodash from 'lodash/lodash';
+
+function _createColumns() {
+  var columns = [];
+  columns.push({
+    id: 'flowName',
+    headerTitle: 'Flow Name',
+    contentPath: 'flowName',
+    observePath: true,
+  }, {
+    id: 'user',
+    headerTitle: 'User',
+    contentPath: 'user',
+    observePath: true
+  }, {
+    id: 'uid',
+    headerTitle: 'Flow ID',
+    contentPath: 'uid',
+    observePath: true,
+    cellComponentName: 'em-table-linked-cell',
+    minWidth: "300px",
+    getCellContent: function (row) {
+      return {
+        routeName: 'yarn-flow.info',
+        id: row.get('uid'),
+        displayText: row.get('uid')
+      };
+    }
+  }, {
+    id: 'lastExecDate',
+    headerTitle: 'Last Execution Date',
+    contentPath: 'lastExecDate',
+    observePath: true
+  });
+  return ColumnDef.make(columns);
+}
+
+function _getAggregatedFlowsData(flows) {
+  var aggregatedFlows = [];
+  flows = flows? flows.get('content') : [];
+
+  var aggregated = lodash.groupBy(flows, function(flow) {
+    return flow.getRecord().get('uid');
+  });
+
+  lodash.forIn(aggregated, function(flows) {
+    let flowsInAsc = lodash.sortBy(flows, function(flow) {
+      return flow.getRecord().get('lastExecDate');
+    });
+    let flowsInDesc = flowsInAsc.reverse();
+    aggregatedFlows.push(flowsInDesc[0].getRecord());
+  });
+
+  return aggregatedFlows;
+}
+
+function _createRows(flows) {
+  var data = [],
+      aggregatedFlows = null,
+      row = null;
+
+  aggregatedFlows = _getAggregatedFlowsData(flows);
+
+  aggregatedFlows.forEach(function(flow) {
+    row = Ember.Object.create({
+      user: flow.get('user'),
+      flowName: flow.get('flowName'),
+      uid: flow.get('uid'),
+      lastExecDate: flow.get('lastExecDate')
+    });
+    data.push(row);
+  });
+
+  return Ember.A(data);
+}
+
+export default Ember.Controller.extend({
+  breadcrumbs: [{
+    text: "Home",
+    routeName: 'application'
+  }, {
+    text: "Flow Activities",
+    routeName: 'yarn-flow-activity',
+  }],
+
+  columns: _createColumns(),
+
+  rows: Ember.computed('model', function() {
+    return _createRows(this.get('model'));
+  }),
+
+  tableDefinition: TableDef.create({
+    sortColumnId: 'lastExecDate',
+    sortOrder: 'desc'
+  }),
+
+  getLastFlowExecutionInfoByFlowUid: function(uid) {
+    var aggregatedFlows = _getAggregatedFlowsData(this.get('model'));
+    var recent = aggregatedFlows.find(function(flow) {
+      return flow.get('uid') === uid;
+    });
+    return recent;
+  }
+});

+ 36 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-flow.js

@@ -0,0 +1,36 @@
+/**
+ * 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({
+  breadcrumbs: Ember.computed("model.flowUid", function() {
+    var flowUid = this.get('model.flowUid');
+    return [{
+      text: "Home",
+      routeName: 'application'
+    }, {
+      text: "Flow Activities",
+      routeName: 'yarn-flow-activity'
+    }, {
+      text: `Flow Info [${flowUid}]`,
+      routeName: 'yarn-flow.info',
+      model: flowUid
+    }];
+  })
+});

+ 66 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-flow/info.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';
+import Converter from 'yarn-ui/utils/converter';
+
+export default Ember.Controller.extend({
+  flowUid: function() {
+    return this.get('model.flowUid');
+  }.property('model.flowUid'),
+
+  flowLastExecutionDate: function() {
+    if (this.get('model.lastFlowExecutionInfo')) {
+      return this.get('model.lastFlowExecutionInfo').get('lastExecDate');
+    } else {
+      return '';
+    }
+  }.property('model.lastFlowExecutionInfo'),
+
+  flowInfo: function() {
+    var info = {};
+    var firstRunObj = this.get('model.flowRuns').get('firstObject');
+    info.flowUid = this.get('flowUid');
+    info.flowName = firstRunObj.get('flowName');
+    info.user = firstRunObj.get('user');
+    info.lastExecutionDate = this.get('flowLastExecutionDate');
+    info.firstRunStarted = this.get('earliestStartTime');
+    info.lastRunFinished = this.get('latestFinishTime');
+    return info;
+  }.property('model.flowRuns', 'flowLastExecutionDate'),
+
+  earliestStartTime: function() {
+    var earliestStart = Number.MAX_VALUE;
+    this.get('model.flowRuns').forEach(function(flowrun) {
+      if (flowrun.get('createTimeRaw') < earliestStart) {
+        earliestStart = flowrun.get('createTimeRaw');
+      }
+    });
+    return Converter.timeStampToDate(earliestStart);
+  }.property('model.flowRuns'),
+
+  latestFinishTime: function() {
+    var latestFinish = 0;
+    this.get('model.flowRuns').forEach(function(flowrun) {
+      if (flowrun.get('endTimeRaw') > latestFinish) {
+        latestFinish = flowrun.get('endTimeRaw');
+      }
+    });
+    return Converter.timeStampToDate(latestFinish);
+  }.property('model.flowRuns')
+});

+ 178 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-flow/runs.js

@@ -0,0 +1,178 @@
+/**
+ * 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 TableDef from 'em-table/utils/table-definition';
+import ColumnDef from 'em-table/utils/column-definition';
+import Converter from 'yarn-ui/utils/converter';
+
+function createColumn() {
+  var columns = [];
+
+  // Generate columns
+  columns.push({
+    id: 'runid',
+    headerTitle: 'Run ID',
+    contentPath: 'runid',
+    cellComponentName: 'em-table-linked-cell',
+    minWidth: "300px",
+    getCellContent: function (row) {
+      return {
+        routeName: 'yarn-flowrun.info',
+        id: row.get('uid'),
+        displayText: row.get('shownid')
+      };
+    }
+  });
+
+  columns.push({
+    id: 'runDurationTs',
+    headerTitle: 'Run Duration',
+    contentPath: 'runDurationTs',
+    getCellContent: function(row) {
+      return Converter.msToElapsedTimeUnit(row.get('runDurationTs'));
+    }
+  });
+
+  columns.push({
+    id: 'cpuVCores',
+    headerTitle: 'CPU VCores',
+    contentPath: 'cpuVCores',
+    getCellContent: function(row) {
+      if (row.get('cpuVCores') > -1) {
+        return row.get('cpuVCores');
+      }
+      return 'N/A';
+    }
+  });
+
+  columns.push({
+    id: 'memoryUsed',
+    headerTitle: 'Memory Used',
+    contentPath: 'memoryUsed',
+    getCellContent: function(row) {
+      if (row.get('memoryUsed') > -1) {
+        return Converter.memoryBytesToMB(row.get('memoryUsed'));
+      }
+      return 'N/A';
+    }
+  });
+
+  columns.push({
+    id: 'createTime',
+    headerTitle: 'Creation Time',
+    contentPath: 'createTime'
+  });
+
+  columns.push({
+    id: 'endTime',
+    headerTitle: 'End Time',
+    contentPath: 'endTime'
+  });
+
+  return ColumnDef.make(columns);
+}
+
+export default Ember.Controller.extend({
+  vizWidgets: {
+    runDuration: true,
+    cpuVcores: false,
+    memoryUsed: false
+  },
+
+  actions: {
+    addVizWidget(widget) {
+      Ember.set(this.vizWidgets, widget, true);
+    },
+
+    removeVizWidget(widget) {
+      Ember.set(this.vizWidgets, widget, false);
+    }
+  },
+
+  columns: createColumn(),
+
+  tableDefinition: TableDef.create({
+    sortColumnId: 'createTime',
+    sortOrder: 'desc'
+  }),
+
+  elapsedTimeVizData: function() {
+    var data = [];
+    this.get('model.flowRuns').forEach(function(run) {
+      var vizData = run.getElapsedTimeVizDataForBarChart();
+      if (vizData.value > 0) {
+        data.push(vizData);
+      }
+    });
+    data = this.getSortedVizDataInDesc(data);
+    return this.getRefactoredVizData(data);
+  }.property('model.flowRuns'),
+
+  elapsedTimeFormatter: function(tick) {
+    return Converter.msToElapsedTimeUnit(tick, true);
+  },
+
+  cpuVCoresVizData: function() {
+    var data = [];
+    this.get('model.flowRuns').forEach(function(run) {
+      var vizData = run.getCpuVCoresVizDataForBarChart();
+      if (vizData.value > 0) {
+        data.push(vizData);
+      }
+    });
+    data = this.getSortedVizDataInDesc(data);
+    return this.getRefactoredVizData(data);
+  }.property('model.flowRuns'),
+
+  memoryVizData: function() {
+    var data = [];
+    this.get('model.flowRuns').forEach(function(run) {
+      var vizData = run.getMemoryVizDataForBarChart();
+      if (vizData.value > 0) {
+        data.push(vizData);
+      }
+    });
+    data = this.getSortedVizDataInDesc(data);
+    return this.getRefactoredVizData(data);
+  }.property('model.flowRuns'),
+
+  memoryFormatter: function(tick) {
+    return Converter.memoryBytesToMB(tick);
+  },
+
+  onBarChartClick: function() {
+    var self = this;
+    return function(data) {
+      self.transitionToRoute('yarn-flowrun.info', data.flowrunUid);
+    };
+  }.property(),
+
+  getSortedVizDataInDesc: function(data) {
+    return data.sort(function(d1, d2) {
+      return d2.value - d1.value;
+    });
+  },
+
+  getRefactoredVizData: function(data) {
+    data.forEach(function(viz, idx) {
+      viz.label = "Run " + (++idx);
+    }, this);
+    return data;
+  }
+});

+ 50 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-flowrun.js

@@ -0,0 +1,50 @@
+/**
+ * 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({
+  breadcrumbs: Ember.computed('model.flowrun_uid', 'model.parentFlowUid', function() {
+    var flowRunId = this.get('model.flowrun_uid');
+    var parentFlowUid = this.get('model.parentFlowUid');
+    var crumbs = [{
+      text: "Home",
+      routeName: 'application'
+    }, {
+      text: "Flow Activities",
+      routeName: 'yarn-flow-activity'
+    }];
+    if (parentFlowUid) {
+      crumbs.push({
+        text: `Flow Info [${parentFlowUid}]`,
+        routeName: 'yarn-flow.info',
+        model: parentFlowUid
+      }, {
+        text: `Flow Runs [${parentFlowUid}]`,
+        routeName: 'yarn-flow.runs',
+        model: parentFlowUid
+      });
+    }
+    crumbs.push({
+      text: `Run Info [${flowRunId}]`,
+      routeName: 'yarn-flowrun.info',
+      model: flowRunId
+    });
+    return crumbs;
+  })
+});

+ 157 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-flowrun/info.js

@@ -0,0 +1,157 @@
+/**
+ * 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 ColumnDef from 'em-table/utils/column-definition';
+import Converter from 'yarn-ui/utils/converter';
+
+function createColumn() {
+  var columns = [];
+
+  // Generate columns
+  columns.push({
+    id: 'appId',
+    headerTitle: 'Application ID',
+    contentPath: 'appId',
+    cellComponentName: 'em-table-linked-cell',
+    minWidth: "300px",
+    getCellContent: function (row) {
+      return {
+        routeName: 'yarn-app.info',
+        id: row.get('appId'),
+        displayText: row.get('appId')
+      };
+    }
+  });
+
+  columns.push({
+    id: 'appType',
+    headerTitle: 'Application Type',
+    contentPath: 'type'
+  });
+
+  columns.push({
+    id: 'state',
+    headerTitle: 'State',
+    contentPath: 'state',
+    cellComponentName: 'em-table-status-cell',
+  });
+
+  columns.push({
+    id: 'elapsedTs',
+    headerTitle: 'Elapsed Time',
+    contentPath: 'elapsedTs',
+    getCellContent: function(row) {
+      return Converter.msToElapsedTimeUnit(row.get('elapsedTs'));
+    }
+  });
+
+  columns.push({
+    id: 'cpuVCores',
+    headerTitle: 'CPU VCores',
+    contentPath: 'cpuVCores',
+    getCellContent: function(row) {
+      if (row.get('cpuVCores') > -1) {
+        return row.get('cpuVCores');
+      }
+      return 'N/A';
+    }
+  });
+
+  columns.push({
+    id: 'memoryUsed',
+    headerTitle: 'Memory Used',
+    contentPath: 'memoryUsed',
+    getCellContent: function(row) {
+      if (row.get('memoryUsed') > -1) {
+        return Converter.memoryBytesToMB(row.get('memoryUsed'));
+      }
+      return 'N/A';
+    }
+  });
+
+  return ColumnDef.make(columns);
+}
+
+export default Ember.Controller.extend({
+  vizWidgets: {
+    cpuVcores: true,
+    memoryUsed: false
+  },
+
+  actions: {
+    addVizWidget(widget) {
+      Ember.set(this.vizWidgets, widget, true);
+    },
+
+    removeVizWidget(widget) {
+      Ember.set(this.vizWidgets, widget, false);
+    }
+  },
+
+  columns: createColumn(),
+
+  cpuVCoresVizData: function() {
+    var data = [];
+    this.get('model.apps').forEach(function(app) {
+      var vizData = app.getCpuVCoresVizDataForBarChart();
+      if (vizData.value > 0) {
+        data.push(vizData);
+      }
+    });
+    data = this.getSortedVizDataInDesc(data);
+    return this.getRefactoredVizData(data);
+  }.property('model.apps'),
+
+  memoryVizData: function() {
+    var data = [];
+    this.get('model.apps').forEach(function(app) {
+      var vizData = app.getMemoryVizDataForBarChart();
+      if (vizData.value > 0) {
+        data.push(vizData);
+      }
+    });
+    data = this.getSortedVizDataInDesc(data);
+    return this.getRefactoredVizData(data);
+  }.property('model.apps'),
+
+  memoryFormatter: function(tick) {
+    return Converter.memoryBytesToMB(tick);
+  },
+
+  onBarChartClick: function() {
+    var self = this;
+    return function(data) {
+      self.transitionToRoute('yarn-app', data.appId);
+    };
+  }.property(),
+
+  getSortedVizDataInDesc: function(data) {
+    return data.sort(function(d1, d2) {
+      return d2.value - d1.value;
+    });
+  },
+
+  getRefactoredVizData: function(data) {
+    data.forEach(function(viz, idx) {
+      viz.appId = viz.label;
+      viz.label = "App " + (++idx);
+    }, this);
+    return data;
+  }
+});

+ 126 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-flowrun/metrics.js

@@ -0,0 +1,126 @@
+/**
+ * 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 ColumnDef from 'em-table/utils/column-definition';
+
+function _createColumns() {
+  var columns = [];
+
+  columns.push({
+    id: 'name',
+    headerTitle: 'Name',
+    contentPath: 'name',
+    observePath: true,
+    cellComponentName: 'em-table-html-cell',
+    getCellContent: function(row) {
+      var plainName = row.name;
+      if (plainName.indexOf('MAP:') > -1 || plainName.indexOf('REDUCE:') > -1) {
+        plainName = plainName.substring(plainName.indexOf(':') + 1);
+      }
+      return `<span>${plainName}</span>`;
+    }
+  }, {
+    id: 'value',
+    headerTitle: 'Value',
+    contentPath: 'value',
+    observePath: true
+  });
+
+  return ColumnDef.make(columns);
+}
+
+export default Ember.Controller.extend({
+  mapMetrics: null,
+  reduceMetrics: null,
+  generalMetrics: null,
+
+  columns: Ember.computed(function() {
+    return _createColumns(this.get('model.flowrun_uid'));
+  }),
+
+  metricsObserver: Ember.observer('model.flowrun', function() {
+    var metrics = this.get('model.flowrun.metrics');
+    var mapConfigs = [],
+        reduceConfigs = [],
+        generalConfigs = [];
+
+    metrics.forEach(function(metric) {
+      let id = metric.id;
+      if (id.startsWith('MAP:')) {
+        mapConfigs.push(metric);
+      } else if (id.startsWith('REDUCE:')) {
+        reduceConfigs.push(metric);
+      } else {
+        generalConfigs.push(metric);
+      }
+    }, this);
+
+    this.set('mapMetrics', mapConfigs);
+    this.set('reduceMetrics', reduceConfigs);
+    this.set('generalMetrics', generalConfigs);
+  }),
+
+  mapConfigRows: Ember.computed('mapMetrics', function() {
+    var row = null,
+        data = [];
+
+    this.get('mapMetrics').forEach(function(map) {
+      let value = map.values[Object.keys(map.values)[0]];
+      row = Ember.Object.create({
+        name: map.id,
+        value: value
+      });
+      data.push(row);
+    }, this);
+
+    return Ember.A(data);
+  }),
+
+  reduceConfigRows: Ember.computed('reduceMetrics', function() {
+    var row = null,
+        data = [];
+
+    this.get('reduceMetrics').forEach(function(map) {
+      let value = map.values[Object.keys(map.values)[0]];
+      row = Ember.Object.create({
+        name: map.id,
+        value: value
+      });
+      data.push(row);
+    }, this);
+
+    return Ember.A(data);
+  }),
+
+  generalConfigRows: Ember.computed('generalMetrics', function() {
+    var row = null,
+        data = [];
+
+    this.get('generalMetrics').forEach(function(map) {
+      let value = map.values[Object.keys(map.values)[0]];
+      row = Ember.Object.create({
+        name: map.id,
+        value: value
+      });
+      data.push(row);
+    }, this);
+
+    return Ember.A(data);
+  })
+});

+ 39 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node-app.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.Controller.extend({
+
+  breadcrumbs: Ember.computed('model.nodeInfo', function () {
+    var nodeInfo = this.get('model.nodeInfo');
+    return [{
+      text: "Home",
+      routeName: 'application'
+    }, {
+      text: "Nodes",
+      routeName: 'yarn-nodes.table'
+    }, {
+      text: `Node [ ${nodeInfo.id} ]`,
+      href: `#/yarn-node/${nodeInfo.id}/${nodeInfo.addr}`,
+    }, {
+      text: `Application [ ${nodeInfo.appId} ]`,
+    }];
+  })
+
+});

+ 39 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node-apps.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.Controller.extend({
+
+  breadcrumbs: Ember.computed("model.attempt.appId", function () {
+    var nodeInfo = this.get("model.nodeInfo");
+    return [{
+      text: "Home",
+      routeName: 'application'
+    },{
+      text: "Nodes",
+      routeName: 'yarn-nodes.table'
+    }, {
+      text: `Node [ ${nodeInfo.id} ]`,
+      href: `#/yarn-node/${nodeInfo.id}/${nodeInfo.addr}`
+    }, {
+      text: "Applications",
+    }];
+  })
+
+});

+ 39 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node-container.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.Controller.extend({
+
+  breadcrumbs: Ember.computed("model.nodeInfo", function () {
+    var nodeInfo = this.get("model.nodeInfo");
+    return [{
+      text: "Home",
+      routeName: 'application'
+    },{
+      text: "Nodes",
+      routeName: 'yarn-nodes.table'
+    }, {
+      text: `Node [ ${nodeInfo.id} ]`,
+      href: `#/yarn-node/${nodeInfo.id}/${nodeInfo.addr}`
+    }, {
+      text: `Container [ ${nodeInfo.containerId} ]`
+    }];
+  })
+
+});

+ 39 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node-containers.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.Controller.extend({
+
+  breadcrumbs: Ember.computed("model.nodeInfo", function () {
+    var nodeInfo = this.get("model.nodeInfo");
+    return [{
+      text: "Home",
+      routeName: 'application'
+    },{
+      text: "Nodes",
+      routeName: 'yarn-nodes.table'
+    }, {
+      text: `Node [ ${nodeInfo.id} ]`,
+      href: `#/yarn-node/${nodeInfo.id}/${nodeInfo.addr}`
+    }, {
+      text: "Containers",
+    }];
+  })
+
+});

+ 38 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node.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.Controller.extend({
+
+  breadcrumbs: Ember.computed("model.nodeInfo", function () {
+    var nodeInfo = this.get("model.nodeInfo");
+
+    return [{
+      text: "Home",
+      routeName: 'application'
+    },{
+      text: "Nodes",
+      routeName: 'yarn-nodes.table'
+    }, {
+      text: `Node [ ${nodeInfo.id} ]`,
+      href: `#/yarn-node/${nodeInfo.id}/${nodeInfo.addr}`,
+    }];
+  })
+
+});

+ 36 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-nodes-heatmap.js

@@ -0,0 +1,36 @@
+/**
+ * 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,
+
+  breadcrumbs: [{
+    text: "Home",
+    routeName: 'application'
+  }, {
+    text: "Nodes",
+    routeName: 'yarn-nodes.table',
+  }, {
+    text: "Heatmap",
+    routeName: 'yarn-nodes-heatmap',
+  }]
+
+});

+ 33 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-nodes.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 Ember from 'ember';
+
+export default Ember.Controller.extend({
+  needReload: true,
+  selectedQueue: undefined,
+
+  breadcrumbs: [{
+    text: "Home",
+    routeName: 'application'
+  }, {
+    text: "Nodes",
+    routeName: 'yarn-nodes.table',
+  }]
+
+});

+ 117 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-nodes/table.js

@@ -0,0 +1,117 @@
+/**
+ * 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 ColumnDef from 'em-table/utils/column-definition';
+import TableDefinition from 'em-table/utils/table-definition';
+
+export default Ember.Controller.extend({
+    queryParams: ['searchText', 'sortColumnId', 'sortOrder', 'pageNum', 'rowCount'],
+    tableDefinition: TableDefinition.create(),
+    searchText: Ember.computed.alias('tableDefinition.searchText'),
+    sortColumnId: Ember.computed.alias('tableDefinition.sortColumnId'),
+    sortOrder: Ember.computed.alias('tableDefinition.sortOrder'),
+    pageNum: Ember.computed.alias('tableDefinition.pageNum'),
+    rowCount: Ember.computed.alias('tableDefinition.rowCount'),
+    columns: function() {
+        var colums = [];
+        colums.push({
+            id: 'label',
+            headerTitle: 'Node Label',
+            contentPath: 'nodeLabelsAsString',
+            minWidth: "100px"
+        }, {
+            id: 'rack',
+            headerTitle: 'Rack',
+            contentPath: 'rack',
+            minWidth: "100px"
+        }, {
+            id: 'state',
+            headerTitle: 'Node State',
+            contentPath: 'state',
+            cellComponentName: 'em-table-status-cell',
+            minWidth: "100px"
+        }, {
+            id: 'address',
+            headerTitle: 'Node Address',
+            contentPath: 'id',
+            minWidth: "300px"
+        }, {
+            id: 'nodeId',
+            headerTitle: 'Node HTTP Address',
+            contentPath: 'nodeHTTPAddress',
+            cellComponentName: 'em-table-linked-cell',
+            getCellContent: function(row) {
+              var node_id = row.get("id"),
+                  node_addr = row.get("nodeHTTPAddress"),
+                  href = `#/yarn-node/${node_id}/${node_addr}`;
+                switch(row.get("nodeState")) {
+                case "SHUTDOWN":
+                case "LOST":
+                    href = "";
+                }
+              return {
+                text: row.get("nodeHTTPAddress"),
+                href: href
+              };
+            },
+            minWidth: "250px"
+        }, {
+            id: 'containers',
+            headerTitle: 'Containers',
+            contentPath: 'numContainers',
+        }, {
+            id: 'memUsed',
+            headerTitle: 'Mem Used',
+            contentPath: 'usedMemoryBytes',
+            cellDefinition: {
+              type: "memory"
+            }
+        }, {
+            id: 'memAvail',
+            headerTitle: 'Mem Available',
+            contentPath: 'availMemoryBytes',
+            cellDefinition: {
+              type: "memory"
+            }
+        }, {
+            id: 'coresUsed',
+            headerTitle: 'VCores Used',
+            contentPath: 'usedVirtualCores',
+        }, {
+            id: 'coresAvail',
+            headerTitle: 'VCores Available',
+            contentPath: 'availableVirtualCores',
+        }, {
+            id: 'healthUpdate',
+            headerTitle: 'Last Health Update',
+            contentPath: 'lastHealthUpdate',
+        }, {
+            id: 'healthReport',
+            headerTitle: 'Health-Report',
+            contentPath: 'healthReport',
+        }, {
+            id: 'version',
+            headerTitle: 'Version',
+            contentPath: 'version',
+            observePath: true
+        });
+        return ColumnDef.make(colums);
+    }.property()
+});

+ 53 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-queue.js

@@ -0,0 +1,53 @@
+/**
+ * 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,
+
+  breadcrumbs: Ember.computed("model.selected", "target.currentPath", function () {
+    var queueName = this.get("model.selected");
+    var path = this.get("target.currentPath");
+
+    var crumbs = [{
+      text: "Home",
+      routeName: 'application'
+    }, {
+      text: "Queues",
+      routeName: 'yarn-queues',
+      model: 'root'
+    }, {
+      text: `Queue [ ${queueName} ]`,
+      routeName: 'yarn-queue.info',
+      model: queueName
+    }];
+
+    if (path && path === "yarn-queue.apps") {
+      crumbs.push({
+        text: "Applications",
+        routeName: 'yarn-queue.apps',
+        model: queueName
+      });
+    }
+
+    return crumbs;
+  })
+
+});

+ 31 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-queue/apps.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';
+import TableDefinition from 'em-table/utils/table-definition';
+import AppTableController from '../app-table-columns';
+
+export default AppTableController.extend({
+  // Your custom instance of table definition
+  tableDefinition: TableDefinition.create(),
+
+  // Search text alias, any change in controller's searchText would affect the table's searchText, and vice-versa.
+  _selectedObserver: Ember.on("init", Ember.observer("model.selected", function () {
+    this.set("tableDefinition.searchText", this.get("model.selected"));
+  })),
+});

Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä