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

[48297] Restrict options in baseline modal without enterprise (#12728)

Behrokh Satarnejad5c98aa79f52f
diff --git a/config/locales/js-en.yml b/config/locales/js-en.yml
index 257ddbad208..8e8dad8502f 100644
--- a/config/locales/js-en.yml
+++ b/config/locales/js-en.yml
@@ -1365,8 +1365,10 @@ en:
toggle_title: 'Baseline'
clear: 'Clear'
apply: 'Apply'
- header_description: 'View changes made to work packages in the current view within a time period.'
+ header_description: 'Highlight changes made to this list since any point in the past.'
+ enterprise_header_description: 'Highlight changes made to this list since any point in the past with Enterprise edition.'
show_changes_since: 'Show changes since'
+ baseline_comparison: 'Baseline comparison'
help_description: 'Reference time zone for the baseline.'
time_description: 'In your local time: %{datetime}'
time: 'Time'
diff --git a/frontend/src/app/features/work-packages/components/wp-baseline/baseline-modal/baseline-modal.component.html b/frontend/src/app/features/work-packages/components/wp-baseline/baseline-modal/baseline-modal.component.html
index acc171ce52a..57a4d2a9e3c 100644
--- a/frontend/src/app/features/work-packages/components/wp-baseline/baseline-modal/baseline-modal.component.html
+++ b/frontend/src/app/features/work-packages/components/wp-baseline/baseline-modal/baseline-modal.component.html
@@ -17,12 +17,6 @@
<span class="spot-icon spot-icon_dropdown"></span>
</button>
-
- <ng-container slot="body">
- <div class="op-baseline-modal--header">
- <span class="spot-body-small">{{ text.header_description }}</span>
- </div>
- </ng-container>
<op-baseline
[visible]="opened"
[showActionBar]="true"
diff --git a/frontend/src/app/features/work-packages/components/wp-baseline/baseline-modal/baseline-modal.component.sass b/frontend/src/app/features/work-packages/components/wp-baseline/baseline-modal/baseline-modal.component.sass
index 5bb92f7537b..b7ba90b18b6 100644
--- a/frontend/src/app/features/work-packages/components/wp-baseline/baseline-modal/baseline-modal.component.sass
+++ b/frontend/src/app/features/work-packages/components/wp-baseline/baseline-modal/baseline-modal.component.sass
@@ -2,10 +2,7 @@
.op-baseline-modal
- &--header
- display: flex
- justify-content: space-between
- align-items: center
- margin: $spot-spacing-1 $spot-spacing-1 0 $spot-spacing-1
- width: 265px
- color: $spot-color-basic-gray-2
+.op-baseline
+ @media screen and #{$spot-mq-drop-modal-in-context}
+ max-height: 70vh
+ width: 316px
diff --git a/frontend/src/app/features/work-packages/components/wp-baseline/baseline-modal/baseline-modal.component.ts b/frontend/src/app/features/work-packages/components/wp-baseline/baseline-modal/baseline-modal.component.ts
index fa3a40bd953..004c482ceb2 100644
--- a/frontend/src/app/features/work-packages/components/wp-baseline/baseline-modal/baseline-modal.component.ts
+++ b/frontend/src/app/features/work-packages/components/wp-baseline/baseline-modal/baseline-modal.component.ts
@@ -31,7 +31,6 @@ import {
Component,
HostBinding,
} from '@angular/core';
-
import { I18nService } from 'core-app/core/i18n/i18n.service';
@Component({
@@ -50,6 +49,7 @@ export class OpBaselineModalComponent {
header_description: this.I18n.t('js.baseline.header_description'),
clear: this.I18n.t('js.baseline.clear'),
apply: this.I18n.t('js.baseline.apply'),
+
};
constructor(
diff --git a/frontend/src/app/features/work-packages/components/wp-baseline/baseline/baseline.component.html b/frontend/src/app/features/work-packages/components/wp-baseline/baseline/baseline.component.html
index 6e789e9cead..0b5a6a1b6f8 100644
--- a/frontend/src/app/features/work-packages/components/wp-baseline/baseline/baseline.component.html
+++ b/frontend/src/app/features/work-packages/components/wp-baseline/baseline/baseline.component.html
@@ -1,9 +1,30 @@
+<div class="op-baseline--header"
+ [class.op-baseline_tab]="!showActionBar">
+ <div
+ class="op-baseline--enterprise-title"
+ *ngIf="eeShowBanners">
+ <span class="">{{ text.baseline_comparison }}</span>
+ <span class="spot-icon spot-icon_enterprise-addons"></span>
+ </div>
+ <span class="spot-body-small">{{ eeShowBanners ? text.enterprise_header_description : text.header_description }}</span>
+ <a
+ *ngIf="eeShowBanners"
+ [attr.href]="text.moreInfoLink"
+ class="op-baseline--info-button"
+ target=”_blank”>
+ {{ text.more_info_text }}
+ <span class="spot-icon spot-icon_external-link"></span>
+ </a>
+</div>
<form
*ngIf="visible && (nonWorkingDays$ | async); else loadingTemplate"
(submit)="onSubmit($event)"
class="spot-container op-baseline--body"
[class.op-baseline--body_ranged]="selectedFilter === 'betweenTwoSpecificDates'"
+ [class.op-baseline_tab]="!showActionBar"
>
+
+
<spot-form-field
[label]="text.show_changes_since">
@@ -20,6 +41,7 @@
*ngFor="let availableValue of baselineAvailableValues"
[value]="availableValue.value"
[selected]="availableValue.value === selectedFilter"
+ [disabled]="eeShowBanners && availableValue.value !== 'oneDayAgo'"
>
{{availableValue.title}}
</option>
diff --git a/frontend/src/app/features/work-packages/components/wp-baseline/baseline/baseline.component.sass b/frontend/src/app/features/work-packages/components/wp-baseline/baseline/baseline.component.sass
index 26af0111ebb..ffe5be44741 100644
--- a/frontend/src/app/features/work-packages/components/wp-baseline/baseline/baseline.component.sass
+++ b/frontend/src/app/features/work-packages/components/wp-baseline/baseline/baseline.component.sass
@@ -1,6 +1,25 @@
@import "src/assets/sass/helpers"
.op-baseline
+ &--header
+ display: flex
+ justify-content: space-between
+ align-items: start
+ flex-direction: column
+ margin: $spot-spacing-1 $spot-spacing-1 0 $spot-spacing-1
+ color: $spot-color-basic-gray-2
+
+ &--enterprise-title
+ color: $spot-color-feedback-warning-dark
+ @include spot-body-small (bold)
+ display: flex
+ flex-direction: row
+ align-items: center
+ gap: $spot-spacing-1 $spot-spacing-0_25
+
+ &--info-button
+ display: flex
+ align-items: center
&--body
flex-shrink: 1
@@ -51,3 +70,11 @@
&--datepicker
margin: 1rem
+ // remove additional margins when baseline component
+ // is used in baseline tab of WP configuration madal
+ &_tab.op-baseline--header
+ margin: 0
+ &_tab
+ .spot-form-field
+ margin-right: 0
+ margin-left: 0
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 0d2feedffac..3d0cc85e884 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
@@ -57,6 +57,8 @@ import {
offsetToUtcString,
} from 'core-app/features/work-packages/components/wp-baseline/baseline-helpers';
import * as moment from 'moment-timezone';
+import { BannersService } from 'core-app/core/enterprise/banners.service';
+import { enterpriseDocsUrl } from 'core-app/core/setup/globals/constants.const';
@Component({
selector: 'op-baseline',
@@ -93,10 +95,13 @@ export class OpBaselineComponent extends UntilDestroyedMixin implements OnInit {
public tooltipPosition = SpotDropAlignmentOption.TopRight;
+ eeShowBanners = this.Banner.eeShowBanners;
+
public text = {
toggle_title: this.I18n.t('js.baseline.toggle_title'),
drop_down_none_option: this.I18n.t('js.baseline.drop_down.none'),
header_description: this.I18n.t('js.baseline.header_description'),
+ enterprise_header_description: this.I18n.t('js.baseline.enterprise_header_description'),
clear: this.I18n.t('js.baseline.clear'),
apply: this.I18n.t('js.baseline.apply'),
show_changes_since: this.I18n.t('js.baseline.show_changes_since'),
@@ -104,7 +109,10 @@ export class OpBaselineComponent extends UntilDestroyedMixin implements OnInit {
to: this.I18n.t('js.baseline.to'),
date: this.I18n.t('js.label_date'),
time: this.I18n.t('js.baseline.time'),
+ moreInfoLink: enterpriseDocsUrl.website,
+ more_info_text: this.I18n.t('js.admin.enterprise.upsale.more_info'),
help_description: this.I18n.t('js.baseline.help_description'),
+ baseline_comparison: this.I18n.t('js.baseline.baseline_comparison'),
time_description: (i:number) => {
const date = this.selectedDates[i];
const time = this.selectedTimes[i];
@@ -160,6 +168,7 @@ export class OpBaselineComponent extends UntilDestroyedMixin implements OnInit {
readonly daysService:DayResourceService,
readonly timezoneService:TimezoneService,
readonly configuration:ConfigurationService,
+ readonly Banner:BannersService,
) {
super();
}
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 45b56ac65b1..0183b29cf65 100644
--- a/spec/features/work_packages/table/baseline/baseline_rendering_spec.rb
+++ b/spec/features/work_packages/table/baseline/baseline_rendering_spec.rb
@@ -34,6 +34,7 @@ RSpec.describe 'baseline rendering',
shared_let(:type_bug) { create(:type_bug) }
shared_let(:type_task) { create(:type_task) }
shared_let(:project) { create(:project, types: [type_bug, type_task]) }
+ let(:baseline_modal) { Components::WorkPackages::BaselineModal.new }
shared_let(:user) do
create(:user,
firstname: 'Itsa',
@@ -216,4 +217,19 @@ RSpec.describe 'baseline rendering',
baseline.expect_inactive
end
end
+ describe 'without EE', with_ee: false, with_flag: { show_changes: true } do
+ it 'disabled options' do
+ wp_table.visit_query(query)
+ baseline_modal.expect_closed
+ baseline_modal.toggle_drop_modal
+ baseline_modal.expect_open
+ expect(page).to have_selector(".op-baseline--enterprise-title")
+ # only yesterday is selectable
+ page.select('a specific date', from: 'op-baseline-filter')
+ expect(page).not_to have_select('op-baseline-filter', selected: 'a specific date')
+
+ page.select('yesterday', from: 'op-baseline-filter')
+ expect(page).to have_select('op-baseline-filter', selected: 'yesterday')
+ end
+ end
end