@@ -8,6 +8,7 @@ import { Constants } from '../../types/Constants';
88import { filter } from 'rxjs/operators' ;
99import { EventFiltersVm } from '../../types/viewmodels/EventFiltersVm' ;
1010import { EventLog } from '../../types/EventLog' ;
11+ import { NzModalService } from 'ng-zorro-antd' ;
1112//#endregion imports
1213
1314@Component ( {
@@ -16,7 +17,7 @@ import { EventLog } from '../../types/EventLog';
1617} )
1718export class EventViewerComponent implements OnInit , OnDestroy {
1819 //#region Constructor & Properties
19- constructor ( private psService : PowershellService ) { }
20+ constructor ( private psService : PowershellService , private modalService : NzModalService ) { }
2021
2122 @Input ( )
2223 public eventLog : EventLog ;
@@ -77,6 +78,11 @@ export class EventViewerComponent implements OnInit, OnDestroy {
7778 this . viewModel . hasNew = true ;
7879 this . unreadEventsUpdated . emit ( true ) ;
7980 }
81+
82+ private _clearEvents ( ) : void {
83+ this . psService . clearEventLog ( this . eventLog )
84+ . then ( ( ) => this . _refreshList ( ) ) ;
85+ }
8086 //#endregion Implementation
8187
8288
@@ -88,6 +94,16 @@ export class EventViewerComponent implements OnInit, OnDestroy {
8894 public uiOnMoreClicked ( ) : void {
8995 this . _showNextItems ( ) ;
9096 }
97+
98+ public uiOnClearClicked ( ) : void {
99+ this . modalService . confirm ( {
100+ nzTitle : `Clear all events from ${ this . eventLog . log } ?`
101+ , nzCancelText : 'Cancel'
102+ , nzOkText : 'Yes'
103+ , nzOkType : 'danger'
104+ , nzOnOk : ( ) => this . _clearEvents ( )
105+ } ) ;
106+ }
91107 //#endregion UiCallbacks
92108}
93109
0 commit comments