Commit 193c0ce64ee1e9a1fff7978e216614ed85e4a87d
Committed by
GitHub
Merge pull request #5167 from ArtemDzhereleiko/imp/event-table-panel/add-reset-button
[3.3.1] Event filter - add button clear filter
Showing
5 changed files
with
31 additions
and
2 deletions
@@ -69,6 +69,13 @@ export class AppComponent implements OnInit { | @@ -69,6 +69,13 @@ export class AppComponent implements OnInit { | ||
69 | ); | 69 | ); |
70 | 70 | ||
71 | this.matIconRegistry.addSvgIconLiteral( | 71 | this.matIconRegistry.addSvgIconLiteral( |
72 | + 'filter-variant-remove', | ||
73 | + this.domSanitizer.bypassSecurityTrustHtml( | ||
74 | + '<svg viewBox="0 0 24 24"><path d="M21 8H3V6h18v2m-7.19 8H10v2h3.09c.12-.72.37-1.39.72-2M18 11H6v2h12v-2m3.12 4.46L19 17.59l-2.12-2.13-1.41 1.42L17.59 19l-2.12 2.12 1.41 1.42L19 20.41l2.12 2.13 1.42-1.42L20.41 19l2.13-2.12-1.42-1.42z"/></svg>' | ||
75 | + ) | ||
76 | + ); | ||
77 | + | ||
78 | + this.matIconRegistry.addSvgIconLiteral( | ||
72 | 'google-logo', | 79 | 'google-logo', |
73 | this.domSanitizer.bypassSecurityTrustHtml( | 80 | this.domSanitizer.bypassSecurityTrustHtml( |
74 | '<svg viewBox="0 0 48 48"><path fill="#EA4335" d="M24 9.5c3.54 0 6.71 1.22 9.21 3.6l6.85-6.85C35.9 2.38 30.47 0 24 0 14.62 0 6.51 5.38 2.56 13.22l7.98 6.19C12.43 13.72 17.74 9.5 24 9.5z"/><path fill="#4285F4" d="M46.98 24.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58 2.96-2.26 5.48-4.78 7.18l7.73 6c4.51-4.18 7.09-10.36 7.09-17.65z"/><path fill="#FBBC05" d="M10.53 28.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92 16.46 0 20.12 0 24c0 3.88.92 7.54 2.56 10.78l7.97-6.19z"/><path fill="#34A853" d="M24 48c6.48 0 11.93-2.13 15.89-5.81l-7.73-6c-2.15 1.45-4.92 2.3-8.16 2.3-6.26 0-11.57-4.22-13.47-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z"/><path fill="none" d="M0 0h48v48H0z"/></svg>' | 81 | '<svg viewBox="0 0 48 48"><path fill="#EA4335" d="M24 9.5c3.54 0 6.71 1.22 9.21 3.6l6.85-6.85C35.9 2.38 30.47 0 24 0 14.62 0 6.51 5.38 2.56 13.22l7.98 6.19C12.43 13.72 17.74 9.5 24 9.5z"/><path fill="#4285F4" d="M46.98 24.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58 2.96-2.26 5.48-4.78 7.18l7.73 6c4.51-4.18 7.09-10.36 7.09-17.65z"/><path fill="#FBBC05" d="M10.53 28.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92 16.46 0 20.12 0 24c0 3.88.92 7.54 2.56 10.78l7.97-6.19z"/><path fill="#34A853" d="M24 48c6.48 0 11.93-2.13 15.89-5.81l-7.73-6c-2.15 1.45-4.92 2.3-8.16 2.3-6.26 0-11.57-4.22-13.47-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z"/><path fill="none" d="M0 0h48v48H0z"/></svg>' |
@@ -85,7 +85,8 @@ | @@ -85,7 +85,8 @@ | ||
85 | matTooltip="{{ actionDescriptor.name }}" | 85 | matTooltip="{{ actionDescriptor.name }}" |
86 | matTooltipPosition="above" | 86 | matTooltipPosition="above" |
87 | (click)="actionDescriptor.onAction($event)"> | 87 | (click)="actionDescriptor.onAction($event)"> |
88 | - <mat-icon>{{actionDescriptor.icon}}</mat-icon> | 88 | + <mat-icon *ngIf="actionDescriptor.isMdiIcon" [svgIcon]="actionDescriptor.icon"></mat-icon> |
89 | + <mat-icon *ngIf="!actionDescriptor.isMdiIcon">{{actionDescriptor.icon}}</mat-icon> | ||
89 | </button> | 90 | </button> |
90 | <button mat-icon-button [disabled]="isLoading$ | async" (click)="updateData()" | 91 | <button mat-icon-button [disabled]="isLoading$ | async" (click)="updateData()" |
91 | matTooltip="{{ 'action.refresh' | translate }}" | 92 | matTooltip="{{ 'action.refresh' | translate }}" |
@@ -120,6 +120,15 @@ export class EventTableConfig extends EntityTableConfig<Event, TimePageLink> { | @@ -120,6 +120,15 @@ export class EventTableConfig extends EntityTableConfig<Event, TimePageLink> { | ||
120 | this.updateFilterColumns(); | 120 | this.updateFilterColumns(); |
121 | 121 | ||
122 | this.headerActionDescriptors.push({ | 122 | this.headerActionDescriptors.push({ |
123 | + name: this.translate.instant('event.clear-filter'), | ||
124 | + icon: 'filter-variant-remove', | ||
125 | + isMdiIcon: true, | ||
126 | + isEnabled: () => !isEqual(this.filterParams, {}), | ||
127 | + onAction: ($event) => { | ||
128 | + this.clearFiter($event); | ||
129 | + } | ||
130 | + }, | ||
131 | + { | ||
123 | name: this.translate.instant('event.events-filter'), | 132 | name: this.translate.instant('event.events-filter'), |
124 | icon: 'filter_list', | 133 | icon: 'filter_list', |
125 | isEnabled: () => true, | 134 | isEnabled: () => true, |
@@ -316,6 +325,16 @@ export class EventTableConfig extends EntityTableConfig<Event, TimePageLink> { | @@ -316,6 +325,16 @@ export class EventTableConfig extends EntityTableConfig<Event, TimePageLink> { | ||
316 | } | 325 | } |
317 | } | 326 | } |
318 | 327 | ||
328 | + private clearFiter($event) { | ||
329 | + if ($event) { | ||
330 | + $event.stopPropagation(); | ||
331 | + } | ||
332 | + | ||
333 | + this.filterParams = {}; | ||
334 | + this.table.paginator.pageIndex = 0; | ||
335 | + this.table.updateData(); | ||
336 | + } | ||
337 | + | ||
319 | private editEventFilter($event: MouseEvent) { | 338 | private editEventFilter($event: MouseEvent) { |
320 | if ($event) { | 339 | if ($event) { |
321 | $event.stopPropagation(); | 340 | $event.stopPropagation(); |
@@ -73,6 +73,7 @@ export interface GroupActionDescriptor<T extends BaseData<HasId>> { | @@ -73,6 +73,7 @@ export interface GroupActionDescriptor<T extends BaseData<HasId>> { | ||
73 | export interface HeaderActionDescriptor { | 73 | export interface HeaderActionDescriptor { |
74 | name: string; | 74 | name: string; |
75 | icon: string; | 75 | icon: string; |
76 | + isMdiIcon?: boolean; | ||
76 | isEnabled: () => boolean; | 77 | isEnabled: () => boolean; |
77 | onAction: ($event: MouseEvent) => void; | 78 | onAction: ($event: MouseEvent) => void; |
78 | } | 79 | } |
@@ -1822,7 +1822,8 @@ | @@ -1822,7 +1822,8 @@ | ||
1822 | "all-events": "All", | 1822 | "all-events": "All", |
1823 | "has-error": "Has error", | 1823 | "has-error": "Has error", |
1824 | "entity-id": "Entity Id", | 1824 | "entity-id": "Entity Id", |
1825 | - "entity-type": "Entity type" | 1825 | + "entity-type": "Entity type", |
1826 | + "clear-filter": "Clear Filter" | ||
1826 | }, | 1827 | }, |
1827 | "extension": { | 1828 | "extension": { |
1828 | "extensions": "Extensions", | 1829 | "extensions": "Extensions", |