You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by at...@apache.org on 2017/02/10 19:37:50 UTC

ambari git commit: AMBARI-19962 Clicking on the login button (or hitting page refresh) to seeing the dashboard takes a while on a 1000-node cluster. (atkach)

Repository: ambari
Updated Branches:
  refs/heads/trunk fe1704e12 -> e8a996184


AMBARI-19962 Clicking on the login button (or hitting page refresh) to seeing the dashboard takes a while on a 1000-node cluster. (atkach)


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

Branch: refs/heads/trunk
Commit: e8a9961841e0eaac2b471526068afabf37d10a35
Parents: fe1704e
Author: Andrii Tkach <at...@apache.org>
Authored: Fri Feb 10 17:59:58 2017 +0200
Committer: Andrii Tkach <at...@apache.org>
Committed: Fri Feb 10 21:37:29 2017 +0200

----------------------------------------------------------------------
 ambari-web/app/router.js          | 37 ++++++++++++++++++++++++++--------
 ambari-web/app/utils/ajax/ajax.js |  2 +-
 2 files changed, 30 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/e8a99618/ambari-web/app/router.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/router.js b/ambari-web/app/router.js
index d671e86..df54303 100644
--- a/ambari-web/app/router.js
+++ b/ambari-web/app/router.js
@@ -256,16 +256,35 @@ App.Router = Em.Router.extend({
 
   displayLoginName: Em.computed.truncate('loginName', 10, 10),
 
+  /**
+   * @type {$.ajax|null}
+   */
+  clusterDataRequest: null,
+
+  /**
+   * If request was already sent on login then use saved clusterDataRequest and don't make second call
+   * @returns {$.ajax}
+   */
+  getClusterDataRequest: function() {
+    var clusterDataRequest = this.get('clusterDataRequest');
+    if (clusterDataRequest) {
+      this.set('clusterDataRequest', null);
+      return clusterDataRequest;
+    } else {
+      return App.ajax.send({
+        name: 'router.login.clusters',
+        sender: this,
+        success: 'onAuthenticationSuccess',
+        error: 'onAuthenticationError'
+      });
+    }
+  },
+
   getAuthenticated: function () {
     var dfd = $.Deferred();
     var self = this;
     var auth = App.db.getAuthenticated();
-    App.ajax.send({
-      name: 'router.login.clusters',
-      sender: this,
-      success: 'onAuthenticationSuccess',
-      error: 'onAuthenticationError'
-    }).complete(function (xhr) {
+    this.getClusterDataRequest().complete(function (xhr) {
       if (xhr.state() === 'resolved') {
         // if server knows the user and user authenticated by UI
         if (auth) {
@@ -535,12 +554,12 @@ App.Router = Em.Router.extend({
       this.loginGetClustersSuccessCallback(self.get('clusterData'), {}, requestData);
     }
     else {
-      App.ajax.send({
+      this.set('clusterDataRequest', App.ajax.send({
         name: 'router.login.clusters',
         sender: self,
         data: requestData,
         success: 'loginGetClustersSuccessCallback'
-      });
+      }));
     }
   },
 
@@ -584,6 +603,8 @@ App.Router = Em.Router.extend({
         router.transitionToAdminView();
       }
     }
+    // set cluster name and security type
+    App.router.get('clusterController').reloadSuccessCallback(clustersData);
     App.set('isPermissionDataLoaded', true);
     App.router.get('loginController').postLogin(true, true);
   },

http://git-wip-us.apache.org/repos/asf/ambari/blob/e8a99618/ambari-web/app/utils/ajax/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax/ajax.js b/ambari-web/app/utils/ajax/ajax.js
index e344128..ae3947f 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -2290,7 +2290,7 @@ var urls = {
     mock: '/data/users/privileges_{userName}.json'
   },
   'router.login.clusters': {
-    'real': '/clusters?fields=Clusters/provisioning_state',
+    'real': '/clusters?fields=Clusters/provisioning_state,Clusters/security_type',
     'mock': '/data/clusters/info.json'
   },
   'router.login.message': {