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

Basic split view on content_body_right

Oliver Günther5f9c338a641d
diff --git a/app/views/notifications/index.html.erb b/app/views/notifications/index.html.erb
index 0ac45abbc7e..af811c9cb70 100644
--- a/app/views/notifications/index.html.erb
+++ b/app/views/notifications/index.html.erb
@@ -1,4 +1,6 @@
<% html_title t("js.notifications.title") %>
+
+<% content_for :content_body do %>
<%= render(Notifications::IndexPageHeaderComponent.new(
facet: params[:facet],
filter_name: params[:name],
@@ -6,3 +8,16 @@
)) %>
<%= angular_component_tag "opce-notification-center" %>
+
+<% end %>
+
+<% if params[:work_package_id] %>
+ <% content_for :content_body_right do %>
+ <%= angular_component_tag "opce-wp-split-view",
+ inputs: {
+ work_package_id: params[:work_package_id],
+ activeTab: "overview"
+ }
+ %>
+ <% end %>
+<% end %>
diff --git a/config/routes.rb b/config/routes.rb
index efa4c5ae5bd..113c7a64801 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -700,7 +700,7 @@ Rails.application.routes.draw do
root to: "account#login"
concern :with_split_view do |options|
- get "details/:id(/:tab)", on: :collection, action: options.fetch(:action, :index), as: :details
+ get "details/:work_package_id(/:tab)", on: :collection, action: options.fetch(:action, :index), as: :details
end
resources :notifications, only: :index do
diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.ts
index 50466133184..b80abff7fb7 100644
--- a/frontend/src/app/app.module.ts
+++ b/frontend/src/app/app.module.ts
@@ -168,6 +168,9 @@ import { OpAttachmentsComponent } from 'core-app/shared/components/attachments/a
import {
InAppNotificationCenterComponent,
} from 'core-app/features/in-app-notifications/center/in-app-notification-center.component';
+import {
+ WorkPackageSplitViewEntryComponent,
+} from 'core-app/features/work-packages/routing/wp-split-view/wp-split-view-entry.component';
export function initializeServices(injector:Injector) {
return () => {
@@ -366,5 +369,6 @@ export class OpenProjectModule {
registerCustomElement('opce-notification-settings', NotificationsSettingsPageComponent, { injector });
registerCustomElement('opce-reminder-settings', ReminderSettingsPageComponent, { injector });
registerCustomElement('opce-notification-center', InAppNotificationCenterComponent, { injector });
+ registerCustomElement('opce-wp-split-view', WorkPackageSplitViewEntryComponent, { injector });
}
}
diff --git a/frontend/src/app/core/url-params/url-params.service.ts b/frontend/src/app/core/url-params/url-params.service.ts
index 22123db3569..b7edc01b5d5 100644
--- a/frontend/src/app/core/url-params/url-params.service.ts
+++ b/frontend/src/app/core/url-params/url-params.service.ts
@@ -35,7 +35,7 @@ export class UrlParamsService {
}
public pathMatching(key:RegExp):string|null {
- return window.location.pathname.match(key)?.[0] || null;
+ return window.location.pathname.match(key)?.[1] || null;
}
public has(key:string):boolean {
diff --git a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/overview-tab/overview-tab.component.ts b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/overview-tab/overview-tab.component.ts
index bee70853aab..949544c9723 100644
--- a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/overview-tab/overview-tab.component.ts
+++ b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/overview-tab/overview-tab.component.ts
@@ -26,10 +26,7 @@
// See COPYRIGHT and LICENSE files for more details.
//++
-import {
- Component,
- Input,
-} from '@angular/core';
+import { Component, Input, OnInit } from '@angular/core';
import { StateService } from '@uirouter/core';
import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';
import { I18nService } from 'core-app/core/i18n/i18n.service';
@@ -40,7 +37,7 @@ import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';
templateUrl: './overview-tab.html',
selector: 'wp-overview-tab',
})
-export class WorkPackageOverviewTabComponent extends UntilDestroyedMixin {
+export class WorkPackageOverviewTabComponent extends UntilDestroyedMixin implements OnInit {
@Input() public workPackage:WorkPackageResource;
public workPackageId:string;
@@ -52,7 +49,10 @@ export class WorkPackageOverviewTabComponent extends UntilDestroyedMixin {
readonly apiV3Service:ApiV3Service) {
super();
- this.workPackageId = this.$state.params.workPackageId;
+ }
+
+ ngOnInit() {
+ this.workPackageId = this.workPackage?.id || this.$state.params.workPackageId;
this
.apiV3Service
diff --git a/frontend/src/app/features/work-packages/components/wp-tabs/components/wp-tabs/wp-tabs.component.ts b/frontend/src/app/features/work-packages/components/wp-tabs/components/wp-tabs/wp-tabs.component.ts
index f51894c83ab..db120580f73 100644
--- a/frontend/src/app/features/work-packages/components/wp-tabs/components/wp-tabs/wp-tabs.component.ts
+++ b/frontend/src/app/features/work-packages/components/wp-tabs/components/wp-tabs/wp-tabs.component.ts
@@ -1,12 +1,15 @@
+import { ChangeDetectionStrategy, Component, Injector, Input, OnInit } from '@angular/core';
import {
- ChangeDetectionStrategy, Component, Injector, Input, OnInit,
-} from '@angular/core';
-import { KeepTabService } from 'core-app/features/work-packages/components/wp-single-view-tabs/keep-tab/keep-tab.service';
+ KeepTabService,
+} from 'core-app/features/work-packages/components/wp-single-view-tabs/keep-tab/keep-tab.service';
import { StateService, UIRouterGlobals } from '@uirouter/core';
import { I18nService } from 'core-app/core/i18n/i18n.service';
import { TabDefinition } from 'core-app/shared/components/tabs/tab.interface';
-import { WorkPackageTabsService } from 'core-app/features/work-packages/components/wp-tabs/services/wp-tabs/wp-tabs.service';
+import {
+ WorkPackageTabsService,
+} from 'core-app/features/work-packages/components/wp-tabs/services/wp-tabs/wp-tabs.service';
import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';
+import { PathHelperService } from 'core-app/core/path-helper/path-helper.service';
@Component({
selector: 'op-wp-tabs',
@@ -39,6 +42,7 @@ export class WpTabsComponent implements OnInit {
readonly $state:StateService,
readonly uiRouterGlobals:UIRouterGlobals,
readonly keepTab:KeepTabService,
+ readonly pathHelper:PathHelperService,
) {
}
@@ -54,8 +58,7 @@ export class WpTabsComponent implements OnInit {
.getDisplayableTabs(this.workPackage)
.map((tab) => ({
...tab,
- route: `${this.uiSrefBase}.tabs`,
- routeParams: { workPackageId: this.workPackage.id, tabIdentifier: tab.id },
+ path: this.pathHelper.workPackageDetailsPath(this.workPackage.id as string, tab.id),
}));
}
diff --git a/frontend/src/app/features/work-packages/openproject-work-packages.module.ts b/frontend/src/app/features/work-packages/openproject-work-packages.module.ts
index 433283cc79d..060882006ac 100644
--- a/frontend/src/app/features/work-packages/openproject-work-packages.module.ts
+++ b/frontend/src/app/features/work-packages/openproject-work-packages.module.ts
@@ -414,6 +414,9 @@ import {
import {
WorkPackageShareModalComponent,
} from 'core-app/features/work-packages/components/wp-share-modal/wp-share.modal';
+import {
+ WorkPackageSplitViewEntryComponent,
+} from 'core-app/features/work-packages/routing/wp-split-view/wp-split-view-entry.component';
@NgModule({
imports: [
@@ -606,6 +609,7 @@ import {
// Split view
WorkPackageDetailsViewButtonComponent,
WorkPackageSplitViewComponent,
+ WorkPackageSplitViewEntryComponent,
WorkPackageBreadcrumbComponent,
WorkPackageSplitViewToolbarComponent,
WorkPackageWatcherButtonComponent,
diff --git a/frontend/src/app/features/work-packages/routing/wp-split-view/wp-split-view-entry.component.ts b/frontend/src/app/features/work-packages/routing/wp-split-view/wp-split-view-entry.component.ts
new file mode 100644
index 00000000000..c9437642f64
--- /dev/null
+++ b/frontend/src/app/features/work-packages/routing/wp-split-view/wp-split-view-entry.component.ts
@@ -0,0 +1,56 @@
+// -- copyright
+// OpenProject is an open source project management software.
+// Copyright (C) 2012-2024 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 COPYRIGHT and LICENSE files for more details.
+//++
+
+import { Component, ElementRef, Input } from '@angular/core';
+import {
+ WorkPackageIsolatedQuerySpaceDirective,
+} from 'core-app/features/work-packages/directives/query-space/wp-isolated-query-space.directive';
+import { populateInputsFromDataset } from 'core-app/shared/components/dataset-inputs';
+
+
+/**
+ * An entry component to be rendered by Rails which opens an isolated query space
+ * for the work package split view
+ */
+@Component({
+ hostDirectives: [WorkPackageIsolatedQuerySpaceDirective],
+ template: `
+ <op-wp-split-view
+ [workPackageId]="workPackageId"
+ [activeTab]="activeTab"
+ ></op-wp-split-view>
+ `,
+})
+export class WorkPackageSplitViewEntryComponent {
+ @Input() workPackageId:string;
+ @Input() activeTab:string;
+
+ constructor(readonly elementRef:ElementRef) {
+ populateInputsFromDataset(this);
+ }
+}
diff --git a/frontend/src/app/features/work-packages/routing/wp-split-view/wp-split-view.component.ts b/frontend/src/app/features/work-packages/routing/wp-split-view/wp-split-view.component.ts
index 35afb9789f9..004ad39f48c 100644
--- a/frontend/src/app/features/work-packages/routing/wp-split-view/wp-split-view.component.ts
+++ b/frontend/src/app/features/work-packages/routing/wp-split-view/wp-split-view.component.ts
@@ -26,25 +26,31 @@
// See COPYRIGHT and LICENSE files for more details.
//++
-import {
- ChangeDetectionStrategy,
- Component,
- Injector,
- OnInit,
-} from '@angular/core';
+import { ChangeDetectionStrategy, Component, Injector, Input, OnInit } from '@angular/core';
import { StateService } from '@uirouter/core';
-import { WorkPackageViewFocusService } from 'core-app/features/work-packages/routing/wp-view-base/view-services/wp-view-focus.service';
+import {
+ WorkPackageViewFocusService,
+} from 'core-app/features/work-packages/routing/wp-view-base/view-services/wp-view-focus.service';
import { States } from 'core-app/core/states/states.service';
import { FirstRouteService } from 'core-app/core/routing/first-route-service';
-import { KeepTabService } from 'core-app/features/work-packages/components/wp-single-view-tabs/keep-tab/keep-tab.service';
-import { WorkPackageViewSelectionService } from 'core-app/features/work-packages/routing/wp-view-base/view-services/wp-view-selection.service';
-import { WorkPackageSingleViewBase } from 'core-app/features/work-packages/routing/wp-view-base/work-package-single-view.base';
+import {
+ KeepTabService,
+} from 'core-app/features/work-packages/components/wp-single-view-tabs/keep-tab/keep-tab.service';
+import {
+ WorkPackageViewSelectionService,
+} from 'core-app/features/work-packages/routing/wp-view-base/view-services/wp-view-selection.service';
+import {
+ WorkPackageSingleViewBase,
+} from 'core-app/features/work-packages/routing/wp-view-base/work-package-single-view.base';
import { HalResourceNotificationService } from 'core-app/features/hal/services/hal-resource-notification.service';
-import { WorkPackageNotificationService } from 'core-app/features/work-packages/services/notifications/work-package-notification.service';
+import {
+ WorkPackageNotificationService,
+} from 'core-app/features/work-packages/services/notifications/work-package-notification.service';
import { BackRoutingService } from 'core-app/features/work-packages/components/back-routing/back-routing.service';
import { WpSingleViewService } from 'core-app/features/work-packages/routing/wp-view-base/state/wp-single-view.service';
import { CommentService } from 'core-app/features/work-packages/components/wp-activity/comment-service';
import { RecentItemsService } from 'core-app/core/recent-items.service';
+import { UrlParamsService } from 'core-app/core/url-params/url-params.service';
@Component({
templateUrl: './wp-split-view.html',
@@ -57,8 +63,12 @@ import { RecentItemsService } from 'core-app/core/recent-items.service';
],
})
export class WorkPackageSplitViewComponent extends WorkPackageSingleViewBase implements OnInit {
+ hasState:boolean = !!this.$state.current;
/** Reference to the base route e.g., work-packages.partitioned.list or bim.partitioned.split */
- private baseRoute:string = this.$state.current.data.baseRoute;
+ private baseRoute:string = this.$state.current?.data?.baseRoute;
+
+ @Input() workPackageId:string;
+ @Input() activeTab?:string;
constructor(
public injector:Injector,
@@ -69,6 +79,7 @@ export class WorkPackageSplitViewComponent extends WorkPackageSingleViewBase imp
public wpTableFocus:WorkPackageViewFocusService,
public recentItemsService:RecentItemsService,
readonly $state:StateService,
+ readonly urlParams:UrlParamsService,
readonly backRouting:BackRoutingService,
) {
super(injector, $state.params.workPackageId);
@@ -77,7 +88,7 @@ export class WorkPackageSplitViewComponent extends WorkPackageSingleViewBase imp
ngOnInit():void {
this.observeWorkPackage();
- const wpId = this.$state.params.workPackageId as string;
+ const wpId = (this.$state.params.workPackageId || this.workPackageId) as string;
const focusedWP = this.wpTableFocus.focusedWorkPackage;
if (!focusedWP) {
@@ -114,7 +125,7 @@ export class WorkPackageSplitViewComponent extends WorkPackageSingleViewBase imp
}
showBackButton():boolean {
- return this.baseRoute.includes('bim');
+ return this.baseRoute?.includes('bim');
}
backToList():void {
diff --git a/frontend/src/app/features/work-packages/routing/wp-split-view/wp-split-view.html b/frontend/src/app/features/work-packages/routing/wp-split-view/wp-split-view.html
index 57357d980cb..86f1cac1a0b 100644
--- a/frontend/src/app/features/work-packages/routing/wp-split-view/wp-split-view.html
+++ b/frontend/src/app/features/work-packages/routing/wp-split-view/wp-split-view.html
@@ -30,15 +30,16 @@
[customBackMethod]="backToList.bind(this)"
></op-back-button>
- <wp-subject class="subject-header"></wp-subject>
+ <wp-subject [workPackage]="workPackage" class="subject-header"></wp-subject>
</div>
</div>
<div
class="work-package-details-tab"
data-notification-selector='notification-scroll-container'
- ui-view
- ></div>
+ >
+ <wp-overview-tab [workPackage]="workPackage"></wp-overview-tab>
+ </div>
</edit-form>
</div>
diff --git a/frontend/src/app/shared/components/resizer/resizer/wp-resizer.component.ts b/frontend/src/app/shared/components/resizer/resizer/wp-resizer.component.ts
index eca03af8bea..3533652a88d 100644
--- a/frontend/src/app/shared/components/resizer/resizer/wp-resizer.component.ts
+++ b/frontend/src/app/shared/components/resizer/resizer/wp-resizer.component.ts
@@ -26,9 +26,7 @@
// See COPYRIGHT and LICENSE files for more details.
//++
-import {
- AfterViewInit, ChangeDetectionStrategy, Component, ElementRef, Input, OnInit,
-} from '@angular/core';
+import { AfterViewInit, ChangeDetectionStrategy, Component, ElementRef, Input, OnInit } from '@angular/core';
import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
import { TransitionService } from '@uirouter/core';
import { BrowserDetector } from 'core-app/core/browser/browser-detector.service';
@@ -89,6 +87,10 @@ export class WpResizerDirective extends UntilDestroyedMixin implements OnInit, A
const elements = document.getElementsByClassName(this.elementClass);
this.resizingElement = <HTMLElement>elements[elements.length - 1];
+ if (!this.resizingElement) {
+ return;
+ }
+
// Get initial width from local storage and apply
const localStorageValue = this.parseLocalStorageValue();
this.elementWidth = localStorageValue