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

Clear the checksum service to ensure query_props remain empty

Oliver Güntherc5fc4ec14d42
diff --git a/frontend/src/app/core/apiv3/endpoints/queries/apiv3-queries-paths.ts b/frontend/src/app/core/apiv3/endpoints/queries/apiv3-queries-paths.ts
index 333b38b3acb..5cfc1f1047c 100644
--- a/frontend/src/app/core/apiv3/endpoints/queries/apiv3-queries-paths.ts
+++ b/frontend/src/app/core/apiv3/endpoints/queries/apiv3-queries-paths.ts
@@ -74,7 +74,7 @@ export class ApiV3QueriesPaths extends ApiV3ResourceCollection<QueryResource, Ap
* @param queryId
* @param projectIdentifier
*/
- public find(queryData:Object, queryId?:string, projectIdentifier?:string|null|undefined):Observable<QueryResource> {
+ public find(queryData:Object, queryId?:string|null, projectIdentifier?:string|null|undefined):Observable<QueryResource> {
let path:string;
if (queryId) {
diff --git a/frontend/src/app/core/apiv3/endpoints/queries/apiv3-query-form.ts b/frontend/src/app/core/apiv3/endpoints/queries/apiv3-query-form.ts
index 7a98efe6932..046639c1dd4 100644
--- a/frontend/src/app/core/apiv3/endpoints/queries/apiv3-query-form.ts
+++ b/frontend/src/app/core/apiv3/endpoints/queries/apiv3-query-form.ts
@@ -75,7 +75,7 @@ export class ApiV3QueryForm extends ApiV3FormResource<QueryFormResource> {
* @param projectIdentifier
* @param payload
*/
- public loadWithParams(params:{ [key:string]:unknown }, queryId:string|undefined, projectIdentifier:string|undefined|null, payload:any = {}):Observable<[QueryFormResource, QueryResource]> {
+ public loadWithParams(params:{ [key:string]:unknown }, queryId:string|null|undefined, projectIdentifier:string|undefined|null, payload:any = {}):Observable<[QueryFormResource, QueryResource]> {
// We need a valid payload so that we
// can check whether form saving is possible.
// The query needs a name to be valid.
diff --git a/frontend/src/app/features/work-packages/components/wp-list/wp-list-checksum.service.ts b/frontend/src/app/features/work-packages/components/wp-list/wp-list-checksum.service.ts
index e84fd8a9f2a..e609aee3e81 100644
--- a/frontend/src/app/features/work-packages/components/wp-list/wp-list-checksum.service.ts
+++ b/frontend/src/app/features/work-packages/components/wp-list/wp-list-checksum.service.ts
@@ -96,7 +96,7 @@ export class WorkPackagesListChecksumService {
}
}
- private set(id:string|null, checksum:string|null) {
+ public set(id:string|null, checksum:string|null) {
this.id = id;
this.checksum = checksum;
}
@@ -145,8 +145,8 @@ export class WorkPackagesListChecksumService {
return this.UrlParamsHelper.encodeQueryJsonParams(
query,
{
- pa: pagination.page,
pp: pagination.perPage,
+ pa: pagination.page,
},
);
}
diff --git a/frontend/src/app/features/work-packages/components/wp-list/wp-list.service.ts b/frontend/src/app/features/work-packages/components/wp-list/wp-list.service.ts
index c47e443dc61..8afe70ce5ce 100644
--- a/frontend/src/app/features/work-packages/components/wp-list/wp-list.service.ts
+++ b/frontend/src/app/features/work-packages/components/wp-list/wp-list.service.ts
@@ -64,7 +64,7 @@ import { WorkPackagesListInvalidQueryService } from './wp-list-invalid-query.ser
import { WorkPackagesQueryViewService } from 'core-app/features/work-packages/components/wp-list/wp-query-view.service';
export interface QueryDefinition {
- queryParams:{ query_id?:string, query_props?:string };
+ queryParams:{ query_id?:string|null, query_props?:string|null };
projectIdentifier?:string;
}
@@ -118,7 +118,7 @@ export class WorkPackagesListService {
* @param queryParams
* @param projectIdentifier
*/
- private streamQueryRequest(queryParams:{ query_id?:string, query_props?:string }, projectIdentifier?:string):Observable<QueryResource> {
+ private streamQueryRequest(queryParams:{ query_id?:string|null, query_props?:string|null }, projectIdentifier?:string):Observable<QueryResource> {
const decodedProps = this.getCurrentQueryProps(queryParams);
const queryData = this.UrlParamsHelper.buildV3GetQueryFromJsonParams(decodedProps);
const stream = this
@@ -139,7 +139,7 @@ export class WorkPackagesListService {
* Load a query.
* The query is either a persisted query, identified by the query_id parameter, or the default query. Both will be modified by the parameters in the query_props parameter.
*/
- public fromQueryParams(queryParams:{ query_id?:string, query_props?:string }, projectIdentifier?:string):Observable<QueryResource> {
+ public fromQueryParams(queryParams:{ query_id?:string|null, query_props?:string }, projectIdentifier?:string):Observable<QueryResource> {
this.queryRequests.clear();
this.queryRequests.putValue({ queryParams, projectIdentifier });
@@ -153,7 +153,7 @@ export class WorkPackagesListService {
/**
* Get the current decoded query props, if any
*/
- public getCurrentQueryProps(params:{ query_props?:string }):string|null {
+ public getCurrentQueryProps(params:{ query_props?:string|null }):string|null {
if (params.query_props) {
return decodeURIComponent(params.query_props);
}
@@ -366,7 +366,7 @@ export class WorkPackagesListService {
return this.querySpace.query.value!;
}
- private handleQueryLoadingError(error:ErrorResource, queryProps:any, queryId?:string, projectIdentifier?:string|null):Promise<QueryResource> {
+ private handleQueryLoadingError(error:ErrorResource, queryProps:any, queryId?:string|null, projectIdentifier?:string|null):Promise<QueryResource> {
this.toastService.addError(this.I18n.t('js.work_packages.faulty_query.description'), error.message);
return new Promise((resolve, reject) => {
diff --git a/frontend/src/app/shared/components/calendar/op-calendar.service.ts b/frontend/src/app/shared/components/calendar/op-calendar.service.ts
index 9c16fa99c20..37a1e56adac 100644
--- a/frontend/src/app/shared/components/calendar/op-calendar.service.ts
+++ b/frontend/src/app/shared/components/calendar/op-calendar.service.ts
@@ -38,6 +38,7 @@ import {
import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';
import { UIRouterGlobals } from '@uirouter/core';
import { TimezoneService } from 'core-app/core/datetime/timezone.service';
+import { WorkPackagesListChecksumService } from 'core-app/features/work-packages/components/wp-list/wp-list-checksum.service';
export interface CalendarViewEvent {
el:HTMLElement;
@@ -71,6 +72,7 @@ export class OpCalendarService extends UntilDestroyedMixin {
readonly toastService:ToastService,
readonly wpTableFilters:WorkPackageViewFiltersService,
readonly wpListService:WorkPackagesListService,
+ readonly wpListChecksumService:WorkPackagesListChecksumService,
readonly urlParamsHelper:UrlParamsHelperService,
readonly querySpace:IsolatedQuerySpace,
readonly apiV3Service:ApiV3Service,
@@ -166,7 +168,7 @@ export class OpCalendarService extends UntilDestroyedMixin {
const startDate = moment(fetchInfo.start).format('YYYY-MM-DD');
const endDate = moment(fetchInfo.end).format('YYYY-MM-DD');
- let queryId:string|undefined;
+ let queryId:string|null = null;
if (this.urlParams.query_id) {
queryId = this.urlParams.query_id as string;
}
@@ -191,7 +193,10 @@ export class OpCalendarService extends UntilDestroyedMixin {
.find({ perPage: 0 }, queryId)
.toPromise();
- queryProps = this.urlParamsHelper.encodeQueryJsonParams(initialQuery, { pa: OpCalendarService.MAX_DISPLAYED });
+ queryProps = this.urlParamsHelper.encodeQueryJsonParams(
+ initialQuery,
+ { pp: OpCalendarService.MAX_DISPLAYED, pa: 1 },
+ );
} else if (this.initializingWithQueryProps) {
// This is the case on initially loading the calendar with query_props present in the url params.
// There might also be a query_id but the settings persisted in it are overwritten by the props.
@@ -205,13 +210,17 @@ export class OpCalendarService extends UntilDestroyedMixin {
this.querySpace.query.value as QueryResource,
(props) => ({
...props,
- pa: OpCalendarService.MAX_DISPLAYED,
+ pp: OpCalendarService.MAX_DISPLAYED,
+ pa: 1,
f: [
...props.f.filter((filter) => filter.n !== 'datesInterval'),
OpCalendarService.dateFilter(startDate, endDate),
],
}),
);
+
+ // There are no query props, ensure that they are not being shown the next load
+ this.wpListChecksumService.set(queryId, queryProps);
}
return this