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

Fix query_id is missing for export CSV/PDF, which lead manual sorting lost.

Eric Guo27b0e68ef4f6
diff --git a/app/components/work_packages/exports/modal_dialog_component.rb b/app/components/work_packages/exports/modal_dialog_component.rb
index 45255b25993..bd2ddc046b5 100644
--- a/app/components/work_packages/exports/modal_dialog_component.rb
+++ b/app/components/work_packages/exports/modal_dialog_component.rb
@@ -47,7 +47,13 @@ module WorkPackages
end
def export_format_url(format)
- @project.nil? ? index_work_packages_path(format:) : project_work_packages_path(project, format:)
+ if @project.nil?
+ index_work_packages_path(format:)
+ elsif @query.id.present?
+ project_work_packages_path(project, query_id: @query.id, format:)
+ else
+ project_work_packages_path(project, format:)
+ end
end
def export_formats_settings
diff --git a/frontend/src/app/features/work-packages/components/wp-query/url-params-helper.ts b/frontend/src/app/features/work-packages/components/wp-query/url-params-helper.ts
index 73227570912..e20bd87ca98 100644
--- a/frontend/src/app/features/work-packages/components/wp-query/url-params-helper.ts
+++ b/frontend/src/app/features/work-packages/components/wp-query/url-params-helper.ts
@@ -95,6 +95,7 @@ export interface QueryRequestParams {
groupBy:string|null;
filters:string;
sortBy:string;
+ query_id:string|null;
timestamps:string;
valid_subset?:boolean;
}
diff --git a/frontend/src/app/shared/components/op-context-menu/handlers/op-settings-dropdown-menu.directive.ts b/frontend/src/app/shared/components/op-context-menu/handlers/op-settings-dropdown-menu.directive.ts
index d4be4c7d21a..7f336ed1c40 100644
--- a/frontend/src/app/shared/components/op-context-menu/handlers/op-settings-dropdown-menu.directive.ts
+++ b/frontend/src/app/shared/components/op-context-menu/handlers/op-settings-dropdown-menu.directive.ts
@@ -178,14 +178,17 @@ export class OpSettingsMenuDirective extends OpContextMenuTrigger {
}
private buildExportDialogHref(query:QueryResource):string {
- const params:Partial<QueryRequestParams>&{ title:string } = this.urlParamsHelper
- .buildV3GetQueryFromQueryResource(query) as Partial<QueryRequestParams>&{ title:string };
+ const params: Partial<QueryRequestParams> & { title: string } = this.urlParamsHelper
+ .buildV3GetQueryFromQueryResource(query) as Partial<QueryRequestParams> & { title: string };
params['columns[]'] = this.wpTableColumns.getColumns().map((column) => column.id);
params.title = this.queryTitle(query);
- const queryString = this.urlParamsHelper.buildQueryString(params) || '';
const url = new URL(window.location.href);
+ const queryId = url.searchParams.get('query_id');
+ if (queryId) {
+ params.query_id = queryId;
+ }
url.pathname = `${url.pathname}/export_dialog`;
- url.search = queryString;
+ url.search = this.urlParamsHelper.buildQueryString(params) || '';
return url.toString();
}