Repository: ambari Updated Branches: refs/heads/branch-2.5 640fefb21 -> 52daee8fa
AMBARI-21724 Hosts filters work incorrectly. (atkach) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/52daee8f Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/52daee8f Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/52daee8f Branch: refs/heads/branch-2.5 Commit: 52daee8fa02b071383083884305bcc10564bb4d4 Parents: 640fefb Author: Andrii Tkach <atk...@apache.org> Authored: Wed Aug 16 14:49:20 2017 +0300 Committer: Andrii Tkach <atk...@apache.org> Committed: Wed Aug 16 15:31:42 2017 +0300 ---------------------------------------------------------------------- ambari-web/app/mappers/hosts_mapper.js | 2 ++ ambari-web/app/models/host.js | 2 ++ ambari-web/app/views/main/host.js | 10 ++++++++++ 3 files changed, 14 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/52daee8f/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 5042e67..a2d64bf 100644 --- a/ambari-web/app/mappers/hosts_mapper.js +++ b/ambari-web/app/mappers/hosts_mapper.js @@ -206,6 +206,7 @@ App.hostsMapper = App.QuickDataMapper.create({ parsedItem.not_started_components = notStartedComponents; parsedItem.components_in_passive_state = componentsInPassiveState; parsedItem.components_with_stale_configs = componentsWithStaleConfigs; + parsedItem.is_filtered = true; hostIds[item.Hosts.host_name] = parsedItem; @@ -224,6 +225,7 @@ App.hostsMapper = App.QuickDataMapper.create({ //"itemTotal" present only for Hosts page request if (!Em.isNone(json.itemTotal)) { + App.Host.find().setEach('isFiltered', false); App.Host.find().clear(); //App.HostComponent.find contains master components which requested across the app hence it should not be cleared } http://git-wip-us.apache.org/repos/asf/ambari/blob/52daee8f/ambari-web/app/models/host.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/models/host.js b/ambari-web/app/models/host.js index 58ffd41..69e43ba 100644 --- a/ambari-web/app/models/host.js +++ b/ambari-web/app/models/host.js @@ -55,6 +55,8 @@ App.Host = DS.Model.extend({ index: DS.attr('number'), stackVersions: DS.hasMany('App.HostStackVersion'), + isFiltered: DS.attr('boolean'), + /** * Is host checked at the main Hosts page */ http://git-wip-us.apache.org/repos/asf/ambari/blob/52daee8f/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 52692cc..273fd10 100644 --- a/ambari-web/app/views/main/host.js +++ b/ambari-web/app/views/main/host.js @@ -50,6 +50,16 @@ App.MainHostView = App.TableView.extend(App.TableServerViewMixin, { */ contentBinding: 'controller.content', + filteredContent: [], + + filteredContentObserver: function() { + Em.run.once(this, this.setFilteredContentOnce); + }.observes('content.@each'), + + setFilteredContentOnce: function() { + this.set('filteredContent', this.get('content').filterProperty('isFiltered')); + }, + onRequestErrorHandler: function() { this.set('requestError', null); this.set('filteringComplete', true);