Skip to content

Commit a2c70ee

Browse files
authored
fix: prevent empty like clause for search parameters (#1353)
Reference: #1344 Do not send empty search parameters, rather only send them when non empty values are present
1 parent 2388474 commit a2c70ee

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

projects/observability/src/shared/dashboard/widgets/table/table-widget-renderer.component.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -470,12 +470,18 @@ export class TableWidgetRendererComponent
470470
}
471471

472472
public onSearchChange(text: string): void {
473-
const searchFilter: TableFilter = {
474-
field: this.api.model.getSearchAttribute()!,
475-
operator: FilterOperator.Like,
476-
value: text
477-
};
478-
this.searchFilterSubject.next([searchFilter]);
473+
let searchFilters: TableFilter[] = [];
474+
// In case of empty string, avoid sending LIKE operator with empty value
475+
if (isNonEmptyString(text)) {
476+
searchFilters = [
477+
{
478+
field: this.api.model.getSearchAttribute()!,
479+
operator: FilterOperator.Like,
480+
value: text
481+
}
482+
];
483+
}
484+
this.searchFilterSubject.next(searchFilters);
479485
}
480486

481487
public onViewChange(view: string): void {

0 commit comments

Comments
 (0)