Skip to content

Commit

Permalink
feat: added a clear filters button in settings
Browse files Browse the repository at this point in the history
  • Loading branch information
fdewas-aneo committed Dec 12, 2024
1 parent 43b6f04 commit 65e46e4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/app/services/filters-cache.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,11 @@ export class FiltersCacheService {
delete(scope: Scope): void {
this.filtersMap.delete(scope);
}

/**
* Clear all cached filters
*/
clear(): void {
this.filtersMap.clear();
}
}
8 changes: 8 additions & 0 deletions src/app/settings/index.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@
</app-page-section>

<section>
<app-page-section>
<app-page-section-header [icon]="getIcon('filter')">
<span i18n> Filters Cache </span>
</app-page-section-header>

<button mat-flat-button color="primary" (click)="clearFilterCache()" i18n>Clear cached filters</button>
</app-page-section>

<app-page-section class="storage">
<app-page-section-header [icon]="getIcon('storage')">
<span i18n="Section title"> Storage </span>
Expand Down
6 changes: 6 additions & 0 deletions src/app/settings/index.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { Sidebar, SidebarItem } from '@app/types/navigation';
import { PageHeaderComponent } from '@components/page-header.component';
import { PageSectionHeaderComponent } from '@components/page-section-header.component';
import { PageSectionComponent } from '@components/page-section.component';
import { FiltersCacheService } from '@services/filters-cache.service';
import { IconsService } from '@services/icons.service';
import { NavigationService } from '@services/navigation.service';
import { NotificationService } from '@services/notification.service';
Expand Down Expand Up @@ -159,6 +160,7 @@ export class IndexComponent implements OnInit {
private readonly navigationService = inject(NavigationService);
private readonly storageService = inject(StorageService);
private readonly httpClient = inject(HttpClient);
private readonly filtersCacheService = inject(FiltersCacheService);

ngOnInit(): void {
this.keys = this.sortKeys(this.storageService.restoreKeys());
Expand Down Expand Up @@ -350,4 +352,8 @@ export class IndexComponent implements OnInit {
addConfigFile(event: Event): void {
this.fileName = (event.target as HTMLInputElement).files?.item(0)?.name;
}

clearFilterCache() {
this.filtersCacheService.clear();
}
}

0 comments on commit 65e46e4

Please sign in to comment.