You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by rz...@apache.org on 2015/08/12 03:28:26 UTC
[2/3] ambari git commit: AMBARI-12656. Hosts Page Performance: Avoid
triggering hosts loading immediately after switching to hosts tab (rzang)
AMBARI-12656. Hosts Page Performance: Avoid triggering hosts loading immediately after switching to hosts tab (rzang)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/49668c0a
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/49668c0a
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/49668c0a
Branch: refs/heads/branch-2.1
Commit: 49668c0ade4599641387ed1facb999039a136f43
Parents: 6ea94f4
Author: Richard Zang <rz...@apache.org>
Authored: Thu Aug 6 14:13:19 2015 -0700
Committer: Richard Zang <rz...@apache.org>
Committed: Tue Aug 11 18:27:53 2015 -0700
----------------------------------------------------------------------
ambari-web/app/controllers/main/host.js | 18 ++++++++++++++++++
ambari-web/app/routes/main.js | 1 +
ambari-web/app/views/main/host.js | 17 +++++++++++++++--
ambari-web/app/views/main/menu.js | 1 +
4 files changed, 35 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/49668c0a/ambari-web/app/controllers/main/host.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host.js b/ambari-web/app/controllers/main/host.js
index 9d8347c..86dd2c2 100644
--- a/ambari-web/app/controllers/main/host.js
+++ b/ambari-web/app/controllers/main/host.js
@@ -45,6 +45,24 @@ App.MainHostController = Em.ArrayController.extend(App.TableServerMixin, {
startIndex: 1,
/**
+ * true if any host filter got cleared
+ */
+ filterClearHappened: false,
+
+ /**
+ * true if user click "Hosts" on top menu bar
+ */
+ fromTopBarClicking: false,
+ /**
+ * if true, do not clean stored filter before hosts page rendering.
+ */
+ showFilterConditionsFirstLoad: false,
+
+ /**
+ * if true, fire host loading immediately with out any postpone.
+ */
+ needQuickInitLoad: false,
+ /**
* Components which will be shown in component filter
* @returns {Array}
*/
http://git-wip-us.apache.org/repos/asf/ambari/blob/49668c0a/ambari-web/app/routes/main.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/main.js b/ambari-web/app/routes/main.js
index 60567d0..b94d729 100644
--- a/ambari-web/app/routes/main.js
+++ b/ambari-web/app/routes/main.js
@@ -189,6 +189,7 @@ module.exports = Em.Route.extend(App.RouterRedirections, {
route: '/:host_id',
connectOutlets: function (router, host) {
router.get('mainHostController').set('showFilterConditionsFirstLoad', true);
+ router.set('mainHostController.needQuickInitLoad', true);
router.get('mainController').connectOutlet('mainHostDetails', host);
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/49668c0a/ambari-web/app/views/main/host.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/host.js b/ambari-web/app/views/main/host.js
index 6ab3d22..3423fa2 100644
--- a/ambari-web/app/views/main/host.js
+++ b/ambari-web/app/views/main/host.js
@@ -180,7 +180,8 @@ App.MainHostView = App.TableView.extend(App.TableServerViewMixin, {
*/
willInsertElement: function () {
if (!this.get('controller.showFilterConditionsFirstLoad')) {
- this.clearFilterCondition();
+ var didClearedSomething = this.clearFilterCondition();
+ this.set('controller.filterClearHappened', didClearedSomething);
}
this._super();
this.set('startIndex', this.get('controller.startIndex'));
@@ -211,10 +212,22 @@ App.MainHostView = App.TableView.extend(App.TableServerViewMixin, {
onInitialLoad: function () {
if (this.get('tableFilteringComplete')) {
- this.refresh();
+ if (this.get('controller.fromTopBarClicking') && !this.get('controller.filterClearHappened') && !this.get('controller.needQuickInitLoad')) {
+ Em.run.later(this, this.refresh, App.get('contentUpdateInterval'));
+ this.clearLoadRelatedStates();
+ } else {
+ this.refresh();
+ this.clearLoadRelatedStates();
+ }
}
}.observes('tableFilteringComplete'),
+ clearLoadRelatedStates: function() {
+ this.set('controller.filterClearHappened', false);
+ this.set('controller.fromTopBarClicking', false);
+ this.set('controller.needQuickInitLoad', false);
+ },
+
/**
* Set <code>selected</code> property for each App.Host
*/
http://git-wip-us.apache.org/repos/asf/ambari/blob/49668c0a/ambari-web/app/views/main/menu.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/menu.js b/ambari-web/app/views/main/menu.js
index 40f9781..d4d7ef3 100644
--- a/ambari-web/app/views/main/menu.js
+++ b/ambari-web/app/views/main/menu.js
@@ -101,6 +101,7 @@ App.MainMenuView = Em.CollectionView.extend({
goToSection: function (event) {
if (event.context === 'hosts') {
App.router.set('mainHostController.showFilterConditionsFirstLoad', false);
+ App.router.set('mainHostController.fromTopBarClicking', true);
} else if (event.context === 'views') {
App.router.route('views');
return;