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
Use the UpdateForm method to reload form for time entries, wps
Oliver Güntherec975e047399
diff --git a/frontend/src/app/components/time-entries/time-entry-changeset.ts b/frontend/src/app/components/time-entries/time-entry-changeset.tsindex 68a285bae37..b3997bc3dd5 100644--- a/frontend/src/app/components/time-entries/time-entry-changeset.ts+++ b/frontend/src/app/components/time-entries/time-entry-changeset.ts@@ -7,10 +7,8 @@ export class TimeEntryChangeset extends ResourceChangeset<TimeEntryResource> {super.setValue(key, val);// Update the form for fields that may alter the form itself- // when the time entry is new. Otherwise, the save request afterwards- // will update the form automatically.- if (this.pristineResource.isNew && (key === 'workPackage')) {- this.updateForm().then(() => this.push());+ if (key === 'workPackage') {+ this.updateForm();}}diff --git a/frontend/src/app/components/wp-edit/work-package-changeset.ts b/frontend/src/app/components/wp-edit/work-package-changeset.tsindex 157cb5d0c50..f0195c95b08 100644--- a/frontend/src/app/components/wp-edit/work-package-changeset.ts+++ b/frontend/src/app/components/wp-edit/work-package-changeset.ts@@ -7,8 +7,7 @@ export class WorkPackageChangeset extends ResourceChangeset<WorkPackageResource>super.setValue(key, val);if (key === 'project' || key === 'type') {- this.form$.clear(`${key} changed in a new work package`);- this.getForm();+ this.updateForm();}}diff --git a/frontend/src/app/modules/fields/changeset/resource-changeset.ts b/frontend/src/app/modules/fields/changeset/resource-changeset.tsindex 3a25fde5079..1b8bc47cf4f 100644--- a/frontend/src/app/modules/fields/changeset/resource-changeset.ts+++ b/frontend/src/app/modules/fields/changeset/resource-changeset.ts@@ -6,6 +6,7 @@ import {input, InputState} from "reactivestates";import {IFieldSchema} from "core-app/modules/fields/field.base";import {debugLog} from "core-app/helpers/debug_output";import {take} from "rxjs/operators";+import {Form} from "@angular/forms";/*** Temporary class living while a resource is being edited@@ -68,23 +69,22 @@ export class ResourceChangeset<T extends HalResource|{ [key:string]:unknown; } =}+++ public getSchemaName(attribute:string):string {+ if (this.projectedResource.getSchemaName) {+ return this.projectedResource.getSchemaName(attribute);+ } else {+ return attribute;+ }+ }+/**- * Returns the current work package form.- * This may be different from the base form when project or type is changed.+ * Returns the cached form or loads it if necessary.*/public getForm():Promise<FormResource> {if (this.form$.isPristine() && !this.form$.hasActivePromiseRequest()) {- const promise = this- .updateForm()- .then((form) => {- this.form$.putValue(form);- this.setNewDefaults(form);- this.push();- return form;- });-- this.form$.putFromPromiseIfPristine(() => promise);- return promise;+ return this.updateForm();}return this@@ -94,23 +94,26 @@ export class ResourceChangeset<T extends HalResource|{ [key:string]:unknown; } =.toPromise();}- public getSchemaName(attribute:string):string {- if (this.projectedResource.getSchemaName) {- return this.projectedResource.getSchemaName(attribute);- } else {- return attribute;- }- }/**- * Update the form resource from the API.+ * Posts to the form with the current changes+ * to get the up to date projected object.*/protected updateForm():Promise<FormResource> {let payload = this.buildPayloadFromChanges();- return this.pristineResource+ const promise = this.pristineResource.$links- .update(payload);+ .update(payload)+ .then((form:FormResource) => {+ this.form$.putValue(form);+ this.setNewDefaults(form);+ this.push();+ return form;+ });++ this.form$.putFromPromiseIfPristine(() => promise);+ return promise;}/**