diff --git a/API/Helpers/SmartFilterHelper.cs b/API/Helpers/SmartFilterHelper.cs index 30b66c3ee..740b8cd4e 100644 --- a/API/Helpers/SmartFilterHelper.cs +++ b/API/Helpers/SmartFilterHelper.cs @@ -72,7 +72,7 @@ public static class SmartFilterHelper private static string EncodeSortOptions(SortOptions sortOptions) { - return Uri.EscapeDataString($"sortField={(int) sortOptions.SortField}&isAscending={sortOptions.IsAscending}"); + return Uri.EscapeDataString($"sortField={(int) sortOptions.SortField},isAscending={sortOptions.IsAscending}"); } private static string EncodeFilterStatementDtos(ICollection statements) diff --git a/UI/Web/src/app/metadata-filter/metadata-filter.component.ts b/UI/Web/src/app/metadata-filter/metadata-filter.component.ts index fe8f55275..c5107e4f2 100644 --- a/UI/Web/src/app/metadata-filter/metadata-filter.component.ts +++ b/UI/Web/src/app/metadata-filter/metadata-filter.component.ts @@ -121,37 +121,37 @@ export class MetadataFilterComponent implements OnInit { this.loadFromPresetsAndSetup(); } - loadSavedFilter(event: Select2UpdateEvent) { - // Load the filter from the backend and update the screen - if (event.value === undefined || typeof(event.value) === 'string') return; - const smartFilter = event.value as SmartFilter; - this.filterV2 = this.filterUtilitiesService.decodeSeriesFilter(smartFilter.filter); - this.cdRef.markForCheck(); - console.log('update event: ', event); - } - - createFilterValue(event: Select2AutoCreateEvent) { - // Create a new name and filter - if (!this.filterV2) return; - this.filterV2.name = event.value; - this.filterService.saveFilter(this.filterV2).subscribe(() => { - - const item = { - value: { - filter: this.filterUtilitiesService.encodeSeriesFilter(this.filterV2!), - name: event.value, - } as SmartFilter, - label: event.value - }; - this.smartFilters.push(item); - this.sortGroup.get('name')?.setValue(item); - this.cdRef.markForCheck(); - this.toastr.success(translate('toasts.smart-filter-updated')); - this.apply(); - }); - - console.log('create event: ', event); - } + // loadSavedFilter(event: Select2UpdateEvent) { + // // Load the filter from the backend and update the screen + // if (event.value === undefined || typeof(event.value) === 'string') return; + // const smartFilter = event.value as SmartFilter; + // this.filterV2 = this.filterUtilitiesService.decodeSeriesFilter(smartFilter.filter); + // this.cdRef.markForCheck(); + // console.log('update event: ', event); + // } + // + // createFilterValue(event: Select2AutoCreateEvent) { + // // Create a new name and filter + // if (!this.filterV2) return; + // this.filterV2.name = event.value; + // this.filterService.saveFilter(this.filterV2).subscribe(() => { + // + // const item = { + // value: { + // filter: this.filterUtilitiesService.encodeSeriesFilter(this.filterV2!), + // name: event.value, + // } as SmartFilter, + // label: event.value + // }; + // this.smartFilters.push(item); + // this.sortGroup.get('name')?.setValue(item); + // this.cdRef.markForCheck(); + // this.toastr.success(translate('toasts.smart-filter-updated')); + // this.apply(); + // }); + // + // console.log('create event: ', event); + // } close() { diff --git a/UI/Web/src/app/shared/_services/filter-utilities.service.ts b/UI/Web/src/app/shared/_services/filter-utilities.service.ts index 1dc62124d..2b5bb647d 100644 --- a/UI/Web/src/app/shared/_services/filter-utilities.service.ts +++ b/UI/Web/src/app/shared/_services/filter-utilities.service.ts @@ -209,9 +209,9 @@ export class FilterUtilitiesService { } decodeFilterStatements(encodedStatements: string): FilterStatement[] { - const statementStrings = decodeURIComponent(encodedStatements).split(','); + const statementStrings = decodeURIComponent(encodedStatements).split(',').map(s => decodeURIComponent(s)); return statementStrings.map(statementString => { - const parts = statementString.split('&'); + const parts = statementString.split(','); if (parts === null || parts.length < 3) return null; const comparisonStartToken = parts.find(part => part.startsWith('comparison='));