Do not overwrite the dates that are set via the URL

pull/9977/head
Henriette Darge 3 years ago
parent 65de1f4b03
commit f2a93a22b5
  1. 6
      frontend/src/app/features/calendar/wp-calendar-page/wp-calendar-page.component.ts
  2. 31
      frontend/src/app/features/calendar/wp-calendar/wp-calendar.component.ts
  3. 1
      frontend/src/app/features/team-planner/team-planner/page/team-planner-page.component.ts

@ -122,13 +122,9 @@ export class WorkPackagesCalendarPageComponent extends PartitionedQuerySpacePage
}
/**
* We only want to load the initial query if it is saved
* @protected
*/
protected loadInitialQuery():void {
const queryId = this.uiRouterGlobals.params.queryId as string|null;
if (queryId) {
super.loadInitialQuery();
}
// We never load the initial query as the calendar service does all that.
}
}

@ -143,40 +143,9 @@ export class WorkPackagesCalendarComponent extends UntilDestroyedMixin implement
};
}
private setCalendarsDate():void {
const query = this.querySpace.query.value;
if (!query) {
return;
}
const datesIntervalFilter = _.find(query.filters || [], { id: 'datesInterval' }) as any;
let calendarDate:any = null;
let calendarUnit = 'dayGridMonth';
if (datesIntervalFilter) {
const lower = moment(datesIntervalFilter.values[0] as string);
const upper = moment(datesIntervalFilter.values[1] as string);
const diff = upper.diff(lower, 'days');
calendarDate = lower.add(diff / 2, 'days');
if (diff === 7) {
calendarUnit = 'dayGridWeek';
}
}
if (calendarDate) {
this.ucCalendar.getApi().changeView(calendarUnit, calendarDate.toDate());
} else {
this.ucCalendar.getApi().changeView(calendarUnit);
}
}
private setupWorkPackagesListener():void {
this.calendar.workPackagesListener$(() => {
this.alreadyLoaded = true;
this.setCalendarsDate();
this.ucCalendar.getApi().refetchEvents();
});
}

@ -104,7 +104,6 @@ export class TeamPlannerPageComponent extends PartitionedQuerySpacePageComponent
}
/**
* We only want to load the initial query if it is saved
* @protected
*/
protected loadInitialQuery():void {

Loading…
Cancel
Save