remove reset button form filter panel and add clear filter button to table config
This commit is contained in:
parent
04317d6300
commit
56d1c4677b
@ -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 }}"
|
||||||
|
|||||||
@ -61,9 +61,8 @@
|
|||||||
<div fxLayout="row" class="tb-panel-actions" fxLayoutAlign="end center">
|
<div fxLayout="row" class="tb-panel-actions" fxLayoutAlign="end center">
|
||||||
<button type="button"
|
<button type="button"
|
||||||
mat-button
|
mat-button
|
||||||
[disabled]="resetButtonDisabled"
|
(click)="cancel()">
|
||||||
(click)="reset()">
|
{{ 'action.cancel' | translate }}
|
||||||
{{ 'action.reset' | translate }}
|
|
||||||
</button>
|
</button>
|
||||||
<button type="submit"
|
<button type="submit"
|
||||||
mat-raised-button
|
mat-raised-button
|
||||||
|
|||||||
@ -107,21 +107,6 @@ export class EventFilterPanelComponent {
|
|||||||
this.overlayRef.dispose();
|
this.overlayRef.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
reset() {
|
|
||||||
const emptyInputValue = {};
|
|
||||||
|
|
||||||
for (const inputValue in this.eventFilterFormGroup.value) {
|
|
||||||
emptyInputValue[inputValue] = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
this.eventFilterFormGroup.reset(emptyInputValue);
|
|
||||||
this.update();
|
|
||||||
}
|
|
||||||
|
|
||||||
get resetButtonDisabled() {
|
|
||||||
return isEqual(this.data.filterParams, {});
|
|
||||||
}
|
|
||||||
|
|
||||||
changeIsError(value: boolean | string) {
|
changeIsError(value: boolean | string) {
|
||||||
if (this.conditionError && value === '') {
|
if (this.conditionError && value === '') {
|
||||||
this.eventFilterFormGroup.get('error').reset('', {emitEvent: false});
|
this.eventFilterFormGroup.get('error').reset('', {emitEvent: false});
|
||||||
|
|||||||
@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -57,8 +57,7 @@
|
|||||||
"download": "Download",
|
"download": "Download",
|
||||||
"next-with-label": "Next: {{label}}",
|
"next-with-label": "Next: {{label}}",
|
||||||
"read-more": "Read more",
|
"read-more": "Read more",
|
||||||
"hide": "Hide",
|
"hide": "Hide"
|
||||||
"reset": "Reset"
|
|
||||||
},
|
},
|
||||||
"aggregation": {
|
"aggregation": {
|
||||||
"aggregation": "Aggregation",
|
"aggregation": "Aggregation",
|
||||||
@ -1823,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