incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ababiic...@apache.org
Subject [1/2] git commit: AMBARI-3829 Custom user name is not displayed. (ababiichuk)
Date Wed, 20 Nov 2013 17:32:58 GMT
Updated Branches:
  refs/heads/trunk a1bbb6e5b -> a61a83623


AMBARI-3829 Custom user name is not displayed. (ababiichuk)


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

Branch: refs/heads/trunk
Commit: 89a3a2ee909a088dce0425b649ec3e9e0f53775d
Parents: a1bbb6e
Author: aBabiichuk <ababiichuk@cybervisiontech.com>
Authored: Wed Nov 20 19:25:46 2013 +0200
Committer: aBabiichuk <ababiichuk@cybervisiontech.com>
Committed: Wed Nov 20 19:25:46 2013 +0200

----------------------------------------------------------------------
 .../main/admin/security/add/step4.js            |  2 +-
 .../controllers/main/admin/security/disable.js  |  2 +-
 ambari-web/app/models/cluster_states.js         | 28 +++++++++++++++++---
 ambari-web/app/router.js                        |  2 +-
 ambari-web/app/routes/add_security.js           |  6 ++---
 5 files changed, 31 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/89a3a2ee/ambari-web/app/controllers/main/admin/security/add/step4.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/security/add/step4.js b/ambari-web/app/controllers/main/admin/security/add/step4.js
index d62fd1d..6e8d6c1 100644
--- a/ambari-web/app/controllers/main/admin/security/add/step4.js
+++ b/ambari-web/app/controllers/main/admin/security/add/step4.js
@@ -710,7 +710,7 @@ App.MainAdminSecurityAddStep4Controller = Em.Controller.extend({
           clusterName: this.get('clusterName'),
           clusterState: 'ADD_SECURITY_STEP_4',
           wizardControllerName: App.router.get('addSecurityController.name'),
-          localdb: App.db.data.AddSecurity
+          localdb: App.db.data
         });
       }
     }

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/89a3a2ee/ambari-web/app/controllers/main/admin/security/disable.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/security/disable.js b/ambari-web/app/controllers/main/admin/security/disable.js
index d15265d..91b1933 100644
--- a/ambari-web/app/controllers/main/admin/security/disable.js
+++ b/ambari-web/app/controllers/main/admin/security/disable.js
@@ -472,7 +472,7 @@ App.MainAdminSecurityDisableController = Em.Controller.extend({
           clusterName: this.get('clusterName'),
           clusterState: 'DISABLE_SECURITY',
           wizardControllerName: this.get('name'),
-          localdb: App.db.data.AddSecurity
+          localdb: App.db.data
         });
       }
     }

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/89a3a2ee/ambari-web/app/models/cluster_states.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/cluster_states.js b/ambari-web/app/models/cluster_states.js
index b82e079..c922e90 100644
--- a/ambari-web/app/models/cluster_states.js
+++ b/ambari-web/app/models/cluster_states.js
@@ -56,9 +56,15 @@ App.clusterStatus = Ember.Object.create({
    * @param isAsync: set this to true if the call is to be made asynchronously.  if unspecified,
false is assumed
    * @return promise object for the get call
    */
-  updateFromServer: function(isAsync) {
+  updateFromServer: function(isAsync, overrideLocaldb) {
     // if isAsync is undefined, set it to false
     isAsync = isAsync || false;
+    // if overrideLocaldb is undefined, set it to true
+    if(typeof overrideLocaldb == "undefined"){
+      overrideLocaldb =  true;
+    }
+    var user = App.db.getUser();
+    var login = App.db.getLoginName();
     var url = App.apiPrefix + '/persist/' + this.get('key');
     return jQuery.ajax(
       {
@@ -79,8 +85,12 @@ App.clusterStatus = Ember.Object.create({
             }
             if (newValue.localdb) {
               this.set('localdb', newValue.localdb);
-              App.db.data = newValue.localdb;
-              App.db.setLocalStorage();
+              if (overrideLocaldb) {
+                App.db.data = newValue.localdb;
+                App.db.setLocalStorage();
+                App.db.setUser(user);
+                App.db.setLoginName(login);
+              }
             }
           } else {
             // default status already set
@@ -114,6 +124,8 @@ App.clusterStatus = Ember.Object.create({
    */
   setClusterStatus: function(newValue){
     if(App.testMode) return false;
+    var user = App.db.getUser();
+    var login = App.db.getLoginName();
     var val = {clusterName: this.get('clusterName')};
     if (newValue) {
       //setter
@@ -131,8 +143,18 @@ App.clusterStatus = Ember.Object.create({
         val.wizardControllerName = newValue.wizardControllerName;
       }
       if (newValue.localdb) {
+        if (newValue.localdb.app && newValue.localdb.app.user)
+          delete newValue.localdb.app.user;
+        if (newValue.localdb.app && newValue.localdb.app.loginName)
+          delete newValue.localdb.app.loginName;
         this.set('localdb', newValue.localdb);
         val.localdb = newValue.localdb;
+      } else {
+        delete App.db.data.app.user;
+        delete App.db.data.app.loginName;
+          val.localdb = App.db.data;
+        App.db.setUser(user);
+        App.db.setLoginName(login);
       }
 
       var keyValuePair = {};

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/89a3a2ee/ambari-web/app/router.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/router.js b/ambari-web/app/router.js
index c1169c3..e34894b 100644
--- a/ambari-web/app/router.js
+++ b/ambari-web/app/router.js
@@ -266,7 +266,7 @@ App.Router = Em.Router.extend({
         return 'main.index';
       }
     }
-    App.clusterStatus.updateFromServer();
+    App.clusterStatus.updateFromServer(false, false);
     var clusterStatusOnServer = App.clusterStatus.get('value');
     if (!App.get('isAdmin') || clusterStatusOnServer && clusterStatusOnServer.clusterState
=== 'DEFAULT') {
       return 'main.index';

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/89a3a2ee/ambari-web/app/routes/add_security.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/add_security.js b/ambari-web/app/routes/add_security.js
index 8a4d730..b9e7796 100644
--- a/ambari-web/app/routes/add_security.js
+++ b/ambari-web/app/routes/add_security.js
@@ -109,7 +109,7 @@ module.exports = Em.Route.extend({
           clusterName: this.get('clusterName'),
           clusterState: 'ADD_SECURITY_STEP_1',
           wizardControllerName: router.get('addSecurityController.name'),
-          localdb: App.db.data.AddSecurity
+          localdb: App.db.data
         });
       }
     },
@@ -145,7 +145,7 @@ module.exports = Em.Route.extend({
           clusterName: this.get('clusterName'),
           clusterState: 'ADD_SECURITY_STEP_2',
           wizardControllerName: router.get('addSecurityController.name'),
-          localdb:  App.db.data.AddSecurity
+          localdb:  App.db.data
         });
       }
     },
@@ -179,7 +179,7 @@ module.exports = Em.Route.extend({
           clusterName: this.get('clusterName'),
           clusterState: 'ADD_SECURITY_STEP_3',
           wizardControllerName: router.get('addSecurityController.name'),
-          localdb:  App.db.data.AddSecurity
+          localdb:  App.db.data
         });
       }
     },


Mime
View raw message