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
split up API requests for relations in gantt chart
Oliver Günther1e2ec4ac717d
diff --git a/frontend/src/app/core/apiv3/endpoints/relations/apiv3-relations-paths.ts b/frontend/src/app/core/apiv3/endpoints/relations/apiv3-relations-paths.tsindex cc2956e0b9f..2aa1dd9a8e0 100644--- a/frontend/src/app/core/apiv3/endpoints/relations/apiv3-relations-paths.ts+++ b/frontend/src/app/core/apiv3/endpoints/relations/apiv3-relations-paths.ts@@ -28,12 +28,14 @@import { ApiV3GettableResource, ApiV3ResourceCollection } from 'core-app/core/apiv3/paths/apiv3-resource';import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';-import { from, Observable } from 'rxjs';+import { forkJoin, from, Observable } from 'rxjs';import { CollectionResource } from 'core-app/features/hal/resources/collection-resource';import { RelationResource } from 'core-app/features/hal/resources/relation-resource';import { map } from 'rxjs/operators';import { ApiV3Filter } from 'core-app/shared/helpers/api-v3/api-v3-filter-builder';+export const MAGIC_RELATION_SIZE = 100;+export class ApiV3RelationsPaths extends ApiV3ResourceCollection<RelationResource, ApiV3GettableResource<RelationResource>> {constructor(protected apiRoot:ApiV3Service,protected basePath:string) {@@ -50,6 +52,14 @@ export class ApiV3RelationsPaths extends ApiV3ResourceCollection<RelationResourc}public loadInvolved(workPackageIds:string[]):Observable<RelationResource[]> {+ if (workPackageIds.length > MAGIC_RELATION_SIZE) {+ const chunks = _.chunk(workPackageIds, MAGIC_RELATION_SIZE);+ return forkJoin(chunks.map((chunk) => this.loadInvolved(chunk)))+ .pipe(+ map((results) => _.flatten(results)),+ );+ }+const validIds = _.filter(workPackageIds, (id) => /\d+/.test(id));if (validIds.length === 0) {