You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ak...@apache.org on 2014/02/26 15:06:34 UTC

git commit: AMBARI-4837. Do not show Admin Access section on non-2.1 Stack. (Denys Buzhor via akovalenko)

Repository: ambari
Updated Branches:
  refs/heads/trunk 1aeb5aa1c -> edd310c8b


AMBARI-4837. Do not show Admin Access section on non-2.1 Stack. (Denys Buzhor via akovalenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/edd310c8
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/edd310c8
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/edd310c8

Branch: refs/heads/trunk
Commit: edd310c8bba071b2319561b5a364996bc6e305da
Parents: 1aeb5aa
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Wed Feb 26 16:06:13 2014 +0200
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Wed Feb 26 16:06:13 2014 +0200

----------------------------------------------------------------------
 ambari-web/app/controllers/main/admin.js | 23 ++++++++++++++++++++++-
 ambari-web/app/routes/main.js            |  5 +++++
 ambari-web/app/views/main/admin.js       | 12 +++++++-----
 3 files changed, 34 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/edd310c8/ambari-web/app/controllers/main/admin.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin.js b/ambari-web/app/controllers/main/admin.js
index 4c596cb..ea4701c 100644
--- a/ambari-web/app/controllers/main/admin.js
+++ b/ambari-web/app/controllers/main/admin.js
@@ -20,5 +20,26 @@ var App = require('app');
 
 App.MainAdminController = Em.Controller.extend({
   name: 'mainAdminController',
-  category: 'user'
+  category: 'user',
+  /**
+   * Check if access page available.
+   * Turn on if YARN service is installed with Application Timeline Server component and TEZ installed too.
+   *
+   * @type {Boolean}
+   */
+  isAccessAvailable: function() {
+    var dependencies = {
+      services: ['YARN', 'TEZ'],
+      components: ['APP_TIMELINE_SERVER']
+    };
+    var serviceNames = App.Service.find().mapProperty('serviceName')
+      .filter(function(serviceName) {
+        return dependencies.services.contains(serviceName);
+      });
+    var componentNames = App.get('stackDependedComponents').mapProperty('componentName')
+      .filter(function(componentName) {
+        return dependencies.components.contains(componentName);
+      });
+    return (dependencies.services.length == serviceNames.length && componentNames.length == 0);
+  }.property()
 });
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/edd310c8/ambari-web/app/routes/main.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/main.js b/ambari-web/app/routes/main.js
index 80396eb..6f9b185 100644
--- a/ambari-web/app/routes/main.js
+++ b/ambari-web/app/routes/main.js
@@ -546,6 +546,11 @@ module.exports = Em.Route.extend({
       }
     }),
     adminAccess: Em.Route.extend({
+      enter: function(router) {
+        Em.run.next(function() {
+          if (!router.get('mainAdminController.isAccessAvailable')) router.transitionTo('adminUser.allUsers');
+        });
+      },
       route: '/access',
       connectOutlets: function (router) {
         router.set('mainAdminController.category', "access");

http://git-wip-us.apache.org/repos/asf/ambari/blob/edd310c8/ambari-web/app/views/main/admin.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin.js b/ambari-web/app/views/main/admin.js
index ce7f73c..bd7da50 100644
--- a/ambari-web/app/views/main/admin.js
+++ b/ambari-web/app/views/main/admin.js
@@ -51,11 +51,13 @@ App.MainAdminView = Em.View.extend({
       url: 'adminMisc',
       label: Em.I18n.t('common.misc')
     });
-    items.push({
-      name: 'access',
-      url: 'adminAccess',
-      label: Em.I18n.t('common.access')
-    });
+    if (this.get('controller.isAccessAvailable')) {
+      items.push({
+        name: 'access',
+        url: 'adminAccess',
+        label: Em.I18n.t('common.access')
+      });
+    }
     return items;
   }.property(''),