Events clearing UI refactoring

This commit is contained in:
Kalutka Zhenya 2021-11-08 19:21:26 +02:00 committed by Viacheslav Klimov
parent 13a74c784e
commit 6e2c1e3419
4 changed files with 25 additions and 26 deletions

View File

@ -84,7 +84,7 @@
[fxShow]="actionDescriptor.isEnabled()" *ngFor="let actionDescriptor of headerActionDescriptors"
matTooltip="{{ actionDescriptor.name }}"
matTooltipPosition="above"
(click)="actionDescriptor.onAction($event, entitiesTableConfig, pageLink)">
(click)="actionDescriptor.onAction($event)">
<mat-icon *ngIf="actionDescriptor.isMdiIcon" [svgIcon]="actionDescriptor.icon"></mat-icon>
<mat-icon *ngIf="!actionDescriptor.isMdiIcon">{{actionDescriptor.icon}}</mat-icon>
</button>

View File

@ -140,8 +140,8 @@ export class EventTableConfig extends EntityTableConfig<Event, TimePageLink> {
name: this.translate.instant('event.clean-events'),
icon: 'delete',
isEnabled: () => true,
onAction: ($event, entity, pageLink: TimePageLink) => {
this.eventService.clearEvents(entity.entityId, entity.eventType, entity.filterParams, entity.tenantId, pageLink).subscribe(
onAction: ($event) => {
this.eventService.clearEvents(this.entityId, this.eventType, this.filterParams, this.tenantId, this.table.pageLink as TimePageLink).subscribe(
() => {
this.table.paginator.pageIndex = 0;
this.table.updateData();

View File

@ -25,7 +25,6 @@ import { EventService } from '@core/http/event.service';
import { DialogService } from '@core/services/dialog.service';
import { DebugEventType, EventType } from '@shared/models/event.models';
import { Overlay } from '@angular/cdk/overlay';
import { HttpClient } from '@angular/common/http';
@Component({
selector: 'tb-event-table',
@ -85,8 +84,7 @@ export class EventTableComponent implements OnInit {
private dialog: MatDialog,
private overlay: Overlay,
private viewContainerRef: ViewContainerRef,
private cd: ChangeDetectorRef,
private http: HttpClient) {
private cd: ChangeDetectorRef) {
}
ngOnInit() {

View File

@ -25,7 +25,8 @@ import { EntityComponent } from '@home/components/entity/entity.component';
import { Type } from '@angular/core';
import { EntityAction } from './entity-component.models';
import { HasUUID } from '@shared/models/id/has-uuid';
import { PageLink } from '@shared/models/page/page-link';
import { PageLink, TimePageLink } from '@shared/models/page/page-link';
import { EntitiesTableComponent } from '@home/components/entity/entities-table.component';
import { EntityTableHeaderComponent } from '@home/components/entity/entity-table-header.component';
import { ActivatedRoute } from '@angular/router';
import { EntityTabsComponent } from '../../components/entity/entity-tabs.component';
@ -75,7 +76,7 @@ export interface HeaderActionDescriptor {
icon: string;
isMdiIcon?: boolean;
isEnabled: () => boolean;
onAction: ($event: MouseEvent, entity?, pageLink?) => void;
onAction: ($event: MouseEvent) => void;
}
export type EntityTableColumnType = 'content' | 'action';