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

Links for sidemenu

Benjamin Bädorf59472665d118
diff --git a/frontend/src/app/core/path-helper/path-helper.service.ts b/frontend/src/app/core/path-helper/path-helper.service.ts
index cb66a055f8e..35aacf3a164 100644
--- a/frontend/src/app/core/path-helper/path-helper.service.ts
+++ b/frontend/src/app/core/path-helper/path-helper.service.ts
@@ -29,6 +29,11 @@
import { Injectable } from '@angular/core';
import { Apiv3Paths } from './apiv3-paths';
+export interface INotificationPageQueryParameters {
+ reason?:string;
+ project?:string;
+};
+
@Injectable({ providedIn: 'root' })
export class PathHelperService {
public readonly appBasePath = window.appBasePath || '';
@@ -108,8 +113,10 @@ export class PathHelperService {
return `${this.staticBase}/news/${newsId}`;
}
- public notificationsPath():string {
- return `${this.staticBase}/notifications`;
+ public notificationsPath({ reason, project }:INotificationPageQueryParameters = {}):string {
+ const reasonQuery = reason ? `&reason=${reason}` : '';
+ const projectQuery = project ? `&project=${project}` : '';
+ return `${this.staticBase}/notifications?${reasonQuery}${projectQuery}`;
}
public loginPath() {
diff --git a/frontend/src/app/features/in-app-notifications/center/menu/menu.component.ts b/frontend/src/app/features/in-app-notifications/center/menu/menu.component.ts
index 863d24cbc7e..bfc7db047fb 100644
--- a/frontend/src/app/features/in-app-notifications/center/menu/menu.component.ts
+++ b/frontend/src/app/features/in-app-notifications/center/menu/menu.component.ts
@@ -6,19 +6,17 @@ import {
} from '@angular/core';
import { combineLatest } from 'rxjs';
import { map } from 'rxjs/operators';
+import idFromLink from 'core-app/features/hal/helpers/id-from-link';
+import {
+ PathHelperService,
+ INotificationPageQueryParameters,
+} from 'core-app/core/path-helper/path-helper.service';
import { I18nService } from 'core-app/core/i18n/i18n.service';
import { IanMenuService } from './state/ian-menu.service';
export const ianMenuSelector = 'op-ian-menu';
const REASON_MENU_ITEMS = [
- { key: 'mentioned', title: '@mentioned' },
- { key: 'involved', title: 'Involved' },
- { key: 'watched', title: 'Watched' },
- { key: 'created', title: 'Created' },
- { key: 'assigned', title: 'Assigned' },
- { key: 'accountable', title: 'Accountable' },
- { key: 'commented', title: 'Commented' },
];
@Component({
@@ -29,14 +27,32 @@ const REASON_MENU_ITEMS = [
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class IanMenuComponent implements OnInit {
+ baseMenuItems = [
+ { title: 'Inbox', href: this.getHrefForFilters({}) },
+ { title: 'Flagged', href: this.getHrefForFilters({}) },
+ { title: 'My Comments', href: this.getHrefForFilters({}) },
+ ];
+
+ reasonMenuItems = [
+ { key: 'mentioned', title: '@mentioned', href: this.getHrefForFilters({ reason: 'mentioned' }) },
+ { key: 'involved', title: 'Involved', href: this.getHrefForFilters({ reason: 'involved' }) },
+ { key: 'watched', title: 'Watched', href: this.getHrefForFilters({ reason: 'watched' }) },
+ { key: 'created', title: 'Created', href: this.getHrefForFilters({ reason: 'created' }) },
+ { key: 'assigned', title: 'Assigned', href: this.getHrefForFilters({ reason: 'assigned' }) },
+ { key: 'accountable', title: 'Accountable', href: this.getHrefForFilters({ reason: 'accountable' }) },
+ { key: 'commented', title: 'Commented', href: this.getHrefForFilters({ reason: 'commented' }) },
+ ];
+
notificationsByProject$ = this.ianMenuService.query.notificationsByProject$.pipe(
map((items) => items.map(item => ({
...item,
title: item.value,
+ href: this.getHrefForFilters({ project: idFromLink(item._links.valueLink[0].href) }),
}))),
);
+
notificationsByReason$ = this.ianMenuService.query.notificationsByReason$.pipe(
- map((items) => REASON_MENU_ITEMS.map(reason => ({
+ map((items) => this.reasonMenuItems.map(reason => ({
...items.find(item => item.value === reason.key),
...reason,
})))
@@ -47,9 +63,7 @@ export class IanMenuComponent implements OnInit {
this.notificationsByReason$,
]).pipe(
map(([byProject, byReason]) => [
- { title: 'Inbox', href: '#' },
- { title: 'Flagged', href: '#' },
- { title: 'My Comments', href: '#' },
+ ...this.baseMenuItems,
{
title: 'By Reason',
collapsible: true,
@@ -76,12 +90,15 @@ export class IanMenuComponent implements OnInit {
readonly cdRef:ChangeDetectorRef,
readonly I18n:I18nService,
readonly ianMenuService:IanMenuService,
+ readonly pathHelper:PathHelperService,
) {
- console.log('menu');
}
ngOnInit() {
this.ianMenuService.reload();
- this.notificationsByProject$.subscribe(console.log);
+ }
+
+ private getHrefForFilters(filters:INotificationPageQueryParameters = {}) {
+ return this.pathHelper.notificationsPath(filters);
}
}
diff --git a/frontend/src/app/shared/components/sidemenu/sidemenu.component.sass b/frontend/src/app/shared/components/sidemenu/sidemenu.component.sass
index 1d419ac93cd..f9a7b82dae2 100644
--- a/frontend/src/app/shared/components/sidemenu/sidemenu.component.sass
+++ b/frontend/src/app/shared/components/sidemenu/sidemenu.component.sass
@@ -10,6 +10,7 @@
border: 0
text-transform: uppercase
padding: 8px 12px
+ margin-top: 12px
font-size: 12px
&:hover
diff --git a/frontend/src/app/shared/components/sidemenu/sidemenu.component.ts b/frontend/src/app/shared/components/sidemenu/sidemenu.component.ts
index 76e33d265b1..b7b2b2b3cd4 100644
--- a/frontend/src/app/shared/components/sidemenu/sidemenu.component.ts
+++ b/frontend/src/app/shared/components/sidemenu/sidemenu.component.ts
@@ -37,9 +37,7 @@ export class OpSidemenuComponent implements OnInit {
readonly I18n:I18nService,
) { }
- ngOnInit() {
- console.log(this.items);
- }
+ ngOnInit() { }
toggleCollapsed() {
this.collapsed = !this.collapsed;