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

Update the cards whenever the work package was saved

Oliver Günther744859931808
diff --git a/frontend/src/app/components/wp-card-view/wp-card-view.component.ts b/frontend/src/app/components/wp-card-view/wp-card-view.component.ts
index c2eb747696f..34c6fb87d50 100644
--- a/frontend/src/app/components/wp-card-view/wp-card-view.component.ts
+++ b/frontend/src/app/components/wp-card-view/wp-card-view.component.ts
@@ -36,6 +36,7 @@ import {DeviceService} from "core-app/modules/common/browser/device.service";
import {WorkPackageViewHandlerToken} from "core-app/modules/work_packages/routing/wp-view-base/event-handling/event-handler-registry";
import {UntilDestroyedMixin} from "core-app/helpers/angular/until-destroyed.mixin";
import {componentDestroyed} from "@w11k/ngx-componentdestroyed";
+import {HalEventsService} from "core-app/modules/hal/services/hal-events.service";
export type CardViewOrientation = 'horizontal'|'vertical';
@@ -98,6 +99,7 @@ export class WorkPackageCardViewComponent extends UntilDestroyedMixin implements
readonly wpCreate:WorkPackageCreateService,
readonly wpInlineCreate:WorkPackageInlineCreateService,
readonly notificationService:WorkPackageNotificationService,
+ readonly halEvents:HalEventsService,
readonly authorisationService:AuthorisationService,
readonly causedUpdates:CausedUpdatesService,
readonly cdRef:ChangeDetectorRef,
@@ -122,6 +124,19 @@ export class WorkPackageCardViewComponent extends UntilDestroyedMixin implements
this.cdRef.detectChanges();
});
+ // Observe changes to the work packages in this view
+ this.halEvents
+ .aggregated$('WorkPackage')
+ .pipe(
+ filter(events => {
+ const wpIds:string[] = this.workPackages.map(el => el.id!.toString());
+ return !!events.find(event => wpIds.indexOf(event.id) !== -1);
+ })
+ ).subscribe(() => {
+ this.workPackages = this.wpViewOrder.orderedWorkPackages();
+ this.cdRef.detectChanges();
+ });
+
this.querySpace.results
.values$()
.pipe(