Skip to content

Commit

Permalink
AMBARI-12824. Components filter on Hosts page doesn't work (rzang)
Browse files Browse the repository at this point in the history
  • Loading branch information
Zangr committed Aug 20, 2015
1 parent 108b496 commit 988d7e1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 16 deletions.
14 changes: 2 additions & 12 deletions ambari-web/app/controllers/main/host.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,25 +45,15 @@ App.MainHostController = Em.ArrayController.extend(App.TableServerMixin, {
startIndex: 1,

/**
* true if any host filter got cleared
* true if any host page filter changed
*/
filterClearHappened: false,
filterChangeHappened: false,

/**
* if true, do not clean stored filter before hosts page rendering.
*/
showFilterConditionsFirstLoad: false,

/**
* Components which will be shown in component filter
* @returns {Array}
*/
componentsForFilter: function () {
var installedComponents = App.StackServiceComponent.find().toArray();
installedComponents.setEach('checkedForHostFilter', false);
return installedComponents;
}.property('App.router.clusterController.isLoaded'),

content: App.Host.find(),

allHostStackVersions: App.HostStackVersion.find(),
Expand Down
1 change: 1 addition & 0 deletions ambari-web/app/routes/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,7 @@ module.exports = Em.Route.extend(App.RouterRedirections, {
return;
router.get('mainHostController').filterByComponent(component.context);
router.get('mainHostController').set('showFilterConditionsFirstLoad', true);
router.get('mainHostController').set('filterChangeHappened', true);
router.transitionTo('hosts.index');
},
showDetails: function (router, event) {
Expand Down
8 changes: 4 additions & 4 deletions ambari-web/app/views/main/host.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ App.MainHostView = App.TableView.extend(App.TableServerViewMixin, {
willInsertElement: function () {
if (!this.get('controller.showFilterConditionsFirstLoad')) {
var didClearedSomething = this.clearFilterCondition();
this.set('controller.filterClearHappened', didClearedSomething);
this.set('controller.filterChangeHappened', didClearedSomething);
}
this._super();
this.set('startIndex', this.get('controller.startIndex'));
Expand Down Expand Up @@ -212,15 +212,15 @@ App.MainHostView = App.TableView.extend(App.TableServerViewMixin, {

onInitialLoad: function () {
if (this.get('tableFilteringComplete')) {
if (this.get('controller.filterClearHappened')) {
if (this.get('controller.filterChangeHappened')) {
this.refresh();
} else {
// no refresh but still need to enable pagination controls
this.propertyDidChange('filteringComplete');
}
}
// reset filter cleaning marker
this.set('controller.filterClearHappened', false);
// reset filter change marker
this.set('controller.filterChangeHappened', false);
}.observes('tableFilteringComplete'),

/**
Expand Down

0 comments on commit 988d7e1

Please sign in to comment.