Skip to content

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

show children's duration bar only when visible childrens

Aleix Suau0919b55315ad
diff --git a/frontend/src/app/components/wp-table/timeline/cells/timeline-cell-renderer.ts b/frontend/src/app/components/wp-table/timeline/cells/timeline-cell-renderer.ts
index 67b1d06ae6a..965aa58ce6b 100644
--- a/frontend/src/app/components/wp-table/timeline/cells/timeline-cell-renderer.ts
+++ b/frontend/src/app/components/wp-table/timeline/cells/timeline-cell-renderer.ts
@@ -415,30 +415,30 @@ export class TimelineCellRenderer {
bar.style.borderWidth = '2px';
bar.style.borderBottom = 'none';
bar.style.background = 'none';
- }
- // Display the children's duration bar
- if (wp.derivedStartDate && wp.derivedDueDate) {
- let derivedStartDate = moment(wp.derivedStartDate);
- let derivedDueDate = moment(wp.derivedDueDate);
- let startDate = moment(renderInfo.change.projectedResource.startDate);
- let dueDate = moment(renderInfo.change.projectedResource.dueDate);
- let previousChildrenDurationBar = row.querySelector('.children-duration-bar');
- const childrenDurationBar = document.createElement('div');
+ // Display the children's duration bar
+ if (wp.derivedStartDate && wp.derivedDueDate) {
+ let derivedStartDate = moment(wp.derivedStartDate);
+ let derivedDueDate = moment(wp.derivedDueDate);
+ let startDate = moment(renderInfo.change.projectedResource.startDate);
+ let dueDate = moment(renderInfo.change.projectedResource.dueDate);
+ let previousChildrenDurationBar = row.querySelector('.children-duration-bar');
+ const childrenDurationBar = document.createElement('div');
- childrenDurationBar.classList.add('children-duration-bar');
+ childrenDurationBar.classList.add('children-duration-bar');
- if (derivedStartDate.isBefore(startDate) || derivedDueDate.isAfter(dueDate)) {
- childrenDurationBar.classList.add('-duration-overflow');
- }
+ if (derivedStartDate.isBefore(startDate) || derivedDueDate.isAfter(dueDate)) {
+ childrenDurationBar.classList.add('-duration-overflow');
+ }
- this.setElementPositionAndSize(childrenDurationBar, renderInfo, derivedStartDate, derivedDueDate);
+ this.setElementPositionAndSize(childrenDurationBar, renderInfo, derivedStartDate, derivedDueDate);
- if (previousChildrenDurationBar) {
- previousChildrenDurationBar.remove();
- }
+ if (previousChildrenDurationBar) {
+ previousChildrenDurationBar.remove();
+ }
- row!.appendChild(childrenDurationBar);
+ row!.appendChild(childrenDurationBar);
+ }
}
}