11//#region imports
2- import { Component , OnInit , OnDestroy } from '@angular/core' ;
3- import { EventLog } from '../../types/EventLog' ;
4- import { NzModalRef , NzModalService } from 'ng-zorro-antd' ;
2+ import { Component , OnInit , OnDestroy , Output , EventEmitter } from '@angular/core' ;
3+ import { EventLog } from '../../../ types/EventLog' ;
4+ import { NzModalService } from 'ng-zorro-antd' ;
55import { Subscription , fromEvent } from 'rxjs' ;
66import { map , debounceTime } from 'rxjs/operators' ;
7- import { PowershellCommands } from '../../services/powershell/powershell-commands' ;
8- import { GlobalUtils } from '../../services/global-utils' ;
7+ import { PowershellCommands } from '../../../services/powershell/powershell-commands' ;
8+ import { GlobalUtils } from '../../../services/global-utils' ;
9+ import { AppLogger } from '../../../services/AppLogger' ;
910//#endregion imports
1011
1112@Component ( {
@@ -14,18 +15,27 @@ import { GlobalUtils } from '../../services/global-utils';
1415} )
1516export class LogSelectionComponent implements OnInit , OnDestroy {
1617
17- //#region Constructor & Properties
18- constructor ( private modalService : NzModalService
19- , private modal : NzModalRef ) { }
18+ //#region Constructor Input - Outputs
19+ @Output ( )
20+ public onLogSelected = new EventEmitter < any > ( ) ;
21+
22+ constructor ( private modalService : NzModalService ) { }
23+
24+ public refreshLogs ( ) : void {
25+ this . _search ( ) ;
26+ }
27+ //#endregion Constructor Input - Outputs
28+
2029
30+ //#region Component Variables
2131 private _searchInputSub : Subscription ;
2232
2333 public loading : boolean = true ;
2434 private _logers : EventLog [ ] = [ ] ;
2535 public logers : EventLog [ ] = [ ] ;
2636 private _searchValue : string = '' ;
2737 public remoteComputer : string = '' ;
28- //#endregion Constructor & Properties
38+ //#endregion Component Variables
2939
3040
3141 //#region Component Methods
@@ -90,8 +100,8 @@ export class LogSelectionComponent implements OnInit, OnDestroy {
90100 . then ( ( ) => {
91101 this . _search ( ) ;
92102 } )
93- . catch ( ex => {
94- console . log ( ex ) ;
103+ . catch ( e => {
104+ AppLogger . getInstance ( ) . logError ( e ) ;
95105 this . modalService . error ( {
96106 nzTitle : 'Something went wrong'
97107 , nzContent : 'please try again'
@@ -109,9 +119,9 @@ export class LogSelectionComponent implements OnInit, OnDestroy {
109119 nzTitle : 'Which events to show?' ,
110120 nzContent : '' ,
111121 nzOkText : 'All events' ,
112- nzOnOk : ( ) => this . modal . close ( { eventLog : item , showOnlyNew :false } ) ,
122+ nzOnOk : ( ) => this . onLogSelected . emit ( { eventLog : item , showOnlyNew :false } ) ,
113123 nzCancelText : 'New Only' ,
114- nzOnCancel : ( ) => this . modal . close ( { eventLog : item , showOnlyNew :true } )
124+ nzOnCancel : ( ) => this . onLogSelected . emit ( { eventLog : item , showOnlyNew :true } )
115125 } ) ;
116126 }
117127
0 commit comments