Skip to content

Commit

Permalink
[New #36] Added support for export of records with MSExcel
Browse files Browse the repository at this point in the history
  • Loading branch information
LaChope committed Jul 10, 2024
1 parent 9f8e3b0 commit 3f0eee4
Showing 4 changed files with 2 additions and 5 deletions.
3 changes: 0 additions & 3 deletions src/actions/RecordsActions.js
Original file line number Diff line number Diff line change
@@ -61,9 +61,6 @@ export function exportRecords(exportType, params = {}) {
.get(`${API_URL}/rest/records/export`, {
params,
paramsSerializer,
headers: {
accept: exportType.mediaType,
},
responseType: "arraybuffer",
})
.then((resp) => {
1 change: 0 additions & 1 deletion src/components/record/ExportRecordsDropdown.jsx
Original file line number Diff line number Diff line change
@@ -18,7 +18,6 @@ const ExportRecordsDropdown = ({ records, onExport }) => {
variant="primary"
className="action-button"
>
{/*Excel export is currently not supported by the backend, uncommenting for demonstration purposes*/}
<Dropdown.Item onClick={() => onExport(ExportType.EXCEL)}>{i18n("records.export.excel")}</Dropdown.Item>
<Dropdown.Item onClick={() => onExport(ExportType.JSON)}>{i18n("records.export.json")}</Dropdown.Item>
</DropdownButton>
1 change: 1 addition & 0 deletions src/components/record/RecordsController.jsx
Original file line number Diff line number Diff line change
@@ -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,
}),
"records",
);
2 changes: 1 addition & 1 deletion src/constants/DefaultConstants.js
Original file line number Diff line number Diff line change
@@ -106,7 +106,7 @@ export const HttpHeaders = {

export const MediaType = {
FORM_URLENCODED: "application/x-www-form-urlencoded",
EXCEL: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
EXCEL: "application/vnd.ms-excel",
JSON: "application/json",
};

0 comments on commit 3f0eee4

Please sign in to comment.