From 18e00772422404220d7be9298d4c351c1ba1e310 Mon Sep 17 00:00:00 2001 From: dweinholz Date: Mon, 7 Oct 2024 07:56:41 +0200 Subject: [PATCH] fix(Application):reload user from modification/lifetime request when approved --- .../application-card/application-card.component.ts | 1 + .../application-detail/application-detail.component.ts | 6 +++++- .../lifetime-extension-detail.component.ts | 8 ++++++-- .../resource-detail/resource-detail.component.ts | 9 +++++++-- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/app/applications/application-card/application-card.component.ts b/src/app/applications/application-card/application-card.component.ts index 869cf40db4..f06451e045 100644 --- a/src/app/applications/application-card/application-card.component.ts +++ b/src/app/applications/application-card/application-card.component.ts @@ -70,6 +70,7 @@ export class ApplicationCardComponent extends AbstractBaseClass implements OnIni this.applicationsService.getApplication(this.application.project_application_id.toString()).subscribe( (aj: Application): void => { this.application = aj + this.applicationDetailComponent.loadData() }, (error: any): void => { console.log(error) diff --git a/src/app/applications/application-detail/application-detail.component.ts b/src/app/applications/application-detail/application-detail.component.ts index 852229b750..bd8dbcdf06 100644 --- a/src/app/applications/application-detail/application-detail.component.ts +++ b/src/app/applications/application-detail/application-detail.component.ts @@ -107,12 +107,16 @@ export class ApplicationDetailComponent extends ApplicationBaseClassComponent im ngOnInit(): void { this.setTab(this.default_tab) + this.loadData() + this.is_vo_admin = is_vo + } + + loadData() { this.getPi() this.getUser() if (this.application.credits_allowed) { this.getCurrentCredits() } - this.is_vo_admin = is_vo } getUser() { diff --git a/src/app/applications/application-detail/lifetime-extension-detail/lifetime-extension-detail.component.ts b/src/app/applications/application-detail/lifetime-extension-detail/lifetime-extension-detail.component.ts index f089fa22c2..eacf041620 100644 --- a/src/app/applications/application-detail/lifetime-extension-detail/lifetime-extension-detail.component.ts +++ b/src/app/applications/application-detail/lifetime-extension-detail/lifetime-extension-detail.component.ts @@ -1,4 +1,4 @@ -import { Component, Input, OnInit } from '@angular/core' +import { Component, Input, OnChanges, OnInit } from '@angular/core' import { Application } from '../../application.model/application.model' import { ApplicationBaseClassComponent } from '../../../shared/shared_modules/baseClass/application-base-class.component' import { User } from '../../application.model/user.model' @@ -10,13 +10,17 @@ import { User } from '../../application.model/user.model' selector: 'app-lifetime-extension-detail', templateUrl: './lifetime-extension-detail.component.html' }) -export class LifetimeExtensionDetailComponent extends ApplicationBaseClassComponent implements OnInit { +export class LifetimeExtensionDetailComponent extends ApplicationBaseClassComponent implements OnInit, OnChanges { @Input() application: Application ngOnInit() { this.getRequestingUser() } + ngOnChanges() { + this.getRequestingUser() + } + getRequestingUser() { if (this.application.project_lifetime_request && !this.application.project_lifetime_request.user) { this.applicationsService diff --git a/src/app/applications/application-detail/resource-detail/resource-detail.component.ts b/src/app/applications/application-detail/resource-detail/resource-detail.component.ts index ca36d8404d..98ab663ba3 100644 --- a/src/app/applications/application-detail/resource-detail/resource-detail.component.ts +++ b/src/app/applications/application-detail/resource-detail/resource-detail.component.ts @@ -1,4 +1,4 @@ -import { Component, Input, OnInit } from '@angular/core' +import { Component, Input, OnChanges, OnInit } from '@angular/core' import { Application } from '../../application.model/application.model' import { User } from '../../application.model/user.model' import { ApplicationBaseClassComponent } from '../../../shared/shared_modules/baseClass/application-base-class.component' @@ -18,7 +18,7 @@ interface FlavorDiff { selector: 'app-resource-detail', templateUrl: './resource-detail.component.html' }) -export class ResourceDetailComponent extends ApplicationBaseClassComponent implements OnInit { +export class ResourceDetailComponent extends ApplicationBaseClassComponent implements OnInit, OnChanges { @Input() application: Application @Input() is_vo_admin: boolean @Input() current_credits: number @@ -30,6 +30,11 @@ export class ResourceDetailComponent extends ApplicationBaseClassComponent imple this.getModificationRequestingUser() } + ngOnChanges() { + this.getFlavorChanges() + this.getModificationRequestingUser() + } + getModificationRequestingUser() { if (this.application.project_modification_request && !this.application.project_modification_request.user) { this.applicationsService.getModificationUser(this.application.project_application_id).subscribe((user: User) => {