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

Fix: Load work packages for the current date range when opening team planner

Benjamin Bädorf8df982f95d32
diff --git a/frontend/src/app/features/calendar/op-calendar.service.ts b/frontend/src/app/features/calendar/op-calendar.service.ts
index 0ff6cb415ec..5b9a653e70b 100644
--- a/frontend/src/app/features/calendar/op-calendar.service.ts
+++ b/frontend/src/app/features/calendar/op-calendar.service.ts
@@ -50,6 +50,7 @@ import { uiStateLinkClass } from 'core-app/features/work-packages/components/wp-
import { debugLog } from 'core-app/shared/helpers/debug_output';
import { WorkPackageViewContextMenu } from 'core-app/shared/components/op-context-menu/wp-context-menu/wp-view-context-menu.directive';
import { OPContextMenuService } from 'core-app/shared/components/op-context-menu/op-context-menu.service';
+import { initial } from 'lodash';
export interface CalendarViewEvent {
el:HTMLElement;
@@ -191,9 +192,10 @@ export class OpCalendarService extends UntilDestroyedMixin {
.find({ pageSize: 0 }, queryId)
.toPromise();
- queryProps = this.urlParamsHelper.encodeQueryJsonParams(
+ queryProps = this.generateQueryProps(
initialQuery,
- { pp: OpCalendarService.MAX_DISPLAYED, pa: 1 },
+ startDate,
+ endDate,
);
} else if (this.initializingWithQueryProps) {
// This is the case on initially loading the calendar with query_props present in the url params.
@@ -216,17 +218,10 @@ export class OpCalendarService extends UntilDestroyedMixin {
queryProps = OpCalendarService.defaultQueryProps(startDate, endDate);
}
} else {
- queryProps = this.urlParamsHelper.encodeQueryJsonParams(
+ queryProps = this.generateQueryProps(
this.querySpace.query.value as QueryResource,
- (props) => ({
- ...props,
- pp: OpCalendarService.MAX_DISPLAYED,
- pa: 1,
- f: [
- ...props.f.filter((filter) => filter.n !== 'datesInterval'),
- OpCalendarService.dateFilter(startDate, endDate),
- ],
- }),
+ startDate,
+ endDate,
);
// There are no query props, ensure that they are not being shown the next load
@@ -239,6 +234,25 @@ export class OpCalendarService extends UntilDestroyedMixin {
.toPromise();
}
+ public generateQueryProps(
+ query: QueryResource,
+ startDate:string,
+ endDate:string,
+ ):string {
+ return this.urlParamsHelper.encodeQueryJsonParams(
+ query,
+ (props) => ({
+ ...props,
+ pp: OpCalendarService.MAX_DISPLAYED,
+ pa: 1,
+ f: [
+ ...props.f.filter((filter) => filter.n !== 'datesInterval'),
+ OpCalendarService.dateFilter(startDate, endDate),
+ ],
+ }),
+ );
+ }
+
public get initialView():string|undefined {
return this.urlParams.cview as string|undefined;
}