@@ -5,6 +5,7 @@ import { NzModalRef, NzModalService } from 'ng-zorro-antd';
55import { Subscription , fromEvent } from 'rxjs' ;
66import { map , debounceTime } from 'rxjs/operators' ;
77import { PowershellCommands } from '../../services/powershell/powershell-commands' ;
8+ import { GlobalUtils } from '../../services/global-utils' ;
89//#endregion imports
910
1011@Component ( {
@@ -82,6 +83,23 @@ export class LogSelectionComponent implements OnInit, OnDestroy {
8283 this . logers = this . _logers . filter ( l => ! this . _searchValue || l . log . toLowerCase ( ) . indexOf ( this . _searchValue ) >= 0 ) ;
8384 }
8485
86+
87+ private _removeEventLog ( item : EventLog ) {
88+ this . loading = true ;
89+ PowershellCommands . removeEventLog ( item )
90+ . then ( ( ) => {
91+ this . _search ( ) ;
92+ } )
93+ . catch ( ex => {
94+ console . log ( ex ) ;
95+ this . modalService . error ( {
96+ nzTitle : 'Something went wrong'
97+ , nzContent : 'please try again'
98+ } ) ;
99+ } )
100+ . finally ( ( ) => this . loading = false ) ;
101+ }
102+
85103 //#endregion Implementation
86104
87105
@@ -100,6 +118,27 @@ export class LogSelectionComponent implements OnInit, OnDestroy {
100118 public UiOnSearchClicked ( ) : void {
101119 this . _search ( ) ;
102120 }
121+
122+ public UiOnRemoveItemClicked ( item : EventLog ) : void {
123+ GlobalUtils . runningAsAdmin ( )
124+ . then ( ( res :boolean ) => {
125+ if ( ! res ) {
126+ this . modalService . error ( {
127+ nzTitle : 'Error'
128+ , nzContent : 'Run the app as admin to execute this action'
129+ } ) ;
130+ return ;
131+ }
132+
133+ this . modalService . confirm ( {
134+ nzTitle : `Remove EventLog ${ item . log } ?`
135+ , nzCancelText : 'Cancel'
136+ , nzOkText : 'Yes'
137+ , nzOkType : 'danger'
138+ , nzOnOk : ( ) => this . _removeEventLog ( item )
139+ } ) ;
140+ } ) ;
141+ }
103142 //#endregion UiCallbacks
104143
105144}
0 commit comments