Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for export of records with MSExcel #178

Merged
merged 4 commits into from
Jul 11, 2024
Merged

Conversation

LaChope
Copy link
Collaborator

@LaChope LaChope commented Jul 10, 2024

No description provided.

@LaChope LaChope requested review from blcham and kostobog July 10, 2024 19:25
@@ -61,9 +61,6 @@ export function exportRecords(exportType, params = {}) {
.get(`${API_URL}/rest/records/export`, {
params,
paramsSerializer,
headers: {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this as described here: kbss-cvut/record-manager#52 (comment)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to revert this change and keep the accept header.
Without it the backend will not receive the export type and it will always return JSON.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it returns the correct file type even without it (not sure how tbh, I think it it because of the file extension), but if I add the headers, the backend returns 406 (only for excel file types)

Copy link

@kostobog kostobog Jul 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LaChope
I just tested this PR. The when downloading excel the file has xslx extension but the content is json.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oohh ok I see, then I can put back the headers but I will get 406 error.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kostobog I reverted

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LaChope @blcham
Export of both json and excel in distribution works for small number of records. I tested it with 71 records.

@@ -104,6 +104,7 @@ class RecordsController extends React.Component {
this.props.exportRecords(exportType, {
...this.state.filters,
sort: sortToParams(this.state.sort),
page: this.state.pageNumber,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kostobog I believe this is what this parameter is supposed to represent?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LaChope
Yes I think this the right parameter. You should also set the size parameter, see how it is done in _loadRecords().

@blcham
Copy link

blcham commented Jul 10, 2024

@kostobog please revise

@kostobog
Copy link

kostobog commented Jul 10, 2024

@blcham @LaChope
Are we planning to support the two options, download page (records from the current page) and download all (records from all pages) as described in kbss-cvut/record-manager#52 (comment)?
The implementation in this PR supports only download page.

@LaChope LaChope linked an issue Jul 11, 2024 that may be closed by this pull request
2 tasks
@kostobog kostobog merged commit f9170ff into main Jul 11, 2024
2 checks passed
@kostobog kostobog deleted the add-excel-export branch July 11, 2024 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support export to CSV/Excel
3 participants