forked from ddrilling/asb_cloud_front
CF2-8: HotFix. Исправлено преобразование полученного массива байтов в файл
This commit is contained in:
parent
6a2fa499df
commit
a89c5200d7
@ -37,6 +37,11 @@ const imgPaths = {
|
||||
'.las': '/images/las.png'
|
||||
}
|
||||
|
||||
const contentTypes = {
|
||||
'.pdf': 'application/pdf',
|
||||
'.las': 'application/octet-stream'
|
||||
}
|
||||
|
||||
|
||||
// Экспорт рендера
|
||||
export default function Report(props) {
|
||||
@ -80,8 +85,8 @@ export default function Report(props) {
|
||||
<br />
|
||||
<span> { progressData.operation } </span>
|
||||
<br />
|
||||
<a onClick={event => {getReportFile(event, progressData.reportName)}}
|
||||
download={progressData.reportName}>
|
||||
<a onClick={event => getReportFile(event, progressData.reportName)}
|
||||
download>
|
||||
{ progressData.reportName }
|
||||
</a>
|
||||
</>
|
||||
@ -91,8 +96,9 @@ export default function Report(props) {
|
||||
const getReportFile = async (event, reportFileName) => {
|
||||
try {
|
||||
const element = event.target
|
||||
let reportFile = await ReportService.getReport(wellId, reportFileName)
|
||||
let reportUrl = URL.createObjectURL(reportFile)
|
||||
let bytesArray = await ReportService.getReport(wellId, reportFileName)
|
||||
const contentType = contentTypes[reportFileName.slice(-4)]
|
||||
let reportUrl = URL.createObjectURL(new File(bytesArray, {type: contentType}))
|
||||
element.href = reportUrl
|
||||
} catch (error) {
|
||||
notify(`Не удалось скачать отчет по скважине (${wellId}) c
|
||||
@ -120,7 +126,7 @@ export default function Report(props) {
|
||||
duration: 0
|
||||
});
|
||||
|
||||
if (progressData.reportName.length)
|
||||
if (progressData.reportName?.length)
|
||||
unSubscribeReportHub()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user