diff --git a/ui-ngx/src/app/modules/home/components/entity/entities-table.component.html b/ui-ngx/src/app/modules/home/components/entity/entities-table.component.html
index c4f470bbd2..3242bb5a53 100644
--- a/ui-ngx/src/app/modules/home/components/entity/entities-table.component.html
+++ b/ui-ngx/src/app/modules/home/components/entity/entities-table.component.html
@@ -84,7 +84,7 @@
[fxShow]="actionDescriptor.isEnabled()" *ngFor="let actionDescriptor of headerActionDescriptors"
matTooltip="{{ actionDescriptor.name }}"
matTooltipPosition="above"
- (click)="actionDescriptor.onAction($event)">
+ (click)="actionDescriptor.onAction($event, entitiesTableConfig)">
{{actionDescriptor.icon}}
diff --git a/ui-ngx/src/app/modules/home/components/event/event-table-config.ts b/ui-ngx/src/app/modules/home/components/event/event-table-config.ts
index 9bf6912c9f..2d5cfbb428 100644
--- a/ui-ngx/src/app/modules/home/components/event/event-table-config.ts
+++ b/ui-ngx/src/app/modules/home/components/event/event-table-config.ts
@@ -48,6 +48,7 @@ import {
EventFilterPanelData,
FilterEntityColumn
} from '@home/components/event/event-filter-panel.component';
+import { HttpClient } from '@angular/common/http';
export class EventTableConfig extends EntityTableConfig {
@@ -82,7 +83,8 @@ export class EventTableConfig extends EntityTableConfig {
private debugEventTypes: Array = null,
private overlay: Overlay,
private viewContainerRef: ViewContainerRef,
- private cd: ChangeDetectorRef) {
+ private cd: ChangeDetectorRef,
+ private http: HttpClient) {
super();
this.loadDataOnInit = false;
this.tableTitle = '';
@@ -135,6 +137,14 @@ export class EventTableConfig extends EntityTableConfig {
onAction: ($event) => {
this.editEventFilter($event);
}
+ },
+ {
+ name: this.translate.instant('event.clean-events'),
+ icon: 'delete',
+ isEnabled: () => true,
+ onAction: ($event, entity) => {
+ this.http.delete(`/events/${entity.entityId.entityType}/${entity.entityId.id}/${entity.eventTypeValue}/clear`).subscribe();
+ }
});
}
diff --git a/ui-ngx/src/app/modules/home/components/event/event-table.component.ts b/ui-ngx/src/app/modules/home/components/event/event-table.component.ts
index 00aeb4f50c..e875036562 100644
--- a/ui-ngx/src/app/modules/home/components/event/event-table.component.ts
+++ b/ui-ngx/src/app/modules/home/components/event/event-table.component.ts
@@ -25,6 +25,7 @@ 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',
@@ -84,7 +85,8 @@ export class EventTableComponent implements OnInit {
private dialog: MatDialog,
private overlay: Overlay,
private viewContainerRef: ViewContainerRef,
- private cd: ChangeDetectorRef) {
+ private cd: ChangeDetectorRef,
+ private http: HttpClient) {
}
ngOnInit() {
@@ -102,7 +104,8 @@ export class EventTableComponent implements OnInit {
this.debugEventTypes,
this.overlay,
this.viewContainerRef,
- this.cd
+ this.cd,
+ this.http
);
}
diff --git a/ui-ngx/src/app/modules/home/models/entity/entities-table-config.models.ts b/ui-ngx/src/app/modules/home/models/entity/entities-table-config.models.ts
index 2f3d58e61f..c86ae6fef8 100644
--- a/ui-ngx/src/app/modules/home/models/entity/entities-table-config.models.ts
+++ b/ui-ngx/src/app/modules/home/models/entity/entities-table-config.models.ts
@@ -75,7 +75,7 @@ export interface HeaderActionDescriptor {
icon: string;
isMdiIcon?: boolean;
isEnabled: () => boolean;
- onAction: ($event: MouseEvent) => void;
+ onAction: ($event: MouseEvent, entity?) => void;
}
export type EntityTableColumnType = 'content' | 'action';
diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json
index 5d3adba457..f4a868a5c9 100644
--- a/ui-ngx/src/assets/locale/locale.constant-en_US.json
+++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json
@@ -1853,6 +1853,7 @@
"event": {
"event-type": "Event type",
"events-filter": "Events Filter",
+ "clean-events": "Clean Events",
"type-error": "Error",
"type-lc-event": "Lifecycle event",
"type-stats": "Statistics",