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
Merge branch 'dev' into implementation/44376-add-selection-state-logic-and-file-link-creation
Eric Schubert165d6bb4448e
diff --cc frontend/src/app/core/state/file-links/file-links.service.tsindex 7c1be8ed5b0,a397d97ea13..09354a7c146--- a/frontend/src/app/core/state/file-links/file-links.service.ts+++ b/frontend/src/app/core/state/file-links/file-links.service.ts@@@ -26,9 -26,8 +26,9 @@@// See COPYRIGHT and LICENSE files for more details.//+++import { applyTransaction } from '@datorama/akita';import { Injectable } from '@angular/core';--import { HttpClient, HttpHeaders } from '@angular/common/http';++import { HttpHeaders } from '@angular/common/http';import { from } from 'rxjs';import {catchError,@@@ -44,10 -42,12 +44,11 @@@ import { IHALCollection } from 'core-apimport { ToastService } from 'core-app/shared/components/toaster/toast.service';import { FileLinksStore } from 'core-app/core/state/file-links/file-links.store';import { insertCollectionIntoState, removeEntityFromCollectionAndState } from 'core-app/core/state/collection-store';-import idFromLink from 'core-app/features/hal/helpers/id-from-link';-import {- CollectionStore,- ResourceCollectionService,-} from 'core-app/core/state/resource-collection.service';+import { CollectionStore, ResourceCollectionService } from 'core-app/core/state/resource-collection.service';+import { IHalResourceLink } from 'core-app/core/state/hal-resource';+import { IStorageFile } from 'core-app/core/state/storage-files/storage-file.model';+ import { InjectField } from 'core-app/shared/helpers/angular/inject-field.decorator';+import idFromLink from 'core-app/features/hal/helpers/id-from-link';@Injectable()export class FileLinksResourceService extends ResourceCollectionService<IFileLink> {@@@ -109,46 -104,7 +105,50 @@@.subscribe(() => removeEntityFromCollectionAndState(this.store, fileLink.id, collectionKey));}+ addFileLinks(collectionKey:string, addFileLinksHref:string, storage:IHalResourceLink, filesToLink:IStorageFile[]):void {+ const elements = filesToLink.map((file) => ({+ originData: {+ id: file.id,+ name: file.name,+ mimeType: file.mimeType,+ size: file.size,+ createdAt: file.createdAt,+ lastModifiedAt: file.lastModifiedAt,+ createdByName: file.createdByName,+ lastModifiedByName: file.lastModifiedByName,+ },+ _links: { storage },+ }));++ this.http+ .post<IHALCollection<IFileLink>>(addFileLinksHref, { _type: 'Collection', _embedded: { elements } })+ .pipe(+ tap((collection) => {+ applyTransaction(() => {+ const newFileLinks = collection._embedded.elements;+ this.store.add(newFileLinks);+ this.store.update(({ collections }) => (+ {+ collections: {+ ...collections,+ [collectionKey]: {+ ...collections[collectionKey],+ ids: (collections[collectionKey]?.ids || []).concat(newFileLinks.map((link) => link.id)),+ },+ },+ }+ ));+ });+ }),+ catchError((error) => {+ this.toastService.addError(error);+ throw error;+ }),+ )+ .subscribe();+ }+++ protected basePath():string {+ return this.apiV3Service.file_links.path;+ }}