From f384981d7b3c758906d26cd794e21c7fdcad4f7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A4=D1=80=D0=BE=D0=BB=D0=BE=D0=B2?= Date: Thu, 12 Aug 2021 17:54:04 +0500 Subject: [PATCH] grouping TelemetryView components --- .../charts => pages/TelemetryView}/ChartTimeOnline.tsx | 2 +- src/pages/TelemetryView/Column.jsx | 2 +- src/{components => pages/TelemetryView}/ModeDisplay.jsx | 6 +++--- src/pages/TelemetryView/index.jsx | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) rename src/{components/charts => pages/TelemetryView}/ChartTimeOnline.tsx (98%) rename src/{components => pages/TelemetryView}/ModeDisplay.jsx (81%) diff --git a/src/components/charts/ChartTimeOnline.tsx b/src/pages/TelemetryView/ChartTimeOnline.tsx similarity index 98% rename from src/components/charts/ChartTimeOnline.tsx rename to src/pages/TelemetryView/ChartTimeOnline.tsx index 4e9eb26..7aa1d35 100644 --- a/src/components/charts/ChartTimeOnline.tsx +++ b/src/pages/TelemetryView/ChartTimeOnline.tsx @@ -1,5 +1,5 @@ import { useEffect, useState} from 'react'; -import {ChartTimeBase, ChartTimeData, ChartTimeDataParams} from './ChartTimeBase' +import {ChartTimeBase, ChartTimeData, ChartTimeDataParams} from '../../components/charts/ChartTimeBase' const GetRandomColor = () => "#" + Math.floor(Math.random()*16777215).toString(16) function GetOrCreateDatasetByLineConfig (data: ChartTimeData, lineConfig: LineConfig) { diff --git a/src/pages/TelemetryView/Column.jsx b/src/pages/TelemetryView/Column.jsx index 2aa9f6e..75b2f0c 100644 --- a/src/pages/TelemetryView/Column.jsx +++ b/src/pages/TelemetryView/Column.jsx @@ -1,5 +1,5 @@ import {Display} from "../../components/Display"; -import {ChartTimeOnline} from "../../components/charts/ChartTimeOnline"; +import {ChartTimeOnline} from "./ChartTimeOnline"; import {ChartTimeOnlineFooter} from "./ChartTimeOnlineFooter"; export const Column = ({lineGroup, data, interval, showBorder}) => { diff --git a/src/components/ModeDisplay.jsx b/src/pages/TelemetryView/ModeDisplay.jsx similarity index 81% rename from src/components/ModeDisplay.jsx rename to src/pages/TelemetryView/ModeDisplay.jsx index bc63063..df81db0 100644 --- a/src/components/ModeDisplay.jsx +++ b/src/pages/TelemetryView/ModeDisplay.jsx @@ -10,11 +10,11 @@ const modeNames = { 10: "БЛОКИРОВКА", } -export const ModeDisplay = (props)=>{ +export const ModeDisplay = ({data})=>{ let value = '---' - if(props.data.length > 0){ - let lastFullData = props.data[props.data.length - 1] + if(data.length > 0){ + let lastFullData = data[data.length - 1] let index = lastFullData['mode'] if(index >= 0) value = modeNames[index] ?? index diff --git a/src/pages/TelemetryView/index.jsx b/src/pages/TelemetryView/index.jsx index ecea287..740fb84 100644 --- a/src/pages/TelemetryView/index.jsx +++ b/src/pages/TelemetryView/index.jsx @@ -4,12 +4,12 @@ import {Row, Col, Select} from 'antd' import {Column} from './Column' import {CustomColumn} from './CustomColumn' import ActiveMessagesOnline from './ActiveMessagesOnline' +import {ModeDisplay} from "./ModeDisplay" +import {UserOfWells} from './UserOfWells' import LoaderPortal from '../../components/LoaderPortal' -import {UserOfWells} from './UserOfWells' import {Subscribe} from '../../services/signalr' import {DataService} from '../../services/api' -import {ModeDisplay} from "../../components/ModeDisplay" import notify from "../../components/notify" import '../../styles/message.css'