From 1f4846ea0d6804b142310c4e01ca86a62af7cab1 Mon Sep 17 00:00:00 2001 From: John Rassa Date: Mon, 25 Nov 2024 10:56:08 -0500 Subject: [PATCH] refactor(team): Use team parentObj and ancestorObjs virtuals where appropriate --- src/app/core/teams/team.model.ts | 8 ++++++-- .../general-details/general-details.component.html | 11 +++-------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/app/core/teams/team.model.ts b/src/app/core/teams/team.model.ts index e359b31e..f7539db3 100644 --- a/src/app/core/teams/team.model.ts +++ b/src/app/core/teams/team.model.ts @@ -7,6 +7,9 @@ export class Team { requiresExternalRoles: string[] = []; requiresExternalTeams: string[] = []; parent?: Team; + parentObj: Team; + ancestors: string[] = []; + ancestorObjs: Team[] = []; constructor(model?: unknown) { this.setFromModel(model); @@ -23,8 +26,9 @@ export class Team { this.requiresExternalTeams ??= []; // Replace raw objects (from Object.assign) with class instances - if (this.parent) { - this.parent = new Team(this.parent); + if (this.parentObj) { + this.parentObj = new Team(this.parentObj); } + this.ancestorObjs = this.ancestorObjs.map((team) => new Team(team)); } } diff --git a/src/app/core/teams/view-team/general-details/general-details.component.html b/src/app/core/teams/view-team/general-details/general-details.component.html index dd76cbb0..f735608e 100644 --- a/src/app/core/teams/view-team/general-details/general-details.component.html +++ b/src/app/core/teams/view-team/general-details/general-details.component.html @@ -149,18 +149,13 @@

Details

{{ team().created | utcDate: 'yyyy-MM-dd' }}
- @if (team().parent) { + @if (team().parentObj) {
Parent