Skip to content

Commit ee531d4

Browse files
Enhance saved filters panel layout and improve validation logic in saved filters dialog
1 parent eea5ef9 commit ee531d4

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

frontend/src/app/components/dashboard/db-table-view/saved-filters-panel/saved-filters-dialog/saved-filters-dialog.component.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -330,18 +330,24 @@ export class SavedFiltersDialogComponent implements OnInit, AfterViewInit {
330330
return;
331331
}
332332

333-
// Validate conditions - check if there are any filters (excluding dynamic column)
333+
// Validate conditions - check if there are any filters
334334
// A valid filter must have a comparator defined
335-
const hasFilters = Object.keys(this.tableRowFieldsShown).some(key => {
336-
// Skip dynamic column as it's not a filter condition
335+
// Either regular filters OR dynamic column with comparator should exist
336+
const hasRegularFilters = Object.keys(this.tableRowFieldsShown).some(key => {
337+
// Skip dynamic column for regular filter check
337338
if (key === this.dynamicColumn) {
338339
return false;
339340
}
340341
// Check if comparator is defined (even if value is empty/null, comparator must exist)
341342
return this.tableRowFieldsComparator[key] !== undefined && this.tableRowFieldsComparator[key] !== null;
342343
});
343344

344-
if (!hasFilters) {
345+
// Check if dynamic column has a comparator (it counts as a valid filter condition)
346+
const hasDynamicColumnFilter = this.dynamicColumn &&
347+
this.tableRowFieldsComparator[this.dynamicColumn] !== undefined &&
348+
this.tableRowFieldsComparator[this.dynamicColumn] !== null;
349+
350+
if (!hasRegularFilters && !hasDynamicColumnFilter) {
345351
this.showConditionsError = true;
346352
setTimeout(() => {
347353
const conditionInput = this.elementRef.nativeElement.querySelector('input[name="filter_columns"]') as HTMLInputElement;

frontend/src/app/components/dashboard/db-table-view/saved-filters-panel/saved-filters-panel.component.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
display: flex;
33
flex-direction: column;
44
gap: 8px;
5+
margin-bottom: 12px;
56
}
67

78
.saved-filters-list {

0 commit comments

Comments
 (0)