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
Start implementation of filters in the ian-center store
Benjamin Bädorf8020615ecb14
diff --git a/frontend/src/app/core/path-helper/path-helper.service.ts b/frontend/src/app/core/path-helper/path-helper.service.tsindex 35aacf3a164..cb66a055f8e 100644--- a/frontend/src/app/core/path-helper/path-helper.service.ts+++ b/frontend/src/app/core/path-helper/path-helper.service.ts@@ -29,11 +29,6 @@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 || '';@@ -113,10 +108,8 @@ export class PathHelperService {return `${this.staticBase}/news/${newsId}`;}- public notificationsPath({ reason, project }:INotificationPageQueryParameters = {}):string {- const reasonQuery = reason ? `&reason=${reason}` : '';- const projectQuery = project ? `&project=${project}` : '';- return `${this.staticBase}/notifications?${reasonQuery}${projectQuery}`;+ public notificationsPath():string {+ return `${this.staticBase}/notifications`;}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.tsindex bfc7db047fb..fca0f8e9bd6 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,14 @@ import {} from '@angular/core';import { combineLatest } from 'rxjs';import { map } from 'rxjs/operators';+import { StateService } from '@uirouter/core';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 { INotificationPageQueryParameters } from '../../in-app-notifications.routes';import { IanMenuService } from './state/ian-menu.service';export const ianMenuSelector = 'op-ian-menu';-const REASON_MENU_ITEMS = [-];-@Component({selector: ianMenuSelector,templateUrl: './menu.component.html',@@ -34,20 +29,20 @@ export class IanMenuComponent implements OnInit {];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' }) },+ { key: 'mentioned', title: '@mentioned', href: this.getHrefForFilters({ filter: 'reason', name: 'mentioned' }) },+ { key: 'involved', title: 'Involved', href: this.getHrefForFilters({ filter: 'reason', name: 'involved' }) },+ { key: 'watched', title: 'Watched', href: this.getHrefForFilters({ filter: 'reason', name: 'watched' }) },+ { key: 'created', title: 'Created', href: this.getHrefForFilters({ filter: 'reason', name: 'created' }) },+ { key: 'assigned', title: 'Assigned', href: this.getHrefForFilters({ filter: 'reason', name: 'assigned' }) },+ { key: 'accountable', title: 'Accountable', href: this.getHrefForFilters({ filter: 'reason', name: 'accountable' }) },+ { key: 'commented', title: 'Commented', href: this.getHrefForFilters({ filter: 'reason', name: '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) }),+ href: this.getHrefForFilters({ filter: 'project', name: idFromLink(item._links.valueLink[0].href) }),}))),);@@ -90,15 +85,14 @@ export class IanMenuComponent implements OnInit {readonly cdRef:ChangeDetectorRef,readonly I18n:I18nService,readonly ianMenuService:IanMenuService,- readonly pathHelper:PathHelperService,- ) {- }+ readonly state:StateService,+ ) { }ngOnInit() {this.ianMenuService.reload();}private getHrefForFilters(filters:INotificationPageQueryParameters = {}) {- return this.pathHelper.notificationsPath(filters);+ return this.state.href('notifications', filters);}}diff --git a/frontend/src/app/features/in-app-notifications/center/state/ian-center.query.ts b/frontend/src/app/features/in-app-notifications/center/state/ian-center.query.tsindex 8bb6a6feee5..ec9cf577802 100644--- a/frontend/src/app/features/in-app-notifications/center/state/ian-center.query.ts+++ b/frontend/src/app/features/in-app-notifications/center/state/ian-center.query.ts@@ -1,4 +1,5 @@import { Query } from '@datorama/akita';+import { StateService } from '@uirouter/core';import {IAN_FACET_FILTERS,IanCenterState,@@ -11,6 +12,7 @@ import {} from 'rxjs/operators';import { Apiv3ListParameters } from 'core-app/core/apiv3/paths/apiv3-list-resource.interface';import { InAppNotification } from 'core-app/core/state/in-app-notifications/in-app-notification.model';+import { INotificationPageQueryParameters } from 'core-app/features/in-app-notifications/in-app-notifications.routes';import { selectCollectionAsEntities$ } from 'core-app/core/state/collection-store';export class IanCenterQuery extends Query<IanCenterState> {@@ -54,12 +56,14 @@ export class IanCenterQuery extends Query<IanCenterState> {get params():Apiv3ListParameters {const state = this.store.getValue();+ const filters = this.state.params;return { ...state.params, filters: IAN_FACET_FILTERS[state.activeFacet] };}constructor(protected store:IanCenterStore,protected resourceService:InAppNotificationsResourceService,+ protected state:StateService,) {super(store);}diff --git a/frontend/src/app/features/in-app-notifications/center/state/ian-center.service.ts b/frontend/src/app/features/in-app-notifications/center/state/ian-center.service.tsindex f1f03c7d138..648e50fa956 100644--- a/frontend/src/app/features/in-app-notifications/center/state/ian-center.service.ts+++ b/frontend/src/app/features/in-app-notifications/center/state/ian-center.service.ts@@ -2,6 +2,7 @@ import {Injectable,Injector,} from '@angular/core';+import { StateService } from '@uirouter/core';import {IanCenterStore,InAppNotificationFacet,@@ -39,13 +40,14 @@ export class IanCenterService {readonly store = new IanCenterStore();- readonly query = new IanCenterQuery(this.store, this.resourceService);+ readonly query = new IanCenterQuery(this.store, this.resourceService, this.state);constructor(readonly injector:Injector,readonly resourceService:InAppNotificationsResourceService,readonly actions$:ActionsService,readonly apiV3Service:APIV3Service,+ readonly state:StateService,) {}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.tsindex ece4f8ac8b1..9af9562e12c 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@@ -33,10 +33,15 @@ import { InAppNotificationCenterComponent } from 'core-app/features/in-app-notifimport { 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 interface INotificationPageQueryParameters {+ filter?:string;+ name?:string;+};+export const IAN_ROUTES:Ng2StateDeclaration[] = [{name: 'notifications',- url: '/notifications',+ url: '/notifications?{filter:string}&{name:string}',data: {bodyClasses: 'router--work-packages-base',},