Merge pull request #5167 from ArtemDzhereleiko/imp/event-table-panel/add-reset-button
[3.3.1] Event filter - add button clear filter
This commit is contained in:
commit
193c0ce64e
@ -68,6 +68,13 @@ export class AppComponent implements OnInit {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
this.matIconRegistry.addSvgIconLiteral(
|
||||||
|
'filter-variant-remove',
|
||||||
|
this.domSanitizer.bypassSecurityTrustHtml(
|
||||||
|
'<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>'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
this.matIconRegistry.addSvgIconLiteral(
|
this.matIconRegistry.addSvgIconLiteral(
|
||||||
'google-logo',
|
'google-logo',
|
||||||
this.domSanitizer.bypassSecurityTrustHtml(
|
this.domSanitizer.bypassSecurityTrustHtml(
|
||||||
|
|||||||
@ -85,7 +85,8 @@
|
|||||||
matTooltip="{{ actionDescriptor.name }}"
|
matTooltip="{{ actionDescriptor.name }}"
|
||||||
matTooltipPosition="above"
|
matTooltipPosition="above"
|
||||||
(click)="actionDescriptor.onAction($event)">
|
(click)="actionDescriptor.onAction($event)">
|
||||||
<mat-icon>{{actionDescriptor.icon}}</mat-icon>
|
<mat-icon *ngIf="actionDescriptor.isMdiIcon" [svgIcon]="actionDescriptor.icon"></mat-icon>
|
||||||
|
<mat-icon *ngIf="!actionDescriptor.isMdiIcon">{{actionDescriptor.icon}}</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
<button mat-icon-button [disabled]="isLoading$ | async" (click)="updateData()"
|
<button mat-icon-button [disabled]="isLoading$ | async" (click)="updateData()"
|
||||||
matTooltip="{{ 'action.refresh' | translate }}"
|
matTooltip="{{ 'action.refresh' | translate }}"
|
||||||
|
|||||||
@ -120,6 +120,15 @@ export class EventTableConfig extends EntityTableConfig<Event, TimePageLink> {
|
|||||||
this.updateFilterColumns();
|
this.updateFilterColumns();
|
||||||
|
|
||||||
this.headerActionDescriptors.push({
|
this.headerActionDescriptors.push({
|
||||||
|
name: this.translate.instant('event.clear-filter'),
|
||||||
|
icon: 'filter-variant-remove',
|
||||||
|
isMdiIcon: true,
|
||||||
|
isEnabled: () => !isEqual(this.filterParams, {}),
|
||||||
|
onAction: ($event) => {
|
||||||
|
this.clearFiter($event);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
name: this.translate.instant('event.events-filter'),
|
name: this.translate.instant('event.events-filter'),
|
||||||
icon: 'filter_list',
|
icon: 'filter_list',
|
||||||
isEnabled: () => true,
|
isEnabled: () => true,
|
||||||
@ -316,6 +325,16 @@ export class EventTableConfig extends EntityTableConfig<Event, TimePageLink> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private clearFiter($event) {
|
||||||
|
if ($event) {
|
||||||
|
$event.stopPropagation();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.filterParams = {};
|
||||||
|
this.table.paginator.pageIndex = 0;
|
||||||
|
this.table.updateData();
|
||||||
|
}
|
||||||
|
|
||||||
private editEventFilter($event: MouseEvent) {
|
private editEventFilter($event: MouseEvent) {
|
||||||
if ($event) {
|
if ($event) {
|
||||||
$event.stopPropagation();
|
$event.stopPropagation();
|
||||||
|
|||||||
@ -73,6 +73,7 @@ export interface GroupActionDescriptor<T extends BaseData<HasId>> {
|
|||||||
export interface HeaderActionDescriptor {
|
export interface HeaderActionDescriptor {
|
||||||
name: string;
|
name: string;
|
||||||
icon: string;
|
icon: string;
|
||||||
|
isMdiIcon?: boolean;
|
||||||
isEnabled: () => boolean;
|
isEnabled: () => boolean;
|
||||||
onAction: ($event: MouseEvent) => void;
|
onAction: ($event: MouseEvent) => void;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1822,7 +1822,8 @@
|
|||||||
"all-events": "All",
|
"all-events": "All",
|
||||||
"has-error": "Has error",
|
"has-error": "Has error",
|
||||||
"entity-id": "Entity Id",
|
"entity-id": "Entity Id",
|
||||||
"entity-type": "Entity type"
|
"entity-type": "Entity type",
|
||||||
|
"clear-filter": "Clear Filter"
|
||||||
},
|
},
|
||||||
"extension": {
|
"extension": {
|
||||||
"extensions": "Extensions",
|
"extensions": "Extensions",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user