forked from ddrilling/asb_cloud_front
TelemetryView и ActiveMessage переписаны в асинхронную функцию
This commit is contained in:
parent
c5abb21e6d
commit
93b7196236
@ -53,16 +53,20 @@ export default function ActiveMessagesOnline({idWell}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
const update = async () => {
|
||||||
setLoader(true)
|
setLoader(true)
|
||||||
MessageService.getMessage(idWell)
|
try {
|
||||||
.then(handleReceiveMessages)
|
const messages = await MessageService.getMessage(idWell)
|
||||||
.catch((ex) => {
|
handleReceiveMessages(messages)
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
notify(`Не удалось загрузить сообщения по скважине "${idWell}"`, 'error')
|
notify(`Не удалось загрузить сообщения по скважине "${idWell}"`, 'error')
|
||||||
console.log(ex)
|
console.log(ex)
|
||||||
})
|
}
|
||||||
.finally(()=>setLoader(false))
|
setLoader(false)
|
||||||
|
|
||||||
return Subscribe('hubs/telemetry','ReceiveMessages', `well_${idWell}`, handleReceiveMessages)
|
return Subscribe('hubs/telemetry','ReceiveMessages', `well_${idWell}`, handleReceiveMessages)
|
||||||
|
}
|
||||||
|
update()
|
||||||
}, [idWell])
|
}, [idWell])
|
||||||
|
|
||||||
return (<LoaderPortal show={loader}>
|
return (<LoaderPortal show={loader}>
|
||||||
|
@ -31,7 +31,7 @@ export default function Deposit() {
|
|||||||
const [showLoader, setShowLoader] = useState(false)
|
const [showLoader, setShowLoader] = useState(false)
|
||||||
|
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
const updateClusters = async()=>{
|
const update = async()=>{
|
||||||
setShowLoader(true)
|
setShowLoader(true)
|
||||||
try{
|
try{
|
||||||
const data = await ClusterService.getClusters()
|
const data = await ClusterService.getClusters()
|
||||||
@ -43,7 +43,7 @@ export default function Deposit() {
|
|||||||
}
|
}
|
||||||
setShowLoader(false)
|
setShowLoader(false)
|
||||||
}
|
}
|
||||||
updateClusters()
|
update()
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const viewParams = calcViewParams(clustersData)
|
const viewParams = calcViewParams(clustersData)
|
||||||
|
@ -2,7 +2,7 @@ import {useState, useEffect} from 'react'
|
|||||||
import {useParams} from 'react-router-dom'
|
import {useParams} from 'react-router-dom'
|
||||||
import {Row, Col, Select} from 'antd'
|
import {Row, Col, Select} from 'antd'
|
||||||
import LoaderPortal from '../components/LoaderPortal'
|
import LoaderPortal from '../components/LoaderPortal'
|
||||||
import { Column } from '../components/Column'
|
import {Column} from '../components/Column'
|
||||||
import {CustomColumn} from '../components/CustomColumn'
|
import {CustomColumn} from '../components/CustomColumn'
|
||||||
import {UserOfWells} from '../components/UserOfWells'
|
import {UserOfWells} from '../components/UserOfWells'
|
||||||
import {Subscribe} from '../services/signalr'
|
import {Subscribe} from '../services/signalr'
|
||||||
@ -19,8 +19,16 @@ const dash = [7, 3]
|
|||||||
const blockHeightGroup = {
|
const blockHeightGroup = {
|
||||||
label: "Высота блока",
|
label: "Высота блока",
|
||||||
yDisplay: false,
|
yDisplay: false,
|
||||||
linePv: { label: "blockPosition", units: 'м', xAccessorName: "blockPosition", yAccessorName: "date", color: '#333' },
|
linePv: {label: "blockPosition", units: 'м', xAccessorName: "blockPosition", yAccessorName: "date", color: '#333'},
|
||||||
lineOther: { label: "wellDepth", units: 'м', xAccessorName: "wellDepth", yAccessorName: "date", color: '#333', showLine: false, xConstValue:30 },
|
lineOther: {
|
||||||
|
label: "wellDepth",
|
||||||
|
units: 'м',
|
||||||
|
xAccessorName: "wellDepth",
|
||||||
|
yAccessorName: "date",
|
||||||
|
color: '#333',
|
||||||
|
showLine: false,
|
||||||
|
xConstValue: 30
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
const blockSpeedGroup = {
|
const blockSpeedGroup = {
|
||||||
@ -141,16 +149,19 @@ export default function TelemetryView(props) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
const update = async () => {
|
||||||
setLoader(true)
|
setLoader(true)
|
||||||
DataService.getData(id)
|
try {
|
||||||
.then(handleReceiveDataSaub)
|
const data = await DataService.getData(id)
|
||||||
.catch((ex) => {
|
handleReceiveDataSaub(data)
|
||||||
notify(`Не удалось загрузить данные по скважине "${id}"`, 'error')
|
} catch (ex) {
|
||||||
|
notify(`Не удалось получить данные по скважине "${id}"`, 'error')
|
||||||
console.log(ex)
|
console.log(ex)
|
||||||
})
|
}
|
||||||
.finally(()=>setLoader(false))
|
setLoader(false)
|
||||||
|
|
||||||
return Subscribe('hubs/telemetry', 'ReceiveDataSaub', `well_${id}`, handleReceiveDataSaub)
|
return Subscribe('hubs/telemetry', 'ReceiveDataSaub', `well_${id}`, handleReceiveDataSaub)
|
||||||
|
}
|
||||||
|
update()
|
||||||
}, [id])
|
}, [id])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -158,7 +169,7 @@ export default function TelemetryView(props) {
|
|||||||
DataService.getData(id, null, chartInterval)
|
DataService.getData(id, null, chartInterval)
|
||||||
.then(handleReceiveDataSaub)
|
.then(handleReceiveDataSaub)
|
||||||
.catch(error => console.error(error))
|
.catch(error => console.error(error))
|
||||||
.finally(()=>setLoader(false))
|
.finally(() => setLoader(false))
|
||||||
}, [id, chartInterval])
|
}, [id, chartInterval])
|
||||||
|
|
||||||
const colSpan = 24 / (paramsGroups.length)
|
const colSpan = 24 / (paramsGroups.length)
|
||||||
@ -188,7 +199,8 @@ export default function TelemetryView(props) {
|
|||||||
<Row>
|
<Row>
|
||||||
{paramsGroups.map((group, index) =>
|
{paramsGroups.map((group, index) =>
|
||||||
<Col span={colSpan} className='border_small' key={group.label}>
|
<Col span={colSpan} className='border_small' key={group.label}>
|
||||||
<Column data={saubData} lineGroup={group} interval={chartInterval} showBorder = {saubData[saubData.length - 1]?.drillingBy === index}/>
|
<Column data={saubData} lineGroup={group} interval={chartInterval}
|
||||||
|
showBorder={saubData[saubData.length - 1]?.drillingBy === index}/>
|
||||||
</Col>)}
|
</Col>)}
|
||||||
</Row>
|
</Row>
|
||||||
</Col>
|
</Col>
|
||||||
|
Loading…
Reference in New Issue
Block a user