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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Allow plugins to add additional work package tabs (#8999)
Philipp Tessenowf426d3ece3c6
diff --git a/docs/development/concepts/translations/README.md b/docs/development/concepts/translations/README.mdindex 079ea132324..03345ae688b 100644--- a/docs/development/concepts/translations/README.md+++ b/docs/development/concepts/translations/README.md@@ -31,7 +31,7 @@ The OpenProject localizable strings are stored in the [Rails-standard I18n YAMLAdditionally, modules can define their own translations, such as `modules/budgets/config/locales/en.yml`.-The `js-en.yml` are not special on their own, but are simply prefixed with the `js:` key at the beginning of the while. This means all translations within are prefixed with the `js.` key. This is picked up by [`I18n.js`](https://github.com/fnando/i18n-js), a Ruby gem and frontend library that helps outputting javascript objects for the frontend. Only strings that are prefixed with `js.` and some internals will end up in the frontend due to the config we applied in [`config/i18n-js.yml`](https://github.com/opf/openproject/blob/dev/config/i18n-js.yml). The translations are output by the take task `./bin/rails i18n:js:export` and are output to `frontend/src/locales/{language}.js`.+The `js-en.yml` are not special on their own, but are simply prefixed with the `js:` key at the beginning of the file. This means all translations within are prefixed with the `js.` key. This is picked up by [`I18n.js`](https://github.com/fnando/i18n-js), a Ruby gem and frontend library that helps outputting javascript objects for the frontend. Only strings that are prefixed with `js.` and some internals will end up in the frontend due to the config we applied in [`config/i18n-js.yml`](https://github.com/opf/openproject/blob/dev/config/i18n-js.yml). The translations are output by the take task `./bin/rails i18n:js:export` and are output to `frontend/src/locales/{language}.js`.diff --git a/frontend/src/app/components/wp-tabs/components/wp-tab-wrapper/tab.ts b/frontend/src/app/components/wp-tabs/components/wp-tab-wrapper/tab.tsnew file mode 100644index 00000000000..cb2a92b3dd8--- /dev/null+++ b/frontend/src/app/components/wp-tabs/components/wp-tab-wrapper/tab.ts@@ -0,0 +1,15 @@+import {Type, Component} from '@angular/core';++import {WorkPackageBaseResource, WorkPackageResource} from 'core-app/modules/hal/resources/work-package-resource';++export interface TabComponent extends Component {+ workPackage:WorkPackageResource;+}+export class Tab {+ constructor(+ public component:Type<TabComponent>,+ public displayName:string,+ public identifier:string,+ public displayable:(work_package:WorkPackageBaseResource) => boolean+ ) {}+}diff --git a/frontend/src/app/components/wp-tabs/components/wp-tab-wrapper/wp-tab-wrapper.component.ts b/frontend/src/app/components/wp-tabs/components/wp-tab-wrapper/wp-tab-wrapper.component.tsnew file mode 100644index 00000000000..d32986dec71--- /dev/null+++ b/frontend/src/app/components/wp-tabs/components/wp-tab-wrapper/wp-tab-wrapper.component.ts@@ -0,0 +1,78 @@+// -- copyright+// OpenProject is an open source project management software.+// Copyright (C) 2012-2021 the OpenProject GmbH+//+// This program is free software; you can redistribute it and/or+// modify it under the terms of the GNU General Public License version 3.+//+// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+// Copyright (C) 2006-2013 Jean-Philippe Lang+// Copyright (C) 2010-2013 the ChiliProject Team+//+// This program is free software; you can redistribute it and/or+// modify it under the terms of the GNU General Public License+// as published by the Free Software Foundation; either version 2+// of the License, or (at your option) any later version.+//+// This program is distributed in the hope that it will be useful,+// but WITHOUT ANY WARRANTY; without even the implied warranty of+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+// GNU General Public License for more details.+//+// You should have received a copy of the GNU General Public License+// along with this program; if not, write to the Free Software+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+//+// See docs/COPYRIGHT.rdoc for more details.+// ++++import {Transition} from '@uirouter/core';+import {Component, OnInit} from '@angular/core';+import {I18nService} from 'core-app/modules/common/i18n/i18n.service';+import {WorkPackageResource} from 'core-app/modules/hal/resources/work-package-resource';+import {APIV3Service} from 'core-app/modules/apiv3/api-v3.service';+import {Tab} from './tab';+import {WpTabsService} from "core-components/wp-tabs/services/wp-tabs/wp-tabs.service";+import {Observable} from "rxjs";+import {map} from "rxjs/operators";++@Component({+ templateUrl: './wp-tab-wrapper.html',+ selector: 'wp-tab',+})+export class WpTabWrapperComponent implements OnInit {+ workPackage:WorkPackageResource;+ ndcDynamicInputs$:Observable<{+ workPackage:WorkPackageResource;+ tab:Tab | undefined;+ }>;++ get workPackageId() {+ return(this.$transition.params('to').workPackageId);+ }++ constructor(readonly I18n:I18nService,+ readonly $transition:Transition,+ readonly apiV3Service:APIV3Service,+ readonly wpTabsService:WpTabsService) {}++ ngOnInit() {+ this.ndcDynamicInputs$ = this+ .apiV3Service+ .work_packages+ .id(this.workPackageId)+ .requireAndStream()+ .pipe(+ map(wp => ({+ workPackage: wp,+ tab: this.findTab(wp),+ }))+ );+ }++ findTab(workPackage:WorkPackageResource):Tab | undefined {+ const tabIdentifier = this.$transition.params('to').tabIdentifier;++ return this.wpTabsService.getTab(tabIdentifier, workPackage);+ }+}diff --git a/frontend/src/app/components/wp-tabs/components/wp-tab-wrapper/wp-tab-wrapper.html b/frontend/src/app/components/wp-tabs/components/wp-tab-wrapper/wp-tab-wrapper.htmlnew file mode 100644index 00000000000..faf437a3be3--- /dev/null+++ b/frontend/src/app/components/wp-tabs/components/wp-tab-wrapper/wp-tab-wrapper.html@@ -0,0 +1,7 @@+<ng-container *ngIf="(ndcDynamicInputs$ | async) as ndcDynamicInputs">+ <ndc-dynamic+ *ngIf="ndcDynamicInputs.workPackage && ndcDynamicInputs.tab"+ [ndcDynamicComponent]="ndcDynamicInputs?.tab?.component"+ [ndcDynamicInputs]="ndcDynamicInputs">+ </ndc-dynamic>+</ng-container>diff --git a/frontend/src/app/components/wp-tabs/components/wp-tabs/wp-tabs.component.html b/frontend/src/app/components/wp-tabs/components/wp-tabs/wp-tabs.component.htmlnew file mode 100644index 00000000000..76ab629e09b--- /dev/null+++ b/frontend/src/app/components/wp-tabs/components/wp-tabs/wp-tabs.component.html@@ -0,0 +1,5 @@+<li *ngFor="let tab of tabs" [uiSref]="uiSref"+ [uiParams]="{workPackageId: workPackage.id, tabIdentifier: tab.identifier}"+ uiSrefActive="selected">+ <a href="" [textContent]="tab.displayName"></a>+</li>diff --git a/frontend/src/app/components/wp-tabs/components/wp-tabs/wp-tabs.component.scss b/frontend/src/app/components/wp-tabs/components/wp-tabs/wp-tabs.component.scssnew file mode 100644index 00000000000..e69de29bb2ddiff --git a/frontend/src/app/components/wp-tabs/components/wp-tabs/wp-tabs.component.spec.ts b/frontend/src/app/components/wp-tabs/components/wp-tabs/wp-tabs.component.spec.tsnew file mode 100644index 00000000000..a5a30e87380--- /dev/null+++ b/frontend/src/app/components/wp-tabs/components/wp-tabs/wp-tabs.component.spec.ts@@ -0,0 +1,56 @@+import { HttpClientModule } from '@angular/common/http';+import { Injector } from '@angular/core';+import {Input} from '@angular/core';+import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';+import { By } from '@angular/platform-browser';+import { OpenProjectDirectFileUploadService } from 'core-app/components/api/op-file-upload/op-direct-file-upload.service';+import { OpenProjectFileUploadService } from 'core-app/components/api/op-file-upload/op-file-upload.service';+import { States } from 'core-app/components/states.service';++import { WorkPackageResource } from 'core-app/modules/hal/resources/work-package-resource';+import { HalResourceNotificationService } from 'core-app/modules/hal/services/hal-resource-notification.service';+import { HalResourceService } from 'core-app/modules/hal/services/hal-resource.service';+import { HookService } from 'core-app/modules/plugins/hook-service';++import { Tab, TabComponent } from '../wp-tab-wrapper/tab';+import { WpTabsComponent } from './wp-tabs.component';++describe('WpTabsComponent', () => {+ class TestComponent implements TabComponent {+ @Input() public workPackage:WorkPackageResource;+ }++ const displayableTab = new Tab(TestComponent, 'Displayable TestTab', 'displayable-test-tab', (_) => true)+ const notDisplayableTab = new Tab(TestComponent, 'NotDisplayable TestTab', 'not-displayable-test-tab', (_) => false)++ const HookServiceStub = {+ getWorkPackageTabs: () => [displayableTab, notDisplayableTab]+ };++ let component: WpTabsComponent;+ let fixture: ComponentFixture<WpTabsComponent>;++ beforeEach(async () => {+ await TestBed.configureTestingModule({+ declarations: [ WpTabsComponent ],+ providers: [+ { provide: HookService, useValue: HookServiceStub }+ ]+ })+ .compileComponents();+ });++ beforeEach(() => {+ fixture = TestBed.createComponent(WpTabsComponent);+ component = fixture.componentInstance;+ component.workPackage = {} as WorkPackageResource;+ fixture.detectChanges();+ });++ it('displays the visible tab', waitForAsync(() => {+ fixture.whenStable().then(() => {+ const tabLink:HTMLElement = fixture.debugElement.query(By.css('li a')).nativeElement;+ expect(tabLink.innerText).toContain('Displayable TestTab');+ });+ }));+});diff --git a/frontend/src/app/components/wp-tabs/components/wp-tabs/wp-tabs.component.ts b/frontend/src/app/components/wp-tabs/components/wp-tabs/wp-tabs.component.tsnew file mode 100644index 00000000000..326c719965c--- /dev/null+++ b/frontend/src/app/components/wp-tabs/components/wp-tabs/wp-tabs.component.ts@@ -0,0 +1,28 @@+import {Component, Input} from '@angular/core';+import {WorkPackageResource} from "core-app/modules/hal/resources/work-package-resource";+import {WpTabsService} from "core-components/wp-tabs/services/wp-tabs/wp-tabs.service";+import {Tab} from "core-app/components/wp-tabs/components/wp-tab-wrapper/tab";++@Component({+ selector: 'op-wp-tabs',+ templateUrl: './wp-tabs.component.html',+ styleUrls: ['./wp-tabs.component.scss']+})+export class WpTabsComponent {+ @Input()+ workPackage:WorkPackageResource;+ @Input()+ set view(uiSref:'full' | 'split') {+ this.uiSref = uiSref === 'split' ? '.tabs' : 'work-packages.show.tabs';+ }++ get tabs():Tab[] {+ return this.wpTabsService.getDisplayableTabs(this.workPackage);+ }++ uiSref:string;++ constructor(+ readonly wpTabsService:WpTabsService,+ ) { }+}diff --git a/frontend/src/app/components/wp-tabs/services/wp-tabs/wp-tabs.service.spec.ts b/frontend/src/app/components/wp-tabs/services/wp-tabs/wp-tabs.service.spec.tsnew file mode 100644index 00000000000..e4a8e713010--- /dev/null+++ b/frontend/src/app/components/wp-tabs/services/wp-tabs/wp-tabs.service.spec.ts@@ -0,0 +1,73 @@+import { HttpClientModule } from '@angular/common/http';+import { Injector } from '@angular/core';+import { Input } from '@angular/core';+import { TestBed } from '@angular/core/testing';+import { OpenProjectDirectFileUploadService } from 'core-app/components/api/op-file-upload/op-direct-file-upload.service';+import { OpenProjectFileUploadService } from 'core-app/components/api/op-file-upload/op-file-upload.service';+import { States } from 'core-app/components/states.service';+import { WorkPackageResource } from 'core-app/modules/hal/resources/work-package-resource';+import { HalResourceNotificationService } from 'core-app/modules/hal/services/hal-resource-notification.service';+import { HalResourceService } from 'core-app/modules/hal/services/hal-resource.service';+import { HookService } from 'core-app/modules/plugins/hook-service';+import { Tab, TabComponent } from '../../components/wp-tab-wrapper/tab';++import { WpTabsService } from './wp-tabs.service';++describe('WpTabsService', () => {+ let service: WpTabsService;+ let workPackage:WorkPackageResource;+ let injector:Injector;+ let halResourceService:HalResourceService;++ let source = {+ _type: 'WorkPackage',+ id: '1234',+ _links: {}+ };++ class TestComponent implements TabComponent {+ @Input() public workPackage:WorkPackageResource;+ }++ const displayableTab = new Tab(TestComponent, 'Displayable TestTab', 'displayable-test-tab', (_) => true)+ const nonDisplayableTab = new Tab(TestComponent, 'NotDisplayable TestTab', 'non-displayable-test-tab', (_) => false)++ const HookServiceStub = {+ getWorkPackageTabs: () => [displayableTab, nonDisplayableTab]+ };++ beforeEach(() => {+ TestBed.configureTestingModule({+ imports: [+ HttpClientModule+ ],+ providers: [+ { provide: HookService, useValue: HookServiceStub },+ OpenProjectFileUploadService,+ OpenProjectDirectFileUploadService,+ HalResourceService,+ HalResourceNotificationService,+ States+ ]+ });+ service = TestBed.inject(WpTabsService);++ injector = TestBed.inject(Injector);+ halResourceService = injector.get(HalResourceService);+ workPackage = halResourceService.createHalResourceOfClass(WorkPackageResource, source, true);+ });++ describe('displayableTabs()', () =>{+ it('returns just the displayable tab', () => {+ expect(service.getDisplayableTabs(workPackage)).toEqual([displayableTab]);+ });+ });++ describe('getTab()', () =>{+ it('returns the displayable tab whith the correct identifier', () => {+ expect(service.getTab('displayable-test-tab', workPackage)).toEqual(displayableTab);+ expect(service.getTab('non-existing-tab', workPackage)).toEqual(undefined);+ expect(service.getTab('non-displayable-test-tab', workPackage)).toEqual(undefined);+ });+ });+});diff --git a/frontend/src/app/components/wp-tabs/services/wp-tabs/wp-tabs.service.ts b/frontend/src/app/components/wp-tabs/services/wp-tabs/wp-tabs.service.tsnew file mode 100644index 00000000000..1e56252cfc7--- /dev/null+++ b/frontend/src/app/components/wp-tabs/services/wp-tabs/wp-tabs.service.ts@@ -0,0 +1,25 @@+import { Injectable } from '@angular/core';+import {HookService} from "core-app/modules/plugins/hook-service";+import {WorkPackageResource} from "core-app/modules/hal/resources/work-package-resource";+import {Tab} from "core-components/wp-tabs/components/wp-tab-wrapper/tab";++@Injectable({+ providedIn: 'root'+})+export class WpTabsService {+ get tabs() {+ return this.hookService.getWorkPackageTabs();+ }++ constructor(+ private hookService:HookService,+ ) { }++ getDisplayableTabs(workPackage:WorkPackageResource):Tab[] {+ return this.tabs.filter(tab => tab.displayable(workPackage));+ }++ getTab(tabId:string, workPackage:WorkPackageResource):Tab | undefined {+ return this.getDisplayableTabs(workPackage).find(({identifier:id}) => id === tabId);+ }+}diff --git a/frontend/src/app/components/wp-tabs/wp-tabs.module.ts b/frontend/src/app/components/wp-tabs/wp-tabs.module.tsnew file mode 100644index 00000000000..977f5c7f725--- /dev/null+++ b/frontend/src/app/components/wp-tabs/wp-tabs.module.ts@@ -0,0 +1,23 @@+import { NgModule } from '@angular/core';+import { CommonModule } from '@angular/common';+import { WpTabsComponent } from './components/wp-tabs/wp-tabs.component';+import {UIRouterModule} from "@uirouter/angular";+import {WpTabWrapperComponent} from "core-components/wp-tabs/components/wp-tab-wrapper/wp-tab-wrapper.component";+import {DynamicModule} from "ng-dynamic-component";++@NgModule({+ declarations: [+ WpTabsComponent,+ WpTabWrapperComponent,+ ],+ imports: [+ CommonModule,+ UIRouterModule,+ DynamicModule,+ ],+ exports: [+ WpTabsComponent,+ WpTabWrapperComponent,+ ]+})+export class OpWpTabsModule { }diff --git a/frontend/src/app/modules/hal/resources/work-package-resource.spec.ts b/frontend/src/app/modules/hal/resources/work-package-resource.spec.tsindex 6cb0e23d17b..b39da7c62c4 100644--- a/frontend/src/app/modules/hal/resources/work-package-resource.spec.ts+++ b/frontend/src/app/modules/hal/resources/work-package-resource.spec.ts@@ -153,7 +153,6 @@ describe('WorkPackage', () => {describe('when using removeAttachment', () => {let file:any;let attachment:any;- let result:any;beforeEach(() => {file = {};@@ -214,5 +213,4 @@ describe('WorkPackage', () => {});});});-});diff --git a/frontend/src/app/modules/hal/resources/work-package-resource.ts b/frontend/src/app/modules/hal/resources/work-package-resource.tsindex 23492d0c852..1ca8408e5af 100644--- a/frontend/src/app/modules/hal/resources/work-package-resource.ts+++ b/frontend/src/app/modules/hal/resources/work-package-resource.ts@@ -32,10 +32,7 @@ import { AttachmentCollectionResource } from 'core-app/modules/hal/resources/attimport { CollectionResource } from 'core-app/modules/hal/resources/collection-resource';import { TypeResource } from 'core-app/modules/hal/resources/type-resource';import { RelationResource } from 'core-app/modules/hal/resources/relation-resource';-import {- OpenProjectFileUploadService,- UploadFile-} from 'core-components/api/op-file-upload/op-file-upload.service';+import { OpenProjectFileUploadService } from 'core-components/api/op-file-upload/op-file-upload.service';import { States } from 'core-components/states.service';import { PathHelperService } from 'core-app/modules/common/path-helper/path-helper.service';import { NotificationsService } from 'core-app/modules/common/notifications/notifications.service';diff --git a/frontend/src/app/modules/plugins/hook-service.spec.ts b/frontend/src/app/modules/plugins/hook-service.spec.tsindex ea474062d3f..725873741f9 100644--- a/frontend/src/app/modules/plugins/hook-service.spec.ts+++ b/frontend/src/app/modules/plugins/hook-service.spec.ts@@ -28,7 +28,10 @@/*jshint expr: true*/-import { HookService } from "core-app/modules/plugins/hook-service";+import { Component, ChangeDetectionStrategy } from '@angular/core';+import { HookService } from 'core-app/modules/plugins/hook-service';+import { WorkPackageResource } from 'core-app/modules/hal/resources/work-package-resource';+import { Tab, TabComponent } from 'core-app/components/wp-tabs/components/wp-tab-wrapper/tab';describe('HookService', function() {let service:HookService = new HookService();@@ -156,4 +159,32 @@ describe('HookService', function() {shouldBehaveLikeResultWithElements(validId, 2);});});++ describe('registerWorkPackageTab/getWorkPackageTabs', function() {+ @Component({+ selector: 'my-tab-component',+ template: '',+ changeDetection: ChangeDetectionStrategy.OnPush,+ })+ class MyTestTabComponent implements TabComponent {+ workPackage: WorkPackageResource;+ }++ const tab1 = new Tab(MyTestTabComponent, 'GitHub', 'github', () => true);+ const tab2 = new Tab(MyTestTabComponent, 'GitLab', 'gitlab', () => true);+ const tab3 = new Tab(MyTestTabComponent, 'Bitbucket', 'bitbucket', () => true);++ it('returns all registered tabs', function() {+ expect(service.getWorkPackageTabs()).toEqual([]);++ service.registerWorkPackageTab(tab1);+ expect(service.getWorkPackageTabs()).toEqual([tab1]);++ service.registerWorkPackageTab(tab2);+ expect(service.getWorkPackageTabs()).toEqual([tab1, tab2]);++ service.registerWorkPackageTab(tab3);+ expect(service.getWorkPackageTabs()).toEqual([tab1, tab2, tab3]);+ });+ });});diff --git a/frontend/src/app/modules/plugins/hook-service.ts b/frontend/src/app/modules/plugins/hook-service.tsindex 195855872de..48e2e7751a3 100644--- a/frontend/src/app/modules/plugins/hook-service.ts+++ b/frontend/src/app/modules/plugins/hook-service.ts@@ -26,9 +26,12 @@// See docs/COPYRIGHT.rdoc for more details.//++-import { Injectable } from "@angular/core";+import { Injectable } from '@angular/core';+import { Tab } from 'core-app/components/wp-tabs/components/wp-tab-wrapper/tab';-@Injectable()+@Injectable({+ providedIn: 'root'+})export class HookService {private hooks:{[hook:string]:Function[]} = {};@@ -59,4 +62,12 @@ export class HookService {return results;}++ public registerWorkPackageTab(tab:Tab) {+ this.register('workPackageTabs', () => tab);+ }++ public getWorkPackageTabs():Tab[] {+ return(this.call('workPackageTabs'));+ }}diff --git a/frontend/src/app/modules/work_packages/openproject-work-packages.module.ts b/frontend/src/app/modules/work_packages/openproject-work-packages.module.tsindex 14411237340..aacea8aaf7f 100644--- a/frontend/src/app/modules/work_packages/openproject-work-packages.module.ts+++ b/frontend/src/app/modules/work_packages/openproject-work-packages.module.ts@@ -30,11 +30,11 @@ import { Injector, NgModule } from '@angular/core';import { OpenprojectCommonModule } from 'core-app/modules/common/openproject-common.module';import { OpenprojectFieldsModule } from 'core-app/modules/fields/openproject-fields.module';import { OpenprojectModalModule } from 'core-app/modules/modal/modal.module';-import { HookService } from 'core-app/modules/plugins/hook-service';import {GroupDescriptor,WorkPackageSingleViewComponent} from 'core-components/work-packages/wp-single-view/wp-single-view.component';+import { HookService } from 'core-app/modules/plugins/hook-service';import { WorkPackageFormAttributeGroupComponent } from 'core-components/wp-form-group/wp-attribute-group.component';import { WorkPackageEmbeddedTableComponent } from 'core-components/wp-table/embedded/wp-embedded-table.component';import { WorkPackageEmbeddedTableEntryComponent } from 'core-components/wp-table/embedded/wp-embedded-table-entry.component';@@ -170,6 +170,7 @@ import { DatePickerModal } from "core-components/datepicker/datepicker.modal";import { WorkPackagesTableComponent } from "core-components/wp-table/wp-table.component";import { WorkPackageGroupToggleDropdownMenuDirective } from "core-components/op-context-menu/handlers/wp-group-toggle-dropdown-menu.directive";import { OpenprojectAutocompleterModule } from "core-app/modules/autocompleter/openproject-autocompleter.module";+import { OpWpTabsModule } from "core-components/wp-tabs/wp-tabs.module";@NgModule({imports: [@@ -189,6 +190,8 @@ import { OpenprojectAutocompleterModule } from "core-app/modules/autocompleter/oOpenprojectModalModule,OpenprojectAutocompleterModule,++ OpWpTabsModule,],providers: [// Notification service@@ -326,7 +329,7 @@ import { OpenprojectAutocompleterModule } from "core-app/modules/autocompleter/oActivityLinkComponent,WorkPackageActivityTabComponent,- // Watchers tab+ // Watchers wp-tab-wrapperWorkPackageWatchersTabComponent,WorkPackageWatcherEntryComponent,diff --git a/frontend/src/app/modules/work_packages/routing/split-view-routes.template.ts b/frontend/src/app/modules/work_packages/routing/split-view-routes.template.tsindex ae4d2d6eaff..5deb565326d 100644--- a/frontend/src/app/modules/work_packages/routing/split-view-routes.template.ts+++ b/frontend/src/app/modules/work_packages/routing/split-view-routes.template.ts@@ -31,9 +31,10 @@ import { WorkPackageActivityTabComponent } from 'core-components/wp-single-view-import { WorkPackageRelationsTabComponent } from 'core-components/wp-single-view-tabs/relations-tab/relations-tab.component';import { WorkPackageWatchersTabComponent } from 'core-components/wp-single-view-tabs/watchers-tab/watchers-tab.component';import { WorkPackageNewSplitViewComponent } from 'core-components/wp-new/wp-new-split-view.component';-import { Ng2StateDeclaration } from "@uirouter/angular";-import { ComponentType } from "@angular/cdk/overlay";-import { WorkPackageCopySplitViewComponent } from "core-components/wp-copy/wp-copy-split-view.component";+import { Ng2StateDeclaration } from '@uirouter/angular';+import { ComponentType } from '@angular/cdk/overlay';+import { WorkPackageCopySplitViewComponent } from 'core-components/wp-copy/wp-copy-split-view.component';+import { WpTabWrapperComponent } from 'core-components/wp-tabs/components/wp-tab-wrapper/wp-tab-wrapper.component';/*** Return a set of routes for a split view mounted under the given base route,@@ -124,6 +125,16 @@ export function makeSplitViewRoutes(baseRoute:string,parent: routeName + '.details'}},+ {+ name: routeName + '.details.tabs',+ url: '/tabs/:tabIdentifier',+ component: WpTabWrapperComponent,+ data: {+ baseRoute: baseRoute,+ menuItem: menuItemClass,+ parent: routeName + '.details'+ }+ },// Split create route{name: routeName + '.new',diff --git a/frontend/src/app/modules/work_packages/routing/work-packages-routes.ts b/frontend/src/app/modules/work_packages/routing/work-packages-routes.tsindex 878f32a435a..30e3f9c5794 100644--- a/frontend/src/app/modules/work_packages/routing/work-packages-routes.ts+++ b/frontend/src/app/modules/work_packages/routing/work-packages-routes.ts@@ -28,16 +28,17 @@import { WorkPackageActivityTabComponent } from 'core-components/wp-single-view-tabs/activity-panel/activity-tab.component';import { WorkPackageRelationsTabComponent } from 'core-components/wp-single-view-tabs/relations-tab/relations-tab.component';+import { WpTabWrapperComponent } from 'core-components/wp-tabs/components/wp-tab-wrapper/wp-tab-wrapper.component';import { WorkPackageWatchersTabComponent } from 'core-components/wp-single-view-tabs/watchers-tab/watchers-tab.component';import { WorkPackageNewFullViewComponent } from 'core-components/wp-new/wp-new-full-view.component';import { WorkPackageCopyFullViewComponent } from 'core-components/wp-copy/wp-copy-full-view.component';-import { WorkPackagesFullViewComponent } from "core-app/modules/work_packages/routing/wp-full-view/wp-full-view.component";-import { WorkPackageSplitViewComponent } from "core-app/modules/work_packages/routing/wp-split-view/wp-split-view.component";-import { Ng2StateDeclaration } from "@uirouter/angular";-import { WorkPackagesBaseComponent } from "core-app/modules/work_packages/routing/wp-base/wp--base.component";-import { WorkPackageListViewComponent } from "core-app/modules/work_packages/routing/wp-list-view/wp-list-view.component";-import { WorkPackageViewPageComponent } from "core-app/modules/work_packages/routing/wp-view-page/wp-view-page.component";-import { makeSplitViewRoutes } from "core-app/modules/work_packages/routing/split-view-routes.template";+import { WorkPackagesFullViewComponent } from 'core-app/modules/work_packages/routing/wp-full-view/wp-full-view.component';+import { WorkPackageSplitViewComponent } from 'core-app/modules/work_packages/routing/wp-split-view/wp-split-view.component';+import { Ng2StateDeclaration } from '@uirouter/angular';+import { WorkPackagesBaseComponent } from 'core-app/modules/work_packages/routing/wp-base/wp--base.component';+import { WorkPackageListViewComponent } from 'core-app/modules/work_packages/routing/wp-list-view/wp-list-view.component';+import { WorkPackageViewPageComponent } from 'core-app/modules/work_packages/routing/wp-view-page/wp-view-page.component';+import { makeSplitViewRoutes } from 'core-app/modules/work_packages/routing/split-view-routes.template';export const menuItemClass = 'work-packages-menu-item';@@ -133,6 +134,15 @@ export const WORK_PACKAGES_ROUTES:Ng2StateDeclaration[] = [menuItem: menuItemClass}},+ {+ name: 'work-packages.show.tabs',+ url: '/tabs/:tabIdentifier',+ component: WpTabWrapperComponent,+ data: {+ parent: 'work-packages.show',+ menuItem: menuItemClass,+ }+ },{name: 'work-packages.partitioned',component: WorkPackageViewPageComponent,diff --git a/frontend/src/app/modules/work_packages/routing/wp-full-view/wp-full-view.html b/frontend/src/app/modules/work_packages/routing/wp-full-view/wp-full-view.htmlindex f54647594c9..2488ae19526 100644--- a/frontend/src/app/modules/work_packages/routing/wp-full-view/wp-full-view.html+++ b/frontend/src/app/modules/work_packages/routing/wp-full-view/wp-full-view.html@@ -74,6 +74,8 @@<a href="" [textContent]="text.tabs.watchers"></a><wp-watchers-count [wpId]="workPackage.id"></wp-watchers-count></li>++ <op-wp-tabs [workPackage]="workPackage" view="full"></op-wp-tabs></ul></div><div class="tabcontent" ui-view>diff --git a/frontend/src/app/modules/work_packages/routing/wp-split-view/wp-split-view.html b/frontend/src/app/modules/work_packages/routing/wp-split-view/wp-split-view.htmlindex 58b88782cdd..0d7b04ec792 100644--- a/frontend/src/app/modules/work_packages/routing/wp-split-view/wp-split-view.html+++ b/frontend/src/app/modules/work_packages/routing/wp-split-view/wp-split-view.html@@ -24,6 +24,9 @@<a href="" [textContent]="text.tabs.watchers"></a><wp-watchers-count [wpId]="workPackage.id"></wp-watchers-count></li>++ <op-wp-tabs [workPackage]="workPackage" view="split"></op-wp-tabs>+<li class="tab-icon"><accessible-by-keyboard (execute)="switchToFullscreen()"[linkAriaLabel]="text.goTofullScreen"diff --git a/frontend/src/app/modules/work_packages/routing/wp-view-base/work-package-single-view.base.ts b/frontend/src/app/modules/work_packages/routing/wp-view-base/work-package-single-view.base.tsindex 71176d19ef2..6eb6a7a40b5 100644--- a/frontend/src/app/modules/work_packages/routing/wp-view-base/work-package-single-view.base.ts+++ b/frontend/src/app/modules/work_packages/routing/wp-view-base/work-package-single-view.base.ts@@ -32,16 +32,17 @@ import { PathHelperService } from 'core-app/modules/common/path-helper/path-helpimport { WorkPackageViewFocusService } from 'core-app/modules/work_packages/routing/wp-view-base/view-services/wp-view-focus.service';import { WorkPackageResource } from 'core-app/modules/hal/resources/work-package-resource';import { OpTitleService } from 'core-components/html/op-title.service';-import { AuthorisationService } from "core-app/modules/common/model-auth/model-auth.service";-import { States } from "core-components/states.service";-import { KeepTabService } from "core-components/wp-single-view-tabs/keep-tab/keep-tab.service";--import { HalResourceEditingService } from "core-app/modules/fields/edit/services/hal-resource-editing.service";-import { WorkPackageNotificationService } from "core-app/modules/work_packages/notifications/work-package-notification.service";-import { InjectField } from "core-app/helpers/angular/inject-field.decorator";-import { UntilDestroyedMixin } from "core-app/helpers/angular/until-destroyed.mixin";-import { APIV3Service } from "core-app/modules/apiv3/api-v3.service";-import { catchError, subscribeOn } from "rxjs/operators";+import { AuthorisationService } from 'core-app/modules/common/model-auth/model-auth.service';+import { States } from 'core-components/states.service';+import { KeepTabService } from 'core-components/wp-single-view-tabs/keep-tab/keep-tab.service';++import { HalResourceEditingService } from 'core-app/modules/fields/edit/services/hal-resource-editing.service';+import { WorkPackageNotificationService } from 'core-app/modules/work_packages/notifications/work-package-notification.service';+import { InjectField } from 'core-app/helpers/angular/inject-field.decorator';+import { UntilDestroyedMixin } from 'core-app/helpers/angular/until-destroyed.mixin';+import { APIV3Service } from 'core-app/modules/apiv3/api-v3.service';+import { Tab } from 'core-app/components/wp-tabs/components/wp-tab-wrapper/tab';+import { HookService } from 'core-app/modules/plugins/hook-service';export class WorkPackageSingleViewBase extends UntilDestroyedMixin {@@ -56,6 +57,7 @@ export class WorkPackageSingleViewBase extends UntilDestroyedMixin {@InjectField() cdRef:ChangeDetectorRef;@InjectField() readonly titleService:OpTitleService;@InjectField() readonly apiV3Service:APIV3Service;+ @InjectField() readonly hooks:HookService;// Static textspublic text:any = {};@@ -67,7 +69,8 @@ export class WorkPackageSingleViewBase extends UntilDestroyedMixin {public focusAnchorLabel:string;public showStaticPagePath:string;- constructor(public injector:Injector, protected workPackageId:string) {+ constructor(public injector:Injector,+ protected workPackageId:string) {super();this.initializeTexts();}@@ -139,6 +142,13 @@ export class WorkPackageSingleViewBase extends UntilDestroyedMixin {});}+ public tabs():Tab[] {+ return _.filter(+ this.hooks.getWorkPackageTabs(),+ (tab) => tab.displayable(this.workPackage)+ );+ }+/*** Recompute the current tab focus label*/