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

Revert "Provide different configuration services depending on the module to show/hide the "Gantt" option in the configuration modal of the WP module"

Henriette Dargea429d771a29c
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 077d8c52525..73622309730 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,7 +34,6 @@ 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 { WpTableWithGanttConfigurationService } from 'core-app/features/work-packages/components/wp-table/configuration-modal/wp-table-with-gantt-configuration.service';
export const WpTableConfigurationModalPrependToken = new InjectionToken<ComponentType<any>>('WpTableConfigurationModalPrependComponent');
@@ -67,13 +66,10 @@ export class WpTableConfigurationModalComponent extends OpModalComponent impleme
public tabPortalHost:TabPortalOutlet;
// Try to load an optional provided configuration service, and fall back to the default one
- private wpTableConfigurationService:WpTableConfigurationService = this.injector.get(
- WpTableConfigurationService,
- new WpTableWithGanttConfigurationService(this.I18n),
- );
+ private wpTableConfigurationService:WpTableConfigurationService =
+ this.injector.get(WpTableConfigurationService, new WpTableConfigurationService(this.I18n));
- 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,
@@ -87,8 +83,7 @@ export class WpTableConfigurationModalComponent extends OpModalComponent impleme
readonly wpTableColumns:WorkPackageViewColumnsService,
readonly cdRef:ChangeDetectorRef,
readonly ConfigurationService:ConfigurationService,
- readonly elementRef:ElementRef,
- ) {
+ readonly elementRef:ElementRef) {
super(locals, cdRef, elementRef);
}
diff --git a/frontend/src/app/features/work-packages/components/wp-table/configuration-modal/wp-table-configuration.service.provider.ts b/frontend/src/app/features/work-packages/components/wp-table/configuration-modal/wp-table-configuration.service.provider.ts
deleted file mode 100644
index dc3d9bd5d5f..00000000000
--- a/frontend/src/app/features/work-packages/components/wp-table/configuration-modal/wp-table-configuration.service.provider.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-import { I18nService } from 'core-app/core/i18n/i18n.service';
-import { StateService } from '@uirouter/angular';
-import { WpTableConfigurationService } from 'core-app/features/work-packages/components/wp-table/configuration-modal/wp-table-configuration.service';
-import { WpTableWithGanttConfigurationService } from 'core-app/features/work-packages/components/wp-table/configuration-modal/wp-table-with-gantt-configuration.service';
-
-export const WorkPackageTableConfigurationFactory = (i18n:I18nService, $state:StateService) => {
- // in the WP module we want the default table configuration options
- if ($state.current.name?.includes('work-packages')) {
- return new WpTableConfigurationService(i18n);
- }
-
- // In all others we want the Gantt option as well
- return new WpTableWithGanttConfigurationService(i18n);
-};
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 4c13e52f772..8f8be966f24 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
@@ -5,6 +5,7 @@ import { TabInterface } from 'core-app/features/work-packages/components/wp-tabl
import { WpTableConfigurationColumnsTabComponent } from 'core-app/features/work-packages/components/wp-table/configuration-modal/tabs/columns-tab.component';
import { WpTableConfigurationFiltersTab } from 'core-app/features/work-packages/components/wp-table/configuration-modal/tabs/filters-tab.component';
import { WpTableConfigurationSortByTabComponent } from 'core-app/features/work-packages/components/wp-table/configuration-modal/tabs/sort-by-tab.component';
+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';
@@ -41,6 +42,11 @@ 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) {
diff --git a/frontend/src/app/features/work-packages/components/wp-table/configuration-modal/wp-table-with-gantt-configuration.service.ts b/frontend/src/app/features/work-packages/components/wp-table/configuration-modal/wp-table-with-gantt-configuration.service.ts
deleted file mode 100644
index 8fce694a805..00000000000
--- a/frontend/src/app/features/work-packages/components/wp-table/configuration-modal/wp-table-with-gantt-configuration.service.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { Injectable } from '@angular/core';
-import { TabInterface } from 'core-app/features/work-packages/components/wp-table/configuration-modal/tab-portal-outlet';
-import { WpTableConfigurationTimelinesTabComponent } from 'core-app/features/work-packages/components/wp-table/configuration-modal/tabs/timelines-tab.component';
-import { WpTableConfigurationService } from 'core-app/features/work-packages/components/wp-table/configuration-modal/wp-table-configuration.service';
-
-@Injectable()
-export class WpTableWithGanttConfigurationService extends WpTableConfigurationService {
- protected _tabs:TabInterface[] = super.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 4820bc0c4aa..788576f6da4 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,14 +4,11 @@ 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 { WpTableWithGanttConfigurationService } from 'core-app/features/work-packages/components/wp-table/configuration-modal/wp-table-with-gantt-configuration.service';
@Injectable()
-export class RestrictedWpTableConfigurationService extends WpTableWithGanttConfigurationService {
- constructor(
- @Inject(OpQueryConfigurationLocalsToken) readonly locals:QueryConfigurationLocals,
- readonly I18n:I18nService,
- ) {
+export class RestrictedWpTableConfigurationService extends WpTableConfigurationService {
+ constructor(@Inject(OpQueryConfigurationLocalsToken) readonly locals:QueryConfigurationLocals,
+ readonly I18n:I18nService) {
super(I18n);
}
diff --git a/frontend/src/app/features/work-packages/routing/wp-view-page/wp-view-page.component.ts b/frontend/src/app/features/work-packages/routing/wp-view-page/wp-view-page.component.ts
index 78db9d9aa51..f24f68304d4 100644
--- a/frontend/src/app/features/work-packages/routing/wp-view-page/wp-view-page.component.ts
+++ b/frontend/src/app/features/work-packages/routing/wp-view-page/wp-view-page.component.ts
@@ -45,10 +45,6 @@ import { of } from 'rxjs';
import { WorkPackageFoldToggleButtonComponent } from 'core-app/features/work-packages/components/wp-buttons/wp-fold-toggle-button/wp-fold-toggle-button.component';
import { OpProjectIncludeComponent } from 'core-app/shared/components/project-include/project-include.component';
import { OpBaselineModalComponent } from 'core-app/features/work-packages/components/wp-baseline/baseline-modal/baseline-modal.component';
-import { WorkPackageTableConfigurationFactory } from 'core-app/features/work-packages/components/wp-table/configuration-modal/wp-table-configuration.service.provider';
-import { StateService } from '@uirouter/core';
-import { I18nService } from 'core-app/core/i18n/i18n.service';
-import { WpTableConfigurationService } from 'core-app/features/work-packages/components/wp-table/configuration-modal/wp-table-configuration.service';
@Component({
selector: 'wp-view-page',
@@ -61,7 +57,6 @@ import { WpTableConfigurationService } from 'core-app/features/work-packages/com
providers: [
/** We need to provide the wpNotification service here to get correct save notifications for WP resources */
{ provide: HalResourceNotificationService, useClass: WorkPackageNotificationService },
- { provide: WpTableConfigurationService, useFactory: WorkPackageTableConfigurationFactory, deps: [I18nService, StateService] },
QueryParamListenerService,
],
})