OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Hide children section for milestones
Oliver Günther378773027cfc
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.tsindex be844b0dcb2..079eeb1bc93 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@@ -26,19 +26,17 @@// See COPYRIGHT and LICENSE files for more details.//++-import { Component, Input, OnInit } from '@angular/core';+import { ChangeDetectorRef, Component, Input, OnInit } from '@angular/core';import { I18nService } from 'core-app/core/i18n/i18n.service';import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';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 { 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 +52,7 @@ export class WorkPackageRelationsHierarchyComponent extends UntilDestroyedMixinpublic workPackagePath:string;- public canHaveChildren:boolean;+ public canHaveChildren = false;public canModifyHierarchy:boolean;@@ -62,10 +60,13 @@ export class WorkPackageRelationsHierarchyComponent extends UntilDestroyedMixinpublic childrenQueryProps:any;- constructor(protected wpRelationsHierarchyService:WorkPackageRelationsHierarchyService,- protected apiV3Service:ApiV3Service,- protected PathHelper:PathHelperService,- readonly I18n:I18nService) {+ constructor(+ readonly apiV3Service:ApiV3Service,+ readonly PathHelper:PathHelperService,+ readonly I18n:I18nService,+ readonly schemaCache:SchemaCacheService,+ readonly cdRef:ChangeDetectorRef,+ ) {super();}@@ -91,26 +92,15 @@ export class WorkPackageRelationsHierarchyComponent extends UntilDestroyedMixin.id(this.workPackage).requireAndStream().pipe(+ withLatestFrom(this.schemaCache.requireAndStream(this.schemaCache.getSchemaHref(this.workPackage) as string)),this.untilDestroyed(),)- .subscribe((wp:WorkPackageResource) => {+ .subscribe(([wp, _]) => {+ const milestone = this.schemaCache.of(wp).isMilestone as boolean;this.workPackage = wp;+ this.canHaveChildren = !milestone;- const parentId = this.workPackage.parent?.id?.toString();-- if (parentId) {- this- .apiV3Service- .work_packages- .id(parentId)- .get()- .pipe(- take(1),- )- .subscribe((parent:WorkPackageResource) => {- this.workPackage.parent = parent;- });- }+ this.cdRef.detectChanges();});}}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.htmlindex f1aebb86dbe..5f4234b5979 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 @@-<div class="wp-relations-hierarchy-section wp-relations--children">+<div+ *ngIf="canHaveChildren"+ class="wp-relations-hierarchy-section wp-relations--children"><div class="attributes-group--header"><div class="attributes-group--header-container"><h3 class="attributes-group--header-text"diff --git a/spec/features/work_packages/details/relations/hierarchy_milestone_spec.rb b/spec/features/work_packages/details/relations/hierarchy_milestone_spec.rbindex 952c7c371ec..b5159b1319b 100644--- a/spec/features/work_packages/details/relations/hierarchy_milestone_spec.rb+++ b/spec/features/work_packages/details/relations/hierarchy_milestone_spec.rb@@ -49,10 +49,9 @@ RSpec.describe "work package hierarchies for milestones", :js, :selenium doendit "does not provide links to add children or existing children (Regression #28745)" do- within(".wp-relations--children") do- expect(page).to have_no_text("Add existing child")- expect(page).to have_no_text("Create new child")- expect(page).to have_no_css("wp-inline-create--add-link")- end+ expect(page).to have_no_text("Add existing child")+ expect(page).to have_no_text("Create new child")+ expect(page).to have_no_css("wp-inline-create--add-link")+ expect(page).to have_no_text("Children")endend