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
Update target list when matching halEvent arrives
Oliver Güntherc123092633f3
diff --git a/frontend/src/app/components/op-context-menu/handlers/wp-status-dropdown-menu.directive.ts b/frontend/src/app/components/op-context-menu/handlers/wp-status-dropdown-menu.directive.tsindex 987a8aa99b8..05f7f19f250 100644--- a/frontend/src/app/components/op-context-menu/handlers/wp-status-dropdown-menu.directive.ts+++ b/frontend/src/app/components/op-context-menu/handlers/wp-status-dropdown-menu.directive.ts@@ -91,7 +91,6 @@ export class WorkPackageStatusDropdownDirective extends OpContextMenuTrigger {.save(change).then(() => {this.workPackageNotificationService.showSave(this.workPackage);- this.halEvents.push(this.workPackage, { eventType: 'updated' });});}}diff --git a/frontend/src/app/modules/boards/board/board-list/board-list.component.ts b/frontend/src/app/modules/boards/board/board-list/board-list.component.tsindex 1ccfaeae5a9..e12aa7da7be 100644--- a/frontend/src/app/modules/boards/board/board-list/board-list.component.ts+++ b/frontend/src/app/modules/boards/board/board-list/board-list.component.ts@@ -53,7 +53,8 @@ import {StateService, TransitionService} from "@uirouter/core";import {WorkPackageViewFocusService} from "core-app/modules/work_packages/routing/wp-view-base/view-services/wp-view-focus.service";import {WorkPackageViewSelectionService} from "core-app/modules/work_packages/routing/wp-view-base/view-services/wp-view-selection.service";import {BoardListCrossSelectionService} from "core-app/modules/boards/board/board-list/board-list-cross-selection.service";-import {debounceTime} from "rxjs/operators";+import {debounceTime, filter, map} from "rxjs/operators";+import {HalEvent, HalEventsService} from "core-app/modules/hal/services/hal-events.service";export interface DisabledButtonPlaceholder {text:string;@@ -136,6 +137,7 @@ export class BoardListComponent extends AbstractWidgetComponent implements OnInireadonly notifications:NotificationsService,readonly querySpace:IsolatedQuerySpace,readonly halNotification:HalResourceNotificationService,+ readonly halEvents:HalEventsService,readonly wpStatesInitialization:WorkPackageStatesInitializationService,readonly wpViewFocusService:WorkPackageViewFocusService,readonly wpViewSelectionService:WorkPackageViewSelectionService,@@ -211,6 +213,9 @@ export class BoardListComponent extends AbstractWidgetComponent implements OnIni).subscribe(() => this.updateQuery(true));+ // Listen to changes to action attribute+ this.listenToActionAttributeChanges();+this.querySpace.query.values$().pipe(@@ -426,4 +431,24 @@ export class BoardListComponent extends AbstractWidgetComponent implements OnInithis.columnsQueryProps = newColumnsQueryProps;}++ private listenToActionAttributeChanges() {++ // If we don't have an action attribute+ // nothing to do+ if (!this.board.actionAttribute) {+ return;+ }++ // Listen to hal events to detect changes to an action attribute+ this.halEvents+ .events$+ .pipe(+ filter(event => event.resourceType === 'WorkPackage'),+ map((event:HalEvent) => event.commit?.changes[this.board.actionAttribute!]),+ filter((value:HalResource|undefined) => this.actionResource?.href === value?.href)+ ).subscribe((event) => {+ this.updateQuery(true);+ });+ }}diff --git a/frontend/src/app/modules/fields/edit/edit-form/edit-form.component.ts b/frontend/src/app/modules/fields/edit/edit-form/edit-form.component.tsindex cc9fe99995a..68df3eef011 100644--- a/frontend/src/app/modules/fields/edit/edit-form/edit-form.component.ts+++ b/frontend/src/app/modules/fields/edit/edit-form/edit-form.component.ts@@ -43,6 +43,7 @@ import {IFieldSchema} from "core-app/modules/fields/field.base";import {EditFieldHandler} from "core-app/modules/fields/edit/editing-portal/edit-field-handler";import {EditingPortalService} from "core-app/modules/fields/edit/editing-portal/editing-portal-service";import {EditFormRoutingService} from "core-app/modules/fields/edit/edit-form/edit-form-routing.service";+import {ResourceChangesetCommit} from "core-app/modules/fields/edit/services/hal-resource-editing.service";@Component({selector: 'edit-form,[edit-form]',@@ -129,9 +130,8 @@ export class EditFormComponent extends EditForm<HalResource> implements OnInit,ctrl.deactivate(focus);}- public onSaved(isInitial:boolean, saved:HalResource) {- super.onSaved(isInitial, saved);- this.stopEditingAndLeave(saved, isInitial);+ public onSaved(commit:ResourceChangesetCommit) {+ this.stopEditingAndLeave(commit.resource, commit.wasNew);}public requireVisible(fieldName:string):Promise<void> {@@ -196,7 +196,7 @@ export class EditFormComponent extends EditForm<HalResource> implements OnInit,public stopEditingAndLeave(savedResource:HalResource, isInitial:boolean) {this.stop();- this.onSavedEmitter.emit({savedResource, isInitial});+ this.onSavedEmitter.emit({ savedResource, isInitial });}protected focusOnFirstError():void {diff --git a/frontend/src/app/modules/fields/edit/edit-form/edit-form.ts b/frontend/src/app/modules/fields/edit/edit-form/edit-form.tsindex 17b040d7e46..1b68f4415c2 100644--- a/frontend/src/app/modules/fields/edit/edit-form/edit-form.ts+++ b/frontend/src/app/modules/fields/edit/edit-form/edit-form.ts@@ -32,7 +32,10 @@ import {Subscription} from 'rxjs';import {States} from 'core-components/states.service';import {IFieldSchema} from "core-app/modules/fields/field.base";-import {HalResourceEditingService} from "core-app/modules/fields/edit/services/hal-resource-editing.service";+import {+ HalResourceEditingService,+ ResourceChangesetCommit+} from "core-app/modules/fields/edit/services/hal-resource-editing.service";import {HalEventsService} from "core-app/modules/hal/services/hal-events.service";import {EditFieldHandler} from "core-app/modules/fields/edit/editing-portal/edit-field-handler";import {HalResource} from "core-app/modules/hal/resources/hal-resource";@@ -87,9 +90,8 @@ export abstract class EditForm<T extends HalResource = HalResource> {/*** Optional callback when the form is being saved*/- protected onSaved(isInitial:boolean, saved:HalResource):void {- const eventType = isInitial ? 'created' : 'updated';- this.halEvents.push(saved, { eventType });+ protected onSaved(commit:ResourceChangesetCommit):void {+ // Does nothing by default}protected abstract focusOnFirstError():void;@@ -190,7 +192,7 @@ export abstract class EditForm<T extends HalResource = HalResource> {this.halNotification.showSave(result.resource, result.wasNew);this.editMode = false;- this.onSaved(result.wasNew, result.resource);+ this.onSaved(result);this.change.inFlight = false;}).catch((error:ErrorResource|Object) => {diff --git a/frontend/src/app/modules/fields/edit/services/hal-resource-editing.service.ts b/frontend/src/app/modules/fields/edit/services/hal-resource-editing.service.tsindex 362716b454b..1b842434ed2 100644--- a/frontend/src/app/modules/fields/edit/services/hal-resource-editing.service.ts+++ b/frontend/src/app/modules/fields/edit/services/hal-resource-editing.service.ts@@ -36,6 +36,7 @@ import {ResourceChangeset} from "core-app/modules/fields/changeset/resource-chanimport {HalResource} from "core-app/modules/hal/resources/hal-resource";import {StateCacheService} from "core-components/states/state-cache.service";import {HookService} from "core-app/modules/plugins/hook-service";+import {HalEventsService} from "core-app/modules/hal/services/hal-events.service";class ChangesetStates extends StatesGroup {name = 'Changesets';@@ -98,6 +99,7 @@ export class HalResourceEditingService extends StateCacheService<ResourceChangesprivate stateGroup = new ChangesetStates();constructor(protected readonly injector:Injector,+ protected readonly halEvents:HalEventsService,protected readonly hook:HookService) {super();}@@ -125,6 +127,9 @@ export class HalResourceEditingService extends StateCacheService<ResourceChangesthis.comittedChanges.next(commit);this.reset(change);+ const eventType = commit.wasNew ? 'created' : 'updated';+ this.halEvents.push(commit.resource, { eventType, commit });+return commit;}diff --git a/frontend/src/app/modules/hal/services/hal-events.service.ts b/frontend/src/app/modules/hal/services/hal-events.service.tsindex 25751116a17..d3d25c308d7 100644--- a/frontend/src/app/modules/hal/services/hal-events.service.ts+++ b/frontend/src/app/modules/hal/services/hal-events.service.ts@@ -2,11 +2,13 @@ import {Injectable} from "@angular/core";import {Observable, Subject} from "rxjs";import {buffer, debounceTime, filter, scan} from "rxjs/operators";import {HalResource} from "core-app/modules/hal/resources/hal-resource";+import {ResourceChangesetCommit} from "core-app/modules/fields/edit/services/hal-resource-editing.service";export interface HalEvent {id:string;eventType:string;resourceType:string;+ commit?:ResourceChangesetCommit;}export interface HalCreatedEvent extends HalEvent {@@ -48,7 +50,7 @@ export class HalEventsService {);}- public push(resourceReference:HalResource|{id:string, _type:string}, event:Partial<HalEventTypes>) {+ public push(resourceReference:HalResource|{ id:string, _type:string }, event:Partial<HalEventTypes>) {event.id = resourceReference.id!;event.resourceType = resourceReference._type!;