Remove the overridden schema for new work packages once saved

We still have components that use a new work package and its form schema
set by the `overriddenSchema` property. We should get rid of this
and instead let them use the edit resource in the long run.
pull/5799/head
Oliver Günther 7 years ago
parent 4a8a16f82c
commit 0bee148c27
No known key found for this signature in database
GPG Key ID: 88872239EB414F99
  1. 1
      frontend/app/components/api/api-v3/hal-resources/work-package-resource.service.ts
  2. 12
      frontend/app/components/wp-edit-form/work-package-changeset.ts

@ -124,6 +124,7 @@ export class WorkPackageResource extends HalResource {
public attachments:AttachmentCollectionResourceInterface;
public pendingAttachments:UploadFile[] = [];
public overriddenSchema?:SchemaResource;
public get id():string {
return this.$source.id || this.idFromLink;

@ -61,9 +61,14 @@ export class WorkPackageChangeset {
'wpCacheService', 'wpCreate'
);
// Start with a resource from the current work package knowledge.
const payload = this.mergeWithPayload(workPackage.$plain);
this.buildResource(payload);
if (this.workPackage.isNew) {
// New work packages have no schema set yet, so update the form immediately to get one
this.updateForm();
} else {
// Start with a resource from the current work package knowledge.
const payload = this.mergeWithPayload(workPackage.$plain);
this.buildResource(payload);
}
}
public startEditing(key:string) {
@ -185,6 +190,7 @@ export class WorkPackageChangeset {
this.workPackage.updateActivities();
if (wasNew) {
this.workPackage.overriddenSchema = undefined;
this.workPackage.uploadAttachmentsAndReload();
this.wpCreate.newWorkPackageCreated(this.workPackage);
}

Loading…
Cancel
Save