ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nc...@apache.org
Subject [01/24] ambari git commit: AMBARI-14956. If cluster is not deployed login message is shown 2-3 seconds (alexantonenko)
Date Wed, 10 Feb 2016 16:12:58 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-dev-patch-upgrade 697c309c1 -> c543ef8b2


AMBARI-14956. If cluster is not deployed login message is shown 2-3 seconds
 (alexantonenko)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 62f3a3bb7f72c5564b45b8d1fd64a567471084c1
Parents: f60472d
Author: Alex Antonenko <hiveww@gmail.com>
Authored: Mon Feb 8 15:56:28 2016 +0200
Committer: Alex Antonenko <hiveww@gmail.com>
Committed: Mon Feb 8 17:27:01 2016 +0200

----------------------------------------------------------------------
 ambari-web/app/router.js | 48 +++++++++++++++++++++++++++----------------
 1 file changed, 30 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/62f3a3bb/ambari-web/app/router.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/router.js b/ambari-web/app/router.js
index 360480f..809979e 100644
--- a/ambari-web/app/router.js
+++ b/ambari-web/app/router.js
@@ -320,22 +320,10 @@ App.Router = Em.Router.extend({
       App.ajax.send({
         name: 'router.login.message',
         sender: self,
-        success: 'showLoginMessage'
-
-    });
-
-      // no need to load cluster data if it's already loaded
-      if (self.get('clusterData')) {
-        self.loginGetClustersSuccessCallback(self.get('clusterData'), {}, requestData);
-      }
-      else {
-        App.ajax.send({
-          name: 'router.login.clusters',
-          sender: self,
-          data: requestData,
-          success: 'loginGetClustersSuccessCallback'
-        });
-      }
+        data: requestData,
+        success: 'showLoginMessage',
+        error: 'showLoginMessage'
+      });
     });
   },
 
@@ -362,11 +350,12 @@ App.Router = Em.Router.extend({
    * success callback of router.login.message
    * @param {object} data
    */
-  showLoginMessage: function (data){
+  showLoginMessage: function (data, opt, params){
     var response = JSON.parse(data.Settings.content.replace(/\n/g, "\\n")),
       text = response.text ? response.text : "",
       buttonText = response.button ? response.button : Em.I18n.t('ok'),
-      status = response.status && response.status == "true" ? true : false;
+      status = response.status && response.status == "true" ? true : false,
+      self = this;
 
     if(text && status){
       return App.ModalPopup.show({
@@ -379,9 +368,11 @@ App.Router = Em.Router.extend({
         secondary: null,
 
         onPrimary: function () {
+          self.setClusterData(data, opt, params);
           this.hide();
         },
         onClose: function () {
+          self.setClusterData(data, opt, params);
           this.hide();
         },
         didInsertElement: function () {
@@ -391,6 +382,27 @@ App.Router = Em.Router.extend({
     }
   },
 
+  setClusterData: function (data, opt, params) {
+    var
+      self = this,
+      requestData = {
+        loginName: params.loginName,
+        loginData: data
+      };
+    // no need to load cluster data if it's already loaded
+    if (this.get('clusterData')) {
+      this.loginGetClustersSuccessCallback(self.get('clusterData'), {}, requestData);
+    }
+    else {
+      App.ajax.send({
+        name: 'router.login.clusters',
+        sender: self,
+        data: requestData,
+        success: 'loginGetClustersSuccessCallback'
+      });
+    }
+  },
+
 
   /**
    * success callback of login request


Mime
View raw message