Skip to content

Commit

Permalink
Hide children section for milestones
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverguenther committed Jun 24, 2024
1 parent dceff13 commit 8845f0b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ 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',
Expand All @@ -54,18 +55,21 @@ export class WorkPackageRelationsHierarchyComponent extends UntilDestroyedMixin

public workPackagePath:string;

public canHaveChildren:boolean;
public canHaveChildren = false;

public canModifyHierarchy:boolean;

public canAddRelation:boolean;

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();
}

Expand Down Expand Up @@ -93,8 +97,10 @@ export class WorkPackageRelationsHierarchyComponent extends UntilDestroyedMixin
.pipe(
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();

Expand Down
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,7 @@
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("Children")
end
end

0 comments on commit 8845f0b

Please sign in to comment.