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

Remove unused code and make service a bit more generic

Henriette Darge5d32a93313a7
diff --git a/frontend/src/app/features/team-planner/team-planner/add-work-packages/add-existing-pane.component.ts b/frontend/src/app/features/team-planner/team-planner/add-work-packages/add-existing-pane.component.ts
index e8a4d22118c..814cde46f41 100644
--- a/frontend/src/app/features/team-planner/team-planner/add-work-packages/add-existing-pane.component.ts
+++ b/frontend/src/app/features/team-planner/team-planner/add-work-packages/add-existing-pane.component.ts
@@ -23,7 +23,7 @@ import { CurrentProjectService } from 'core-app/core/current-project/current-pro
import { UrlParamsHelperService } from 'core-app/features/work-packages/components/wp-query/url-params-helper';
import { IsolatedQuerySpace } from 'core-app/features/work-packages/directives/query-space/isolated-query-space';
import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destroyed.mixin';
-import { CalendarDragService } from 'core-app/features/team-planner/team-planner/calendar-drag.service';
+import { CalendarDragDropService } from 'core-app/features/team-planner/team-planner/calendar-drag-drop.service';
@Component({
selector: 'op-add-existing-pane',
@@ -40,7 +40,7 @@ export class AddExistingPaneComponent extends UntilDestroyedMixin {
// due to ngIf
if (v !== undefined) {
this.calendarDrag.destroyDrake();
- this.calendarDrag.registerDrag(v);
+ this.calendarDrag.registerDrag(v, '.op-add-existing-pane--wp');
}
}
@@ -68,7 +68,7 @@ export class AddExistingPaneComponent extends UntilDestroyedMixin {
private readonly notificationService:WorkPackageNotificationService,
private readonly currentProject:CurrentProjectService,
private readonly urlParamsHelper:UrlParamsHelperService,
- private readonly calendarDrag:CalendarDragService,
+ private readonly calendarDrag:CalendarDragDropService,
) {
super();
}
diff --git a/frontend/src/app/features/team-planner/team-planner/calendar-drag.service.ts b/frontend/src/app/features/team-planner/team-planner/calendar-drag-drop.service.ts
similarity index 87%
rename from frontend/src/app/features/team-planner/team-planner/calendar-drag.service.ts
rename to frontend/src/app/features/team-planner/team-planner/calendar-drag-drop.service.ts
index 8dbdf05cb92..2a13b8d201a 100644
--- a/frontend/src/app/features/team-planner/team-planner/calendar-drag.service.ts
+++ b/frontend/src/app/features/team-planner/team-planner/calendar-drag-drop.service.ts
@@ -11,28 +11,18 @@ import { BehaviorSubject } from 'rxjs';
@Injectable({
providedIn: 'root',
})
-export class CalendarDragService {
+export class CalendarDragDropService {
drake:Drake;
draggableWorkPackages$ = new BehaviorSubject<WorkPackageResource[]>([]);
- private workPackages:WorkPackageResource[];
-
- set draggableWorkPackages(wps:WorkPackageResource[]) {
- this.workPackages = wps;
- }
-
- get draggableWorkPackages():WorkPackageResource[] {
- return this.workPackages;
- }
-
destroyDrake():void {
if (this.drake) {
this.drake.destroy();
}
}
- registerDrag(container:ElementRef):void {
+ registerDrag(container:ElementRef, itemSelector:string):void {
this.drake = dragula({
containers: [container.nativeElement],
revertOnSpill: true,
@@ -44,7 +34,7 @@ export class CalendarDragService {
// eslint-disable-next-line no-new
new ThirdPartyDraggable(container.nativeElement, {
- itemSelector: '.op-add-existing-pane--wp',
+ itemSelector,
mirrorSelector: '.gu-mirror', // the dragging element that dragula renders
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
eventData: this.eventData.bind(this),
diff --git a/frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.ts b/frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.ts
index 98a2d395039..f3413796aab 100644
--- a/frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.ts
+++ b/frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.ts
@@ -54,7 +54,7 @@ import { HalResourceEditingService } from 'core-app/shared/components/fields/edi
import { HalResourceNotificationService } from 'core-app/features/hal/services/hal-resource-notification.service';
import { SchemaCacheService } from 'core-app/core/schemas/schema-cache.service';
import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';
-import { CalendarDragService } from 'core-app/features/team-planner/team-planner/calendar-drag.service';
+import { CalendarDragDropService } from 'core-app/features/team-planner/team-planner/calendar-drag-drop.service';
@Component({
selector: 'op-team-planner',
@@ -138,7 +138,7 @@ export class TeamPlannerComponent extends UntilDestroyedMixin implements OnInit,
readonly halNotification:HalResourceNotificationService,
readonly schemaCache:SchemaCacheService,
readonly apiV3Service:ApiV3Service,
- readonly calendarDrag:CalendarDragService,
+ readonly calendarDrag:CalendarDragDropService,
) {
super();
}