1- import { Component , ElementRef , EventEmitter , Input , OnDestroy , OnInit , Output , ViewChild } from "@angular/core" ;
1+ import { Component , ElementRef , EventEmitter , Input , NgZone , OnDestroy , OnInit , Output , ViewChild } from "@angular/core" ;
22import { WindupService } from "../services/windup.service" ;
33import { MigrationProject , WindupExecution } from "../generated/windup-services" ;
44import { NotificationService } from "../core/notification/notification.service" ;
@@ -8,6 +8,7 @@ import {MigrationProjectService} from "../project/migration-project.service";
88import { WindupExecutionService } from "../services/windup-execution.service" ;
99import { ConfirmationModalComponent } from "../shared/dialog/confirmation-modal.component" ;
1010import { AbstractComponent } from "../shared/AbstractComponent" ;
11+ import { SchedulerService } from "../shared/scheduler.service" ;
1112
1213@Component ( {
1314 selector : 'wu-executions-list' ,
@@ -53,7 +54,9 @@ export class ExecutionsListComponent extends AbstractComponent implements OnInit
5354 private _windupService : WindupService ,
5455 private _notificationService : NotificationService ,
5556 private _sortingService : SortingService < WindupExecution > ,
56- private _projectService : MigrationProjectService
57+ private _projectService : MigrationProjectService ,
58+ private _schedulerService : SchedulerService ,
59+ private _zone : NgZone
5760 ) {
5861 super ( ) ;
5962 this . element = _elementRef . nativeElement ;
@@ -72,14 +75,17 @@ export class ExecutionsListComponent extends AbstractComponent implements OnInit
7275 this . doDeleteExecution ( execution ) ;
7376 } ) ;
7477
75- this . currentTimeTimer = < any > setInterval ( ( ) => {
76- this . currentTime = new Date ( ) . getTime ( ) ;
78+ this . currentTimeTimer = this . _schedulerService . setInterval ( ( ) => {
79+ this . _zone . run ( ( ) => {
80+ this . currentTime = new Date ( ) . getTime ( ) ;
81+ } ) ;
7782 } , 5000 ) ;
7883 }
7984
8085 ngOnDestroy ( ) : void {
81- if ( this . currentTimeTimer )
82- clearInterval ( this . currentTimeTimer ) ;
86+ if ( this . currentTimeTimer ) {
87+ this . _schedulerService . clearInterval ( this . currentTimeTimer ) ;
88+ }
8389 }
8490
8591 @Input ( )
0 commit comments