2021-08-18 10:35:39 +05:00
|
|
|
|
import { Progress } from "antd"
|
2021-08-20 10:49:20 +05:00
|
|
|
|
import { download, notify } from "../../components/factory"
|
2021-08-18 10:35:39 +05:00
|
|
|
|
|
|
|
|
|
export const getReportFile = async (idWell, reportName) => {
|
|
|
|
|
try {
|
|
|
|
|
await download(`/api/well/${idWell}/report/${reportName}`, reportName)
|
|
|
|
|
} catch (error) {
|
|
|
|
|
notify(`Не удалось скачать отчет ${reportName} по скважине (${idWell})`, 'error')
|
|
|
|
|
console.log(error)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const ReportCreationNotify = ({idWell, progressData}) => {
|
|
|
|
|
progressData = progressData ?? {progress: 0.0, operation: 'Создание отчета', reportName: ''}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<Progress percent={ progressData.progress } />
|
|
|
|
|
<br />
|
|
|
|
|
<span> { progressData.operation } </span>
|
|
|
|
|
<br />
|
|
|
|
|
<button onClick={event => {getReportFile(idWell, progressData.reportName)}}
|
|
|
|
|
download={progressData.reportName}>
|
|
|
|
|
{ progressData.reportName }
|
|
|
|
|
</button>
|
|
|
|
|
</>
|
|
|
|
|
)
|
|
|
|
|
}
|