You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by al...@apache.org on 2016/02/08 16:27:04 UTC

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

Repository: ambari
Updated Branches:
  refs/heads/trunk f60472d5f -> 62f3a3bb7


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/trunk
Commit: 62f3a3bb7f72c5564b45b8d1fd64a567471084c1
Parents: f60472d
Author: Alex Antonenko <hi...@gmail.com>
Authored: Mon Feb 8 15:56:28 2016 +0200
Committer: Alex Antonenko <hi...@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