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
Actually load all pages in the relations view
Oliver Güntherfb453dbd3b39
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 556f2ede556..5d5f063e850 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@@ -59,11 +59,7 @@ export class ApiV3RelationsPaths extends ApiV3ResourceCollection<RelationResourcreturn this.filtered(ApiV3Filter('involved', '=', validIds),- { pageSize: '-1' },)- .get()- .pipe(- map((collection) => collection.elements),- );+ .getPaginatedResults();}}diff --git a/frontend/src/app/core/apiv3/paths/apiv3-resource.ts b/frontend/src/app/core/apiv3/paths/apiv3-resource.tsindex 479caab428d..768ba6180c5 100644--- a/frontend/src/app/core/apiv3/paths/apiv3-resource.ts+++ b/frontend/src/app/core/apiv3/paths/apiv3-resource.ts@@ -1,7 +1,10 @@/* eslint-disable max-classes-per-file */import { Constructor } from '@angular/cdk/table';-import { SimpleResource, SimpleResourceCollection } from 'core-app/core/apiv3/paths/path-resources';+import {+ SimpleResource,+ SimpleResourceCollection,+} from 'core-app/core/apiv3/paths/path-resources';import { InjectField } from 'core-app/shared/helpers/angular/inject-field.decorator';import { HalResourceService } from 'core-app/features/hal/services/hal-resource.service';import { Observable } from 'rxjs';@@ -12,6 +15,7 @@ import {} from 'core-app/shared/helpers/api-v3/api-v3-filter-builder';import { HalResource } from 'core-app/features/hal/resources/hal-resource';import { CollectionResource } from 'core-app/features/hal/resources/collection-resource';+import { getPaginatedResults } from 'core-app/core/apiv3/helpers/get-paginated-results';export class ApiV3ResourcePath<T = HalResource> extends SimpleResource {readonly injector = this.apiRoot.injector;@@ -42,7 +46,20 @@ export class ApiV3GettableResource<T = HalResource> extends ApiV3ResourcePath<T>public get():Observable<T> {return this.halResourceService- .get(this.path) as any;+ .get(this.path) as unknown as Observable<T>;+ }+}++export class ApiV3GettableResourceCollection<T = HalResource, V = CollectionResource<T>> extends ApiV3GettableResource<V> {+ /**+ * Perform a request to the HalResourceService with the current path,+ * loading all pages into a single array+ */+ public getPaginatedResults():Observable<T[]> {+ return getPaginatedResults<T>(+ (pageParams) => this.halResourceService.request<CollectionResource<T>>('get', this.path, pageParams),+ -1,+ );}}@@ -61,14 +78,14 @@ export class ApiV3ResourceCollection<V, T extends ApiV3GettableResource<V>> exte/*** Returns an instance of T for the given singular resource ID.*- * @param id Identifier of the resource, may be a string or number, or a HalResource with id property.+ * @param input Identifier of the resource, may be a string or number, or a HalResource with id property.*/public id(input:string|number|{ id:string|null }):T {let id:string;if (typeof input === 'string' || typeof input === 'number') {id = input.toString();} else {- id = input.id!;+ id = input.id as string;}return new (this.resource || ApiV3GettableResource)(this.apiRoot, this.path, id, this) as T;@@ -101,8 +118,9 @@ export class ApiV3ResourceCollection<V, T extends ApiV3GettableResource<V>> exte** @param filters filter object to filter with* @param params additional URL params to append+ * @param resourceClass The APIV3 resource class to instantiate*/- public filtered<R = ApiV3GettableResource<CollectionResource<V>>>(filters:ApiV3FilterBuilder, params:{ [key:string]:string } = {}, resourceClass?:Constructor<R>):R {+ public filtered<R = ApiV3GettableResourceCollection<V>>(filters:ApiV3FilterBuilder, params:{ [key:string]:string } = {}, resourceClass?:Constructor<R>):R {const url = new URL(this.path, window.location.origin);if (url.searchParams.has('filters')) {@@ -118,7 +136,7 @@ export class ApiV3ResourceCollection<V, T extends ApiV3GettableResource<V>> exteurl.searchParams.set(key, params[key]);});- const cls = resourceClass || ApiV3GettableResource;+ const cls = resourceClass || ApiV3GettableResourceCollection;// eslint-disable-next-line new-capreturn new cls(this.apiRoot, url.pathname, url.search, this) as R;}