From ec6d9c3d6c00bbf80fbc5d6ef682a7680f43c74f Mon Sep 17 00:00:00 2001 From: Jack Harper Date: Thu, 12 Sep 2024 09:00:30 +0100 Subject: [PATCH] move pvws message interface out into new file --- app/components/IfcPVWSMessage.tsx | 20 ++++++++++++++++++++ app/components/InstrumentData.tsx | 22 +--------------------- 2 files changed, 21 insertions(+), 21 deletions(-) create mode 100644 app/components/IfcPVWSMessage.tsx diff --git a/app/components/IfcPVWSMessage.tsx b/app/components/IfcPVWSMessage.tsx new file mode 100644 index 0000000..5f2e049 --- /dev/null +++ b/app/components/IfcPVWSMessage.tsx @@ -0,0 +1,20 @@ +export interface PVWSMessage { + type: string; + pv: string; + value?: number | null; + text?: string | null; + b64byt?: string | null; + units?: string | null; + precision?: number | null; + labels?: string | null; + min?: number | null; + max?: number | null; + warn_low?: number | null; + warn_high?: number | null; + alarm_low?: number | null; + alarm_high?: number | null; + severity?: string | null; + seconds?: number | null; + readonly?: boolean | null; + nanos?: number | null; +} diff --git a/app/components/InstrumentData.tsx b/app/components/InstrumentData.tsx index 7049a7e..d19aff9 100644 --- a/app/components/InstrumentData.tsx +++ b/app/components/InstrumentData.tsx @@ -7,30 +7,10 @@ import useWebSocket from "react-use-websocket"; import { dehex_and_decompress } from "./dehex_and_decompress"; import { Instrument } from "./Instrument"; import {PV} from "./PV"; +import { PVWSMessage } from "./IfcPVWSMessage"; let lastUpdate: string = ""; -interface PVWSMessage { - type: string; - pv: string; - value?: number|null; - text?: string|null; - b64byt?: string|null; - units?: string|null; - precision?: number|null; - labels?: string|null; - min?: number|null; - max?: number|null; - warn_low?: number|null; - warn_high?: number|null; - alarm_low?: number|null; - alarm_high?: number|null; - severity?: string|null; - seconds?: number|null; - readonly?: boolean|null; - nanos?: number|null; -} - export default function InstrumentData({instrumentName}: {instrumentName:string} ) { // set up the different states for the instrument data