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
[#43693] added file links to work package creation payload
Eric Schubert46705432426a
diff --git a/frontend/src/app/core/path-helper/path-helper.service.ts b/frontend/src/app/core/path-helper/path-helper.service.tsindex 09d6c63a039..bb5ccb1e495 100644--- a/frontend/src/app/core/path-helper/path-helper.service.ts+++ b/frontend/src/app/core/path-helper/path-helper.service.ts@@ -54,6 +54,10 @@ export class PathHelperService {return `${this.staticBase}/attachments/${attachmentIdentifier}/content`;}+ public fileLinksPath():string {+ return `${this.staticBase}/file_links`;+ }+public ifcModelsPath(projectIdentifier:string) {return `${this.staticBase}/projects/${projectIdentifier}/ifc_models`;}diff --git a/frontend/src/app/features/work-packages/components/wp-single-view/wp-single-view.component.ts b/frontend/src/app/features/work-packages/components/wp-single-view/wp-single-view.component.tsindex 8e388d06ee5..65a4646b5ea 100644--- a/frontend/src/app/features/work-packages/components/wp-single-view/wp-single-view.component.ts+++ b/frontend/src/app/features/work-packages/components/wp-single-view/wp-single-view.component.ts@@ -154,12 +154,6 @@ export class WorkPackageSingleViewComponent extends UntilDestroyedMixin implemenstorages$ = new BehaviorSubject<IStorage[]>([]);- public get workPackageWithProjectContext():WorkPackageResource {- const clone = Object.create(this.workPackage) as WorkPackageResource;- clone.project = { id: this.projectContext.id };- return clone;- }-constructor(protected readonly injector:Injector,private readonly states:States,@@ -207,8 +201,13 @@ export class WorkPackageSingleViewComponent extends UntilDestroyedMixin implemenconst isNew = isNewResource(this.workPackage);const resource = change.projectedResource;+ if (!this.currentProject.inProjectContext) {+ this.workPackage.project = resource.project;+ }+if (!resource.project) {this.projectContext = { matches: false, href: null, id: null };+ this.storages$.next([]);} else {const project = resource.project as unknown&{ href:string, id:string };const workPackageId = this.workPackage.id;diff --git a/frontend/src/app/features/work-packages/components/wp-single-view/wp-single-view.html b/frontend/src/app/features/work-packages/components/wp-single-view/wp-single-view.htmlindex b9805154f75..e2644d96d01 100644--- a/frontend/src/app/features/work-packages/components/wp-single-view/wp-single-view.html+++ b/frontend/src/app/features/work-packages/components/wp-single-view/wp-single-view.html@@ -146,7 +146,7 @@<op-storage*ngFor="let storage of storages$ | async"- [resource]="workPackageWithProjectContext"+ [resource]="workPackage"[storage]="storage"[allowLinking]="true"[allowUploading]="true"diff --git a/frontend/src/app/shared/components/fields/changeset/resource-changeset.ts b/frontend/src/app/shared/components/fields/changeset/resource-changeset.tsindex 87fde4fb843..e068dc5fc45 100644--- a/frontend/src/app/shared/components/fields/changeset/resource-changeset.ts+++ b/frontend/src/app/shared/components/fields/changeset/resource-changeset.ts@@ -9,6 +9,7 @@ import { take } from 'rxjs/operators';import { SchemaCacheService } from 'core-app/core/schemas/schema-cache.service';import { SchemaProxy } from 'core-app/features/hal/schemas/schema-proxy';import isNewResource from 'core-app/features/hal/helpers/is-new-resource';+import { IHalResourceLink } from 'core-app/core/state/hal-resource';export const PROXY_IDENTIFIER = '__is_changeset_proxy';@@ -380,7 +381,7 @@ export class ResourceChangeset<T extends HalResource = HalResource> {}// Add attachments to be assigned.- // They will already be created on the server but now+ // They will already be created on the server, but now// we need to claim them for the newly created work package.if (this.pristineResource.attachments) {payload._links.attachments = this.pristineResource@@ -388,6 +389,14 @@ export class ResourceChangeset<T extends HalResource = HalResource> {.elements.map((a:HalResource) => ({ href: a.href }));}++ // Add file links to be assigned.+ if (this.pristineResource.fileLinks) {+ payload._links.fileLinks = this.pristineResource+ .fileLinks+ .elements+ .map((fl:IHalResourceLink) => ({ href: fl.href }));+ }} else {// Otherwise, simply use the bare minimumpayload = this.minimalPayload;diff --git a/frontend/src/app/shared/components/storages/storage/storage.component.ts b/frontend/src/app/shared/components/storages/storage/storage.component.tsindex 3ed8eba3cca..60fa9256a41 100644--- a/frontend/src/app/shared/components/storages/storage/storage.component.ts+++ b/frontend/src/app/shared/components/storages/storage/storage.component.ts@@ -82,6 +82,7 @@ import { UploadFile } from 'core-app/core/file-upload/op-file-upload.service';import { StorageFilesResourceService } from 'core-app/core/state/storage-files/storage-files.service';import { IUploadLink } from 'core-app/core/state/storage-files/upload-link.model';import { TimezoneService } from 'core-app/core/datetime/timezone.service';+import { PathHelperService } from 'core-app/core/path-helper/path-helper.service';@Component({selector: 'op-storage',@@ -155,7 +156,7 @@ export class StorageComponent extends UntilDestroyedMixin implements OnInit, OnDprivate get addFileLinksHref():string {if (isNewResource(this.resource)) {- return '/api/v3/file_links';+ return this.pathHelperService.fileLinksPath();}return (this.resource.$links as unknown&{ addFileLink:IHalResourceLink }).addFileLink.href;@@ -184,6 +185,7 @@ export class StorageComponent extends UntilDestroyedMixin implements OnInit, OnDprivate readonly cookieService:CookieService,private readonly opModalService:OpModalService,private readonly timezoneService:TimezoneService,+ private readonly pathHelperService:PathHelperService,private readonly currentUserService:CurrentUserService,private readonly fileLinkResourceService:FileLinksResourceService,private readonly storageFilesResourceService:StorageFilesResourceService,