You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by yu...@apache.org on 2014/10/16 22:12:14 UTC

[50/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)

http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-admin/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-admin/pom.xml b/ambari-admin/pom.xml
index 559a13d..8251860 100644
--- a/ambari-admin/pom.xml
+++ b/ambari-admin/pom.xml
@@ -15,7 +15,7 @@
    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">
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <parent>
     <groupId>org.apache.ambari</groupId>
     <artifactId>ambari-project</artifactId>
@@ -59,6 +59,89 @@
         </executions>
       </plugin>
       <plugin>
+        <groupId>com.github.eirslett</groupId>
+        <artifactId>frontend-maven-plugin</artifactId>
+        <version>0.0.14</version>
+        <configuration>
+          <nodeVersion>v0.10.26</nodeVersion>
+          <npmVersion>1.4.3</npmVersion>
+          <workingDirectory>src/main/resources/ui/admin-web/</workingDirectory>
+        </configuration>
+        <executions>
+          <execution>
+            <id>install node and npm</id>
+            <phase>generate-sources</phase>
+            <goals>
+              <goal>install-node-and-npm</goal>
+            </goals>
+          </execution>
+          <execution>
+            <id>npm install</id>
+            <phase>generate-sources</phase>
+            <goals>
+              <goal>npm</goal>
+            </goals>
+            <configuration>
+              <arguments>install --unsafe-perm</arguments>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <artifactId>exec-maven-plugin</artifactId>
+        <groupId>org.codehaus.mojo</groupId>
+        <executions>
+          <execution>
+            <id>Bower install</id>
+            <phase>generate-sources</phase>
+            <goals>
+              <goal>exec</goal>
+            </goals>
+            <configuration>
+              <workingDirectory>${basedir}/src/main/resources/ui/admin-web</workingDirectory>
+              <executable>${basedir}/src/main/resources/ui/admin-web/node/${executable.node}</executable>
+              <arguments>
+                <argument>${basedir}/src/main/resources/ui/admin-web/node_modules/bower/bin/bower</argument>
+                <argument>install</argument>
+                <argument>--allow-root</argument>
+              </arguments>
+            </configuration>
+          </execution>
+          <execution>
+            <id>Gulp build</id>
+            <phase>generate-sources</phase>
+            <goals>
+              <goal>exec</goal>
+            </goals>
+            <configuration>
+              <workingDirectory>${basedir}/src/main/resources/ui/admin-web</workingDirectory>
+              <executable>${basedir}/src/main/resources/ui/admin-web/node/${executable.node}</executable>
+              <arguments>
+                <argument>${basedir}/src/main/resources/ui/admin-web/node_modules/gulp/bin/gulp</argument>
+                <argument>build</argument>
+              </arguments>
+            </configuration>
+          </execution>
+          <!--  @TODO: uncomment below execution for triggering ambar-admin UI unit tests from maven test phase.(AMBARI-7600)
+          <execution>
+            <id>unit test</id>
+            <phase>test</phase>
+            <goals>
+              <goal>exec</goal>
+            </goals>
+            <configuration>
+              <workingDirectory>${basedir}/src/main/resources/ui/admin-web</workingDirectory>
+              <executable>npm</executable>
+              <arguments>
+                <argument>run</argument>
+                <argument>test-single-run</argument>
+              </arguments>
+            </configuration>
+          </execution>
+          -->
+        </executions>
+      </plugin>
+      <plugin>
         <artifactId>maven-compiler-plugin</artifactId>
         <version>3.0</version>
       </plugin>
@@ -71,22 +154,91 @@
         </configuration>
       </plugin>
       <plugin>
-          <groupId>org.vafer</groupId>
-          <artifactId>jdeb</artifactId>
-          <version>1.0.1</version>
-          <executions>
-              <execution>
-                  <phase>none</phase>
-                  <goals>
-                      <goal>jdeb</goal>
-                  </goals>
-              </execution>
-          </executions>
-          <configuration>
-              <skip>true</skip>
-              <submodules>false</submodules>
-          </configuration>
+        <groupId>org.vafer</groupId>
+        <artifactId>jdeb</artifactId>
+        <version>1.0.1</version>
+        <executions>
+            <execution>
+                <phase>none</phase>
+                <goals>
+                    <goal>jdeb</goal>
+                </goals>
+            </execution>
+        </executions>
+        <configuration>
+            <skip>true</skip>
+            <submodules>false</submodules>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.rat</groupId>
+        <artifactId>apache-rat-plugin</artifactId>
+        <configuration>
+          <excludes>
+            <exclude>src/main/resources/ui/admin-web/bower_components/**</exclude>
+            <exclude>src/main/resources/ui/admin-web/dist/**</exclude>
+            <exclude>src/main/resources/ui/admin-web/node/**</exclude>
+            <exclude>src/main/resources/ui/admin-web/node_modules/**</exclude>
+            <exclude>src/main/resources/ui/admin-web/app/bower_components/**</exclude>
+            <exclude>src/main/resources/ui/admin-web/test/bower_components/**</exclude>
+            <exclude>src/main/resources/ui/admin-web/mock.js</exclude>
+            <exclude>src/main/resources/ui/admin-web/bower.json</exclude>
+            <exclude>src/main/resources/ui/admin-web/test/bower.json</exclude>
+            <exclude>src/main/resources/ui/admin-web/test/.bowerrc</exclude>
+            <exclude>src/main/resources/ui/admin-web/.bowerrc</exclude>
+            <exclude>src/main/resources/ui/admin-web/package.json</exclude>
+            <exclude>src/main/resources/ui/admin-web/.jshintrc</exclude>
+          </excludes>
+        </configuration>
+        <executions>
+          <execution>
+            <phase>test</phase>
+            <goals>
+              <goal>check</goal>
+            </goals>
+          </execution>
+        </executions>
       </plugin>
     </plugins>
+    <resources>
+      <resource>
+        <directory>src/main/resources</directory>
+        <filtering>false</filtering>
+        <includes>
+          <include>META-INF/**/*</include>
+          <include>view.xml</include>
+        </includes>
+      </resource>
+      <resource>
+        <directory>src/main/resources/ui/admin-web/dist</directory>
+        <filtering>false</filtering>
+      </resource>
+    </resources>
   </build>
+    <profiles>
+    <profile>
+        <id>windows</id>
+        <activation>
+            <os>
+                <family>win</family>
+            </os>
+        </activation>
+        <properties>
+            <envClassifier>win</envClassifier>
+            <executable.node>node.exe</executable.node>
+        </properties>
+    </profile>
+    <profile>
+        <id>linux</id>
+        <activation>
+            <os>
+                <family>unix</family>
+            </os>
+        </activation>
+        <properties>
+            <envClassifier>linux</envClassifier>
+            <executable.node>node</executable.node>
+        </properties>
+    </profile>
+  </profiles>
 </project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-admin/src/main/resources/ui/admin-web/.bowerrc
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/.bowerrc b/ambari-admin/src/main/resources/ui/admin-web/.bowerrc
new file mode 100644
index 0000000..d0f0b6f
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/.bowerrc
@@ -0,0 +1,3 @@
+{
+    "directory": "app/bower_components"
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-admin/src/main/resources/ui/admin-web/.gitignore
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/.gitignore b/ambari-admin/src/main/resources/ui/admin-web/.gitignore
new file mode 100644
index 0000000..a0e4caf
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/.gitignore
@@ -0,0 +1,10 @@
+node_modules
+public
+.tmp
+.sass-cache
+app/bower_components
+test/bower_components
+heroku
+/views
+dist
+node
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-admin/src/main/resources/ui/admin-web/.jshintrc
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/.jshintrc b/ambari-admin/src/main/resources/ui/admin-web/.jshintrc
new file mode 100644
index 0000000..dfda519
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/.jshintrc
@@ -0,0 +1,24 @@
+{
+  "node": true,
+  "browser": true,
+  "esnext": true,
+  "bitwise": true,
+  "camelcase": true,
+  "curly": true,
+  "eqeqeq": true,
+  "immed": true,
+  "indent": 2,
+  "latedef": true,
+  "newcap": true,
+  "noarg": true,
+  "quotmark": "single",
+  "regexp": true,
+  "undef": true,
+  "unused": false,
+  "strict": true,
+  "trailing": true,
+  "smarttabs": true,
+  "globals": {
+    "angular": false
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-admin/src/main/resources/ui/admin-web/app/index.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/index.html b/ambari-admin/src/main/resources/ui/admin-web/app/index.html
new file mode 100644
index 0000000..6f2db36
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/index.html
@@ -0,0 +1,156 @@
+<!--
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+-->
+<!doctype html>
+<html class="no-js">
+  <head>
+    <meta charset="utf-8">
+    <title>Ambari</title>
+    <meta name="description" content="">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <link rel="shortcut icon" href="/img/logo.png" type="image/x-icon">
+    <!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
+
+    <!-- build:css styles/vendor.css -->
+    <!-- bower:css -->
+    <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css" />
+    <link rel="stylesheet" href="bower_components/angular-bootstrap-toggle-switch/style/bootstrap3/angular-toggle-switch-bootstrap-3.css" />
+    <link rel="stylesheet" href="bower_components/font-awesome/css/font-awesome.min.css"/>
+    <!-- endbower -->
+    <!-- endbuild -->
+
+    <!-- build:css styles/main.css -->
+    <link rel="stylesheet" href="styles/main.css">
+    <!-- endbuild -->
+
+  </head>
+  <body ng-app="ambariAdminConsole">
+    <!--[if lt IE 10]>
+      <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
+    <![endif]-->
+
+    <div id="top-nav" ng-controller="MainCtrl">
+      <header class="navbar navbar-static-top navbar-inverse">
+        <div class="navbar-inner">
+          <div class="container">
+            <a href="#/" class="logo"><img src="/img/logo-white.png" alt="Apache Ambari" title="Apache Ambari"></a>
+            <a href="#/" class="brand" title="Apache Ambari">Ambari</a>
+            <ul class="nav navbar-nav navbar-right">
+              <li>
+                <div class="btn-group navbar-views-dropdown" dropdown is-open="viewsdropdown.isopen" ng-mouseover="viewsdropdown.isopen=true" ng-mouseout="viewsdropdown.isopen=false">
+                  <a href="/#/main/views" ng-click="gotoViewsDashboard()" class="dropdown-toggle"><i class="fa fa-th"></i></a>
+                  <ul class="dropdown-menu" role="menu">
+                    <li ng-repeat="instance in viewInstances"><a href="/#/main{{instance.context_path}}" ng-click="about()">{{instance.label}}</a></li>
+                    <li ng-show="!viewInstances.length" class="disabled"><a>No Views</a></li>
+                  </ul>
+                </div>
+              </li>
+              <li>
+                <div class="btn-group" dropdown is-open="status.isopen">
+                  <button type="button" class="btn btn-default dropdown-toggle navbar-btn" ng-disabled="disabled">
+                    <i class="fa fa-user"></i> {{currentUser}} <span class="caret"></span>
+                  </button>
+                  <ul class="dropdown-menu" role="menu">
+                    <li><a href ng-click="about()">About</a></li>
+                    <li class="divider"></li>
+                    <li><a href ng-click="signOut()">Sign out</a></li>
+                  </ul>
+                </div>
+              </li>
+            </ul>
+          </div>
+        </div>
+      </header>
+    </div>
+
+
+    <div class="container">
+      <div class="row">
+        <div class="col-sm-3">
+          <div ng-include="'views/leftNavbar.html'" ng-controller="NavbarCtrl"></div>
+        </div>
+        <div class="col-sm-9">
+          <ng-view></ng-view>
+        </div>
+      </div>
+    </div>
+
+
+    <!-- build:js scripts/vendor.js -->
+    <!-- bower:js -->
+    <script src="bower_components/jquery/dist/jquery.js"></script>
+    <script src="bower_components/bootstrap/dist/js/bootstrap.js"></script>
+    <script src="bower_components/angular/angular.js"></script>
+    <script src="bower_components/angular-animate/angular-animate.js"></script>
+    <script src="bower_components/angular-route/angular-route.js"></script>
+    <script src="bower_components/angular-bootstrap/ui-bootstrap-tpls.js"></script>
+    <script src="bower_components/lodash/dist/lodash.compat.js"></script>
+    <script src="bower_components/restangular/dist/restangular.js"></script>
+    <script src="bower_components/angular-bootstrap-toggle-switch/angular-toggle-switch.min.js"></script>
+    <script src="bower_components/angular-translate/angular-translate.min.js"></script>
+    <!-- endbower -->
+    <!-- endbuild -->
+
+    <!-- build:js scripts/plugins.js -->
+    <script src="bower_components/bootstrap/js/affix.js"></script>
+    <script src="bower_components/bootstrap/js/alert.js"></script>
+    <script src="bower_components/bootstrap/js/dropdown.js"></script>
+    <script src="bower_components/bootstrap/js/tooltip.js"></script>
+    <script src="bower_components/bootstrap/js/modal.js"></script>
+    <script src="bower_components/bootstrap/js/transition.js"></script>
+    <script src="bower_components/bootstrap/js/button.js"></script>
+    <script src="bower_components/bootstrap/js/popover.js"></script>
+    <script src="bower_components/bootstrap/js/carousel.js"></script>
+    <script src="bower_components/bootstrap/js/scrollspy.js"></script>
+    <script src="bower_components/bootstrap/js/collapse.js"></script>
+    <script src="bower_components/bootstrap/js/tab.js"></script>
+    <!-- endbuild -->
+
+    <!-- build:js scripts/main.js -->
+    <script src="scripts/app.js"></script>
+    <script src="scripts/routes.js"></script>
+    <script src="scripts/i18n.config.js"></script>
+    <script src="scripts/controllers/mainCtrl.js"></script>
+    <script src="scripts/controllers/NavbarCtrl.js"></script>
+    <script src="scripts/controllers/users/UsersCreateCtrl.js"></script>
+    <script src="scripts/controllers/users/UsersListCtrl.js"></script>
+    <script src="scripts/controllers/users/UsersShowCtrl.js"></script>
+    <script src="scripts/controllers/groups/GroupsListCtrl.js"></script>
+    <script src="scripts/controllers/groups/GroupsCreateCtrl.js"></script>
+    <script src="scripts/controllers/groups/GroupsEditCtrl.js"></script>
+    <script src="scripts/controllers/ambariViews/ViewsListCtrl.js"></script>
+    <script src="scripts/controllers/ambariViews/ViewsEditCtrl.js"></script>
+    <script src="scripts/controllers/ambariViews/CreateViewInstanceCtrl.js"></script>
+    <script src="scripts/controllers/clusters/ClustersManageAccessCtrl.js"></script>
+    <script src="scripts/directives/linkToDir.js"></script>
+    <script src="scripts/directives/PasswordVerify.js"></script>
+    <script src="scripts/directives/disabledTooltip.js"></script>
+    <script src="scripts/directives/editableList.js"></script>
+    <script src="scripts/services/User.js"></script>
+    <script src="scripts/services/Group.js"></script>
+    <script src="scripts/services/View.js"></script>
+    <script src="scripts/services/Cluster.js"></script>
+    <script src="scripts/services/Alert.js"></script>
+    <script src="scripts/services/PermissionLoader.js"></script>
+    <script src="scripts/services/PermissionsSaver.js"></script>
+    <script src="scripts/services/ConfirmationModal.js"></script>
+    <script src="scripts/services/Auth.js"></script>
+    <script src="scripts/services/GetDifference.js"></script>
+    <script src="scripts/services/UnsavedDialog.js"></script>
+    <!-- endbuild -->
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-admin/src/main/resources/ui/admin-web/app/scripts/app.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/app.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/app.js
new file mode 100644
index 0000000..e949527
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/app.js
@@ -0,0 +1,102 @@
+/**
+ * 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.
+ */
+'use strict';
+
+angular.module('ambariAdminConsole', [
+  'ngRoute',
+  'ngAnimate',
+  'ui.bootstrap',
+  'restangular',
+  'toggle-switch',
+  'pascalprecht.translate'
+])
+.constant('Settings',{
+	baseUrl: '/api/v1'
+})
+.config(['RestangularProvider', '$httpProvider', '$provide', function(RestangularProvider, $httpProvider, $provide) {
+  // Config Ajax-module
+  RestangularProvider.setBaseUrl('/api/v1');
+  RestangularProvider.setDefaultHeaders({'X-Requested-By':'ambari'});
+
+  $httpProvider.defaults.headers.post['Content-Type'] = 'plain/text';
+  $httpProvider.defaults.headers.put['Content-Type'] = 'plain/text';
+
+  $httpProvider.defaults.headers.post['X-Requested-By'] = 'ambari';
+  $httpProvider.defaults.headers.put['X-Requested-By'] = 'ambari';
+  $httpProvider.defaults.headers.common['X-Requested-By'] = 'ambari';
+
+  $httpProvider.responseInterceptors.push(['$rootScope', '$q', function (scope, $q) {
+    function success(response) {
+      return response;
+    }
+
+    function error(response) {
+      if (response.status == 403) {
+        window.location = "/";
+        return;
+      }
+      return $q.reject(response);
+    }
+
+    return function (promise) {
+      return promise.then(success, error);
+    }
+  }]);
+
+  $provide.decorator('ngFormDirective', ['$delegate', function($delegate) {
+    var ngForm = $delegate[0], controller = ngForm.controller;
+    ngForm.controller = ['$scope', '$element', '$attrs', '$injector', function(scope, element, attrs, $injector) {
+    var $interpolate = $injector.get('$interpolate');
+      attrs.$set('name', $interpolate(attrs.name || '')(scope));
+      $injector.invoke(controller, this, {
+        '$scope': scope,
+        '$element': element,
+        '$attrs': attrs
+      });
+    }];
+    return $delegate;
+  }]);
+
+  $provide.decorator('ngModelDirective', ['$delegate', function($delegate) {
+    var ngModel = $delegate[0], controller = ngModel.controller;
+    ngModel.controller = ['$scope', '$element', '$attrs', '$injector', function(scope, element, attrs, $injector) {
+      var $interpolate = $injector.get('$interpolate');
+      attrs.$set('name', $interpolate(attrs.name || '')(scope));
+      $injector.invoke(controller, this, {
+        '$scope': scope,
+        '$element': element,
+        '$attrs': attrs
+      });
+    }];
+    return $delegate;
+  }]);
+
+  $provide.decorator('formDirective', ['$delegate', function($delegate) {
+    var form = $delegate[0], controller = form.controller;
+    form.controller = ['$scope', '$element', '$attrs', '$injector', function(scope, element, attrs, $injector) {
+      var $interpolate = $injector.get('$interpolate');
+      attrs.$set('name', $interpolate(attrs.name || attrs.ngForm || '')(scope));
+        $injector.invoke(controller, this, {
+        '$scope': scope,
+        '$element': element,
+        '$attrs': attrs
+      });
+    }];
+    return $delegate;
+  }]);
+}]);

http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/NavbarCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/NavbarCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/NavbarCtrl.js
new file mode 100644
index 0000000..719d033
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/NavbarCtrl.js
@@ -0,0 +1,76 @@
+/**
+ * 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.
+ */
+'use strict';
+
+angular.module('ambariAdminConsole')
+.controller('NavbarCtrl',['$scope', 'Cluster', '$location', 'Alert', 'ROUTES', 'ConfirmationModal', '$rootScope', function($scope, Cluster, $location, Alert, ROUTES, ConfirmationModal, $rootScope) {
+  $scope.cluster = null;
+  $scope.editCluster = {
+    name        : '',
+    editingName : false
+  };
+
+  Cluster.getStatus().then(function(cluster) {
+    $scope.cluster = cluster;
+  }).catch(function(data) {
+    Alert.error('Cannot load cluster status', data.data.message);
+  });
+
+  $scope.toggleEditName = function($event) {
+    if ($event && $event.keyCode !== 27) {
+      // 27 = Escape key
+      return false;
+    }
+
+    $scope.editCluster.name         = $scope.cluster.Clusters.cluster_name;
+    $scope.editCluster.editingName  = !$scope.editCluster.editingName;
+  };
+
+  $scope.confirmClusterNameChange = function() {
+    ConfirmationModal.show('Confirm Cluster Name Change', 'Are you sure you want to change the cluster name to ' + $scope.editCluster.name + '?')
+      .then(function() {
+        $scope.saveClusterName();
+      }).catch(function() {
+        // user clicked cancel
+        $scope.toggleEditName();
+      });
+  };
+
+  $scope.saveClusterName = function() {
+    var oldClusterName = $scope.cluster.Clusters.cluster_name,
+        newClusterName = $scope.editCluster.name;
+
+    Cluster.editName(oldClusterName, newClusterName).then(function(data) {
+      $scope.cluster.Clusters.cluster_name = newClusterName;
+      Alert.success('The cluster has been renamed to ' + newClusterName + '.');
+    }).catch(function(data) {
+      Alert.error('Cannot rename cluster to ' + newClusterName, data.data.message);
+    });
+
+    $scope.toggleEditName();
+  };
+
+  $scope.isActive = function(path) {
+	var route = ROUTES;
+	angular.forEach(path.split('.'), function(routeObj) {
+		route = route[routeObj];
+	});
+	var r = new RegExp( route.url.replace(/(:\w+)/, '\\w+'));
+	return r.test($location.path());
+  };
+}]);

http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/CreateViewInstanceCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/CreateViewInstanceCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/CreateViewInstanceCtrl.js
new file mode 100644
index 0000000..06a8b6b
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/CreateViewInstanceCtrl.js
@@ -0,0 +1,121 @@
+/**
+ * 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.
+ */
+'use strict';
+
+angular.module('ambariAdminConsole')
+.controller('CreateViewInstanceCtrl',['$scope', 'View', 'Alert', 'Auth', '$routeParams', '$location', 'UnsavedDialog', function($scope, View, Alert, Auth, $routeParams, $location, UnsavedDialog) {
+  $scope.form = {};
+  var targetUrl = '';
+
+  function loadMeta(){
+    View.getMeta($routeParams.viewId, $scope.version).then(function(data) {
+      var viewVersion = data.data;
+      var pattern = /{username}/;
+      viewVersion.ViewVersionInfo.parameters = viewVersion.ViewVersionInfo.parameters.map(function (item) {
+        var parameter = item;
+        if (pattern.test(item.description)) {
+          parameter.description = item.description.replace(pattern, Auth.getCurrentUser());
+        }
+        return parameter;
+      });
+      $scope.view = viewVersion;
+
+      $scope.instance = {
+        view_name: viewVersion.ViewVersionInfo.view_name,
+        version: viewVersion.ViewVersionInfo.version,
+        instance_name: '',
+        label: '',
+        visible: true,
+        icon_path: '',
+        icon64_path: '',
+        properties: viewVersion.ViewVersionInfo.parameters,
+        description: ''
+      };
+    });
+  }
+
+
+  $scope.$watch(function(scope) {
+    return scope.version;
+  }, function(version) {
+    if( version ){
+      loadMeta();
+    }
+  });
+
+  // $scope.view = viewVersion;
+  $scope.isAdvancedClosed = true;
+  $scope.instanceExists = false;
+
+  $scope.versions = [];
+  $scope.version = null;
+
+  View.getVersions($routeParams.viewId).then(function(versions) {
+    $scope.versions = versions;
+    $scope.version = $scope.versions[$scope.versions.length-1];
+  });
+
+
+  $scope.nameValidationPattern = /^\s*\w*\s*$/;
+
+  $scope.save = function() {
+    $scope.form.instanceCreateForm.submitted = true;
+    if($scope.form.instanceCreateForm.$valid){
+      View.createInstance($scope.instance)
+        .then(function(data) {
+          Alert.success('Created View Instance ' + $scope.instance.instance_name);
+          $scope.form.instanceCreateForm.$setPristine();
+          if( targetUrl ){
+            $location.path(targetUrl);
+          } else {
+            $location.path('/views/' + $scope.instance.view_name + '/versions/' + $scope.instance.version + '/instances/' + $scope.instance.instance_name + '/edit');
+          }
+        })
+        .catch(function(data) {
+          Alert.error('Cannot create instance', data.data.message);
+        });
+    }
+  };
+
+  $scope.cancel = function() {
+    $scope.form.instanceCreateForm.$setPristine();
+    $location.path('/views');
+  };
+
+  $scope.$on('$locationChangeStart', function(event, __targetUrl) {
+    if( $scope.form.instanceCreateForm.$dirty ){
+      UnsavedDialog().then(function(action) {
+        targetUrl = __targetUrl.split('#').pop();
+        switch(action){
+          case 'save':
+            $scope.save();
+            break;
+          case 'discard':
+            $scope.form.instanceCreateForm.$setPristine();
+            $location.path(targetUrl);
+            break;
+          case 'cancel':
+            targetUrl = '';
+            break;
+        }
+      });
+      event.preventDefault();
+    }
+  });
+
+}]);

http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsEditCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsEditCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsEditCtrl.js
new file mode 100644
index 0000000..af2ffa6
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsEditCtrl.js
@@ -0,0 +1,215 @@
+/**
+ * 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.
+ */
+'use strict';
+
+angular.module('ambariAdminConsole')
+.controller('ViewsEditCtrl', ['$scope', '$routeParams' , 'View', 'Alert', 'PermissionLoader', 'PermissionSaver', 'ConfirmationModal', '$location', 'UnsavedDialog', function($scope, $routeParams, View, Alert, PermissionLoader, PermissionSaver, ConfirmationModal, $location, UnsavedDialog) {
+  $scope.identity = angular.identity;
+  $scope.isConfigurationEmpty = true;
+  function reloadViewInfo(){
+    // Load instance data, after View permissions meta loaded
+    View.getInstance($routeParams.viewId, $routeParams.version, $routeParams.instanceId)
+    .then(function(instance) {
+      $scope.instance = instance;
+
+      $scope.settings = {
+        'visible': $scope.instance.ViewInstanceInfo.visible,
+        'label': $scope.instance.ViewInstanceInfo.label,
+        'description': $scope.instance.ViewInstanceInfo.description
+      };
+
+      $scope.configuration = angular.copy($scope.instance.ViewInstanceInfo.properties);
+      for(var confName in $scope.configuration){
+        if( $scope.configuration.hasOwnProperty(confName) ){
+          $scope.configuration[confName] = $scope.configuration[confName] === 'null' ? '' : $scope.configuration[confName];
+        }
+      }
+      $scope.isConfigurationEmpty = angular.equals({}, $scope.configuration);
+    })
+    .catch(function(data) {
+      Alert.error('Cannot load instance info', data.data.message);
+    });
+  }
+
+
+  // Get META for properties
+  View.getMeta($routeParams.viewId, $routeParams.version).then(function(data) {
+    $scope.configurationMeta = data.data.ViewVersionInfo.parameters;
+    reloadViewInfo();
+  });
+
+  function reloadViewPrivileges(){
+    PermissionLoader.getViewPermissions({
+      viewName: $routeParams.viewId,
+      version: $routeParams.version,
+      instanceId: $routeParams.instanceId
+    })
+    .then(function(permissions) {
+      // Refresh data for rendering
+      $scope.permissionsEdit = permissions;
+      $scope.permissions = angular.copy(permissions);
+      $scope.isPermissionsEmpty = angular.equals({}, $scope.permissions);
+    })
+    .catch(function(data) {
+      Alert.error('Cannot load permissions', data.data.message);
+    });
+  }
+
+  $scope.permissions = [];
+
+  reloadViewPrivileges();
+
+  $scope.editSettingsDisabled = true;
+  $scope.toggleSettingsEdit = function() {
+    $scope.editSettingsDisabled = !$scope.editSettingsDisabled;
+  };
+
+  $scope.saveSettings = function(callback) {
+    if( $scope.settingsForm.$valid ){
+      return View.updateInstance($routeParams.viewId, $routeParams.version, $routeParams.instanceId, {
+        'ViewInstanceInfo':{
+          'visible': $scope.settings.visible,
+          'label': $scope.settings.label,
+          'description': $scope.settings.description
+        }
+      })
+      .success(function() {
+        if( callback ){
+          callback();
+        } else {
+          reloadViewInfo();
+          $scope.editSettingsDisabled = true;
+          $scope.settingsForm.$setPristine();
+        }
+      })
+      .catch(function(data) {
+        Alert.error('Cannot save settings', data.data.message);
+      });
+    }
+  };
+  $scope.cancelSettings = function() {
+    $scope.settings = {
+      'visible': $scope.instance.ViewInstanceInfo.visible,
+      'label': $scope.instance.ViewInstanceInfo.label,
+      'description': $scope.instance.ViewInstanceInfo.description
+    };
+    $scope.editSettingsDisabled = true;
+    $scope.settingsForm.$setPristine();
+  };
+
+
+  $scope.editConfigurationDisabled = true;
+  $scope.togglePropertiesEditing = function() {
+     $scope.editConfigurationDisabled = !$scope.editConfigurationDisabled;
+  }
+  $scope.saveConfiguration = function() {
+    if( $scope.propertiesForm.$valid ){
+      return View.updateInstance($routeParams.viewId, $routeParams.version, $routeParams.instanceId, {
+        'ViewInstanceInfo':{
+          'properties': $scope.configuration
+        }
+      })
+      .success(function() {
+        $scope.editConfigurationDisabled = true;
+        $scope.propertiesForm.$setPristine();
+      })
+      .catch(function(data) {
+        Alert.error('Cannot save properties', data.data.message);
+      });
+    }
+  };
+  $scope.cancelConfiguration = function() {
+    $scope.configuration = angular.copy($scope.instance.ViewInstanceInfo.properties);
+    $scope.editConfigurationDisabled = true;
+    $scope.propertiesForm.$setPristine();
+  };
+
+  // Permissions edit
+  $scope.editPermissionDisabled = true;
+  $scope.cancelPermissions = function() {
+    $scope.permissionsEdit = angular.copy($scope.permissions); // Reset textedit areaes
+    $scope.editPermissionDisabled = true;
+  };
+
+  $scope.savePermissions = function() {
+    $scope.editPermissionDisabled = true;
+    return PermissionSaver.saveViewPermissions(
+      $scope.permissionsEdit,
+      {
+        view_name: $routeParams.viewId,
+        version: $routeParams.version,
+        instance_name: $routeParams.instanceId
+      }
+    )
+    .then(reloadViewPrivileges)
+    .catch(function(data) {
+      reloadViewPrivileges();
+      Alert.error('Cannot save permissions', data.data.message);
+    });
+  };
+
+  $scope.$watch(function() {
+    return $scope.permissionsEdit;
+  }, function(newValue) {
+    if(newValue){
+      $scope.savePermissions();
+    }
+  }, true);
+
+  $scope.deleteInstance = function(instance) {
+    ConfirmationModal.show('Delete View Instance', 'Are you sure you want to delete View Instance '+ instance.ViewInstanceInfo.label +'?').then(function() {
+      View.deleteInstance(instance.ViewInstanceInfo.view_name, instance.ViewInstanceInfo.version, instance.ViewInstanceInfo.instance_name)
+      .then(function() {
+        $location.path('/views');
+      })
+      .catch(function(data) {
+        Alert.error('Cannot delete instance', data.data.message);
+      });
+    });
+  };
+
+  $scope.$on('$locationChangeStart', function(event, targetUrl) {
+    if( $scope.settingsForm.$dirty || $scope.propertiesForm.$dirty){
+      UnsavedDialog().then(function(action) {
+        targetUrl = targetUrl.split('#').pop();
+        switch(action){
+          case 'save':
+            if($scope.settingsForm.$valid &&  $scope.propertiesForm.$valid ){
+              $scope.saveSettings(function() {
+                $scope.saveConfiguration().then(function() {
+                  $scope.propertiesForm.$setPristine();
+                  $scope.settingsForm.$setPristine();
+                  $location.path(targetUrl);
+                });
+              });
+            }
+            break;
+          case 'discard':
+            $scope.propertiesForm.$setPristine();
+            $scope.settingsForm.$setPristine();
+            $location.path(targetUrl);
+            break;
+          case 'cancel':
+            targetUrl = '';
+            break;
+        }
+      });
+      event.preventDefault();
+    }
+  });
+}]);

http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsListCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsListCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsListCtrl.js
new file mode 100644
index 0000000..4fad3b3
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsListCtrl.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.
+ */
+'use strict';
+
+angular.module('ambariAdminConsole')
+.controller('ViewsListCtrl',['$scope', 'View', '$modal', 'Alert', 'ConfirmationModal', function($scope, View, $modal, Alert, ConfirmationModal) {
+  var deferredList = [];
+  $scope.$on('$locationChangeStart', function() {
+    deferredList.forEach(function(def) {
+      def.reject();
+    })
+  });
+
+  function checkViewVersionStatus(view, versionObj, versionNumber){
+    var deferred = View.checkViewVersionStatus(view.view_name, versionNumber);
+    deferredList.push(deferred);
+
+    deferred.promise.then(function(status) {
+      deferredList.splice(deferredList.indexOf(deferred), 1);
+      if (status !== 'DEPLOYED' && status !== 'ERROR') {
+        checkViewVersionStatus(view, versionObj, versionNumber);
+      } else {
+        $scope.$evalAsync(function() {
+          versionObj.status = status;
+          angular.forEach(view.versions, function(version) {
+            if(version.status === 'DEPLOYED'){
+              view.canCreateInstance = true;
+            }
+          })
+        });
+      }
+    });
+  }
+
+  function loadViews(){
+    View.all().then(function(views) {
+      $scope.views = views;
+      $scope.getFilteredViews();
+      angular.forEach(views, function(view) {
+        angular.forEach(view.versions, function(versionObj, versionNumber) {
+          if (versionObj.status !== 'DEPLOYED' || versionObj.status !== 'ERROR'){
+            checkViewVersionStatus(view, versionObj, versionNumber);
+          }
+        });
+      })
+    }).catch(function(data) {
+      Alert.error('Cannot load views', data.data.message);
+    });
+  }
+
+  loadViews();
+
+  $scope.createInstance = function(view) {
+    var modalInstance = $modal.open({
+      templateUrl: 'views/ambariViews/modals/create.html',
+      size: 'lg',
+      controller: 'CreateViewInstanceCtrl',
+      resolve: {
+        viewVersion: function(){
+          return view.versionsList[ view.versionsList.length-1];
+        }
+      }
+    });
+
+    modalInstance.result.then(loadViews);
+  };
+
+  $scope.viewsFilter = '';
+  $scope.filteredViews = [];
+  $scope.getFilteredViews = function(views) {
+    var result = [];
+    var filter = $scope.viewsFilter.toLowerCase();
+    if(!filter){  // if no filter return all views
+      result = $scope.views.map(function(view) {
+        view.isOpened = false;
+        return view;
+      });
+    } else {
+      result = $scope.views.map(function(view) {
+        view.isOpened = true;
+        if(view.view_name.toLowerCase().indexOf(filter) >= 0){
+          return view; // if filter matched with view name -- return whole view
+        } else {
+          var instances = [];
+          angular.forEach(view.instances, function(instance) {
+            if(instance.ViewInstanceInfo.label.toLowerCase().indexOf(filter) >= 0){
+              instances.push(instance);
+            }
+          });
+          if( instances.length ){ // If inside view exists instances with matched filter - show only this instances
+            var v = angular.copy(view);
+            v.instances = instances;
+            return v;
+          }
+        }
+      }).filter(function(view) {
+        return !!view; // Remove 'undefined'
+      });
+    }
+    $scope.filteredViews = result;
+  };
+}]);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/clusters/ClustersManageAccessCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/clusters/ClustersManageAccessCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/clusters/ClustersManageAccessCtrl.js
new file mode 100644
index 0000000..44f4efb
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/clusters/ClustersManageAccessCtrl.js
@@ -0,0 +1,72 @@
+/**
+ * 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.
+ */
+'use strict';
+
+angular.module('ambariAdminConsole')
+.controller('ClustersManageAccessCtrl', ['$scope', 'Cluster', '$routeParams', 'Alert', 'PermissionLoader', 'PermissionSaver', function($scope, Cluster, $routeParams, Alert, PermissionLoader, PermissionSaver) {
+  $scope.identity = angular.identity;
+  function reloadClusterData(){
+    PermissionLoader.getClusterPermissions({
+      clusterId: $routeParams.id
+    }).then(function(permissions) {
+      // Refresh data for rendering
+      $scope.permissionsEdit = permissions;
+      $scope.permissions = angular.copy(permissions);
+    })
+    .catch(function(data) {
+      Alert.error('Cannot load cluster data', data.data.message);
+    });;
+  }
+
+  reloadClusterData();
+  $scope.isEditMode = false;
+  $scope.permissions = {};
+  $scope.clusterName = $routeParams.id;
+
+
+  $scope.toggleEditMode = function() {
+    $scope.isEditMode = !$scope.isEditMode;
+  };
+
+  $scope.cancel = function() {
+    $scope.isEditMode = false;
+    $scope.permissionsEdit = angular.copy($scope.permissions); // Reset textedit areaes
+  };
+
+  $scope.save = function() {
+    PermissionSaver.saveClusterPermissions(
+      $scope.permissionsEdit,
+      {
+        clusterId: $routeParams.id
+      }
+    ).then(reloadClusterData)
+    .catch(function(data) {
+      Alert.error('Cannot save permissions', data.data.message);
+      reloadClusterData();
+    });
+    $scope.isEditMode = false;
+  };
+
+  $scope.$watch(function() {
+    return $scope.permissionsEdit;
+  }, function(newValue) {
+    if(newValue){
+      $scope.save();
+    }
+  }, true);
+}]);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsCreateCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsCreateCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsCreateCtrl.js
new file mode 100644
index 0000000..1768bff
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsCreateCtrl.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.
+ */
+'use strict';
+
+angular.module('ambariAdminConsole')
+.controller('GroupsCreateCtrl',['$scope', 'Group', '$location', 'Alert', 'UnsavedDialog', function($scope, Group, $location, Alert, UnsavedDialog) {
+  $scope.group = new Group();
+  var targetUrl = '/groups';
+
+  $scope.createGroup = function() {
+    $scope.form.submitted = true;
+    if ($scope.form.$valid){
+      $scope.group.save().then(function() {
+        Alert.success('Created group <a href="#/groups/' + $scope.group.group_name + '/edit">' + $scope.group.group_name + '</a>');
+        $scope.form.$setPristine();
+        $location.path(targetUrl);
+      })
+      .catch(function(data) {
+        Alert.error('Group creation error', data.data.message);
+      });
+    }
+  };
+
+  $scope.cancel = function() {
+    $scope.form.$setPristine();
+    $location.path('/groups');
+  };
+
+  $scope.$on('$locationChangeStart', function(event, __targetUrl) {
+    if( $scope.form.$dirty ){
+      UnsavedDialog().then(function(action) {
+        targetUrl = __targetUrl.split('#').pop();
+        switch(action){
+          case 'save':
+            $scope.createGroup();
+            break;
+          case 'discard':
+            $scope.form.$setPristine();
+            $location.path(targetUrl);
+            break;
+          case 'cancel':
+            targetUrl = '/groups';
+            break;
+        }
+      });
+      event.preventDefault();
+    }
+  });
+}]);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsEditCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsEditCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsEditCtrl.js
new file mode 100644
index 0000000..53d0a06
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsEditCtrl.js
@@ -0,0 +1,106 @@
+/**
+ * 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.
+ */
+'use strict';
+
+angular.module('ambariAdminConsole')
+.controller('GroupsEditCtrl',['$scope', 'Group', '$routeParams', 'Alert', 'ConfirmationModal', '$location', function($scope, Group, $routeParams, Alert, ConfirmationModal, $location) {
+  $scope.editMode = false;
+  $scope.group = new Group($routeParams.id);
+  $scope.group.editingUsers = [];
+  $scope.groupMembers = [];
+  $scope.dataLoaded = false;
+
+  $scope.isMembersEditing = false;
+
+  $scope.$watch(function() {
+    return $scope.group.editingUsers;
+  }, function(newValue) {
+    if(newValue && !angular.equals(newValue, $scope.groupMembers)){
+      $scope.updateMembers();
+    }
+  }, true);
+
+  $scope.enableMembersEditing = function() {
+    $scope.isMembersEditing = true;
+    $scope.group.editingUsers = angular.copy($scope.groupMembers);
+  };
+  $scope.cancelUpdate = function() {
+    $scope.isMembersEditing = false;
+    $scope.group.editingUsers = '';
+  };
+  $scope.updateMembers = function() {
+    var newMembers = $scope.group.editingUsers.toString().split(',').filter(function(item) {return item.trim();}).map(function(item) {return item.trim()});
+    $scope.group.members = newMembers;
+    $scope.group.saveMembers().then(loadMembers)
+    .catch(function(data) {
+      Alert.error('Cannot update group members', data.data.message);
+    });
+    $scope.isMembersEditing = false;
+  };
+
+
+  function loadMembers(){
+    $scope.group.getMembers().then(function(members) {
+      $scope.groupMembers = members;
+      $scope.group.editingUsers = angular.copy($scope.groupMembers);
+    });
+  }
+
+  $scope.group.isLDAP().then(function(isLDAP) {
+    $scope.group.ldap_group = isLDAP;
+    loadMembers();
+  });
+
+  $scope.deleteGroup = function(group) {
+    ConfirmationModal.show('Delete Group', 'Are you sure you want to delete group "'+ group.group_name +'"?').then(function() {
+      group.destroy().then(function() {
+        $location.path('/groups');
+      }).catch(function() {
+
+      });
+    });
+  };
+
+  // Load privileges
+  Group.getPrivileges($routeParams.id).then(function(data) {
+    var privileges = {
+      clusters: {},
+      views: {}
+    };
+    angular.forEach(data.data.items, function(privilege) {
+      privilege = privilege.PrivilegeInfo;
+      if(privilege.type === 'CLUSTER'){
+        // This is cluster
+        privileges.clusters[privilege.cluster_name] = privileges.clusters[privilege.cluster_name] || [];
+        privileges.clusters[privilege.cluster_name].push(privilege.permission_name);
+      } else if ( privilege.type === 'VIEW'){
+        privileges.views[privilege.instance_name] = privileges.views[privilege.instance_name] || { privileges:[]};
+        privileges.views[privilege.instance_name].version = privilege.version;
+        privileges.views[privilege.instance_name].view_name = privilege.view_name;
+        privileges.views[privilege.instance_name].privileges.push(privilege.permission_name);
+      }
+    });
+
+    $scope.privileges = data.data.items.length ? privileges : null;
+    $scope.dataLoaded = true;
+  }).catch(function(data) {
+    Alert.error('Cannot load privileges', data.data.message);
+  });
+
+
+}]);

http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsListCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsListCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsListCtrl.js
new file mode 100644
index 0000000..f47158f
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsListCtrl.js
@@ -0,0 +1,75 @@
+/**
+ * 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.
+ */
+'use strict';
+
+angular.module('ambariAdminConsole')
+.controller('GroupsListCtrl',['$scope', 'Group', '$modal', 'ConfirmationModal', '$rootScope', function($scope, Group, $modal, ConfirmationModal, $rootScope) {
+  $scope.groups = [];
+
+  $scope.groupsPerPage = 10;
+  $scope.currentPage = 1;
+  $scope.totalGroups = 1;
+  $scope.currentNameFilter = '';
+  $scope.maxVisiblePages=20;
+
+  $scope.pageChanged = function() {
+    loadGroups();
+  };
+  $scope.groupsPerPageChanges = function() {
+    loadGroups();
+  };
+
+  $scope.resetPagination = function() {
+    $scope.currentPage = 1;
+    loadGroups();
+  };
+
+  function loadGroups(){
+    Group.all({
+      currentPage: $scope.currentPage,
+      groupsPerPage: $scope.groupsPerPage,
+      searchString: $scope.currentNameFilter,
+      ldap_group: $scope.currentTypeFilter.value
+    }).then(function(groups) {
+      $scope.totalGroups = groups.itemTotal;
+      $scope.groups = groups;
+    })
+    .catch(function(data) {
+      console.error('Get groups list error');
+    });
+  }
+
+  $scope.typeFilterOptions = [
+    {label:'All', value:'*'},
+    {label:'Local', value: false},
+    {label:'LDAP', value:true}
+  ];
+  $scope.currentTypeFilter = $scope.typeFilterOptions[0];
+
+  loadGroups();
+
+  $rootScope.$watch(function(scope) {
+    return scope.LDAPSynced;
+  }, function(LDAPSynced) {
+    if(LDAPSynced === true){
+      $rootScope.LDAPSynced = false;
+      loadGroups();
+    }
+  });
+
+}]);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/mainCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/mainCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/mainCtrl.js
new file mode 100644
index 0000000..9faebe9
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/mainCtrl.js
@@ -0,0 +1,65 @@
+/**
+ * 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.
+ */
+'use strict';
+
+angular.module('ambariAdminConsole')
+.controller('MainCtrl',['$scope', '$window','Auth', 'Alert', '$modal', 'Cluster', 'View', function($scope, $window, Auth, Alert, $modal, Cluster, View) {
+  $scope.signOut = function() {
+    var data = JSON.parse(localStorage.ambari);
+    delete data.app.authenticated;
+    delete data.app.loginName;
+    delete data.app.user;
+    localStorage.ambari = JSON.stringify(data);
+    $window.location.pathname = '';
+    $scope.hello = "hello";
+    Auth.signout();
+  };
+
+  $scope.about = function() {
+	var modalInstance = $modal.open({
+		templateUrl:'views/modals/AboutModal.html',
+		controller: ['$scope', function($scope) {
+			$scope.ok = function() {
+				modalInstance.close();
+			};
+		}]
+	});
+  };
+
+  $scope.currentUser = Auth.getCurrentUser();
+
+  $scope.cluster = null;
+  $scope.isLoaded = null;
+
+  Cluster.getStatus().then(function(cluster) {
+    $scope.cluster = cluster;
+    $scope.isLoaded = true;
+  }).catch(function(data) {
+    Alert.error('Check cluster status error', data.data.message);
+  });
+
+  $scope.viewInstances = [];
+  View.getAllVisibleInstance().then(function(instances) {
+    $scope.viewInstances = instances;
+  });
+
+  $scope.gotoViewsDashboard =function() {
+    window.location = '/#/main/views';
+  };
+
+}]);

http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersCreateCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersCreateCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersCreateCtrl.js
new file mode 100644
index 0000000..7251fbb
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersCreateCtrl.js
@@ -0,0 +1,71 @@
+/**
+ * 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.
+ */
+'use strict';
+
+angular.module('ambariAdminConsole')
+.controller('UsersCreateCtrl',['$scope', '$routeParams', 'User', '$location', 'Alert', 'UnsavedDialog', function($scope, $routeParams, User, $location, Alert, UnsavedDialog) {
+  $scope.user = {
+    active: true
+  };
+  var targetUrl = '/users';
+
+  $scope.createUser = function() {
+    $scope.form.submitted = true;
+    if ($scope.form.$valid){
+      User.create({
+        'Users/user_name': $scope.user.user_name,
+        'Users/password': $scope.user.password,
+        'Users/active': !!$scope.user.active,
+        'Users/admin': !!$scope.user.admin
+      }).then(function() {
+        Alert.success('Created user <a href="#/users/' + $scope.user.user_name + '">' + $scope.user.user_name + "</a>");
+        $scope.form.$setPristine();
+        $location.path(targetUrl);
+      }).catch(function(data) {
+        Alert.error('User creation error', data.data.message);
+      });
+    }
+  };
+
+  $scope.cancel = function() {
+    $scope.form.$setPristine();
+    $location.path('/users');
+  };
+
+  $scope.$on('$locationChangeStart', function(event, __targetUrl) {
+
+    if( $scope.form.$dirty ){
+      UnsavedDialog().then(function(action) {
+        targetUrl = __targetUrl.split('#').pop();
+        switch(action){
+          case 'save':
+            $scope.createUser();
+            break;
+          case 'discard':
+            $scope.form.$setPristine();
+            $location.path(targetUrl);
+            break;
+          case 'cancel':
+          targetUrl = '/users';
+            break;
+        }
+      });
+      event.preventDefault();
+    }
+  });
+}]);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersListCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersListCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersListCtrl.js
new file mode 100644
index 0000000..91c31dc
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersListCtrl.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.
+ */
+'use strict';
+
+angular.module('ambariAdminConsole')
+.controller('UsersListCtrl',['$scope', 'User', '$modal', '$rootScope', function($scope, User, $modal, $rootScope) {
+  $scope.users = [];
+  $scope.usersPerPage = 10;
+  $scope.currentPage = 1;
+  $scope.totalUsers = 1;
+  $scope.currentNameFilter = '';
+  $scope.maxVisiblePages=20;
+
+  $scope.pageChanged = function() {
+    $scope.loadUsers();
+  };
+  $scope.usersPerPageChanges = function() {
+    $scope.resetPagination();
+  };
+
+  $scope.loadUsers = function(){
+    User.list({
+      currentPage: $scope.currentPage,
+      usersPerPage: $scope.usersPerPage,
+      searchString: $scope.currentNameFilter,
+      ldap_user: $scope.currentTypeFilter.value,
+      active: $scope.currentActiveFilter.value,
+      admin: $scope.adminFilter
+    }).then(function(data) {
+      $scope.totalUsers = data.data.itemTotal;
+      $scope.users = data.data.items;
+    });
+  };
+
+  $scope.resetPagination = function() {
+    $scope.currentPage = 1;
+    $scope.loadUsers();
+  };
+
+  $scope.actvieFilterOptions = [
+    {label: 'All', value: '*'},
+    {label: 'Active', value: true},
+    {label:'Inactive', value:false}
+  ];
+  $scope.currentActiveFilter = $scope.actvieFilterOptions[0];
+
+
+  $scope.typeFilterOptions = [
+    {label:'All', value:'*'},
+    {label:'Local', value:false},
+    {label:'LDAP', value:true}
+  ];
+  $scope.currentTypeFilter = $scope.typeFilterOptions[0];
+
+  $scope.adminFilter = false;
+  $scope.toggleAdminFilter = function() {
+    $scope.adminFilter = !$scope.adminFilter;
+    $scope.resetPagination();
+    $scope.loadUsers();
+  };
+
+
+  $scope.loadUsers();
+
+  $rootScope.$watch(function(scope) {
+    return scope.LDAPSynced;
+  }, function(LDAPSynced) {
+    if(LDAPSynced === true){
+      $rootScope.LDAPSynced = false;
+      $scope.loadUsers();
+    }
+  });
+}]);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersShowCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersShowCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersShowCtrl.js
new file mode 100644
index 0000000..51d9f0c
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersShowCtrl.js
@@ -0,0 +1,191 @@
+/**
+ * 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.
+ */
+'use strict';
+
+angular.module('ambariAdminConsole')
+.controller('UsersShowCtrl', ['$scope', '$routeParams', 'User', '$modal', '$location', 'ConfirmationModal', 'Alert', 'Auth', 'getDifference', 'Group', '$q', function($scope, $routeParams, User, $modal, $location, ConfirmationModal, Alert, Auth, getDifference, Group, $q) {
+
+  function loadUserInfo(){
+    User.get($routeParams.id).then(function(data) {
+      $scope.user = data.Users;
+      $scope.isCurrentUser = $scope.user.user_name === Auth.getCurrentUser();
+      $scope.editingGroupsList = angular.copy($scope.user.groups);
+    });
+  }
+
+  loadUserInfo();
+  $scope.user;
+  $scope.isCurrentUser = true;
+  $scope.dataLoaded = false;
+
+  $scope.isGroupEditing = false;
+  $scope.enableGroupEditing = function() {
+    $scope.isGroupEditing = true;
+    $scope.editingGroupsList = angular.copy($scope.user.groups);
+  };
+
+  $scope.$watch(function() {
+    return $scope.editingGroupsList;
+  }, function(newValue) {
+    if(newValue){
+      if( !angular.equals(newValue, $scope.user.groups) ){
+        $scope.updateGroups();
+      }
+
+    }
+  }, true);
+
+  $scope.updateGroups = function() {
+    var groups = $scope.editingGroupsList.toString().split(',').filter(function(item) {return item.trim();}).map(function(item) {return item.trim()});
+    var diff = getDifference($scope.user.groups, groups);
+    var promises = [];
+    // Remove user from groups
+    angular.forEach(diff.del, function(groupName) {
+      promises.push(Group.removeMemberFromGroup(groupName, $scope.user.user_name).catch(function(data) {
+        Alert.error('Removing from group error', data.data.message);
+      }));
+    });
+    // Add user to groups
+    angular.forEach(diff.add, function(groupName) {
+      promises.push(Group.addMemberToGroup(groupName, $scope.user.user_name).catch(function(data) {
+        Alert.error('Cannot add user to group', data.data.message);
+      }));
+    });
+    $q.all(promises).then(function() {
+      loadUserInfo();
+    });
+    $scope.isGroupEditing = false;
+  };
+
+  $scope.cancelUpdate = function() {
+    $scope.isGroupEditing = false;
+    $scope.editingGroupsList = '';
+  };
+
+  $scope.openChangePwdDialog = function() {
+    var modalInstance = $modal.open({
+      templateUrl: 'views/users/modals/changePassword.html',
+      resolve: {
+        userName: function() {
+          return $scope.user.user_name;
+        }
+      },
+      controller: ['$scope', 'userName', function($scope, userName) {
+        $scope.passwordData = {
+          password: '',
+          currentUserPassword: ''
+        };
+
+        $scope.form = {};
+        $scope.userName = userName;
+
+        $scope.ok = function() {
+          $scope.form.passwordChangeForm.submitted = true;
+          if($scope.form.passwordChangeForm.$valid){
+
+            modalInstance.close({
+              password: $scope.passwordData.password,
+              currentUserPassword: $scope.passwordData.currentUserPassword
+            });
+          }
+        };
+        $scope.cancel = function() {
+          modalInstance.dismiss('cancel');
+        };
+      }]
+    });
+
+    modalInstance.result.then(function(data) {
+      User.setPassword($scope.user, data.password, data.currentUserPassword).then(function() {
+        Alert.success('Password changed.');
+      }).catch(function(data) {
+        Alert.error('Cannot change password', data.data.message);
+      });
+    });
+  };
+
+  $scope.toggleUserActive = function() {
+    if(!$scope.isCurrentUser){
+      ConfirmationModal.show('Change Status', 'Are you sure you want to change status for user "'+ $scope.user.user_name +'" to '+($scope.user.active ? 'inactive' : 'active')+'?').then(function() {
+        User.setActive($scope.user.user_name, $scope.user.active);
+      })
+      .catch(function() {
+        $scope.user.active = !$scope.user.active;
+      });;
+    }
+  };
+  $scope.toggleUserAdmin = function() {
+    if(!$scope.isCurrentUser){
+      var message = '';
+      if( !$scope.user.admin ){
+        message = 'Are you sure you want to grant Admin privilege to user ';
+      } else {
+        message = 'Are you sure you want to revoke Admin privilege from user ';
+      }
+      ConfirmationModal.show('Change Admin Privilege', message + '"'+$scope.user.user_name+'"?').then(function() {
+        User.setAdmin($scope.user.user_name, $scope.user.admin)
+        .then(function() {
+          loadPrivileges();
+        });
+      })
+      .catch(function() {
+        $scope.user.admin = !$scope.user.admin;
+      });;
+
+    }
+  };
+
+  $scope.deleteUser = function() {
+    ConfirmationModal.show('Delete User', 'Are you sure you want to delete user "'+ $scope.user.user_name +'"?').then(function() {
+      User.delete($scope.user.user_name).then(function() {
+        $location.path('/users');
+      });
+    });
+  };
+
+  // Load privileges
+  function loadPrivileges(){
+    User.getPrivileges($routeParams.id).then(function(data) {
+      var privileges = {
+        clusters: {},
+        views: {}
+      };
+      angular.forEach(data.data.items, function(privilege) {
+        privilege = privilege.PrivilegeInfo;
+        if(privilege.type === 'CLUSTER'){
+          // This is cluster
+          privileges.clusters[privilege.cluster_name] = privileges.clusters[privilege.cluster_name] || [];
+          privileges.clusters[privilege.cluster_name].push(privilege.permission_name);
+        } else if ( privilege.type === 'VIEW'){
+          privileges.views[privilege.instance_name] = privileges.views[privilege.instance_name] || { privileges:[]};
+          privileges.views[privilege.instance_name].version = privilege.version;
+          privileges.views[privilege.instance_name].view_name = privilege.view_name;
+          privileges.views[privilege.instance_name].privileges.push(privilege.permission_name);
+
+        }
+      });
+
+      $scope.privileges = data.data.items.length ? privileges : null;
+      $scope.dataLoaded = true;
+
+    }).catch(function(data) {
+      Alert.error('Cannot load privileges', data.data.message);
+    });
+  }
+  loadPrivileges();
+}]);

http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-admin/src/main/resources/ui/admin-web/app/scripts/directives/PasswordVerify.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/directives/PasswordVerify.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/directives/PasswordVerify.js
new file mode 100644
index 0000000..134ce7e
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/directives/PasswordVerify.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.
+ */
+'use strict';
+
+angular.module('ambariAdminConsole')
+.directive('passwordVerify', function() {
+  return {
+    require: 'ngModel',
+    restrict: 'A',
+    scope: {
+      passwordVerify: '='
+    },
+    link: function(scope, elem, attrs, ctrl) {
+      scope.$watch(function() {
+        return (ctrl.$pristine && angular.isUndefined(ctrl.$modelValue)) || scope.passwordVerify === ctrl.$modelValue;
+      }, function(currentValue) {
+        ctrl.$setValidity('passwordVerify', currentValue);
+      })
+    }
+  }
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-admin/src/main/resources/ui/admin-web/app/scripts/directives/disabledTooltip.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/directives/disabledTooltip.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/directives/disabledTooltip.js
new file mode 100644
index 0000000..3e29b46
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/directives/disabledTooltip.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.
+ */
+'use strict';
+
+angular.module('ambariAdminConsole')
+.directive('disabledTooltip', function() {
+  return {
+    restrict: 'A',
+    link: function(scope, elem, attrs, ctrl) {
+      if(!attrs.ngDisabled){
+        return;
+      }
+      scope.$watch(function(scope) {
+        return scope[attrs.ngDisabled];
+      }, function(val) {
+        if(val){
+          elem.tooltip({
+            title: attrs.disabledTooltip
+          });
+        } else {
+          elem.tooltip('destroy');
+        }
+      });
+    }
+  };
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-admin/src/main/resources/ui/admin-web/app/scripts/directives/editableList.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/directives/editableList.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/directives/editableList.js
new file mode 100644
index 0000000..6b56c36
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/directives/editableList.js
@@ -0,0 +1,236 @@
+/**
+ * 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.
+ */
+'use strict';
+
+angular.module('ambariAdminConsole')
+.directive('editableList', ['$q', '$document', '$location', function($q, $document, $location) {
+  return {
+    restrict: 'E',
+    templateUrl: 'views/directives/editableList.html',
+    scope: {
+      itemsSource: '=',
+      resourceType: '@',
+      editable: '='
+    },
+    link: function($scope, $elem, $attr, $ctrl) {
+      var $editBox = $elem.find('[contenteditable]');
+
+      var readInput = function() {
+        $scope.$apply(function() {
+          $scope.input = $editBox.html();
+        });
+      };
+
+      $scope.$watch(function() {
+        return $scope.input;
+      }, function(newValue) {
+        if(newValue === ''){
+          $scope.clearInput();
+        }
+      });
+
+      $scope.clearInput = function() {
+        $editBox.html('').blur();
+      };
+
+      $scope.focusOnInput = function() {
+        setTimeout(function() {
+          var elem = $editBox[0];
+          var selection = window.getSelection(),
+              range = document.createRange();
+          elem.innerHTML = '\u00a0';
+          range.selectNodeContents(elem);
+          selection.removeAllRanges();
+          selection.addRange(range);
+          document.execCommand('delete', false, null);
+        }, 0);
+      };
+
+      $editBox.on('input', readInput);
+      $editBox.on('keydown', function(e) {
+        switch(e.which){
+          case 27: // ESC
+            $editBox.html('').blur();
+            readInput();
+            break;
+          case 13: // Enter
+            $scope.$apply(function() {
+              $scope.addItem();
+              $scope.focusOnInput();
+            });
+            return false;
+            break;
+          case 40: // Down arrow
+            $scope.downArrowHandler();
+            break;
+          case 38: // Up arrow
+            $scope.upArrowHandler();
+            break;
+        }
+      });
+    },
+    controller: ['$scope', '$injector', '$modal', function($scope, $injector, $modal) {
+      var $resource = $injector.get($scope.resourceType);
+
+      $scope.identity = angular.identity; // Sorting function
+
+      $scope.items = angular.copy($scope.itemsSource);
+      $scope.editMode = false;
+      $scope.input = '';
+      $scope.typeahead = [];
+      $scope.selectedTypeahed = 0;
+
+      // Watch source of items
+      $scope.$watch(function() {
+        return $scope.itemsSource;
+      }, function(newValue) {
+        $scope.items = angular.copy($scope.itemsSource);
+      }, true);
+
+      // When input has changed - load typeahead items
+      $scope.$watch(function() {
+        return $scope.input;
+      }, function(newValue) {
+        if(newValue){
+          var newValue = newValue.split(',').filter(function(i){
+            i = i.replace('&nbsp;', ''); // Sanitize from spaces
+            return !!i.trim();
+          });
+          if( newValue.length > 1){
+            // If someone paste coma separated string, then just add all items to list
+            angular.forEach(newValue, function(item) {
+              $scope.addItem(item);
+            });
+            $scope.clearInput();
+            $scope.focusOnInput();
+
+          } else {
+            // Load typeahed items based on current input
+            $resource.listByName(newValue).then(function(data) {
+              var items = [];
+              angular.forEach(data.data.items, function(item) {
+                var name;
+                if($scope.resourceType === 'User'){
+                  name = item.Users.user_name;
+                } else if($scope.resourceType === 'Group'){
+                  name = item.Groups.group_name;
+                }
+                if($scope.items.indexOf(name) < 0){ // Only if item not in list
+                  items.push(name);
+                }
+              });
+              $scope.typeahead = items.slice(0, 5);
+              $scope.selectedTypeahed = 0;
+            });
+          }
+        } else {
+          $scope.typeahead = [];
+          $scope.selectedTypeahed = 0;
+          $scope.focusOnInput();
+        }
+      });
+
+      $scope.enableEditMode = function(event) {
+        if( $scope.editable && !$scope.editMode){
+          $scope.editMode = true;
+          $scope.focusOnInput();
+        }
+        event.stopPropagation();
+      };
+
+      $scope.cancel = function(event) {
+        $scope.editMode = false;
+        $scope.items = angular.copy($scope.itemsSource);
+        $scope.input = '';
+        event.stopPropagation();
+      };
+      $scope.save = function(event) {
+        if( $scope.input ){
+          $scope.addItem($scope.input);
+        }
+        $scope.itemsSource = $scope.items;
+        $scope.editMode = false;
+        $scope.input = '';
+        if(event){
+          event.stopPropagation();
+        }
+      };
+
+
+      $scope.downArrowHandler = function() {
+        $scope.$apply(function() {
+          $scope.selectedTypeahed = ($scope.selectedTypeahed+1) % $scope.typeahead.length;
+        });
+      };
+      $scope.upArrowHandler = function() {
+        $scope.$apply(function() {
+          $scope.selectedTypeahed -= 1;
+          $scope.selectedTypeahed = $scope.selectedTypeahed < 0 ? $scope.typeahead.length-1 : $scope.selectedTypeahed;
+        });
+      };
+
+      $scope.addItem = function(item) {
+        item = item ? item : $scope.typeahead.length ? $scope.typeahead[$scope.selectedTypeahed] : $scope.input;
+
+        if(item && $scope.items.indexOf(item) < 0){
+          $scope.items.push(item);
+          $scope.input = '';
+        }
+      };
+
+      $scope.removeFromItems = function(item) {
+        $scope.items.splice( $scope.items.indexOf(item), 1);
+      };
+
+      $scope.$on('$locationChangeStart', function(event, targetUrl) {
+        targetUrl = targetUrl.split('#').pop();
+        if( $scope.input ){
+          $scope.addItem($scope.input);
+        }
+        if( $scope.editMode && !angular.equals($scope.items, $scope.itemsSource)){
+          var modalInstance = $modal.open({
+            template: '<div class="modal-header"><h3 class="modal-title">Warning</h3></div><div class="modal-body">You have unsaved changes. Save changes or discard?</div><div class="modal-footer"><div class="btn btn-default" ng-click="cancel()">Cancel</div><div class="btn btn-warning" ng-click="discard()">Discard</div><div class="btn btn-primary" ng-click="save()">Save</div></div>',
+            controller: ['$scope', '$modalInstance', function($scope, $modalInstance) {
+              $scope.save = function() {
+                $modalInstance.close('save');
+              };
+              $scope.discard = function() {
+                $modalInstance.close('discard');
+              };
+              $scope.cancel = function() {
+                $modalInstance.close('cancel');
+              };
+            }]
+          });
+          modalInstance.result.then(function(action) {
+            switch(action){
+              case 'save':
+                $scope.save();
+                break;
+              case 'discard':
+                $scope.editMode = false;
+                $location.path(targetUrl);
+                break;
+            }
+          });
+          event.preventDefault();
+        }
+      });
+    }]
+  };
+}]);

http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-admin/src/main/resources/ui/admin-web/app/scripts/directives/linkToDir.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/directives/linkToDir.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/directives/linkToDir.js
new file mode 100644
index 0000000..72f8a8c
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/directives/linkToDir.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.
+ */
+'use strict';
+
+angular.module('ambariAdminConsole')
+.directive('linkTo', function() {
+  return {
+    restrict: 'E',
+    transclude: true,
+    replace: true,
+    scope: {
+      route: '@',
+      id: '@'
+    },
+
+    template: '<a href="#{{href}}" ng-transclude></a>',
+    controller: ['$scope', 'ROUTES', function($scope, ROUTES) {
+      var route = ROUTES;
+      angular.forEach($scope.route.split('.'), function(routeObj) {
+        route = route[routeObj];
+      });
+      $scope.href = route.url.replace(':id', $scope.id);
+    }]
+  };
+});
\ No newline at end of file