11import { Component , Input , OnChanges , OnDestroy } from "@angular/core" ;
22import { List } from "immutable" ;
3- import { Subscription } from "rxjs" ;
43
54import { GaugeConfig } from "app/components/base/graphs/gauge" ;
65import { Job , JobTaskCounts , Node , Pool } from "app/models" ;
@@ -15,11 +14,9 @@ import "./job-progress-status.scss";
1514 templateUrl : "job-progress-status.html" ,
1615} )
1716export class JobProgressStatusComponent implements OnChanges , OnDestroy {
18- @Input ( )
19- public job : Job ;
17+ @Input ( ) public job : Job ;
2018
21- @Input ( )
22- public poolId : string ;
19+ @Input ( ) public poolId : string ;
2320
2421 public nodes : List < Node > = List ( [ ] ) ;
2522 public pool : Pool ;
@@ -38,7 +35,6 @@ export class JobProgressStatusComponent implements OnChanges, OnDestroy {
3835 private poolData : EntityView < Pool , PoolParams > ;
3936
4037 private _polls : PollObservable [ ] = [ ] ;
41- private _subs : Subscription [ ] = [ ] ;
4238
4339 constructor (
4440 poolService : PoolService ,
@@ -54,20 +50,20 @@ export class JobProgressStatusComponent implements OnChanges, OnDestroy {
5450
5551 this . updateGaugeOptions ( ) ;
5652
57- this . _subs . push ( this . poolData . item . subscribe ( ( pool ) => {
53+ this . poolData . item . subscribe ( ( pool ) => {
5854 this . pool = pool ;
5955 this . maxRunningTasks = pool ? pool . targetNodes * pool . maxTasksPerNode : 1 ;
6056 this . updateGaugeOptions ( ) ;
61- } ) ) ;
57+ } ) ;
6258
63- this . _subs . push ( this . data . items . subscribe ( ( nodes ) => {
59+ this . data . items . subscribe ( ( nodes ) => {
6460 if ( this . nodes . size !== nodes . size ) {
6561 this . poolData . refresh ( ) ;
6662 }
6763 this . nodes = nodes ;
6864 this . countRunningTasks ( ) ;
6965 this . updateGaugeOptions ( ) ;
70- } ) ) ;
66+ } ) ;
7167
7268 this . _polls . push ( this . data . startPoll ( refreshRate ) ) ;
7369
@@ -89,7 +85,7 @@ export class JobProgressStatusComponent implements OnChanges, OnDestroy {
8985
9086 public ngOnDestroy ( ) {
9187 this . _polls . forEach ( x => x . destroy ( ) ) ;
92- this . _subs . forEach ( x => x . unsubscribe ( ) ) ;
88+ this . data . dispose ( ) ;
9389 this . poolData . dispose ( ) ;
9490 }
9591
0 commit comments