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

Use date in URL param to keep team planner date

Oliver Günther6e1bccd41a9c
diff --git a/frontend/src/app/features/team-planner/team-planner/team-planner.routes.ts b/frontend/src/app/features/team-planner/team-planner/team-planner.routes.ts
index fc30c734f84..c7e58a5ef8d 100644
--- a/frontend/src/app/features/team-planner/team-planner/team-planner.routes.ts
+++ b/frontend/src/app/features/team-planner/team-planner/team-planner.routes.ts
@@ -37,13 +37,14 @@ export const TEAM_PLANNER_ROUTES:Ng2StateDeclaration[] = [
{
name: 'team_planner',
parent: 'optional_project',
- url: '/team_planner?query_id&query_props',
+ url: '/team_planner?query_id&query_props&cdate',
redirectTo: 'team_planner.page',
views: {
'!$default': { component: WorkPackagesBaseComponent },
},
params: {
query_id: { type: 'query', dynamic: true },
+ cdate: { type: 'string', dynamic: true },
// Use custom encoder/decoder that ensures validity of URL string
query_props: { type: 'opQueryString' },
},
diff --git a/frontend/src/app/shared/components/calendar/op-calendar.service.ts b/frontend/src/app/shared/components/calendar/op-calendar.service.ts
index 768c908455d..fc0cc96df8f 100644
--- a/frontend/src/app/shared/components/calendar/op-calendar.service.ts
+++ b/frontend/src/app/shared/components/calendar/op-calendar.service.ts
@@ -5,6 +5,7 @@ import {
} from '@angular/core';
import {
CalendarOptions,
+ DatesSetArg,
EventApi,
} from '@fullcalendar/core';
import { I18nService } from 'core-app/core/i18n/i18n.service';
@@ -31,6 +32,8 @@ import { QueryFilterInstanceResource } from 'core-app/features/hal/resources/que
import { QueryResource } from 'core-app/features/hal/resources/query-resource';
import { UrlParamsHelperService } from 'core-app/features/work-packages/components/wp-query/url-params-helper';
import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';
+import { UIRouterGlobals } from '@uirouter/core';
+import { TimezoneService } from 'core-app/core/datetime/timezone.service';
export interface CalendarViewEvent {
el:HTMLElement;
@@ -68,6 +71,8 @@ export class OpCalendarService extends UntilDestroyedMixin {
readonly querySpace:IsolatedQuerySpace,
readonly apiV3Service:ApiV3Service,
readonly halResourceService:HalResourceService,
+ readonly uiRouterGlobals:UIRouterGlobals,
+ readonly timezoneService:TimezoneService,
) {
super();
}
@@ -218,6 +223,8 @@ export class OpCalendarService extends UntilDestroyedMixin {
center: 'title',
right: '',
},
+ initialDate: this.initialDate,
+ datesSet: (dates) => this.updateDateParam(dates),
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
eventClick: this.openSplitView.bind(this),
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
@@ -332,4 +339,20 @@ export class OpCalendarService extends UntilDestroyedMixin {
private get areFiltersEmpty() {
return this.wpTableFilters.isEmpty;
}
+
+ private get initialDate():string|undefined {
+ const date = this.uiRouterGlobals.params.cdate as string|undefined;
+ if (date) {
+ return this.timezoneService.formattedISODate(date);
+ }
+
+ return undefined;
+ }
+
+ private updateDateParam(dates:DatesSetArg) {
+ void this.$state.go(
+ '.',
+ { cdate: this.timezoneService.formattedISODate(dates.start) },
+ );
+ }
}