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

Ensure Baseline is reset and deactivated when querying for `DEFAULT_TIMESTAMP`

Aaron Contreras0c14d270ece5
diff --git a/frontend/src/app/features/work-packages/components/wp-baseline/baseline/baseline.component.ts b/frontend/src/app/features/work-packages/components/wp-baseline/baseline/baseline.component.ts
index 73cb9117ca7..2e0b92dcbc1 100644
--- a/frontend/src/app/features/work-packages/components/wp-baseline/baseline/baseline.component.ts
+++ b/frontend/src/app/features/work-packages/components/wp-baseline/baseline/baseline.component.ts
@@ -192,6 +192,15 @@ export class OpBaselineComponent extends UntilDestroyedMixin implements OnInit {
}
});
}
+
+ this.wpTableBaseline
+ .pristine$()
+ .subscribe((timestamps) => {
+ if (_.isEqual(timestamps, [DEFAULT_TIMESTAMP])) {
+ this.resetSelection();
+ this.wpTableBaseline.disable();
+ }
+ });
}
public resetSelection():void {
diff --git a/spec/features/work_packages/table/baseline/baseline_rendering_spec.rb b/spec/features/work_packages/table/baseline/baseline_rendering_spec.rb
index 36078fd81f0..28e25ed2a39 100644
--- a/spec/features/work_packages/table/baseline/baseline_rendering_spec.rb
+++ b/spec/features/work_packages/table/baseline/baseline_rendering_spec.rb
@@ -378,6 +378,49 @@ RSpec.describe 'baseline rendering',
expect(page).not_to have_selector(".op-wp-single-card--content-baseline")
end
end
+
+ shared_examples_for 'selecting a builtin view' do
+ let(:builtin_view_name) { 'All open' }
+
+ before do
+ within '#main-menu' do
+ click_link builtin_view_name
+ end
+ end
+
+ it 'does not show changes or render baseline details' do
+ wp_table.expect_title builtin_view_name
+
+ baseline.expect_inactive
+ baseline.expect_no_legends
+ baseline_modal.toggle_drop_modal
+ baseline_modal.expect_selected '-'
+ end
+ end
+
+ context 'when a baseline filter is set', :with_cuprite do
+ before do
+ wp_table.visit!
+
+ wait_for_reload # Ensure page is fully loaded
+
+ baseline_modal.toggle_drop_modal
+ baseline_modal.select_filter 'yesterday'
+ baseline_modal.apply
+ end
+
+ context 'and the query is saved' do
+ before do
+ wp_table.save_as 'My Baseline Query'
+ end
+
+ it_behaves_like 'selecting a builtin view'
+ end
+
+ context 'and the query is not saved' do
+ it_behaves_like 'selecting a builtin view'
+ end
+ end
end
describe 'with feature disabled', with_flag: { show_changes: false } do