Remove external events now that events are reloaded

Otherwise, there will be duplicates
pull/10272/head
Oliver Günther 3 years ago
parent 9acc0b5dfb
commit 189c7cddf1
No known key found for this signature in database
GPG Key ID: A3A8BDAD7C0C552C
  1. 19
      frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.ts

@ -18,7 +18,6 @@ import {
import {
BehaviorSubject,
combineLatest,
from,
Subject,
} from 'rxjs';
import {
@ -362,9 +361,7 @@ export class TeamPlannerComponent extends UntilDestroyedMixin implements OnInit,
// DnD configuration
editable: true,
droppable: true,
eventResize: (resizeInfo:EventResizeDoneArg) => {
const updater = from(this.updateEvent(resizeInfo));
},
eventResize: (resizeInfo:EventResizeDoneArg) => this.updateEvent(resizeInfo),
eventDragStart: (dragInfo:EventDragStartArg) => {
const { el } = dragInfo;
el.style.pointerEvents = 'none';
@ -408,6 +405,8 @@ export class TeamPlannerComponent extends UntilDestroyedMixin implements OnInit,
this.viewLookup.destroyDetached();
this.removeExternalEvents();
successCallback(events);
},
failureCallback,
@ -687,4 +686,16 @@ export class TeamPlannerComponent extends UntilDestroyedMixin implements OnInit,
this.showAddExistingPane.next(!this.showAddExistingPane.getValue());
(this.addExistingToggle.nativeElement as HTMLElement).blur();
}
private removeExternalEvents():void {
this
.ucCalendar
.getApi()
.getEvents()
.forEach((evt) => {
if (evt.id.includes('external')) {
evt.remove();
}
});
}
}

Loading…
Cancel
Save