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/08/22 23:50:10 UTC

git commit: AMBARI-6998. Admin View: double refresh on logout. (yusaku)

Repository: ambari
Updated Branches:
  refs/heads/trunk bd2e51621 -> e50da949a


AMBARI-6998. Admin View: double refresh on logout. (yusaku)


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

Branch: refs/heads/trunk
Commit: e50da949adb26563d3efb413433d63dd0742ef6f
Parents: bd2e516
Author: Yusaku Sako <yu...@hortonworks.com>
Authored: Fri Aug 22 14:45:57 2014 -0700
Committer: Yusaku Sako <yu...@hortonworks.com>
Committed: Fri Aug 22 14:46:15 2014 -0700

----------------------------------------------------------------------
 ambari-web/app/app.js                    | 1 +
 ambari-web/app/router.js                 | 9 +++++++--
 ambari-web/app/templates/application.hbs | 6 +++---
 3 files changed, 11 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/e50da949/ambari-web/app/app.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/app.js b/ambari-web/app/app.js
index 09c56fe..bd1f45a 100644
--- a/ambari-web/app/app.js
+++ b/ambari-web/app/app.js
@@ -33,6 +33,7 @@ module.exports = Em.Application.create({
     recordCache: []
   }),
   isAdmin: false,
+  isOperator: false,
   /**
    * return url prefix with number value of version of HDP stack
    */

http://git-wip-us.apache.org/repos/asf/ambari/blob/e50da949/ambari-web/app/router.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/router.js b/ambari-web/app/router.js
index 5510434..04c6385 100644
--- a/ambari-web/app/router.js
+++ b/ambari-web/app/router.js
@@ -274,6 +274,7 @@ App.Router = Em.Router.extend({
           var clusterPermissions = privileges.items.filterProperty('PrivilegeInfo.cluster_name', clusterName).mapProperty('PrivilegeInfo.permission_name');
           if (clusterPermissions.indexOf('CLUSTER.OPERATE') > -1) {
             App.set('isAdmin', true);
+            App.set('isOperator', true);
             transitionToApp = true;
           } else if (clusterPermissions.indexOf('CLUSTER.READ') > -1) {
             transitionToApp = true;
@@ -349,6 +350,7 @@ App.Router = Em.Router.extend({
     // since it's a computed property but we are not setting it as a dependent of App.db.
     App.db.cleanUp();
     App.set('isAdmin', false);
+    App.set('isOperator', false);
     this.set('loggedIn', false);
     this.clearAllSteps();
     console.log("Log off: " + App.router.getClusterName());
@@ -367,8 +369,11 @@ App.Router = Em.Router.extend({
         error:'logOffErrorCallback'
       });
     }
-    this.transitionTo('login', context);
-    window.location.reload();
+    if (App.router.get('clusterController.isLoaded')) {
+      window.location.reload();
+    } else {
+      this.transitionTo('login', context);
+    }
   },
 
   logOffSuccessCallback: function (data) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/e50da949/ambari-web/app/templates/application.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/application.hbs b/ambari-web/app/templates/application.hbs
index 5a6ce4c..2b17667 100644
--- a/ambari-web/app/templates/application.hbs
+++ b/ambari-web/app/templates/application.hbs
@@ -49,9 +49,9 @@
               </button>
               <ul class="dropdown-menu">
                   <li><a href="" {{action showAboutPopup target="controller"}}>{{t app.aboutAmbari}}</a></li>
-                  {{#if App.isAdmin }}
-                    <li><a href="/views/ADMIN_VIEW/1.0.0/INSTANCE/#/" target="adminconsole">{{t app.manageAmbari}}</a></li>
-                  {{/if}}
+                  {{#if App.isAdmin}}{{#unless App.isOperator}}
+                      <li><a href="/views/ADMIN_VIEW/1.0.0/INSTANCE/#/" target="adminconsole">{{t app.manageAmbari}}</a></li>
+                  {{/unless}}{{/if}}
                 {{#if isClusterDataLoaded}}
                   {{#if App.isAdmin}}
                       <li><a href="" {{action showSettingsPopup target="controller"}}>{{t app.settings}}</a></li>