Skip to content

Commit

Permalink
feat(deck): Filter pipeline filters with the search filter (#8352)
Browse files Browse the repository at this point in the history
Co-authored-by: rodrigo-espinosa <rodrigo.espinosa@salesforce.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
3 people committed Jun 18, 2020
1 parent 638a603 commit 1bc7b16
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions app/scripts/modules/core/src/pipeline/filter/ExecutionFilters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export interface IExecutionFiltersState {
pipelineNames: string[];
strategyNames: string[];
pipelineReorderEnabled: boolean;
searchString: string;
tags: IFilterTag[];
}

Expand All @@ -47,6 +48,7 @@ export class ExecutionFilters extends React.Component<IExecutionFiltersProps, IE
pipelineNames: this.getPipelineNames(false),
strategyNames: this.getPipelineNames(true),
pipelineReorderEnabled: false,
searchString: '',
tags: ExecutionState.filterModel.asFilterModel.tags,
};
}
Expand Down Expand Up @@ -124,8 +126,13 @@ export class ExecutionFilters extends React.Component<IExecutionFiltersProps, IE
}

private refreshPipelines(): void {
const { pipelineNames, strategyNames } = this.state;
const newPipelineNames = this.getPipelineNames(false);
const { pipelineNames, strategyNames, searchString } = this.state;
let newPipelineNames = this.getPipelineNames(false);
if (searchString.length > 0) {
newPipelineNames = newPipelineNames.filter(pipelineName =>
pipelineName.toLocaleLowerCase().includes(searchString.toLocaleLowerCase()),
);
}
const newStrategyNames = this.getPipelineNames(true);
if (!isEqual(pipelineNames, newPipelineNames) || !isEqual(strategyNames, newStrategyNames)) {
this.setState({ pipelineNames: newPipelineNames, strategyNames: newStrategyNames });
Expand Down Expand Up @@ -157,6 +164,7 @@ export class ExecutionFilters extends React.Component<IExecutionFiltersProps, IE
}

private searchFieldUpdated = (event: React.FormEvent<HTMLInputElement>): void => {
this.setState({ searchString: event.currentTarget.value }, () => this.refreshPipelines());
this.updateFilterSearch(event.currentTarget.value);
};

Expand Down

0 comments on commit 1bc7b16

Please sign in to comment.