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
Also listen to relation changes to know when a new child was directly created
Henriette Darge9c5ca4fa37f5
diff --git a/frontend/src/app/features/work-packages/components/wp-relations/wp-relations.component.ts b/frontend/src/app/features/work-packages/components/wp-relations/wp-relations.component.tsindex 6f8ae6305fe..2d8e50640b2 100644--- a/frontend/src/app/features/work-packages/components/wp-relations/wp-relations.component.ts+++ b/frontend/src/app/features/work-packages/components/wp-relations/wp-relations.component.ts@@ -38,17 +38,20 @@ import {import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';import {debounceTime,- skip,takeUntil,} from 'rxjs/operators';import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destroyed.mixin';import { componentDestroyed } from '@w11k/ngx-componentdestroyed';import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';-import { WorkPackageRelationsService } from './wp-relations.service';+import {+ RelationsStateValue,+ WorkPackageRelationsService,+} from './wp-relations.service';import { PathHelperService } from 'core-app/core/path-helper/path-helper.service';import { TurboRequestsService } from 'core-app/core/turbo/turbo-requests.service';import { renderStreamMessage } from '@hotwired/turbo';import { HalEventsService } from 'core-app/features/hal/services/hal-events.service';+import { merge } from 'rxjs';@Component({selector: 'wp-relations',@@ -74,31 +77,29 @@ export class WorkPackageRelationsComponent extends UntilDestroyedMixin implementngOnInit() {this.turboFrameSrc = `${this.PathHelper.staticBase}/work_packages/${this.workPackage.id}/relations_tab`;+ }++ ngAfterViewInit() {+ // Listen to changes to this WP or relations+ merge(+ this.wpRelations.state(this.workPackage.id!).values$(),+ this.apiV3Service.work_packages.id(this.workPackage).requireAndStream(),+ ).pipe(+ takeUntil(componentDestroyed(this)),+ debounceTime(500),+ ).subscribe((res:WorkPackageResource|RelationsStateValue) => {+ if (res.$isHal) {+ this.workPackage = <WorkPackageResource>res;+ }- // Listen for changes to this WP.- this- .apiV3Service- .work_packages- .id(this.workPackage)- .requireAndStream()- .pipe(- skip(1),- takeUntil(componentDestroyed(this)),- debounceTime(500),- )- .subscribe((wp:WorkPackageResource) => {- this.workPackage = wp;-- void this.turboRequests.requestStream(this.turboFrameSrc)+ void this.turboRequests.requestStream(this.turboFrameSrc).then((result) => {renderStreamMessage(result.html);});- this.updateCounter();- });- }+ this.updateCounter();+ });- ngAfterViewInit() {/*We globally listen for turbo:submit-end events to know when a form submission ends.If the form action URL contains 'relation' or 'child', we know it is a relation or child creation/update.