2021-10-27 11:05:50 +05:00
|
|
|
|
import { useParams } from 'react-router-dom'
|
|
|
|
|
import { useState, useEffect } from 'react'
|
|
|
|
|
import ClusterWells from './ClusterWells'
|
|
|
|
|
import LoaderPortal from '../../components/LoaderPortal'
|
|
|
|
|
import { invokeWebApiWrapperAsync } from '../../components/factory'
|
|
|
|
|
import { WellOperationStatService } from '../../services/api'
|
2021-08-27 14:21:48 +05:00
|
|
|
|
|
2021-08-30 11:26:00 +05:00
|
|
|
|
|
2021-10-27 11:05:50 +05:00
|
|
|
|
export const Cluster = () => {
|
|
|
|
|
const { idClaster } = useParams()
|
|
|
|
|
const [data, setData] = useState([])
|
|
|
|
|
const [showLoader, setShowLoader] = useState(false)
|
2021-08-27 14:21:48 +05:00
|
|
|
|
|
2021-10-13 16:32:01 +05:00
|
|
|
|
useEffect(() => invokeWebApiWrapperAsync(
|
|
|
|
|
async () => {
|
2021-10-27 11:05:50 +05:00
|
|
|
|
const clusterData = await WellOperationStatService.getStatCluster(idClaster)
|
|
|
|
|
setData(clusterData?.statsWells ?? [])
|
2021-10-13 16:32:01 +05:00
|
|
|
|
},
|
|
|
|
|
setShowLoader,
|
|
|
|
|
`Не удалось загрузить данные по кусту "${idClaster}"`
|
2021-10-27 11:05:50 +05:00
|
|
|
|
), [idClaster])
|
2021-08-27 14:21:48 +05:00
|
|
|
|
|
2021-10-13 16:32:01 +05:00
|
|
|
|
return (
|
|
|
|
|
<LoaderPortal show={showLoader}>
|
|
|
|
|
<ClusterWells statsWells={data} />
|
|
|
|
|
</LoaderPortal>
|
|
|
|
|
)
|
2021-08-27 14:21:48 +05:00
|
|
|
|
}
|
2021-10-27 11:05:50 +05:00
|
|
|
|
|
|
|
|
|
export default Cluster
|