Repository: ambari Updated Branches: refs/heads/trunk 78d04fe45 -> 0562c9c7d
AMBARI-12829. Filtering in the "Select Alert Group Definitions"-popup is too slow, when there are more than 1000 definitions (onechiporenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/0562c9c7 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0562c9c7 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0562c9c7 Branch: refs/heads/trunk Commit: 0562c9c7d65f8b5e956fdb61852cfb872e824bc7 Parents: 78d04fe Author: Oleg Nechiporenko <onechipore...@apache.org> Authored: Thu Aug 20 16:12:06 2015 +0300 Committer: Oleg Nechiporenko <onechipore...@apache.org> Committed: Thu Aug 20 16:17:44 2015 +0300 ---------------------------------------------------------------------- ambari-web/app/utils/hosts.js | 1 + .../select_definitions_popup_body_view.js | 14 +++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/0562c9c7/ambari-web/app/utils/hosts.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/utils/hosts.js b/ambari-web/app/utils/hosts.js index b89bd84..e7ea98c 100644 --- a/ambari-web/app/utils/hosts.js +++ b/ambari-web/app/utils/hosts.js @@ -132,6 +132,7 @@ module.exports = { initialHosts.setEach('filtered', true); this.set('parentView.availableHosts', initialHosts); this.set('parentView.isLoaded', true); + this.filteredContentObsOnce(); }, filterHosts: function () { http://git-wip-us.apache.org/repos/asf/ambari/blob/0562c9c7/ambari-web/app/views/main/alerts/manage_alert_groups/select_definitions_popup_body_view.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/main/alerts/manage_alert_groups/select_definitions_popup_body_view.js b/ambari-web/app/views/main/alerts/manage_alert_groups/select_definitions_popup_body_view.js index f92b804..b92ddad 100644 --- a/ambari-web/app/views/main/alerts/manage_alert_groups/select_definitions_popup_body_view.js +++ b/ambari-web/app/views/main/alerts/manage_alert_groups/select_definitions_popup_body_view.js @@ -26,9 +26,16 @@ App.SelectDefinitionsPopupBodyView = App.TableView.extend({ isPaginate: true, - filteredContent: function () { - return this.get('parentView.availableDefs').filterProperty('filtered') || []; - }.property('parentView.availableDefs.@each.filtered'), + filteredContent: [], + + filteredContentObs: function () { + Em.run.once(this, this.filteredContentObsOnce); + }.observes('parentView.availableDefs.@each.filtered'), + + filteredContentObsOnce: function () { + var filtered = this.get('parentView.availableDefs').filterProperty('filtered') || []; + this.set('filteredContent', filtered); + }, showOnlySelectedDefs: false, @@ -45,6 +52,7 @@ App.SelectDefinitionsPopupBodyView = App.TableView.extend({ initialDefs.setEach('filtered', true); this.set('parentView.availableDefs', initialDefs); this.set('parentView.isLoaded', true); + this.filteredContentObsOnce(); }, filterDefs: function () {