diff --git a/frontend/src/app/features/work-packages/components/wp-relations/wp-relations-hierarchy/wp-relations-hierarchy.directive.ts b/frontend/src/app/features/work-packages/components/wp-relations/wp-relations-hierarchy/wp-relations-hierarchy.directive.ts index be844b0dcb25..6941c9ece8fb 100644 --- a/frontend/src/app/features/work-packages/components/wp-relations/wp-relations-hierarchy/wp-relations-hierarchy.directive.ts +++ b/frontend/src/app/features/work-packages/components/wp-relations/wp-relations-hierarchy/wp-relations-hierarchy.directive.ts @@ -33,12 +33,13 @@ import { PathHelperService } from 'core-app/core/path-helper/path-helper.service import { WorkPackageRelationsHierarchyService, } from 'core-app/features/work-packages/components/wp-relations/wp-relations-hierarchy/wp-relations-hierarchy.service'; -import { take } from 'rxjs/operators'; +import { take, withLatestFrom } from 'rxjs/operators'; import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destroyed.mixin'; import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service'; import { WorkPackageIsolatedQuerySpaceDirective, } from 'core-app/features/work-packages/directives/query-space/wp-isolated-query-space.directive'; +import { SchemaCacheService } from 'core-app/core/schemas/schema-cache.service'; @Component({ selector: 'wp-relations-hierarchy', @@ -54,7 +55,7 @@ export class WorkPackageRelationsHierarchyComponent extends UntilDestroyedMixin public workPackagePath:string; - public canHaveChildren:boolean; + public canHaveChildren = false; public canModifyHierarchy:boolean; @@ -62,10 +63,13 @@ export class WorkPackageRelationsHierarchyComponent extends UntilDestroyedMixin public childrenQueryProps:any; - constructor(protected wpRelationsHierarchyService:WorkPackageRelationsHierarchyService, - protected apiV3Service:ApiV3Service, - protected PathHelper:PathHelperService, - readonly I18n:I18nService) { + constructor( + readonly wpRelationsHierarchyService:WorkPackageRelationsHierarchyService, + readonly apiV3Service:ApiV3Service, + readonly PathHelper:PathHelperService, + readonly I18n:I18nService, + readonly schemaCache:SchemaCacheService, + ) { super(); } @@ -91,10 +95,12 @@ export class WorkPackageRelationsHierarchyComponent extends UntilDestroyedMixin .id(this.workPackage) .requireAndStream() .pipe( + withLatestFrom(this.schemaCache.requireAndStream(this.workPackage.href as string)), this.untilDestroyed(), ) - .subscribe((wp:WorkPackageResource) => { + .subscribe(([wp, schema]) => { this.workPackage = wp; + this.canHaveChildren = !schema.isMilestone as boolean; const parentId = this.workPackage.parent?.id?.toString(); diff --git a/frontend/src/app/features/work-packages/components/wp-relations/wp-relations-hierarchy/wp-relations-hierarchy.template.html b/frontend/src/app/features/work-packages/components/wp-relations/wp-relations-hierarchy/wp-relations-hierarchy.template.html index f1aebb86dbe5..5f4234b5979f 100644 --- a/frontend/src/app/features/work-packages/components/wp-relations/wp-relations-hierarchy/wp-relations-hierarchy.template.html +++ b/frontend/src/app/features/work-packages/components/wp-relations/wp-relations-hierarchy/wp-relations-hierarchy.template.html @@ -1,4 +1,6 @@ -
+