From c834db304864ca6bc21fb462d574baf8740e897b Mon Sep 17 00:00:00 2001 From: goodmice Date: Tue, 27 Dec 2022 19:34:31 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=B0=D1=87=D0=B0=D1=82=D0=B0=20=D0=BF?= =?UTF-8?q?=D0=B5=D1=80=D0=B5=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=9C=D0=BE=D0=BD=D0=B8=D1=82=D0=BE=D1=80=D0=B8=D0=BD=D0=B3?= =?UTF-8?q?=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../d3/monitoring/D3MonitoringCharts.tsx | 2 +- .../TelemetryView/Setpoints/index.jsx | 5 +---- .../TelemetryView/WirelineRunOut.jsx | 5 +---- .../Well/Telemetry/TelemetryView/index.jsx | 21 ++++++++++++------- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/components/d3/monitoring/D3MonitoringCharts.tsx b/src/components/d3/monitoring/D3MonitoringCharts.tsx index 524355a..a965b24 100644 --- a/src/components/d3/monitoring/D3MonitoringCharts.tsx +++ b/src/components/d3/monitoring/D3MonitoringCharts.tsx @@ -545,7 +545,7 @@ const _D3MonitoringCharts = >({ - + {d3.range(1, groups.length).map((i) => { const x = offset.left + (sizes.groupWidth + spaceBetweenGroups) * i - spaceBetweenGroups / 2 return diff --git a/src/pages/Well/Telemetry/TelemetryView/Setpoints/index.jsx b/src/pages/Well/Telemetry/TelemetryView/Setpoints/index.jsx index a5822de..f5ad5f4 100644 --- a/src/pages/Well/Telemetry/TelemetryView/Setpoints/index.jsx +++ b/src/pages/Well/Telemetry/TelemetryView/Setpoints/index.jsx @@ -1,7 +1,6 @@ import { Button, Modal } from 'antd' import { useState, useEffect, memo, useCallback, useMemo } from 'react' -import { useWell } from '@asb/context' import { Table } from '@components/Table' import { UserView } from '@components/views' import LoaderPortal from '@components/LoaderPortal' @@ -12,7 +11,7 @@ import { SetpointsService } from '@api' import SetpointSender from './SetpointSender' import { SetpointViewer, getSetpointStatus } from './SetpointViewer' -export const Setpoints = memo(({ ...other }) => { +export const Setpoints = memo(({ well, ...other }) => { const [isModalVisible, setIsModalVisible] = useState(false) const [isSenderVisible, setIsSenderVisible] = useState(false) const [isViewerVisible, setIsViewerVisible] = useState(false) @@ -21,8 +20,6 @@ export const Setpoints = memo(({ ...other }) => { const [selected, setSelected] = useState(null) const [setpointNames, setSetpointNames] = useState([]) - const [well] = useWell() - useEffect(() => { invokeWebApiWrapperAsync( async () => { diff --git a/src/pages/Well/Telemetry/TelemetryView/WirelineRunOut.jsx b/src/pages/Well/Telemetry/TelemetryView/WirelineRunOut.jsx index fd98f71..9df5ce3 100644 --- a/src/pages/Well/Telemetry/TelemetryView/WirelineRunOut.jsx +++ b/src/pages/Well/Telemetry/TelemetryView/WirelineRunOut.jsx @@ -1,17 +1,14 @@ import { memo, useCallback, useEffect, useState } from 'react' -import { useWell } from '@asb/context' import { WirelineView } from '@components/views' import { invokeWebApiWrapperAsync } from '@components/factory' import { TelemetryWirelineRunOutService } from '@api' -export const WirelineRunOut = memo(() => { +export const WirelineRunOut = memo(({ well }) => { const [twro, setTwro] = useState({}) const [isLoading, setIsLoading] = useState(false) - const [well] = useWell() - const update = useCallback(() => invokeWebApiWrapperAsync( async () => { const twro = await TelemetryWirelineRunOutService.getData(well.id) diff --git a/src/pages/Well/Telemetry/TelemetryView/index.jsx b/src/pages/Well/Telemetry/TelemetryView/index.jsx index 9e0de63..a0f3aca 100644 --- a/src/pages/Well/Telemetry/TelemetryView/index.jsx +++ b/src/pages/Well/Telemetry/TelemetryView/index.jsx @@ -3,7 +3,7 @@ import { BehaviorSubject, buffer, throttleTime } from 'rxjs' import { useSearchParams } from 'react-router-dom' import { Alert, Button, Select } from 'antd' -import { useWell } from '@asb/context' +import { useTopRightBlock, useWell } from '@asb/context' import LoaderPortal from '@components/LoaderPortal' import { CopyUrlButton } from '@components/CopyUrl' import { D3MonitoringCharts } from '@components/d3/monitoring' @@ -76,6 +76,7 @@ const getRowDate = (row) => row && isRawDate(row.date) ? new Date(row.date) : nu const TelemetryView = memo(() => { const [well, updateWell] = useWell() + const setTopRightBlock = useTopRightBlock() const [searchParams, setSearchParams] = useSearchParams() const [dataSaub, setDataSaub] = useState([]) @@ -91,6 +92,7 @@ const TelemetryView = memo(() => { const [archiveMode, setArchiveMode] = useState(false) + const onStatusChanged = useCallback((value) => updateWell({ idState: value }), [well]) const handleDataSaub = useCallback((data, replace = false) => { @@ -251,6 +253,17 @@ const TelemetryView = memo(() => { setEndDate(new Date(saubLast.date)) }, [archiveMode, saubLast]) + useEffect(() => setTopRightBlock((well) => ( +
+ + + + {archiveMode && } +
+ )), [setTopRightBlock, archiveMode]) + return (
@@ -265,9 +278,7 @@ const TelemetryView = memo(() => {
- -
{'TorqueMaster'} {'SpinMaster'} @@ -300,10 +311,6 @@ const TelemetryView = memo(() => { setChartInterval(value * 1000)} />
- - {archiveMode && }