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
Implement work package child relation columns
Oliver Günther58827ba72381
diff --git a/app/models/queries/work_packages.rb b/app/models/queries/work_packages.rbindex 1e584636859..876daaea279 100644--- a/app/models/queries/work_packages.rb+++ b/app/models/queries/work_packages.rb@@ -87,6 +87,7 @@ module Queries::WorkPackagesselect Selects::CustomFieldSelectselect Selects::RelationToTypeSelectselect Selects::RelationOfTypeSelect+ select Selects::RelationChildSelectselect Selects::ManualSortingSelectselect Selects::TypeaheadSelectenddiff --git a/app/models/queries/work_packages/selects/relation_child_select.rb b/app/models/queries/work_packages/selects/relation_child_select.rbnew file mode 100644index 00000000000..9593231f73d--- /dev/null+++ b/app/models/queries/work_packages/selects/relation_child_select.rb@@ -0,0 +1,39 @@+# frozen_string_literal: true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++class Queries::WorkPackages::Selects::RelationChildSelect < Queries::WorkPackages::Selects::RelationSelect+ def initialize+ super(:relation_child)+ end++ def caption+ I18n.t(:"js.relation_labels.children")+ end+enddiff --git a/config/locales/en.yml b/config/locales/en.ymlindex 8afc1681081..bdb051f8c84 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -1045,6 +1045,7 @@ en:column_names: "Columns"relations_to_type_column: "Relations to %{type}"relations_of_type_column: "%{type} relations"+ child_work_packages: "Child work packages"group_by: "Group results by"sort_by: "Sort results by"filters: "Filters"diff --git a/config/locales/js-en.yml b/config/locales/js-en.ymlindex aa5d7465635..71c5e343a3f 100644--- a/config/locales/js-en.yml+++ b/config/locales/js-en.yml@@ -868,6 +868,7 @@ en:relation_labels:parent: "Parent"+ child: "Child"children: "Children"relates: "Related To"duplicates: "Duplicates"diff --git a/frontend/.eslintrc.js b/frontend/.eslintrc.jsindex 74d5ea50994..ebe0532e3e9 100644--- a/frontend/.eslintrc.js+++ b/frontend/.eslintrc.js@@ -147,6 +147,8 @@ module.exports = {"import/prefer-default-export": "off",+ "import/no-cycle": "off",+// HAL has a lot of dangling properties, so allow// usage in properties but not in all other places"no-underscore-dangle": [diff --git a/frontend/src/app/features/work-packages/components/wp-fast-table/builders/drag-and-drop/drag-drop-handle-render-pass.ts b/frontend/src/app/features/work-packages/components/wp-fast-table/builders/drag-and-drop/drag-drop-handle-render-pass.tsindex a92d114c2a9..af1877c3182 100644--- a/frontend/src/app/features/work-packages/components/wp-fast-table/builders/drag-and-drop/drag-drop-handle-render-pass.ts+++ b/frontend/src/app/features/work-packages/components/wp-fast-table/builders/drag-and-drop/drag-drop-handle-render-pass.ts@@ -15,9 +15,11 @@ export class DragDropHandleRenderPass {// Drag & Drop handle builderprotected dragDropHandleBuilder = new DragDropHandleBuilder(this.injector);- constructor(public readonly injector:Injector,+ constructor(+public readonly injector:Injector,private table:WorkPackageTable,- private tablePass:PrimaryRenderPass) {+ private tablePass:PrimaryRenderPass,+) {}public render() {@@ -25,8 +27,8 @@ export class DragDropHandleRenderPass {return;}- this.wpTableOrder.withLoadedPositions().then((positions:QueryOrder) => {- this.tablePass.renderedOrder.forEach((row:RowRenderInfo, position:number) => {+ void this.wpTableOrder.withLoadedPositions().then((positions:QueryOrder) => {+ this.tablePass.renderedOrder.forEach((row:RowRenderInfo) => {// We only care for rows that are natural work packages and are not relation sub-rowsif (!row.workPackage || row.renderType === 'relations') {return;@@ -34,7 +36,7 @@ export class DragDropHandleRenderPass {const handle = this.dragDropHandleBuilder.build(row.workPackage, positions[row.workPackage.id!]);- if (handle) {+ if (handle && row.element) {row.element.replaceChild(handle, row.element.firstElementChild!);}});diff --git a/frontend/src/app/features/work-packages/components/wp-fast-table/builders/primary-render-pass.ts b/frontend/src/app/features/work-packages/components/wp-fast-table/builders/primary-render-pass.tsindex 22d8a12912b..fdc24d8f55c 100644--- a/frontend/src/app/features/work-packages/components/wp-fast-table/builders/primary-render-pass.ts+++ b/frontend/src/app/features/work-packages/components/wp-fast-table/builders/primary-render-pass.ts@@ -11,8 +11,11 @@ import { TimelineRenderPass } from './timeline/timeline-render-pass';import { SingleRowBuilder } from './rows/single-row-builder';import { RelationRenderInfo, RelationsRenderPass } from './relations/relations-render-pass';import { WorkPackageTable } from '../wp-fast-table';+import {+ ChildRelationsRenderPass,+} from 'core-app/features/work-packages/components/wp-fast-table/builders/relations/child-relations-render-pass';-export type RenderedRowType = 'primary'|'relations';+export type RenderedRowType = 'primary'|'relations'|'child_relations';export interface RowRenderInfo {// The rendered row@@ -31,6 +34,7 @@ export interface RowRenderInfo {// Marks if the row is currently hidden to the userhidden:boolean;// Additional data by the render passes+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */data?:any;}@@ -53,15 +57,20 @@ export abstract class PrimaryRenderPass {/** Additional render pass that handles table relation rendering */public relations:RelationsRenderPass;+ /** Additional render pass that handles table child relation rendering */+ public childRelations:ChildRelationsRenderPass;+/** Additional render pass that handles drag'n'drop handle rendering */public dragDropHandle:DragDropHandleRenderPass;/** Additional render pass that handles highlighting of rows */public highlighting:HighlightingRenderPass;- constructor(public readonly injector:Injector,+ constructor(+public readonly injector:Injector,public workPackageTable:WorkPackageTable,- public rowBuilder:SingleRowBuilder) {+ public rowBuilder:SingleRowBuilder,+) {}/**@@ -87,6 +96,7 @@ export abstract class PrimaryRenderPass {timeOutput('Relations render pass', () => {this.relations.render();+ this.childRelations.render();});timeOutput('Drag handle render pass', () => {@@ -110,11 +120,15 @@ export abstract class PrimaryRenderPass {let replacement:JQuery|null = null;switch (row.renderType) {- case 'primary':- replacement = this.rowBuilder.refreshRow(workPackage, oldRow);- break;case 'relations':replacement = this.relations.refreshRelationRow(row as RelationRenderInfo, workPackage, oldRow);+ break;+ case 'child_relations':+ replacement = this.childRelations.refreshRelationRow(row as RelationRenderInfo, workPackage, oldRow);+ break;+ default:+ replacement = this.rowBuilder.refreshRow(workPackage, oldRow);+ break;}if (replacement !== null && oldRow.length) {@@ -153,6 +167,7 @@ export abstract class PrimaryRenderPass {protected prepare() {this.timeline = new TimelineRenderPass(this.injector, this.workPackageTable, this);this.relations = new RelationsRenderPass(this.injector, this.workPackageTable, this);+ this.childRelations = new ChildRelationsRenderPass(this.injector, this.workPackageTable, this);this.dragDropHandle = new DragDropHandleRenderPass(this.injector, this.workPackageTable, this);this.highlighting = new HighlightingRenderPass(this.injector, this.workPackageTable, this);this.tableBody = document.createDocumentFragment();@@ -180,10 +195,12 @@ export abstract class PrimaryRenderPass {* @param rowClasses Additional classes to apply to the timeline row for mirroring purposes* @param hidden whether the row was rendered hidden*/- protected appendRow(workPackage:WorkPackageResource,+ protected appendRow(+workPackage:WorkPackageResource,row:HTMLTableRowElement,additionalClasses:string[] = [],- hidden = false) {+ hidden = false,+) {this.tableBody.appendChild(row);this.renderedOrder.push({@@ -202,10 +219,12 @@ export abstract class PrimaryRenderPass {* @param classIdentifer a unique identifier for the two rows (one each in table/timeline).* @param hidden whether the row was rendered hidden*/- protected appendNonWorkPackageRow(row:HTMLTableRowElement,+ protected appendNonWorkPackageRow(+row:HTMLTableRowElement,classIdentifer:string,additionalClasses:string[] = [],- hidden = false) {+ hidden = false,+) {row.classList.add(classIdentifer);this.tableBody.appendChild(row);diff --git a/frontend/src/app/features/work-packages/components/wp-fast-table/builders/relation-cell-builder.ts b/frontend/src/app/features/work-packages/components/wp-fast-table/builders/relation-cell-builder.tsindex 999e715569e..c30c492d353 100644--- a/frontend/src/app/features/work-packages/components/wp-fast-table/builders/relation-cell-builder.ts+++ b/frontend/src/app/features/work-packages/components/wp-fast-table/builders/relation-cell-builder.ts@@ -1,11 +1,12 @@import { Injector } from '@angular/core';import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';-import { WorkPackageViewRelationColumnsService } from 'core-app/features/work-packages/routing/wp-view-base/view-services/wp-view-relation-columns.service';+import {+ WorkPackageViewRelationColumnsService,+} from 'core-app/features/work-packages/routing/wp-view-base/view-services/wp-view-relation-columns.service';import { InjectField } from 'core-app/shared/helpers/angular/inject-field.decorator';import { States } from 'core-app/core/states/states.service';-import { RelationResource } from 'core-app/features/hal/resources/relation-resource';import { WorkPackageRelationsService } from '../../wp-relations/wp-relations.service';-import { QueryColumn } from '../../wp-query/query-column';+import { QueryColumn, queryColumnTypes } from '../../wp-query/query-column';import { tdClassName } from './cell-builder';export const relationCellTdClassName = 'wp-table--relation-cell-td';@@ -29,18 +30,28 @@ export class RelationCellbuilder {// Get current expansion and value stateconst expanded = this.wpTableRelationColumns.getExpandFor(workPackage.id!) === column.id;const relationState = this.wpRelations.state(workPackage.id!).value;- const relations = this.wpTableRelationColumns.relationsForColumn(workPackage,- relationState,- column);++ let count:number;++ if (column._type === queryColumnTypes.RELATION_CHILD) {+ count = workPackage.children?.length || 0;+ } else {+ const relations = this.wpTableRelationColumns.relationsForColumn(+ workPackage,+ relationState,+ column,+ );+ count = relations.length;+ }const indicator = this.renderIndicator();- const badge = this.renderBadge(relations);+ const badge = this.renderBadge(count);if (expanded) {td.classList.add('-expanded');}- if (relations.length > 0) {+ if (count > 0) {td.appendChild(badge);td.appendChild(indicator);}@@ -57,11 +68,11 @@ export class RelationCellbuilder {return indicator;}- private renderBadge(relations:RelationResource[]) {+ private renderBadge(count:number) {const badge = document.createElement('span');badge.classList.add('wp-table--relation-count');- badge.textContent = `${relations.length}`;+ badge.textContent = count.toString();badge.classList.add('badge', '-border-only');return badge;diff --git a/frontend/src/app/features/work-packages/components/wp-fast-table/builders/relations/child-relations-render-pass.ts b/frontend/src/app/features/work-packages/components/wp-fast-table/builders/relations/child-relations-render-pass.tsnew file mode 100644index 00000000000..c8d29bf7fd6--- /dev/null+++ b/frontend/src/app/features/work-packages/components/wp-fast-table/builders/relations/child-relations-render-pass.ts@@ -0,0 +1,57 @@+import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';+import { RowRenderInfo } from '../primary-render-pass';+import {+ RelationsRenderPass,+} from 'core-app/features/work-packages/components/wp-fast-table/builders/relations/relations-render-pass';++export class ChildRelationsRenderPass extends RelationsRenderPass {+ renderType = 'child_relations';++ label = this.I18n.t('js.relation_labels.child');++ public render() {+ // If no relation column active, skip this pass+ if (!this.isApplicable) {+ return;+ }++ // Render for each original row, clone it since we're modifying the tablepass+ const rendered = _.clone(this.tablePass.renderedOrder);+ rendered.forEach((row:RowRenderInfo) => {+ // We only care for rows that are natural work packages+ if (!row.workPackage) {+ return;+ }++ // If the work package has no children, ignore+ const { workPackage } = row;+ if (workPackage.children?.length === 0) {+ return;+ }++ // Only if the work package has anything expanded+ const expanded = this.wpTableRelationColumns.getExpandFor(workPackage.id!);+ if (expanded === undefined) {+ return;+ }++ const column = this.wpTableColumns.findById(expanded)!;+ // Render the child relations+ workPackage.children.forEach((child) => {+ const target = this.states.workPackages.get(child.id as string).value as WorkPackageResource;+ // Build each relation row (currently sorted by order defined in API)+ const [relationRow] = this.relationRowBuilder.buildEmptyRelationRow(+ workPackage,+ target,+ );++ // Augment any data for the belonging work package row to it+ this.renderRelationRow(relationRow, row, this.label, column, workPackage, target, 'children');+ });+ });+ }++ public get isApplicable() {+ return this.wpTableColumns.hasChildRelationsColumn();+ }+}diff --git a/frontend/src/app/features/work-packages/components/wp-fast-table/builders/relations/relation-row-builder.ts b/frontend/src/app/features/work-packages/components/wp-fast-table/builders/relations/relation-row-builder.tsindex c860ccb629c..112e88789f3 100644--- a/frontend/src/app/features/work-packages/components/wp-fast-table/builders/relations/relation-row-builder.ts+++ b/frontend/src/app/features/work-packages/components/wp-fast-table/builders/relations/relation-row-builder.ts@@ -1,10 +1,8 @@import { Injector } from '@angular/core';import { I18nService } from 'core-app/core/i18n/i18n.service';import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';-import { RelationColumnType } from 'core-app/features/work-packages/routing/wp-view-base/view-services/wp-view-relation-columns.service';import { InjectField } from 'core-app/shared/helpers/angular/inject-field.decorator';import { States } from 'core-app/core/states/states.service';-import { RelationResource } from 'core-app/features/hal/resources/relation-resource';import { commonRowClassName, SingleRowBuilder, tableRowClassName } from '../rows/single-row-builder';import { tdClassName } from '../cell-builder';import { WorkPackageTable } from '../../wp-fast-table';@@ -25,8 +23,10 @@ export class RelationRowBuilder extends SingleRowBuilder {@InjectField() public I18n:I18nService;- constructor(public readonly injector:Injector,- protected workPackageTable:WorkPackageTable) {+ constructor(+public readonly injector:Injector,+ protected workPackageTable:WorkPackageTable,+) {super(injector, workPackageTable);}@@ -49,14 +49,10 @@ export class RelationRowBuilder extends SingleRowBuilder {/*** Build the columns on the given empty row*/- public buildEmptyRelationRow(from:WorkPackageResource, relation:RelationResource, type:RelationColumnType):[HTMLElement, WorkPackageResource] {- const denormalized = relation.denormalized(from);-- const to = this.states.workPackages.get(denormalized.targetId).value!;-+ public buildEmptyRelationRow(from:WorkPackageResource, to:WorkPackageResource):[HTMLElement, WorkPackageResource] {// Let the primary row builder build the rowconst row = this.createEmptyRelationRow(from, to);- const [tr, _] = super.buildEmptyRow(to, row);+ const [tr] = super.buildEmptyRow(to, row);return [tr, to];}@@ -73,11 +69,13 @@ export class RelationRowBuilder extends SingleRowBuilder {tr.dataset.classIdentifier = identifier;tr.classList.add(- commonRowClassName, tableRowClassName, 'issue',- 'wp-table--relations-aditional-row',- identifier,- `${identifier}-table`,- relationGroupClass(from.id!),+ commonRowClassName,+tableRowClassName,+'issue',+'wp-table--relations-aditional-row',+identifier,+`${identifier}-table`,+relationGroupClass(from.id!),);return tr;@@ -89,30 +87,19 @@ export class RelationRowBuilder extends SingleRowBuilder {/***- * @param from- * @param denormalized- * @param type+ * @param jRow+ * @param typeLabel+ * @param columnId*/- public appendRelationLabel(jRow:JQuery, from:WorkPackageResource, relation:RelationResource, columnId:string, type:RelationColumnType) {- const denormalized = relation.denormalized(from);- let typeLabel = '';-- // Add the relation label if this is a "Relations for <WP Type>" column- if (type === 'toType') {- typeLabel = this.I18n.t(`js.relation_labels.${denormalized.reverseRelationType}`);- }- // Add the WP type label if this is a "<Relation Type> Relations" column- if (type === 'ofType') {- const wp = this.states.workPackages.get(denormalized.target.id!).value!;- typeLabel = wp.type.name;- }-+ public appendRelationLabel(+ jRow:JQuery,+ typeLabel:string,+ columnId:string,+ ):void {const relationLabel = document.createElement('span');relationLabel.classList.add('relation-row--type-label');relationLabel.textContent = typeLabel;- const textNode = document.createTextNode(denormalized.target.name);-jRow.find(`.${relationCellClassName}`).empty();jRow.find(`.${relationCellClassName}.${columnId}`).append(relationLabel);}diff --git a/frontend/src/app/features/work-packages/components/wp-fast-table/builders/relations/relations-render-pass.ts b/frontend/src/app/features/work-packages/components/wp-fast-table/builders/relations/relations-render-pass.tsindex 953fbf6700c..a232bc84ef6 100644--- a/frontend/src/app/features/work-packages/components/wp-fast-table/builders/relations/relations-render-pass.ts+++ b/frontend/src/app/features/work-packages/components/wp-fast-table/builders/relations/relations-render-pass.ts@@ -1,9 +1,13 @@import { Injector } from '@angular/core';import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';import { QueryColumn } from 'core-app/features/work-packages/components/wp-query/query-column';-import { WorkPackageRelationsService } from 'core-app/features/work-packages/components/wp-relations/wp-relations.service';+import {+ WorkPackageRelationsService,+} from 'core-app/features/work-packages/components/wp-relations/wp-relations.service';import { WorkPackageTable } from 'core-app/features/work-packages/components/wp-fast-table/wp-fast-table';-import { WorkPackageViewColumnsService } from 'core-app/features/work-packages/routing/wp-view-base/view-services/wp-view-columns.service';+import {+ WorkPackageViewColumnsService,+} from 'core-app/features/work-packages/routing/wp-view-base/view-services/wp-view-columns.service';import {RelationColumnType,WorkPackageViewRelationColumnsService,@@ -12,10 +16,12 @@ import { InjectField } from 'core-app/shared/helpers/angular/inject-field.decoraimport { RelationResource } from 'core-app/features/hal/resources/relation-resource';import { relationGroupClass, RelationRowBuilder } from './relation-row-builder';import { PrimaryRenderPass, RowRenderInfo } from '../primary-render-pass';+import { States } from 'core-app/core/states/states.service';+import { I18nService } from 'core-app/core/i18n/i18n.service';export interface RelationRenderInfo extends RowRenderInfo {data:{- relation:RelationResource;+ label:string;columnId:string;relationType:RelationColumnType;};@@ -28,11 +34,19 @@ export class RelationsRenderPass {@InjectField() wpTableRelationColumns:WorkPackageViewRelationColumnsService;+ @InjectField() states:States;++ @InjectField() I18n:I18nService;+public relationRowBuilder:RelationRowBuilder;- constructor(public readonly injector:Injector,- private table:WorkPackageTable,- private tablePass:PrimaryRenderPass) {+ renderType = 'relations';++ constructor(+ readonly injector:Injector,+ readonly table:WorkPackageTable,+ readonly tablePass:PrimaryRenderPass,+ ) {this.relationRowBuilder = new RelationRowBuilder(injector, table);}@@ -44,7 +58,7 @@ export class RelationsRenderPass {// Render for each original row, clone it since we're modifying the tablepassconst rendered = _.clone(this.tablePass.renderedOrder);- rendered.forEach((row:RowRenderInfo, position:number) => {+ rendered.forEach((row:RowRenderInfo) => {// We only care for rows that are natural work packagesif (!row.workPackage) {return;@@ -52,69 +66,103 @@ export class RelationsRenderPass {// If the work package has no relations, ignoreconst { workPackage } = row;- const fromId = workPackage.id!;- const state = this.wpRelations.state(fromId);+ const state = this.wpRelations.state(workPackage.id as string);if (!state.hasValue() || _.size(state.value) === 0) {return;}- this.wpTableRelationColumns.relationsToExtendFor(workPackage,+ this.wpTableRelationColumns.relationsToExtendFor(+ workPackage,state.value,- (relation:RelationResource, column:QueryColumn, type:any) => {+ (relation:RelationResource, column:QueryColumn, type:RelationColumnType) => {+ const denormalized = relation.denormalized(workPackage);+ const to = this.states.workPackages.get(denormalized.targetId).value!;+// Build each relation row (currently sorted by order defined in API)const [relationRow, target] = this.relationRowBuilder.buildEmptyRelationRow(workPackage,- relation,- type,+ to,);// Augment any data for the belonging work package row to it- relationRow.classList.add(...row.additionalClasses);- this.relationRowBuilder.appendRelationLabel(jQuery(relationRow),- workPackage,- relation,- column.id,- type);-- // Insert next to the work package row- // If no relations exist until here, directly under the row- // otherwise as the last element of the relations- // Insert into table- this.tablePass.spliceRow(- relationRow,- `.${this.relationRowBuilder.classIdentifier(workPackage)},.${relationGroupClass(fromId)}`,- {- classIdentifier: this.relationRowBuilder.relationClassIdentifier(workPackage, target),- additionalClasses: row.additionalClasses.concat(['wp-table--relations-aditional-row']),- workPackage: target,- belongsTo: workPackage,- renderType: 'relations',- hidden: row.hidden,- data: {- relation,- columnId: column.id,- relationType: type,- },- } as RelationRenderInfo,- );- });+ const label = this.relationTypeLabel(workPackage, to, relation, type);+ this.renderRelationRow(relationRow, row, label, column, workPackage, target, type);+ },+ );});}- public refreshRelationRow(renderedRow:RelationRenderInfo,+ protected renderRelationRow(+ relationRow:HTMLElement,+ row:RowRenderInfo,+ label:string,+ column:QueryColumn,+ from:WorkPackageResource,+ to:WorkPackageResource,+ type:RelationColumnType,+ ) {+ relationRow.classList.add(...row.additionalClasses);+ this.relationRowBuilder.appendRelationLabel(+ jQuery(relationRow),+ label,+ column.id,+ );++ // Insert next to the work package row+ // If no relations exist until here, directly under the row+ // otherwise as the last element of the relations+ // Insert into table+ this.tablePass.spliceRow(+ relationRow,+ `.${this.relationRowBuilder.classIdentifier(from)},.${relationGroupClass(from.id as string)}`,+ {+ classIdentifier: this.relationRowBuilder.relationClassIdentifier(from, to),+ additionalClasses: row.additionalClasses.concat(['wp-table--relations-aditional-row']),+ workPackage: to,+ belongsTo: from,+ renderType: this.renderType,+ hidden: row.hidden,+ data: {+ label,+ columnId: column.id,+ relationType: type,+ },+ } as RelationRenderInfo,+ );+ }++ public refreshRelationRow(+ renderedRow:RelationRenderInfo,workPackage:WorkPackageResource,- oldRow:JQuery) {+ oldRow:JQuery,+ ) {const newRow = this.relationRowBuilder.refreshRow(workPackage, oldRow);- this.relationRowBuilder.appendRelationLabel(newRow,- renderedRow.belongsTo!,- renderedRow.data.relation,+ this.relationRowBuilder.appendRelationLabel(+ newRow,+ renderedRow.data.label,renderedRow.data.columnId,- renderedRow.data.relationType);+ );return newRow;}- private get isApplicable() {+ private relationTypeLabel(from:WorkPackageResource, to:WorkPackageResource, relation:RelationResource, type:RelationColumnType) {+ const denormalized = relation.denormalized(from);++ let typeLabel = '';++ if (type === 'toType') {+ typeLabel = this.I18n.t(`js.relation_labels.${denormalized.reverseRelationType}`);+ }++ if (type === 'ofType') {+ typeLabel = to.type.name;+ }++ return typeLabel;+ }++ public get isApplicable() {return this.wpTableColumns.hasRelationColumns();}}diff --git a/frontend/src/app/features/work-packages/components/wp-query/query-column.ts b/frontend/src/app/features/work-packages/components/wp-query/query-column.tsindex 9dec0836fa7..7464cd7a0ce 100644--- a/frontend/src/app/features/work-packages/components/wp-query/query-column.ts+++ b/frontend/src/app/features/work-packages/components/wp-query/query-column.ts@@ -4,19 +4,16 @@ export const queryColumnTypes = {PROPERTY: 'QueryColumn::Property',RELATION_OF_TYPE: 'QueryColumn::RelationOfType',RELATION_TO_TYPE: 'QueryColumn::RelationToType',+ RELATION_CHILD: 'QueryColumn::RelationChild',};-export function isRelationColumn(column:QueryColumn) {- const relationTypes = [queryColumnTypes.RELATION_TO_TYPE, queryColumnTypes.RELATION_OF_TYPE];- return relationTypes.indexOf(column._type) >= 0;-}-/*** A reference to a query column object as returned from the API.*/export interface QueryColumn extends HalResource {id:string;name:string;+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */custom_field?:any;_links?:{self:{ href:string, title:string };@@ -34,3 +31,12 @@ export interface TypeRelationQueryColumn extends QueryColumn {export interface RelationQueryColumn extends QueryColumn {relationType:string;}++export function isRelationColumn(column:QueryColumn) {+ const relationTypes = [+ queryColumnTypes.RELATION_TO_TYPE,+ queryColumnTypes.RELATION_OF_TYPE,+ queryColumnTypes.RELATION_CHILD,+ ];+ return relationTypes.indexOf(column._type) >= 0;+}diff --git a/frontend/src/app/features/work-packages/components/wp-table/sort-header/sort-header.directive.ts b/frontend/src/app/features/work-packages/components/wp-table/sort-header/sort-header.directive.tsindex ca40d341355..6f0a9008aed 100644--- a/frontend/src/app/features/work-packages/components/wp-table/sort-header/sort-header.directive.ts+++ b/frontend/src/app/features/work-packages/components/wp-table/sort-header/sort-header.directive.ts@@ -27,7 +27,7 @@//++import {- AfterViewInit,+ AfterViewInit, ChangeDetectionStrategy,ChangeDetectorRef,Component,ElementRef,@@ -35,14 +35,14 @@ import {} from '@angular/core';import { I18nService } from 'core-app/core/i18n/i18n.service';import {- QueryColumn,+ QueryColumn, queryColumnTypes,RelationQueryColumn,TypeRelationQueryColumn,} from 'core-app/features/work-packages/components/wp-query/query-column';import { WorkPackageTable } from 'core-app/features/work-packages/components/wp-fast-table/wp-fast-table';import {QUERY_SORT_BY_ASC,- QUERY_SORT_BY_DESC,+ QUERY_SORT_BY_DESC, QuerySortByDirection,} from 'core-app/features/hal/resources/query-sort-by-resource';import { WorkPackageViewHierarchiesService } from 'core-app/features/work-packages/routing/wp-view-base/view-services/wp-view-hierarchy.service';import { WorkPackageViewSortByService } from 'core-app/features/work-packages/routing/wp-view-base/view-services/wp-view-sort-by.service';@@ -53,9 +53,12 @@ import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destrimport { WorkPackageViewBaselineService } from 'core-app/features/work-packages/routing/wp-view-base/view-services/wp-view-baseline.service';@Component({+ // eslint-disable-next-line @angular-eslint/component-selectorselector: 'sortHeader',templateUrl: './sort-header.directive.html',+ changeDetection: ChangeDetectionStrategy.OnPush,})+// eslint-disable-next-line @angular-eslint/component-class-suffixexport class SortHeaderDirective extends UntilDestroyedMixin implements AfterViewInit {@Input() headerColumn:QueryColumn;@@ -85,7 +88,7 @@ export class SortHeaderDirective extends UntilDestroyedMixin implements AfterViebaselineIncompatible = false;- private currentSortDirection:any;+ private currentSortDirection:QuerySortByDirection|null;constructor(private wpTableHierarchies:WorkPackageViewHierarchiesService,@@ -143,6 +146,9 @@ export class SortHeaderDirective extends UntilDestroyedMixin implements AfterVie} else if (this.wpTableRelationColumns.relationColumnType(this.headerColumn) === 'ofType') {this.columnType = 'relation';this.columnName = I18n.t(`js.relation_labels.${(this.headerColumn as RelationQueryColumn).relationType}`);+ } else if (this.headerColumn._type === queryColumnTypes.RELATION_CHILD) {+ this.columnType = 'relation';+ this.columnName = this.headerColumn.name;}if (this.isHierarchyColumn) {diff --git a/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-additional-elements.service.ts b/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-additional-elements.service.tsindex d6906824f82..bdf785c8d81 100644--- a/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-additional-elements.service.ts+++ b/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-additional-elements.service.ts@@ -68,8 +68,9 @@ export class WorkPackageViewAdditionalElementsService {const workPackageIds = rows.map((el) => el.id!);// Add relations to the stack- Promise.all([+ void Promise.all([this.requireInvolvedRelations(workPackageIds),+ this.requireInvolvedChildren(rows),this.requireHierarchyElements(rows),this.requireWorkPackageShares(workPackageIds),this.requireSumsSchema(results),@@ -108,6 +109,22 @@ export class WorkPackageViewAdditionalElementsService {});}+ /**+ * Requires the work package children of the given work package ids+ * if a child relation column is present+ */+ private requireInvolvedChildren(rows:WorkPackageResource[]):Promise<string[]> {+ if (!this.wpTableColumns.hasChildRelationsColumn()) {+ return Promise.resolve([]);+ }++ const ids = _.flatten(+ rows.map((el) => el.children?.map((child) => child.id as string) || []),+ );++ return Promise.resolve(ids);+ }+/*** Return the id of all ancestors for visible rows in the table.* @param rowsdiff --git a/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-columns.service.ts b/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-columns.service.tsindex e4563e86213..34a5c9f714d 100644--- a/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-columns.service.ts+++ b/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-columns.service.ts@@ -43,10 +43,6 @@ export class WorkPackageViewColumnsService extends WorkPackageQueryStateService<super(querySpace);}- public initialize(query:any, results:any, schema?:any) {- super.initialize(query, results, schema);- }-public valueFromQuery(query:QueryResource):QueryColumn[] {return [...query.columns];}@@ -82,10 +78,20 @@ export class WorkPackageViewColumnsService extends WorkPackageQueryStateService<* Returns whether the current set of columns include relations*/public hasRelationColumns() {- const relationColumns = [queryColumnTypes.RELATION_OF_TYPE, queryColumnTypes.RELATION_TO_TYPE];+ const relationColumns = [+ queryColumnTypes.RELATION_OF_TYPE,+ queryColumnTypes.RELATION_TO_TYPE,+ ];return !!_.find(this.getColumns(), (c) => relationColumns.indexOf(c._type) >= 0);}+ /**+ * Returns whether the current set of columns include child relations+ */+ public hasChildRelationsColumn() {+ return !!_.find(this.getColumns(), (c) => c._type === queryColumnTypes.RELATION_CHILD);+ }+/*** Returns whether the current set of columns include shares*/diff --git a/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-relation-columns.service.ts b/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-relation-columns.service.tsindex fccb6219a90..fe2ae04ef81 100644--- a/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-relation-columns.service.ts+++ b/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-relation-columns.service.ts@@ -44,19 +44,21 @@ import { HalResourceService } from 'core-app/features/hal/services/hal-resource.import { WorkPackageViewBaseService } from './wp-view-base.service';import { WorkPackageViewColumnsService } from './wp-view-columns.service';-export type RelationColumnType = 'toType'|'ofType';+export type RelationColumnType = 'toType'|'ofType'|'children';@Injectable()export class WorkPackageViewRelationColumnsService extends WorkPackageViewBaseService<WorkPackageViewRelationColumns> {- constructor(public querySpace:IsolatedQuerySpace,+ constructor(+public querySpace:IsolatedQuerySpace,public wpTableColumns:WorkPackageViewColumnsService,public halResourceService:HalResourceService,public apiV3Service:ApiV3Service,- public wpRelations:WorkPackageRelationsService) {+ public wpRelations:WorkPackageRelationsService,+) {super(querySpace);}- public valueFromQuery(query:QueryResource):WorkPackageViewRelationColumns {+ public valueFromQuery(_query:QueryResource):WorkPackageViewRelationColumns {// Take over current expanded values// which are not yet savedreturn this.current;@@ -68,9 +70,11 @@ export class WorkPackageViewRelationColumnsService extends WorkPackageViewBaseSe* @param workPackage* @param relation*/- public relationsToExtendFor(workPackage:WorkPackageResource,+ public relationsToExtendFor(+workPackage:WorkPackageResource,relations:RelationsStateValue|undefined,- eachCallback:(relation:RelationResource, column:QueryColumn, type:RelationColumnType) => void) {+ eachCallback:(relation:RelationResource, column:QueryColumn, type:RelationColumnType) => void,+) {// Only if any relation columns or stored expansion state existif (!(this.wpTableColumns.hasRelationColumns() && this.lastUpdatedState.hasValue())) {return;@@ -91,8 +95,10 @@ export class WorkPackageViewRelationColumnsService extends WorkPackageViewBaseSeconst type = this.relationColumnType(column);if (type !== null) {- _.each(this.relationsForColumn(workPackage, relations, column),- (relation) => eachCallback(relation, column, type));+ _.each(+this.relationsForColumn(workPackage, relations, column),+ (relation) => eachCallback(relation, column, type),+);}}diff --git a/lib/api/v3/queries/columns/query_columns_factory.rb b/lib/api/v3/queries/columns/query_columns_factory.rbindex 4ca32797d69..b281b569ab2 100644--- a/lib/api/v3/queries/columns/query_columns_factory.rb+++ b/lib/api/v3/queries/columns/query_columns_factory.rb@@ -37,6 +37,8 @@ module API::API::V3::Queries::Columns::QueryRelationToTypeColumnRepresenterwhen ::Queries::WorkPackages::Selects::RelationOfTypeSelect::API::V3::Queries::Columns::QueryRelationOfTypeColumnRepresenter+ when ::Queries::WorkPackages::Selects::RelationChildSelect+ ::API::V3::Queries::Columns::QueryRelationChildColumnRepresenterelse::API::V3::Queries::Columns::QueryPropertyColumnRepresenterenddiff --git a/lib/api/v3/queries/columns/query_relation_child_column_representer.rb b/lib/api/v3/queries/columns/query_relation_child_column_representer.rbnew file mode 100644index 00000000000..9fb18bd667d--- /dev/null+++ b/lib/api/v3/queries/columns/query_relation_child_column_representer.rb@@ -0,0 +1,47 @@+# frozen_string_literal: true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++module API+ module V3+ module Queries+ module Columns+ class QueryRelationChildColumnRepresenter < QueryColumnRepresenter+ def _type+ "QueryColumn::RelationChild"+ end+ end++ def json_cache_key+ [represented.name]+ end+ end+ end+ end+enddiff --git a/spec/features/work_packages/table/child_relations_spec.rb b/spec/features/work_packages/table/child_relations_spec.rbnew file mode 100644index 00000000000..f16e5001d8f--- /dev/null+++ b/spec/features/work_packages/table/child_relations_spec.rb@@ -0,0 +1,98 @@+# frozen_string_literal: true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++require "spec_helper"++RSpec.describe "Work Package table child relations", :js, with_ee: %i[work_package_query_relation_columns] do+ let(:user) { create(:admin) }++ let(:type) { create(:type) }+ let(:type2) { create(:type) }+ let(:project) { create(:project, types: [type, type2]) }++ let(:wp_table) { Pages::WorkPackagesTable.new(project) }+ let(:relations) { Components::WorkPackages::Relations.new(relations) }+ let(:columns) { Components::WorkPackages::Columns.new }++ let!(:parent) { create(:work_package, project:, type: type2) }+ let!(:child1) { create(:work_package, project:, type:, parent:) }+ let!(:child2) { create(:work_package, project:, type:, parent:) }++ let!(:query) do+ query = build(:query, user:, project:)+ query.column_names = ["subject"]+ query.filters.clear++ query.save!+ query+ end++ before do+ login_as(user)+ end++ describe "with child relation columns allowed by the enterprise token" do+ it "displays expandable child relation columns" do+ # Now visiting the query for category+ wp_table.visit_query(query)+ wp_table.expect_work_package_listed(parent, child1, child2)++ columns.add("Children")++ parent_row = wp_table.row(parent)+ child1_row = wp_table.row(child1)++ # Expect count for parent in both columns to be two+ expect(parent_row).to have_css(".relationChild .wp-table--relation-count", text: "2")++ # Expect count for child1 in both columns to be not rendered+ expect(child1_row).to have_no_css(".relationChild .wp-table--relation-count")++ # Expand first column+ parent_row.find(".relationChild .wp-table--relation-indicator").click+ expect(page).to have_css(".__relations-expanded-from-#{parent.id}", count: 2)+ related_row = page.first(".__relations-expanded-from-#{parent.id}")+ expect(related_row).to have_css("td.wp-table--relation-cell-td", text: "Child")++ # Collapse+ parent_row.find(".relationChild .wp-table--relation-indicator").click+ expect(page).to have_no_css(".__relations-expanded-from-#{parent.id}")+ end+ end++ describe "with child relation columns disallowed by the enterprise token", with_ee: false do+ it "has no child relation columns available for selection" do+ # Now visiting the query for category+ wp_table.visit_query(query)++ columns.expect_column_not_available "Children"+ end+ end+enddiff --git a/spec/features/work_packages/table/relations_spec.rb b/spec/features/work_packages/table/relations_spec.rbindex 09cfa53da44..dc848fcb71b 100644--- a/spec/features/work_packages/table/relations_spec.rb+++ b/spec/features/work_packages/table/relations_spec.rb@@ -1,33 +1,14 @@require "spec_helper"-RSpec.describe "Work Package table relations", :js, with_ee: %i[work_package_query_relation_columns] do- let(:user) { create(:admin) }+RSpec.describe "Work Package table child relations",+ :js,+ with_ee: %i[work_package_query_relation_columns] do+ shared_let(:user) { create(:admin) }- let(:type) { create(:type) }- let(:type2) { create(:type) }- let(:project) { create(:project, types: [type, type2]) }+ shared_let(:type) { create(:type) }+ shared_let(:project) { create(:project, types: [type]) }- let(:wp_table) { Pages::WorkPackagesTable.new(project) }- let(:relations) { Components::WorkPackages::Relations.new(relations) }- let(:columns) { Components::WorkPackages::Columns.new }-- let!(:wp_from) { create(:work_package, project:, type: type2) }- let!(:wp_to) { create(:work_package, project:, type:) }- let!(:wp_to2) { create(:work_package, project:, type:) }-- let!(:relation) do- create(:relation,- from: wp_from,- to: wp_to,- relation_type: Relation::TYPE_FOLLOWS)- end- let!(:relation2) do- create(:relation,- from: wp_from,- to: wp_to2,- relation_type: Relation::TYPE_FOLLOWS)- end- let!(:query) do+ shared_let(:query) doquery = build(:query, user:, project:)query.column_names = ["subject"]query.filters.clear@@ -36,48 +17,44 @@ RSpec.describe "Work Package table relations", :js, with_ee: %i[work_package_quequeryend- let(:type_column_id) { "relationsToType#{type.id}" }- let(:type_column_follows) { "relationsOfTypeFollows" }+ let(:wp_table) { Pages::WorkPackagesTable.new(project) }+ let(:relations) { Components::WorkPackages::Relations.new(relations) }+ let(:columns) { Components::WorkPackages::Columns.new }++ shared_let(:parent) { create(:work_package, subject: "Parent", project:, type:, author: user) }+ shared_let(:child) { create(:work_package, subject: "Child", parent:, project:, type:, author: user) }before dologin_as(user)enddescribe "with relation columns allowed by the enterprise token" do- it "displays expandable relation columns" do+ it "displays expandable relation columns for the children of a work package" do# Now visiting the query for categorywp_table.visit_query(query)- wp_table.expect_work_package_listed(wp_from, wp_to, wp_to2)+ wp_table.expect_work_package_listed(parent)++ columns.add("Children")- columns.add(type.name)- columns.add("Follows")+ parent_row = wp_table.row(parent)+ child_row = wp_table.row(child)- wp_from_row = wp_table.row(wp_from)- wp_from_to = wp_table.row(wp_to)+ # Expect count for parent to be one+ expect(parent_row).to have_css(".relationChild .wp-table--relation-count", text: "1")- # Expect count for wp_from in both columns to be one- expect(wp_from_row).to have_css(".#{type_column_id} .wp-table--relation-count", text: "2")- expect(wp_from_row).to have_css(".#{type_column_follows} .wp-table--relation-count", text: "2")+ # Expect count for child to be not rendered+ expect(child_row).to have_no_css(".relationChild .wp-table--relation-count")- # Expect count for wp_to in both columns to be not rendered- expect(wp_from_to).to have_no_css(".#{type_column_id} .wp-table--relation-count")- expect(wp_from_to).to have_no_css(".#{type_column_follows} .wp-table--relation-count")+ # Expand column+ parent_row.find(".relationChild .wp-table--relation-indicator").click+ expect(page).to have_css(".__relations-expanded-from-#{parent.id}", count: 1)- # Expand first column- wp_from_row.find(".#{type_column_id} .wp-table--relation-indicator").click- expect(page).to have_css(".__relations-expanded-from-#{wp_from.id}", count: 2)- related_row = page.first(".__relations-expanded-from-#{wp_from.id}")- expect(related_row).to have_css("td.wp-table--relation-cell-td", text: "Precedes")+ related_row = page.first(".__relations-expanded-from-#{parent.id}")+ expect(related_row).to have_css("td.wp-table--relation-cell-td", text: "Child")# Collapse- wp_from_row.find(".#{type_column_id} .wp-table--relation-indicator").click- expect(page).to have_no_css(".__relations-expanded-from-#{wp_from.id}")-- # Expand second column- wp_from_row.find(".#{type_column_follows} .wp-table--relation-indicator").click- expect(page).to have_css(".__relations-expanded-from-#{wp_from.id}", count: 2)- related_row = page.first(".__relations-expanded-from-#{wp_from.id}")- expect(related_row).to have_css(".wp-table--relation-cell-td", text: wp_to.type)+ parent_row.find(".relationChild .wp-table--relation-indicator").click+ expect(page).to have_no_css(".__relations-expanded-from-#{parent.id}")endend@@ -85,9 +62,7 @@ RSpec.describe "Work Package table relations", :js, with_ee: %i[work_package_queit "has no relation columns available for selection" do# Now visiting the query for categorywp_table.visit_query(query)-- columns.expect_column_not_available "follows relations"- columns.expect_column_not_available "Relations to #{type.name}"+ columns.expect_column_not_available "Children"endendenddiff --git a/spec/models/queries/work_packages/selects/relation_child_select_spec.rb b/spec/models/queries/work_packages/selects/relation_child_select_spec.rbnew file mode 100644index 00000000000..b82fd968780--- /dev/null+++ b/spec/models/queries/work_packages/selects/relation_child_select_spec.rb@@ -0,0 +1,45 @@+# frozen_string_literal: true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++require "spec_helper"+require_relative "shared_query_select_specs"++RSpec.describe Queries::WorkPackages::Selects::RelationChildSelect do+ let(:project) { build_stubbed(:project) }+ let(:instance) { described_class.new }++ it_behaves_like "query column"++ describe "#caption" do+ it "returns the translated label for children" do+ expect(instance.caption).to eq("Children")+ end+ end+end