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:26:39 UTC
[1/3] ambari git commit: AMBARI-12656. Hosts Page Performance: Avoid
triggering hosts loading immediately after switching to hosts tab (rzang)
Repository: ambari
Updated Branches:
refs/heads/trunk 38d5eaf0c -> cf3965b75
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/721acd8e
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/721acd8e
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/721acd8e
Branch: refs/heads/trunk
Commit: 721acd8eee7584a1cbb51b502771a54055d491df
Parents: 8b96592
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:22:20 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/721acd8e/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/721acd8e/ambari-web/app/routes/main.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/main.js b/ambari-web/app/routes/main.js
index af86eda..acd6a39 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/721acd8e/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/721acd8e/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;
[2/3] ambari git commit: AMBARI-12655. Hosts Page Performance: Filter
update/save related problems (rzang)
Posted by rz...@apache.org.
AMBARI-12655. Hosts Page Performance: Filter update/save related problems (rzang)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8b96592a
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8b96592a
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8b96592a
Branch: refs/heads/trunk
Commit: 8b96592a0e30fb01f8f4f81412b6bdd972255e2e
Parents: 38d5eaf
Author: Richard Zang <rz...@apache.org>
Authored: Wed Aug 5 17:30:40 2015 -0700
Committer: Richard Zang <rz...@apache.org>
Committed: Tue Aug 11 18:22:20 2015 -0700
----------------------------------------------------------------------
.../mixins/common/table_server_view_mixin.js | 26 ++++++++++++++++++++
ambari-web/app/views/common/table_view.js | 12 +++++++--
.../common/table_server_view_mixin_test.js | 8 +++---
3 files changed, 40 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/8b96592a/ambari-web/app/mixins/common/table_server_view_mixin.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/table_server_view_mixin.js b/ambari-web/app/mixins/common/table_server_view_mixin.js
index 76c2167..3716d42 100644
--- a/ambari-web/app/mixins/common/table_server_view_mixin.js
+++ b/ambari-web/app/mixins/common/table_server_view_mixin.js
@@ -75,6 +75,9 @@ App.TableServerViewMixin = Em.Mixin.create({
* @param type
*/
updateFilter: function (iColumn, value, type) {
+ // Do not even trigger update flow if it's a blank update
+ if (this.isBlankFilterUpdate(iColumn, value, type)) { return; }
+
var self = this;
this.set('controller.resetStartIndex', false);
this.saveFilterConditions(iColumn, value, type, false);
@@ -91,6 +94,29 @@ App.TableServerViewMixin = Em.Mixin.create({
},
/**
+ * 1) Has previous saved filter
+ * 2) Value to update is empty
+ * 3) Value to update is same as before
+ * Returns true if (!1&&2 || 1&&3)
+ * @param iColumn
+ * @param value
+ * @param type
+ * @returns {boolean|*}
+ */
+ isBlankFilterUpdate: function(iColumn, value, type) {
+ var result = false;
+ var filterConfitions = this.get('filterConditions');
+ var filterCondition = filterConfitions? filterConfitions.findProperty('iColumn', iColumn) : null;
+ if ((!filterCondition && Em.isEmpty(value))
+ || (filterCondition && filterCondition.value == value)
+ || (filterCondition && typeof filterCondition.value == 'object'
+ && JSON.stringify(filterCondition.value) == JSON.stringify(value))) {
+ result = true;
+ }
+ return result;
+ },
+
+ /**
* success callback for updater request
*/
updaterSuccessCb: function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/8b96592a/ambari-web/app/views/common/table_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/table_view.js b/ambari-web/app/views/common/table_view.js
index 9a8426b..12bf9f3 100644
--- a/ambari-web/app/views/common/table_view.js
+++ b/ambari-web/app/views/common/table_view.js
@@ -104,7 +104,7 @@ App.TableView = Em.View.extend(App.UserPref, {
var name = this.get('controller.name');
var self = this;
var filterConditions = App.db.getFilterConditions(name);
- if (filterConditions) {
+ if (!Em.isEmpty(filterConditions)) {
this.set('filterConditions', filterConditions);
var childViews = this.get('childViews');
@@ -367,6 +367,8 @@ App.TableView = Em.View.extend(App.UserPref, {
};
this.get('filterConditions').push(filterCondition);
}
+ // remove empty entries
+ this.set('filterConditions', this.get('filterConditions').filter(function(item){ return !Em.isEmpty(item.value); }));
App.db.setFilterConditions(this.get('controller.name'), this.get('filterConditions'));
},
@@ -383,7 +385,13 @@ App.TableView = Em.View.extend(App.UserPref, {
},
clearFilterCondition: function() {
- App.db.setFilterConditions(this.get('controller.name'), null);
+ var result = false;
+ var currentFCs = App.db.getFilterConditions(this.get('controller.name'));
+ if (currentFCs != null) {
+ App.db.setFilterConditions(this.get('controller.name'), null);
+ result = true;
+ }
+ return result;
},
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/8b96592a/ambari-web/test/mixins/common/table_server_view_mixin_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/common/table_server_view_mixin_test.js b/ambari-web/test/mixins/common/table_server_view_mixin_test.js
index 60e0663..4944a7b 100644
--- a/ambari-web/test/mixins/common/table_server_view_mixin_test.js
+++ b/ambari-web/test/mixins/common/table_server_view_mixin_test.js
@@ -147,18 +147,18 @@ describe('App.MainConfigHistoryView', function() {
this.clock = sinon.useFakeTimers();
view.set('filteringComplete', false);
- view.updateFilter(1, '', 'string');
+ view.updateFilter(1, '1', 'string');
expect(view.get('controller.resetStartIndex')).to.be.false;
- expect(view.saveFilterConditions.calledWith(1, '', 'string', false)).to.be.true;
+ expect(view.saveFilterConditions.calledWith(1, '1', 'string', false)).to.be.true;
view.set('filteringComplete', true);
this.clock.tick(view.get('filterWaitingTime'));
- expect(view.updateFilter.calledWith(1, '', 'string')).to.be.true;
+ expect(view.updateFilter.calledWith(1, '1', 'string')).to.be.true;
this.clock.restore();
});
it('filteringComplete is true', function() {
view.set('filteringComplete', true);
- view.updateFilter(1, '', 'string');
+ view.updateFilter(1, '1', 'string');
expect(view.get('controller.resetStartIndex')).to.be.true;
expect(view.refresh.calledOnce).to.be.true;
});
[3/3] ambari git commit: AMBARI-12708. Hosts Page Performance: Reuse
existing FE host model on drill in/out single host detail (rzang)
Posted by rz...@apache.org.
AMBARI-12708. Hosts Page Performance: Reuse existing FE host model on drill in/out single host detail (rzang)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/cf3965b7
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/cf3965b7
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/cf3965b7
Branch: refs/heads/trunk
Commit: cf3965b756423d42c264448f0d86adddec0a0f89
Parents: 721acd8
Author: Richard Zang <rz...@apache.org>
Authored: Tue Aug 11 11:47:55 2015 -0700
Committer: Richard Zang <rz...@apache.org>
Committed: Tue Aug 11 18:22:21 2015 -0700
----------------------------------------------------------------------
ambari-web/app/controllers/main/host.js | 5 +++++
ambari-web/app/mappers/hosts_mapper.js | 4 +++-
ambari-web/app/routes/main.js | 2 +-
ambari-web/app/views/main/host.js | 5 ++++-
4 files changed, 13 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/cf3965b7/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 86dd2c2..aa82645 100644
--- a/ambari-web/app/controllers/main/host.js
+++ b/ambari-web/app/controllers/main/host.js
@@ -62,6 +62,11 @@ App.MainHostController = Em.ArrayController.extend(App.TableServerMixin, {
* if true, fire host loading immediately with out any postpone.
*/
needQuickInitLoad: false,
+
+ /**
+ * true if from details page
+ */
+ isDrillUp: false,
/**
* Components which will be shown in component filter
* @returns {Array}
http://git-wip-us.apache.org/repos/asf/ambari/blob/cf3965b7/ambari-web/app/mappers/hosts_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/hosts_mapper.js b/ambari-web/app/mappers/hosts_mapper.js
index cd05499..69f0139 100644
--- a/ambari-web/app/mappers/hosts_mapper.js
+++ b/ambari-web/app/mappers/hosts_mapper.js
@@ -185,7 +185,9 @@ App.hostsMapper = App.QuickDataMapper.create({
App.store.loadMany(App.HostStackVersion, stackVersions);
}
App.store.loadMany(App.HostComponent, components);
- App.Host.find().clear();
+ if (App.router.get('currentState.parentState.name') != 'hostDetails') {
+ App.Host.find().clear();
+ }
App.store.loadMany(App.Host, hostsWithFullInfo);
var itemTotal = parseInt(json.itemTotal);
if (!isNaN(itemTotal)) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/cf3965b7/ambari-web/app/routes/main.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/main.js b/ambari-web/app/routes/main.js
index acd6a39..de2f0a9 100644
--- a/ambari-web/app/routes/main.js
+++ b/ambari-web/app/routes/main.js
@@ -189,7 +189,6 @@ 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);
},
@@ -264,6 +263,7 @@ module.exports = Em.Route.extend(App.RouterRedirections, {
back: function (router, event) {
var referer = router.get('mainHostDetailsController.referer');
if (referer) {
+ router.set('mainHostController.isDrillUp', true);
router.route(referer);
}
else {
http://git-wip-us.apache.org/repos/asf/ambari/blob/cf3965b7/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 3423fa2..e0f1cbf 100644
--- a/ambari-web/app/views/main/host.js
+++ b/ambari-web/app/views/main/host.js
@@ -212,7 +212,8 @@ App.MainHostView = App.TableView.extend(App.TableServerViewMixin, {
onInitialLoad: function () {
if (this.get('tableFilteringComplete')) {
- if (this.get('controller.fromTopBarClicking') && !this.get('controller.filterClearHappened') && !this.get('controller.needQuickInitLoad')) {
+ if (this.get('controller.fromTopBarClicking') && !this.get('controller.filterClearHappened')
+ && !this.get('controller.needQuickInitLoad') || this.get('controller.isDrillUp')) {
Em.run.later(this, this.refresh, App.get('contentUpdateInterval'));
this.clearLoadRelatedStates();
} else {
@@ -226,6 +227,8 @@ App.MainHostView = App.TableView.extend(App.TableServerViewMixin, {
this.set('controller.filterClearHappened', false);
this.set('controller.fromTopBarClicking', false);
this.set('controller.needQuickInitLoad', false);
+ this.set('controller.isDrillUp', false);
+
},
/**