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

Initial groupBy support fro in-app-notifications

Benjamin Bädorfa2f2441304c0
diff --git a/frontend/src/app/core/apiv3/paths/apiv3-list-resource.interface.ts b/frontend/src/app/core/apiv3/paths/apiv3-list-resource.interface.ts
index 5e4497a2e03..96fdf21de2c 100644
--- a/frontend/src/app/core/apiv3/paths/apiv3-list-resource.interface.ts
+++ b/frontend/src/app/core/apiv3/paths/apiv3-list-resource.interface.ts
@@ -35,6 +35,7 @@ export type ApiV3ListFilter = [string, FilterOperator, boolean|string[]];
export interface Apiv3ListParameters {
filters?:ApiV3ListFilter[];
sortBy?:[string, string][];
+ groupBy?:string;
pageSize?:number;
offset?:number;
}
@@ -50,6 +51,10 @@ export function listParamsString(params?:Apiv3ListParameters):string {
queryProps.push(`sortBy=${JSON.stringify(params.sortBy)}`);
}
+ if (params && params.groupBy) {
+ queryProps.push(`groupBy=${params.groupBy}`);
+ }
+
// 0 should not be treated as false
if (params && params.pageSize !== undefined) {
queryProps.push(`pageSize=${params.pageSize}`);
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 773459cf557..1468603d789 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
@@ -2,9 +2,10 @@ import {
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
+ OnInit,
} from '@angular/core';
import { I18nService } from 'core-app/core/i18n/i18n.service';
-import { IanCenterService } from 'core-app/features/in-app-notifications/center/state/ian-center.service';
+import { InAppNotificationsResourceService } from 'core-app/core/state/in-app-notifications/in-app-notifications.service';
export const ianCenterMenuSelector = 'op-ian-menu';
@@ -14,7 +15,7 @@ export const ianCenterMenuSelector = 'op-ian-menu';
styleUrls: ['./menu.component.sass'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
-export class IANCenterMenuComponent {
+export class IANCenterMenuComponent implements OnInit {
text = {
title: this.I18n.t('js.notifications.title'),
button_close: this.I18n.t('js.button_close'),
@@ -27,7 +28,16 @@ export class IANCenterMenuComponent {
constructor(
readonly cdRef:ChangeDetectorRef,
readonly I18n:I18nService,
+ readonly resourceService:InAppNotificationsResourceService,
) {
console.log('menu');
}
+
+ ngOnInit() {
+ this.resourceService.fetchNotifications({
+ pageSize: 0,
+ groupBy: 'project',
+ filters: [['unread', '=', true]],
+ });
+ }
}