Update the cards whenever the work package was saved

pull/8230/head
Oliver Günther 5 years ago
parent c877886f26
commit 7448599318
No known key found for this signature in database
GPG Key ID: A3A8BDAD7C0C552C
  1. 15
      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(

Loading…
Cancel
Save