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

Remove the "Gantt" option from the configuration modal for the WP and the BCF module

Henriette Dargef1fe507291bc
diff --git a/frontend/src/app/features/work-packages/components/wp-table/configuration-modal/wp-table-configuration.modal.ts b/frontend/src/app/features/work-packages/components/wp-table/configuration-modal/wp-table-configuration.modal.ts
index 73622309730..21ff1abc755 100644
--- a/frontend/src/app/features/work-packages/components/wp-table/configuration-modal/wp-table-configuration.modal.ts
+++ b/frontend/src/app/features/work-packages/components/wp-table/configuration-modal/wp-table-configuration.modal.ts
@@ -34,6 +34,7 @@ import { WorkPackageNotificationService } from 'core-app/features/work-packages/
import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';
import { QueryFormResource } from 'core-app/features/hal/resources/query-form-resource';
import { QueryResource } from 'core-app/features/hal/resources/query-resource';
+import { StateService } from '@uirouter/angular';
export const WpTableConfigurationModalPrependToken = new InjectionToken<ComponentType<any>>('WpTableConfigurationModalPrependComponent');
@@ -67,9 +68,10 @@ export class WpTableConfigurationModalComponent extends OpModalComponent impleme
// Try to load an optional provided configuration service, and fall back to the default one
private wpTableConfigurationService:WpTableConfigurationService =
- this.injector.get(WpTableConfigurationService, new WpTableConfigurationService(this.I18n));
+ this.injector.get(WpTableConfigurationService, new WpTableConfigurationService(this.I18n, this.$state));
- constructor(@Inject(OpModalLocalsToken) public locals:OpModalLocalsMap,
+ constructor(
+ @Inject(OpModalLocalsToken) public locals:OpModalLocalsMap,
@Optional() @Inject(WpTableConfigurationModalPrependToken) public prependModalComponent:ComponentType<any>|null,
readonly I18n:I18nService,
readonly injector:Injector,
@@ -83,7 +85,9 @@ export class WpTableConfigurationModalComponent extends OpModalComponent impleme
readonly wpTableColumns:WorkPackageViewColumnsService,
readonly cdRef:ChangeDetectorRef,
readonly ConfigurationService:ConfigurationService,
- readonly elementRef:ElementRef) {
+ readonly elementRef:ElementRef,
+ readonly $state:StateService,
+ ) {
super(locals, cdRef, elementRef);
}
diff --git a/frontend/src/app/features/work-packages/components/wp-table/configuration-modal/wp-table-configuration.service.ts b/frontend/src/app/features/work-packages/components/wp-table/configuration-modal/wp-table-configuration.service.ts
index 8f8be966f24..be119cedf33 100644
--- a/frontend/src/app/features/work-packages/components/wp-table/configuration-modal/wp-table-configuration.service.ts
+++ b/frontend/src/app/features/work-packages/components/wp-table/configuration-modal/wp-table-configuration.service.ts
@@ -8,6 +8,7 @@ import { WpTableConfigurationSortByTabComponent } from 'core-app/features/work-p
import { WpTableConfigurationTimelinesTabComponent } from 'core-app/features/work-packages/components/wp-table/configuration-modal/tabs/timelines-tab.component';
import { WpTableConfigurationHighlightingTabComponent } from 'core-app/features/work-packages/components/wp-table/configuration-modal/tabs/highlighting-tab.component';
import { OpBaselineComponent } from 'core-app/features/work-packages/components/wp-baseline/baseline/baseline.component';
+import { StateService } from '@uirouter/angular';
@Injectable()
export class WpTableConfigurationService {
@@ -42,17 +43,25 @@ export class WpTableConfigurationService {
name: this.I18n.t('js.work_packages.table_configuration.highlighting'),
componentClass: WpTableConfigurationHighlightingTabComponent,
},
- {
- id: 'timelines',
- name: this.I18n.t('js.gantt_chart.label'),
- componentClass: WpTableConfigurationTimelinesTabComponent,
- },
];
- constructor(readonly I18n:I18nService) {
+ constructor(
+ readonly I18n:I18nService,
+ readonly $state:StateService,
+ ) {
}
public get tabs() {
- return this._tabs;
+ if (this.$state.current.name?.includes('work-packages') || this.$state.current.name?.includes('bim')) {
+ return this._tabs;
+ }
+
+ return this._tabs.concat([
+ {
+ id: 'timelines',
+ name: this.I18n.t('js.gantt_chart.label'),
+ componentClass: WpTableConfigurationTimelinesTabComponent,
+ },
+ ]);
}
}
diff --git a/frontend/src/app/features/work-packages/components/wp-table/external-configuration/restricted-wp-table-configuration.service.ts b/frontend/src/app/features/work-packages/components/wp-table/external-configuration/restricted-wp-table-configuration.service.ts
index 788576f6da4..d1b91c01a0a 100644
--- a/frontend/src/app/features/work-packages/components/wp-table/external-configuration/restricted-wp-table-configuration.service.ts
+++ b/frontend/src/app/features/work-packages/components/wp-table/external-configuration/restricted-wp-table-configuration.service.ts
@@ -4,19 +4,23 @@ import { TabInterface } from 'core-app/features/work-packages/components/wp-tabl
import { WpTableConfigurationService } from 'core-app/features/work-packages/components/wp-table/configuration-modal/wp-table-configuration.service';
import { QueryConfigurationLocals } from 'core-app/features/work-packages/components/wp-table/external-configuration/external-query-configuration.component';
import { OpQueryConfigurationLocalsToken } from 'core-app/features/work-packages/components/wp-table/external-configuration/external-query-configuration.constants';
+import { StateService } from '@uirouter/angular';
@Injectable()
export class RestrictedWpTableConfigurationService extends WpTableConfigurationService {
- constructor(@Inject(OpQueryConfigurationLocalsToken) readonly locals:QueryConfigurationLocals,
- readonly I18n:I18nService) {
- super(I18n);
+ constructor(
+ @Inject(OpQueryConfigurationLocalsToken) readonly locals:QueryConfigurationLocals,
+ readonly I18n:I18nService,
+ readonly $state:StateService,
+ ) {
+ super(I18n, $state);
}
public get tabs():TabInterface[] {
const disabledTabs = this.locals.disabledTabs || {};
- return this
- ._tabs
+ return super
+ .tabs
.map((el) => {
const reason = disabledTabs[el.id];
if (reason != null) {