import { Component , Input , OnChanges , OnInit } from '@angular/core' ; import { IRawNodeUpgradeProgress } from 'src/app/Models/RawDataTypes' ; import { IProgressStatus } from 'src/app/shared/component/phase-diagram/phase-diagram.component' ; @ Component ( { selector : 'app-node-progress' , templateUrl : './node-progress.component.html' , styleUrls : [ './node-progress.component.scss' ] } ) export class NodeProgressComponent implements OnChanges { @ Input ( ) node : IRawNodeUpgradeProgress ; public progress : IProgressStatus [ ] = [ ] ; public index = - 1 ; constructor ( ) { } ngOnChanges ( ) { const phaseMap = { PreUpgradeSafetyCheck : 1 , Upgrading : 2 , PostUpgradeSafetyCheck : 3 } ; this . index = phaseMap [ this . node . UpgradePhase ] ; if ( this . index > 1 ) { this . index ++ ; } this . progress = [ { name : 'PreUpgrade SafetyCheck' , } , { name : 'Upgrading' , } , { name : 'PostUpgrade SafetyCheck' , } ] ; } }