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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Trigger change detection cycle on any hal event
Oliver Güntherfd2ebd7b51f5
diff --git a/frontend/src/app/features/work-packages/components/wp-custom-actions/wp-custom-actions/wp-custom-action.component.ts b/frontend/src/app/features/work-packages/components/wp-custom-actions/wp-custom-actions/wp-custom-action.component.tsindex fb9cd88bfb4..a126f6360cb 100644--- a/frontend/src/app/features/work-packages/components/wp-custom-actions/wp-custom-actions/wp-custom-action.component.ts+++ b/frontend/src/app/features/work-packages/components/wp-custom-actions/wp-custom-actions/wp-custom-action.component.ts@@ -26,26 +26,30 @@// See COPYRIGHT and LICENSE files for more details.//++-import {- ChangeDetectionStrategy, Component, HostListener, Input,-} from '@angular/core';+import { ChangeDetectionStrategy, ChangeDetectorRef, Component, HostListener, Input, OnInit } from '@angular/core';import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';import { CustomActionResource } from 'core-app/features/hal/resources/custom-action-resource';import { HalEventsService } from 'core-app/features/hal/services/hal-events.service';-import { HalResourceEditingService } from 'core-app/shared/components/fields/edit/services/hal-resource-editing.service';+import {+ HalResourceEditingService,+} from 'core-app/shared/components/fields/edit/services/hal-resource-editing.service';import { HalResourceService } from 'core-app/features/hal/services/hal-resource.service';import { ResourceChangeset } from 'core-app/shared/components/fields/changeset/resource-changeset';-import { SchemaCacheService } from 'core-app/core/schemas/schema-cache.service';-import { WorkPackageNotificationService } from 'core-app/features/work-packages/services/notifications/work-package-notification.service';+import {+ WorkPackageNotificationService,+} from 'core-app/features/work-packages/services/notifications/work-package-notification.service';import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';-import { WorkPackagesActivityService } from 'core-app/features/work-packages/components/wp-single-view-tabs/activity-panel/wp-activity.service';+import {+ WorkPackagesActivityService,+} from 'core-app/features/work-packages/components/wp-single-view-tabs/activity-panel/wp-activity.service';+import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destroyed.mixin';@Component({selector: 'wp-custom-action',templateUrl: './wp-custom-action.component.html',changeDetection: ChangeDetectionStrategy.OnPush,})-export class WpCustomActionComponent {+export class WpCustomActionComponent extends UntilDestroyedMixin implements OnInit {@Input() workPackage:WorkPackageResource;@Input() action:CustomActionResource;@@ -53,12 +57,23 @@ export class WpCustomActionComponent {constructor(private halResourceService:HalResourceService,private apiV3Service:ApiV3Service,- private wpSchemaCacheService:SchemaCacheService,private wpActivity:WorkPackagesActivityService,private notificationService:WorkPackageNotificationService,private halEditing:HalResourceEditingService,private halEvents:HalEventsService,+ private cdRef:ChangeDetectorRef,) {+ super();+ }++ ngOnInit() {+ this+ .halEvents+ .events$+ .pipe(+ this.untilDestroyed(),+ )+ .subscribe(() => this.cdRef.detectChanges());}private fetchAction() {@@ -103,11 +118,13 @@ export class WpCustomActionComponent {this.halEditing.stopEditing(savedWp);this.halEvents.push(savedWp, { eventType: 'updated' });this.change.inFlight = false;+ this.cdRef.detectChanges();});},(errorResource) => {this.notificationService.handleRawError(errorResource, this.workPackage);this.change.inFlight = false;+ this.cdRef.detectChanges();},);}