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 a warning on leaf elements in the hiearchy as well to warn of overwrites in the parents * When there is a following and a preceeding relationship, prefer the warning banner over the info banner

Henriette Dargeb6e7ddc931cd
diff --git a/frontend/src/app/shared/components/datepicker/banner/datepicker-banner.component.html b/frontend/src/app/shared/components/datepicker/banner/datepicker-banner.component.html
index 4c2298ed960..c405120aafc 100644
--- a/frontend/src/app/shared/components/datepicker/banner/datepicker-banner.component.html
+++ b/frontend/src/app/shared/components/datepicker/banner/datepicker-banner.component.html
@@ -20,7 +20,7 @@
</op-modal-banner>
<ng-container *ngIf="!scheduleManually && !isParent">
<op-modal-banner
- *ngIf="(hasPrecedingRelations$ | async) === true"
+ *ngIf="(hasPrecedingRelations$ | async) === true && (hasFollowingRelations$ | async) === false"
type="info"
[title]="text.start_date_limited_by_relations"
[subtitle]="text.click_on_show_relations_to_open_gantt"
@@ -31,8 +31,8 @@
</op-modal-banner>
<op-modal-banner
- *ngIf="(hasPrecedingRelations$ | async) === false && (hasFollowingRelations$ | async) === true"
- type="info"
+ *ngIf="(hasFollowingRelations$ | async) === true || isChild"
+ type="warning"
[title]="text.changing_dates_affects_follow_relations"
[subtitle]="text.click_on_show_relations_to_open_gantt"
[actionButton]="text.show_relations_button"
diff --git a/frontend/src/app/shared/components/datepicker/banner/datepicker-banner.component.ts b/frontend/src/app/shared/components/datepicker/banner/datepicker-banner.component.ts
index ed0ffda60c1..8eb85b2b76e 100644
--- a/frontend/src/app/shared/components/datepicker/banner/datepicker-banner.component.ts
+++ b/frontend/src/app/shared/components/datepicker/banner/datepicker-banner.component.ts
@@ -66,6 +66,8 @@ export class DatepickerBannerComponent {
isParent = this.datepickerService.isParent;
+ isChild = this.datepickerService.isChild;
+
text = {
automatically_scheduled_parent: this.I18n.t('js.work_packages.datepicker_modal.automatically_scheduled_parent'),
manually_scheduled: this.I18n.t('js.work_packages.datepicker_modal.manually_scheduled'),
diff --git a/frontend/src/app/shared/components/datepicker/datepicker.modal.service.ts b/frontend/src/app/shared/components/datepicker/datepicker.modal.service.ts
index c6469942a6c..33d4c57b63f 100644
--- a/frontend/src/app/shared/components/datepicker/datepicker.modal.service.ts
+++ b/frontend/src/app/shared/components/datepicker/datepicker.modal.service.ts
@@ -80,7 +80,7 @@ export class DatepickerModalService {
this.followingWorkPackages$,
])
.pipe(
- map(([precedes, follows]) => precedes.length > 0 || follows.length > 0 || this.isParent),
+ map(([precedes, follows]) => precedes.length > 0 || follows.length > 0 || this.isParent || this.isChild),
);
constructor(
@@ -88,6 +88,19 @@ export class DatepickerModalService {
private apiV3Service:ApiV3Service,
) {}
+ /**
+ * Determines whether the work package is a child. It does so
+ * by checking the ancestors links.
+ */
+ get isChild():boolean {
+ return this.ancestors.length > 0;
+ }
+
+ get ancestors():HalResource[] {
+ const wp = this.changeset.projectedResource;
+ return wp.ancestors || [];
+ }
+
/**
* Determines whether the work package is a parent. It does so
* by checking the children links.
@@ -112,6 +125,7 @@ export class DatepickerModalService {
...preceding,
...following,
...this.children,
+ ...this.ancestors,
].map((el) => el.id as string),
),
);
diff --git a/spec/features/work_packages/details/date_editor_spec.rb b/spec/features/work_packages/details/date_editor_spec.rb
index 788089b9f29..20a2d3a6895 100644
--- a/spec/features/work_packages/details/date_editor_spec.rb
+++ b/spec/features/work_packages/details/date_editor_spec.rb
@@ -299,6 +299,61 @@ describe 'date inplace editor',
end
end
+ context 'with the work package being the last in the hierarchy' do
+ let!(:parent) { create :work_package, project:, schedule_manually:, start_date: 1.day.ago, due_date: 5.days.from_now }
+ let!(:work_package) { create :work_package, project:, schedule_manually:, parent: }
+
+ before do
+ start_date.activate!
+ start_date.expect_active!
+ end
+
+ context 'when work package is manually scheduled' do
+ let(:schedule_manually) { true }
+
+ it 'shows a banner that the relations are ignored' do
+ expect(page).to have_selector('[data-qa-selector="op-modal-banner-warning"] span',
+ text: 'Manual scheduling is enabled so all existing work package relations are ignored.',
+ wait: 5)
+
+ # When toggling manually scheduled
+ start_date.expect_scheduling_mode manually: true
+ start_date.toggle_scheduling_mode
+ start_date.expect_scheduling_mode manually: false
+
+ # Expect new banner info
+ expect(page)
+ .to have_selector('[data-qa-selector="op-modal-banner-warning"] span',
+ text: 'Changing the dates of this work package will change the dates of related work packages.')
+
+ new_window = window_opened_by { click_on 'Show relations' }
+ switch_to_window new_window
+
+ wp_table.expect_work_package_listed parent
+ wp_timeline.expect_timeline!
+ end
+ end
+
+ context 'when work package is not manually scheduled' do
+ let(:schedule_manually) { false }
+
+ it 'shows a banner that the start date is limited' do
+ expect(page)
+ .to have_selector('[data-qa-selector="op-modal-banner-warning"] span',
+ text: 'Changing the dates of this work package will change the dates of related work packages.',
+ wait: 5)
+
+ # When toggling manually scheduled
+ start_date.expect_scheduling_mode manually: false
+ start_date.toggle_scheduling_mode
+ start_date.expect_scheduling_mode manually: true
+
+ expect(page).to have_selector('[data-qa-selector="op-modal-banner-warning"] span',
+ text: 'Manual scheduling is enabled so all existing work package relations are ignored.')
+ end
+ end
+ end
+
context 'with the work package being a parent' do
let!(:child) { create :work_package, project:, start_date: 1.day.ago, due_date: 5.days.from_now }
let!(:work_package) do
@@ -447,7 +502,7 @@ describe 'date inplace editor',
start_date.expect_scheduling_mode manually: false
expect(page)
- .to have_selector('[data-qa-selector="op-modal-banner-info"] span',
+ .to have_selector('[data-qa-selector="op-modal-banner-warning"] span',
text: 'Changing the dates of this work package will change the dates of related work packages.')
new_window = window_opened_by { click_on 'Show relations' }
@@ -463,7 +518,7 @@ describe 'date inplace editor',
it 'shows a banner that the start date is limited' do
expect(page)
- .to have_selector('[data-qa-selector="op-modal-banner-info"] span',
+ .to have_selector('[data-qa-selector="op-modal-banner-warning"] span',
text: 'Changing the dates of this work package will change the dates of related work packages.')
# When toggling manually scheduled