Repository: ambari
Updated Branches:
  refs/heads/branch-2.2 bd33feae9 -> aacc16dd2


AMBARI-14755. Timezone change not getting updated on Firefox (onechiporenko)


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

Branch: refs/heads/branch-2.2
Commit: aacc16dd2cfb0f2b57c82fe214d9557327ec86bf
Parents: bd33fea
Author: Oleg Nechiporenko <onechipore...@apache.org>
Authored: Thu Jan 21 14:35:33 2016 +0200
Committer: Oleg Nechiporenko <onechipore...@apache.org>
Committed: Fri Jan 22 10:10:28 2016 +0200

----------------------------------------------------------------------
 .../global/user_settings_controller.js          | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/aacc16dd/ambari-web/app/controllers/global/user_settings_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/user_settings_controller.js 
b/ambari-web/app/controllers/global/user_settings_controller.js
index e78ada0..2f541a8 100644
--- a/ambari-web/app/controllers/global/user_settings_controller.js
+++ b/ambari-web/app/controllers/global/user_settings_controller.js
@@ -104,7 +104,7 @@ App.UserSettingsController = 
Em.Controller.extend(App.UserPref, {
    */
   getUserPrefErrorCallback: function (request) {
     // this user is first time login
-    if (404 == request.status) {
+    if (404 === request.status) {
       this.updateUserPrefWithDefaultValues();
     }
   },
@@ -145,12 +145,12 @@ App.UserSettingsController = 
Em.Controller.extend(App.UserPref, {
    * @method updateUserPrefWithDefaultValues
    */
   updateUserPrefWithDefaultValues: function (response, getAllRequest) {
-    response = response || {};
+    var r = response || {};
     var keys = this.get('userSettingsKeys');
     var self = this;
     if (getAllRequest) {
       Object.keys(keys).forEach(function (key) {
-        if (Em.isNone(response[keys[key].name])) {
+        if (Em.isNone(r[keys[key].name])) {
           self.postUserPref(key, keys[key].defaultValue);
         }
       });
@@ -233,12 +233,16 @@ App.UserSettingsController = 
Em.Controller.extend(App.UserPref, {
         if (Em.isNone(curValue)) {
           curValue = initValue;
         }
+        var tz = this.get('selectedTimezone.value');
+        var popup = this;
         if (!App.get('testMode')) {
-          self.postUserPref('show_bg', curValue);
-          self.postUserPref('timezone', this.get('selectedTimezone.value'));
-        }
-        if (this.needsPageRefresh()) {
-          location.reload();
+          self.postUserPref('show_bg', curValue).always(function () {
+            self.postUserPref('timezone', tz).always(function () {
+              if (popup.needsPageRefresh()) {
+                location.reload();
+              }
+            });
+          });
         }
         this._super();
       },

Reply via email to