Skip to content

Commit

Permalink
Merge pull request #178 from kbss-cvut/add-excel-export
Browse files Browse the repository at this point in the history
Added support for export of records with MSExcel
  • Loading branch information
kostobog committed Jul 11, 2024
2 parents 9f8e3b0 + b3fbab1 commit f9170ff
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/components/record/ExportRecordsDropdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
5 changes: 4 additions & 1 deletion src/components/record/RecordsController.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ class RecordsController extends React.Component {
trackPromise(
this.props.exportRecords(exportType, {
...this.state.filters,
sort: sortToParams(this.state.sort),
// Uncomment if paging is required for export
// sort: sortToParams(this.state.sort),
// page: this.state.pageNumber,
// size: BrowserStorage.get(STORAGE_TABLE_PAGE_SIZE_KEY, DEFAULT_PAGE_SIZE),
}),
"records",
);
Expand Down
2 changes: 1 addition & 1 deletion src/constants/DefaultConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
};

Expand Down

0 comments on commit f9170ff

Please sign in to comment.