Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix updateChart() missing filter expressions map #1123

Merged
merged 1 commit into from
Sep 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,8 @@ export class TimegraphOutputComponent extends AbstractTreeOutputComponent<Timegr
this.doHandleContextMenuContributed(payload);
private pendingSelection: TimeGraphEntry | undefined;

private _debouncedUpdateSearch = debounce(() => this.updateSearchFilters(), 500);
private _debouncedUpdateChart = debounce(() => {
this.chartLayer.updateChart();
this.chartLayer.updateChart(this.filterExpressionsMap());
}, 500);

constructor(props: TimegraphOutputProps) {
Expand Down Expand Up @@ -332,7 +331,7 @@ export class TimegraphOutputComponent extends AbstractTreeOutputComponent<Timegr
prevProps.markerSetId !== this.props.markerSetId
) {
this.selectedMarkerCategories = this.props.markerCategories;
this.chartLayer.updateChart();
this.chartLayer.updateChart(this.filterExpressionsMap());
this.markersChartLayer.updateChart();
this.rangeEventsLayer.update();
this.arrowLayer.update();
Expand All @@ -357,7 +356,7 @@ export class TimegraphOutputComponent extends AbstractTreeOutputComponent<Timegr
!isEqual(this.state.searchString, prevState.searchString) ||
!isEqual(this.state.filters, prevState.filters)
) {
this._debouncedUpdateSearch();
this._debouncedUpdateChart();
}
if (!isEqual(this.state.multiSelectedRows, prevState.multiSelectedRows)) {
const signalPayload: RowSelectionsChangedSignalPayload = new RowSelectionsChangedSignalPayload(
Expand Down Expand Up @@ -862,17 +861,14 @@ export class TimegraphOutputComponent extends AbstractTreeOutputComponent<Timegr
};

private addFilter = (filter: string) => {
this.setState(prevState => ({ filters: [...prevState.filters, filter] }), this.updateSearchFilters);
this.setState(prevState => ({ filters: [...prevState.filters, filter] }));
};

private removeFilter = (filter: string) => {
this.setState(
prevState => ({ filters: prevState.filters.filter(f => f !== filter) }),
this.updateSearchFilters
);
this.setState(prevState => ({ filters: prevState.filters.filter(f => f !== filter) }));
};

private updateSearchFilters = () => {
private filterExpressionsMap() {
const filterExpressionsMap: { [key: number]: string[] } = {};
if (this.state.searchString) {
const DIMMED = 1;
Expand All @@ -882,13 +878,12 @@ export class TimegraphOutputComponent extends AbstractTreeOutputComponent<Timegr
const FILTERED = 4;
filterExpressionsMap[FILTERED] = this.state.filters; // For filtering
}

if (Object.keys(filterExpressionsMap).length > 0) {
this.chartLayer.updateChart(filterExpressionsMap);
return filterExpressionsMap;
} else {
this.chartLayer.updateChart();
return undefined;
}
};
}

private clearSearchBox() {
this.setState({ searchString: '' });
Expand Down
Loading