diff --git a/site/cds_rdm/assets/semantic-ui/js/cds_rdm/administration/harvesterReports/DownloadButton.js b/site/cds_rdm/assets/semantic-ui/js/cds_rdm/administration/harvesterReports/DownloadButton.js index 33835128..3a0c4eb5 100644 --- a/site/cds_rdm/assets/semantic-ui/js/cds_rdm/administration/harvesterReports/DownloadButton.js +++ b/site/cds_rdm/assets/semantic-ui/js/cds_rdm/administration/harvesterReports/DownloadButton.js @@ -4,44 +4,62 @@ // CDS-RDM is free software; you can redistribute it and/or modify it // under the terms of the GPL-2.0 License; see LICENSE file for more details. -import React from "react"; +import React, { useState } from "react"; +import PropTypes from "prop-types"; import { Button, Icon } from "semantic-ui-react"; import { i18next } from "@translations/invenio_administration/i18next"; -export const DownloadButton = ({ runId }) => ( -
-
- -
-
- +export const DownloadButton = ({ runId }) => { + const [isLoadingReport, setIsLoadingReport] = useState(false); + + const handleViewReport = () => { + if (!runId || isLoadingReport) return; + + setIsLoadingReport(true); + window.location.assign(`/administration/harvester-reports/${runId}/report`); + }; + + return ( +
+
+ +
+
+ +
-
-); + ); +}; + +DownloadButton.propTypes = { + runId: PropTypes.string, +}; + +DownloadButton.defaultProps = { + runId: null, +};