asb_cloud_front/src/pages/Report/ReportCreationNotify.jsx

25 lines
770 B
React
Raw Normal View History

2021-09-23 14:18:46 +05:00
import { Progress, Button } from "antd"
import { downloadFile } from "../../components/factory"
2021-08-18 10:35:39 +05:00
2021-09-23 14:18:46 +05:00
export const ReportCreationNotify = ({progressData}) => {
progressData = progressData ?? {progress: 0.0, operation: 'Создание отчета'}
2021-08-18 10:35:39 +05:00
2021-09-23 14:18:46 +05:00
let downloadButton = null
if (progressData.file)
downloadButton = <Button
type="link"
onClick={_ => {downloadFile(progressData.file)}}
2021-09-23 14:18:46 +05:00
download={progressData.file.name}>
{progressData.file.name}
</Button>
const progressText = `${progressData.operation} стр ${progressData.currentPage} из ${progressData.totalPages}`
2021-08-18 10:35:39 +05:00
return (
<>
<Progress percent={ progressData.progress } />
2021-09-23 14:18:46 +05:00
<br/>
<span>{progressText}</span>
{downloadButton}
2021-08-18 10:35:39 +05:00
</>
)
}