github.com/in4it/ecs-deploy@v0.0.42-0.20240508120354-ed77ff16df25/webapp/src/app/service-list/service-list.component.ts (about) 1 import { Component, OnInit } from '@angular/core'; 2 import { ActivatedRoute } from '@angular/router'; 3 4 import { ServiceList, ServiceListService } from './service-list.service'; 5 6 import * as moment from 'moment'; 7 8 @Component({ 9 selector: 'app-service-list', 10 templateUrl: './service-list.component.html', 11 styleUrls: ['./service-list.component.css'] 12 }) 13 export class ServiceListComponent implements OnInit { 14 15 services: string[] = []; 16 17 constructor( 18 private route: ActivatedRoute, 19 ) {} 20 21 ngOnInit(): void { 22 this.route.data 23 .subscribe((data: { sl: ServiceList }) => { 24 let services = data.sl.services 25 services.forEach((service, index) => { 26 services[index]["deploymentMap"] = {} 27 service["deployments"].forEach((deployment, _) => { 28 // make a map per status of deployments 29 let lastDeploy = moment(deployment.updatedAt); 30 deployment.lastDeploy = lastDeploy.fromNow(); 31 services[index]["deploymentMap"][deployment["status"]] = deployment 32 }) 33 }) 34 this.services = services; 35 36 }); 37 } 38 39 }