Commit d1563201 authored by Lukas Burgey's avatar Lukas Burgey

Fix updating of vo data when services change

parent c444e602
......@@ -8,6 +8,7 @@
</mat-panel-description>
</mat-expansion-panel-header>
<ng-template matExpansionPanelContent>
<!-- expansion body -->
<p *ngIf="vo.description != ''">
{{ vo.description }}
......@@ -45,5 +46,6 @@
Currently, no services need membership of this VO. You can request a deployment anyway. We will deploy them to new services.
</p>
</ng-template>
</ng-template>
<mat-action-row deployment-action-row [deployment$]="deployment$" [vo]="vo"></mat-action-row>
</mat-expansion-panel>
......@@ -35,34 +35,44 @@ export class VoDataComponent implements OnInit {
}
ngOnInit(): void {
this.services$$ = this.services$.asObservable();
this.sites$$ = this.sites$.asObservable();
this.deployment$ = this.userService.subscribeDeployment(
(dep: Deployment) => dep.vo ? dep.vo.id == this.vo.id : false
);
// this is just used when no deployment exists
this.userService.subscribeServices().subscribe(
(services: Service[]) => {
// filter by the vo of this vo
this.services = services.filter(
(s: Service) => s.vos.some(
(g: VO) => this.vo.name == g.name
),
this.services = services;
this.services$.next(this.services);
}
);
this.deployment$.subscribe(
(dep: Deployment) => {
if (dep != undefined) {
this.services = dep.services;
this.services$.next(this.services);
}
}
);
// generate the sites from the services
this.services.map(
this.services$$.subscribe(
(services: Service[]) => {
services.map(
(s: Service) => this.sites.set(s.site.id, s.site)
);
let uniqueSites = []
const uniqueSites = []
this.sites.forEach(
site => uniqueSites.push(site)
);
this.sites$.next(uniqueSites);
}
);
this.services$$ = this.services$.asObservable();
this.sites$$ = this.sites$.asObservable();
this.deployment$ = this.userService.subscribeDeployment(
(dep: Deployment) => dep.vo ? dep.vo.id == this.vo.id : false
);
}
ngOnDestroy(): void {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment