feat(system): configure telemetry polling per contour
This commit is contained in:
@@ -2,6 +2,7 @@ import { useEffect, useMemo, useState } from "react";
|
||||
import {
|
||||
Button,
|
||||
FeatureSettingsWindow,
|
||||
FieldFrame,
|
||||
Icon,
|
||||
Select,
|
||||
SettingsCard,
|
||||
@@ -50,6 +51,7 @@ function emptyDraft(): ComputeContourDraft {
|
||||
ssh_port: 22,
|
||||
mqtt_host: "127.0.0.1",
|
||||
mqtt_port: 1883,
|
||||
telemetry_poll_interval_seconds: 3,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -64,6 +66,7 @@ function draftFromContour(contour: ComputeContour | null): ComputeContourDraft {
|
||||
ssh_port: contour.ssh_port,
|
||||
mqtt_host: contour.mqtt_host,
|
||||
mqtt_port: contour.mqtt_port,
|
||||
telemetry_poll_interval_seconds: contour.telemetry_poll_interval_seconds,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -111,6 +114,9 @@ export function ComputeContourSettingsWindow({
|
||||
&& draft.ssh_port > 0
|
||||
&& Number.isInteger(draft.mqtt_port)
|
||||
&& draft.mqtt_port > 0
|
||||
&& Number.isInteger(draft.telemetry_poll_interval_seconds)
|
||||
&& draft.telemetry_poll_interval_seconds >= 1
|
||||
&& draft.telemetry_poll_interval_seconds <= 60
|
||||
), [draft]);
|
||||
|
||||
const save = async () => {
|
||||
@@ -194,14 +200,16 @@ export function ComputeContourSettingsWindow({
|
||||
expected_node_id: event.currentTarget.value,
|
||||
}))}
|
||||
/>
|
||||
<Select
|
||||
label="Платформа"
|
||||
value={draft.platform}
|
||||
options={platformOptions}
|
||||
variant="split"
|
||||
menuWidth="anchor"
|
||||
onChange={(platform) => setDraft((current) => ({ ...current, platform }))}
|
||||
/>
|
||||
<FieldFrame label="Операционная система">
|
||||
<Select
|
||||
label="Операционная система"
|
||||
value={draft.platform}
|
||||
options={platformOptions}
|
||||
variant="split"
|
||||
menuWidth="anchor"
|
||||
onChange={(platform) => setDraft((current) => ({ ...current, platform }))}
|
||||
/>
|
||||
</FieldFrame>
|
||||
<TextField
|
||||
label="Адрес узла"
|
||||
hint="IP или hostname в текущей LAN"
|
||||
@@ -230,6 +238,18 @@ export function ComputeContourSettingsWindow({
|
||||
mqtt_port: Number(event.currentTarget.value),
|
||||
}))}
|
||||
/>
|
||||
<TextField
|
||||
label="Интервал MQTT"
|
||||
hint="1–60 с"
|
||||
type="number"
|
||||
min={1}
|
||||
max={60}
|
||||
value={String(draft.telemetry_poll_interval_seconds)}
|
||||
onChange={(event) => setDraft((current) => ({
|
||||
...current,
|
||||
telemetry_poll_interval_seconds: Number(event.currentTarget.value),
|
||||
}))}
|
||||
/>
|
||||
{draft.telemetry_mode === "legacy-ssh" ? (
|
||||
<TextField
|
||||
label="SSH port"
|
||||
|
||||
Reference in New Issue
Block a user