Skip to content

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

Use valid_subset option.

Pavel Balashou84a98b07a37d
diff --git a/app/services/api/v3/work_package_collection_from_query_params_service.rb b/app/services/api/v3/work_package_collection_from_query_params_service.rb
index 049dec770d9..486dd04cc3a 100644
--- a/app/services/api/v3/work_package_collection_from_query_params_service.rb
+++ b/app/services/api/v3/work_package_collection_from_query_params_service.rb
@@ -39,7 +39,7 @@ module API
WorkPackageCollectionFromQueryService
.new(query, current_user, scope:)
- .call(params)
+ .call(params, valid_subset: params['valid_subset'].present?)
end
private
diff --git a/frontend/src/app/core/apiv3/cache/state-cache.service.ts b/frontend/src/app/core/apiv3/cache/state-cache.service.ts
index 51cbe323311..08176e08fbd 100644
--- a/frontend/src/app/core/apiv3/cache/state-cache.service.ts
+++ b/frontend/src/app/core/apiv3/cache/state-cache.service.ts
@@ -152,7 +152,12 @@ export class StateCacheService<T> {
}
observeSome(ids:string[]):Observable<T[]> {
- return combineLatest(ids.map((id) => this.observe(id)));
+ return combineLatest(
+ ids.map(
+ (id) => this.observe(id).pipe(startWith(null))
+ )).pipe(
+ map((values) => values.filter((value) => !!value)),
+ ) as Observable<T[]>;
}
/**
diff --git a/frontend/src/app/core/apiv3/endpoints/work_packages/api-v3-work-packages-paths.ts b/frontend/src/app/core/apiv3/endpoints/work_packages/api-v3-work-packages-paths.ts
index b76186aa88b..831ae462b3d 100644
--- a/frontend/src/app/core/apiv3/endpoints/work_packages/api-v3-work-packages-paths.ts
+++ b/frontend/src/app/core/apiv3/endpoints/work_packages/api-v3-work-packages-paths.ts
@@ -163,7 +163,10 @@ export class ApiV3WorkPackagesPaths extends ApiV3Collection<WorkPackageResource,
.halResourceService
.getAllPaginated(
this.path,
- { filters: ApiV3Filter('id', '=', ids).toJson() },
+ {
+ filters: ApiV3Filter('id', '=', ids).toJson(),
+ valid_subset: true,
+ },
)
.toPromise() as Promise<WorkPackageCollectionResource[]>;
}
diff --git a/frontend/src/app/core/global_search/input/global-search-input.component.ts b/frontend/src/app/core/global_search/input/global-search-input.component.ts
index 42a4e07da0d..967ee7c3799 100644
--- a/frontend/src/app/core/global_search/input/global-search-input.component.ts
+++ b/frontend/src/app/core/global_search/input/global-search-input.component.ts
@@ -38,7 +38,7 @@ import {
ViewChild,
ViewEncapsulation,
} from '@angular/core';
-import { BehaviorSubject, Observable } from 'rxjs';
+import { BehaviorSubject, Observable, of } from 'rxjs';
import { first, map, tap } from 'rxjs/operators';
import { GlobalSearchService } from 'core-app/core/global_search/services/global-search.service';
import { isClickedWithModifier } from 'core-app/shared/helpers/link-handling/link-handling';
@@ -229,6 +229,8 @@ export class GlobalSearchInputComponent implements AfterViewInit, OnDestroy {
public onFocus():void {
this.expanded = true;
this.toggleTopMenuClass();
+ this.ngSelectComponent.typeahead?.next(' ');
+ this.ngSelectComponent.typeahead?.next('');
this.ngSelectComponent.openSelect();
}
@@ -294,9 +296,12 @@ export class GlobalSearchInputComponent implements AfterViewInit, OnDestroy {
private autocompleteWorkPackages(query:string):Observable<(WorkPackageResource|SearchOptionItem)[]> {
if (!query) {
const wpIds = this.recentItemsService.getAll();
- void this.apiV3Service
- .work_packages
- .requireAll(wpIds);
+ // It is needed, because otherwise we get infinite spin running
+ // in the searchbar with no recent workpackages IDs inside localStorage
+ if(wpIds.length === 0) {
+ return of([]);
+ }
+ void this.apiV3Service.work_packages.requireAll(wpIds);
return this.apiV3Service.work_packages.cache.observeSome(wpIds);
}
diff --git a/frontend/src/app/features/hal/services/hal-resource.service.ts b/frontend/src/app/features/hal/services/hal-resource.service.ts
index 246684e9074..b35c9be1997 100644
--- a/frontend/src/app/features/hal/services/hal-resource.service.ts
+++ b/frontend/src/app/features/hal/services/hal-resource.service.ts
@@ -150,7 +150,7 @@ export class HalResourceService {
*/
public getAllPaginated<T extends CollectionResource>(
href:string,
- params:Record<string, string|number> = {},
+ params:Record<string, string|number|boolean> = {},
headers:HTTPClientHeaders = {},
):Observable<T[]> {
return getPaginatedCollections(