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

Implement center as partitioned page

Oliver Günther770f56d501ba
diff --git a/config/routes.rb b/config/routes.rb
index 37b08c74374..932b06c875d 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -576,7 +576,7 @@ OpenProject::Application.routes.draw do
root to: 'account#login'
scope :notifications do
- get '/', to: 'angular#empty_layout'
+ get '(/*state)', to: 'angular#empty_layout', as: :notifications_center
end
# Development route for styleguide
diff --git a/frontend/src/app/core/routing/openproject.routes.ts b/frontend/src/app/core/routing/openproject.routes.ts
index cbd2a19285c..68d9023f1a1 100644
--- a/frontend/src/app/core/routing/openproject.routes.ts
+++ b/frontend/src/app/core/routing/openproject.routes.ts
@@ -37,7 +37,7 @@ import { Ng2StateDeclaration, StatesModule } from '@uirouter/angular';
import { appBaseSelector, ApplicationBaseComponent } from 'core-app/core/routing/base/application-base.component';
import { BackRoutingService } from 'core-app/features/work-packages/components/back-routing/back-routing.service';
import { MY_ACCOUNT_LAZY_ROUTES } from 'core-app/features/user-preferences/user-preferences.lazy-routes';
-import { IAN_LAZY_ROUTES } from "core-app/features/in-app-notifications/in-app-notifications.lazy-routes";
+import { IAN_LAZY_ROUTES } from 'core-app/features/in-app-notifications/in-app-notifications.lazy-routes';
export const OPENPROJECT_ROUTES:Ng2StateDeclaration[] = [
{
diff --git a/frontend/src/app/features/boards/board/board-partitioned-page/board-partitioned-page.component.ts b/frontend/src/app/features/boards/board/board-partitioned-page/board-partitioned-page.component.ts
index 9e52d0c94a4..7b0c830d2f9 100644
--- a/frontend/src/app/features/boards/board/board-partitioned-page/board-partitioned-page.component.ts
+++ b/frontend/src/app/features/boards/board/board-partitioned-page/board-partitioned-page.component.ts
@@ -117,6 +117,7 @@ export class BoardPartitionedPageComponent extends UntilDestroyedMixin {
},
);
+ toolbarComponent = null;
toolbarButtonComponents:ToolbarButtonComponentDefinition[] = [
{
component: WorkPackageFilterButtonComponent,
diff --git a/frontend/src/app/features/in-app-notifications/center/in-app-notification-center-page.component.ts b/frontend/src/app/features/in-app-notifications/center/in-app-notification-center-page.component.ts
new file mode 100644
index 00000000000..8799dc82cff
--- /dev/null
+++ b/frontend/src/app/features/in-app-notifications/center/in-app-notification-center-page.component.ts
@@ -0,0 +1,65 @@
+import {
+ ChangeDetectionStrategy,
+ ChangeDetectorRef,
+ Component,
+ Injector,
+} from '@angular/core';
+import { ViewPartitionState } from 'core-app/features/work-packages/routing/partitioned-query-space-page/partitioned-query-space-page.component';
+import {
+ StateService,
+ TransitionService,
+} from '@uirouter/core';
+import { NotificationsService } from 'core-app/shared/components/notifications/notifications.service';
+import { I18nService } from 'core-app/core/i18n/i18n.service';
+import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destroyed.mixin';
+import { APIV3Service } from 'core-app/core/apiv3/api-v3.service';
+import { InAppNotificationToolbarComponent } from 'core-app/features/in-app-notifications/center/toolbar/in-app-notification-toolbar.component';
+
+@Component({
+ templateUrl: '../../work-packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.html',
+ styleUrls: [
+ '../../work-packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.sass',
+ ],
+ changeDetection: ChangeDetectionStrategy.OnPush,
+})
+export class InAppNotificationCenterPageComponent extends UntilDestroyedMixin {
+ text = {
+ title: this.I18n.t('js.notifications.title'),
+ };
+
+ /** Go back to boards using back-button */
+ backButtonCallback = ():void => window.history.back();
+
+ /** Current query title to render */
+ selectedTitle = this.text.title;
+
+ /** Disable filter container for now */
+ filterContainerDefinition = null;
+
+ /** We need to pass the correct partition state to the view to manage the grid */
+ currentPartition:ViewPartitionState = '-split';
+
+ toolbarComponent = InAppNotificationToolbarComponent;
+
+ constructor(
+ readonly I18n:I18nService,
+ readonly cdRef:ChangeDetectorRef,
+ readonly $transitions:TransitionService,
+ readonly state:StateService,
+ readonly notifications:NotificationsService,
+ readonly injector:Injector,
+ readonly apiV3Service:APIV3Service,
+ ) {
+ super();
+ }
+
+ /**
+ * We need to set the current partition to the grid to ensure
+ * either side gets expanded to full width if we're not in '-split' mode.
+ *
+ * @param state The current or entering state
+ */
+ setPartition(state:{ data:{ partition?:ViewPartitionState } }):void {
+ this.currentPartition = state.data?.partition || '-split';
+ }
+}
diff --git a/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.html b/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.html
index 5c5487f9694..23e9df22cca 100644
--- a/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.html
+++ b/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.html
@@ -1,6 +1,4 @@
<div class="op-ian-center">
- <op-ian-center-toolbar class="op-ian-center--toolbar"></op-ian-center-toolbar>
-
<div class="op-ian-center--content">
<ng-container *ngIf="(hasNotifications$ | async) as notifications; else noResults">
<cdk-virtual-scroll-viewport
@@ -11,6 +9,7 @@
*cdkVirtualFor="let item of notifications$ | async; templateCacheSize: 0"
class="op-ian-center--entry"
[notification]="item"
+ (resourceLinkClicked)="openSplitView($event)"
></op-in-app-notification-entry>
</cdk-virtual-scroll-viewport>
</ng-container>
diff --git a/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.sass b/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.sass
index 7965bbe7de6..e6275bf577a 100644
--- a/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.sass
+++ b/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.sass
@@ -1,6 +1,6 @@
.op-ian-center
display: grid
- grid-template-rows: auto 1fr auto
+ grid-template-rows: 1fr auto
height: 100%
&--content
diff --git a/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.ts b/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.ts
index dbd529cc8d8..33fe6e1d8ec 100644
--- a/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.ts
+++ b/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.ts
@@ -10,6 +10,9 @@ import { InAppNotificationsQuery } from 'core-app/features/in-app-notifications/
import { InAppNotificationsService } from 'core-app/features/in-app-notifications/store/in-app-notifications.service';
import { NOTIFICATIONS_MAX_SIZE } from 'core-app/features/in-app-notifications/store/in-app-notification.model';
import { map } from 'rxjs/operators';
+import { StateService } from '@uirouter/angular';
+import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';
+import { UIRouterGlobals } from '@uirouter/core';
@Component({
selector: 'op-in-app-notification-center',
@@ -53,6 +56,8 @@ export class InAppNotificationCenterComponent implements OnInit {
readonly I18n:I18nService,
readonly ianService:InAppNotificationsService,
readonly ianQuery:InAppNotificationsQuery,
+ readonly uiRouterGlobals:UIRouterGlobals,
+ readonly state:StateService,
) {
}
@@ -68,4 +73,10 @@ export class InAppNotificationCenterComponent implements OnInit {
{ newest_count: NOTIFICATIONS_MAX_SIZE, more_count: state.notShowing },
);
}
+
+ openSplitView($event:WorkPackageResource):void {
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
+ const baseRoute = this.uiRouterGlobals.current.data.baseRoute as string;
+ void this.state.go(`${baseRoute}.details`, { workPackageId: $event.id });
+ }
}
diff --git a/frontend/src/app/features/in-app-notifications/in-app-notifications.module.ts b/frontend/src/app/features/in-app-notifications/in-app-notifications.module.ts
index a3bebed4d3e..221dfb363ae 100644
--- a/frontend/src/app/features/in-app-notifications/in-app-notifications.module.ts
+++ b/frontend/src/app/features/in-app-notifications/in-app-notifications.module.ts
@@ -2,14 +2,16 @@ import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { IconModule } from 'core-app/shared/components/icon/icon.module';
import { InAppNotificationBellComponent } from 'core-app/features/in-app-notifications/bell/in-app-notification-bell.component';
-import { OpenprojectModalModule } from 'core-app/shared/components/modal/modal.module';
import { InAppNotificationEntryComponent } from 'core-app/features/in-app-notifications/entry/in-app-notification-entry.component';
import { OpenprojectPrincipalRenderingModule } from 'core-app/shared/components/principal/principal-rendering.module';
import { UIRouterModule } from '@uirouter/angular';
import { ScrollingModule } from '@angular/cdk/scrolling';
import { IAN_ROUTES } from 'core-app/features/in-app-notifications/in-app-notifications.routes';
import { InAppNotificationCenterComponent } from 'core-app/features/in-app-notifications/center/in-app-notification-center.component';
-import { InAppNotificationToolbarComponent } from "core-app/features/in-app-notifications/center/toolbar/in-app-notification-toolbar.component";
+import { InAppNotificationToolbarComponent } from 'core-app/features/in-app-notifications/center/toolbar/in-app-notification-toolbar.component';
+import { InAppNotificationCenterPageComponent } from 'core-app/features/in-app-notifications/center/in-app-notification-center-page.component';
+import { OpenprojectWorkPackagesModule } from 'core-app/features/work-packages/openproject-work-packages.module';
+import { DynamicModule } from 'ng-dynamic-component';
@NgModule({
declarations: [
@@ -17,16 +19,18 @@ import { InAppNotificationToolbarComponent } from "core-app/features/in-app-noti
InAppNotificationCenterComponent,
InAppNotificationEntryComponent,
InAppNotificationToolbarComponent,
+ InAppNotificationCenterPageComponent,
],
imports: [
// Routes for /backlogs
UIRouterModule.forChild({
states: IAN_ROUTES,
}),
+ DynamicModule,
CommonModule,
IconModule,
- OpenprojectModalModule,
OpenprojectPrincipalRenderingModule,
+ OpenprojectWorkPackagesModule,
ScrollingModule,
],
})
diff --git a/frontend/src/app/features/in-app-notifications/in-app-notifications.routes.ts b/frontend/src/app/features/in-app-notifications/in-app-notifications.routes.ts
index 392d6f7d559..d00d3a1c045 100644
--- a/frontend/src/app/features/in-app-notifications/in-app-notifications.routes.ts
+++ b/frontend/src/app/features/in-app-notifications/in-app-notifications.routes.ts
@@ -27,15 +27,39 @@
//++
import { Ng2StateDeclaration } from '@uirouter/angular';
+import { makeSplitViewRoutes } from 'core-app/features/work-packages/routing/split-view-routes.template';
+import { WorkPackageSplitViewComponent } from 'core-app/features/work-packages/routing/wp-split-view/wp-split-view.component';
import { InAppNotificationCenterComponent } from 'core-app/features/in-app-notifications/center/in-app-notification-center.component';
+import { InAppNotificationCenterPageComponent } from 'core-app/features/in-app-notifications/center/in-app-notification-center-page.component';
+import { WorkPackagesBaseComponent } from 'core-app/features/work-packages/routing/wp-base/wp--base.component';
export const IAN_ROUTES:Ng2StateDeclaration[] = [
{
name: 'notifications',
url: '/notifications',
- component: InAppNotificationCenterComponent,
data: {
bodyClasses: 'router--work-packages-base',
},
+ component: WorkPackagesBaseComponent,
+ redirectTo: 'notifications.center.show',
},
-];
+ {
+ name: 'notifications.center',
+ component: InAppNotificationCenterPageComponent,
+ redirectTo: 'notifications.center.show',
+ },
+ {
+ name: 'notifications.center.show',
+ data: {
+ baseRoute: 'notifications.center.show',
+ },
+ views: {
+ 'content-left': { component: InAppNotificationCenterComponent },
+ },
+ },
+ ...makeSplitViewRoutes(
+ 'notifications.center.show',
+ undefined,
+ WorkPackageSplitViewComponent,
+ ),
+];
\ No newline at end of file
diff --git a/frontend/src/app/features/work-packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.html b/frontend/src/app/features/work-packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.html
index 867dc0ba6e7..a18c52333db 100644
--- a/frontend/src/app/features/work-packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.html
+++ b/frontend/src/app/features/work-packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.html
@@ -1,10 +1,16 @@
<div class="work-packages-partitioned-query-space--container"
- [ngClass]="currentPartition">
- <div class="toolbar-container -editable">
+ [ngClass]="currentPartition">
+ <ng-container *ngIf="toolbarComponent">
+ <ng-container *ngComponentOutlet="toolbarComponent;
+ ndcDynamicInjector: injector"
+ ></ng-container>
+ </ng-container>
+ <div *ngIf="!toolbarComponent"
+ class="toolbar-container -editable">
<div class="toolbar">
<op-back-button *ngIf="backButtonCallback"
- linkClass="back-button"
- [customBackMethod]="backButtonCallback">
+ linkClass="back-button"
+ [customBackMethod]="backButtonCallback">
</op-back-button>
<editable-toolbar-title [title]="selectedTitle"
@@ -33,7 +39,8 @@
</div>
<div class="work-packages-partitioned-query-space--filter-area">
- <ndc-dynamic [ndcDynamicComponent]="filterContainerDefinition.component"
+ <ndc-dynamic *ngIf="filterContainerDefinition"
+ [ndcDynamicComponent]="filterContainerDefinition.component"
[ndcDynamicInputs]="filterContainerDefinition.inputs"
[ndcDynamicOutputs]="filterContainerDefinition.outputs"
[ndcDynamicInjector]="injector">
diff --git a/frontend/src/app/features/work-packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.ts b/frontend/src/app/features/work-packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.ts
index a4d115b769e..0d11d9b315e 100644
--- a/frontend/src/app/features/work-packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.ts
+++ b/frontend/src/app/features/work-packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.ts
@@ -27,7 +27,11 @@
//++
import {
- ChangeDetectionStrategy, Component, OnDestroy, OnInit,
+ ChangeDetectionStrategy,
+ Component,
+ ComponentRef,
+ OnDestroy,
+ OnInit,
} from '@angular/core';
import { QueryResource } from 'core-app/features/hal/resources/query-resource';
import { OpTitleService } from 'core-app/core/html/op-title.service';
@@ -58,7 +62,6 @@ export interface ToolbarButtonComponentDefinition extends DynamicComponentDefini
export type ViewPartitionState = '-split'|'-left-only'|'-right-only';
@Component({
- selector: 'partitioned-query-space-page',
templateUrl: './partitioned-query-space-page.component.html',
styleUrls: ['./partitioned-query-space-page.component.sass'],
changeDetection: ChangeDetectionStrategy.OnPush,
@@ -97,13 +100,18 @@ export class PartitionedQuerySpacePageComponent extends WorkPackagesViewBase imp
showToolbarSaveButton:boolean;
/** Listener callbacks */
+ // eslint-disable-next-line @typescript-eslint/ban-types
unRegisterTitleListener:Function;
+ // eslint-disable-next-line @typescript-eslint/ban-types
removeTransitionSubscription:Function;
/** Determine when query is initially loaded */
showToolbar = false;
+ /** The toolbar to render */
+ toolbarComponent:ComponentRef<unknown>|undefined;
+
/** The toolbar buttons to render */
toolbarButtonComponents:ToolbarButtonComponentDefinition[] = [];
@@ -114,7 +122,7 @@ export class PartitionedQuerySpacePageComponent extends WorkPackagesViewBase imp
currentPartition:ViewPartitionState = '-split';
/** What route (if any) should we go back to using the back button left of the title? */
- backButtonCallback:Function|undefined;
+ backButtonCallback:() => void|undefined;
/** Which filter container component to mount */
filterContainerDefinition:DynamicComponentDefinition = {