SDRs panel: an unreported device list reads 'not reported', not 'not plugged in'
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
fb2d737d6f
commit
5dcf1b5e9c
@@ -26,10 +26,11 @@ const selectClass =
|
|||||||
"bg-gray-800 border border-gray-700 rounded px-2 py-1 text-gray-200 text-xs focus:outline-none focus:border-indigo-500 disabled:opacity-60 max-w-[13rem]";
|
"bg-gray-800 border border-gray-700 rounded px-2 py-1 text-gray-200 text-xs focus:outline-none focus:border-indigo-500 disabled:opacity-60 max-w-[13rem]";
|
||||||
|
|
||||||
function DeviceSelect({
|
function DeviceSelect({
|
||||||
value, devices, autoLabel, label, disabled, onChange,
|
value, devices, devicesKnown, autoLabel, label, disabled, onChange,
|
||||||
}: {
|
}: {
|
||||||
value: string;
|
value: string;
|
||||||
devices: SdrDevice[];
|
devices: SdrDevice[];
|
||||||
|
devicesKnown: boolean;
|
||||||
autoLabel: string;
|
autoLabel: string;
|
||||||
label: string;
|
label: string;
|
||||||
disabled: boolean;
|
disabled: boolean;
|
||||||
@@ -44,7 +45,9 @@ function DeviceSelect({
|
|||||||
SDR {d.index + 1} · serial {d.serial ?? "unknown"}{d.duplicate_serial ? " (shared serial!)" : ""}
|
SDR {d.index + 1} · serial {d.serial ?? "unknown"}{d.duplicate_serial ? " (shared serial!)" : ""}
|
||||||
</option>
|
</option>
|
||||||
))}
|
))}
|
||||||
{value && !known && <option value={value}>serial {value} (not plugged in)</option>}
|
{value && !known && (
|
||||||
|
<option value={value}>serial {value} ({devicesKnown ? "not plugged in" : "not reported"})</option>
|
||||||
|
)}
|
||||||
</select>
|
</select>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -57,6 +60,7 @@ export function SdrSettings({ node, canEdit }: { node: NodeRecord; canEdit: bool
|
|||||||
const reported = node.secondary_sdr_running != null;
|
const reported = node.secondary_sdr_running != null;
|
||||||
const running = node.secondary_sdr_running ?? [];
|
const running = node.secondary_sdr_running ?? [];
|
||||||
const devices = node.sdr_devices ?? [];
|
const devices = node.sdr_devices ?? [];
|
||||||
|
const devicesKnown = reported && node.sdr_devices != null;
|
||||||
|
|
||||||
const [rows, setRows] = useState<Row[]>(() => rowsFrom(priority, pins));
|
const [rows, setRows] = useState<Row[]>(() => rowsFrom(priority, pins));
|
||||||
const [op25Pin, setOp25Pin] = useState(pins.op25 ?? "");
|
const [op25Pin, setOp25Pin] = useState(pins.op25 ?? "");
|
||||||
@@ -114,7 +118,7 @@ export function SdrSettings({ node, canEdit }: { node: NodeRecord; canEdit: bool
|
|||||||
<section>
|
<section>
|
||||||
<h2 className="text-sm font-semibold text-gray-400 uppercase tracking-wider mb-1">SDRs</h2>
|
<h2 className="text-sm font-semibold text-gray-400 uppercase tracking-wider mb-1">SDRs</h2>
|
||||||
<p className="text-xs text-gray-500 font-mono mb-3">
|
<p className="text-xs text-gray-500 font-mono mb-3">
|
||||||
{reported && node.sdr_devices != null
|
{devicesKnown
|
||||||
? `This node reports ${devices.length} SDR${devices.length === 1 ? "" : "s"}.`
|
? `This node reports ${devices.length} SDR${devices.length === 1 ? "" : "s"}.`
|
||||||
: "This node hasn't reported its SDRs yet."}
|
: "This node hasn't reported its SDRs yet."}
|
||||||
</p>
|
</p>
|
||||||
@@ -134,6 +138,7 @@ export function SdrSettings({ node, canEdit }: { node: NodeRecord; canEdit: bool
|
|||||||
<DeviceSelect
|
<DeviceSelect
|
||||||
value={op25Pin}
|
value={op25Pin}
|
||||||
devices={devices}
|
devices={devices}
|
||||||
|
devicesKnown={devicesKnown}
|
||||||
autoLabel="Automatic (first SDR)"
|
autoLabel="Automatic (first SDR)"
|
||||||
label="OP25 SDR"
|
label="OP25 SDR"
|
||||||
disabled={!canEdit}
|
disabled={!canEdit}
|
||||||
@@ -143,7 +148,7 @@ export function SdrSettings({ node, canEdit }: { node: NodeRecord; canEdit: bool
|
|||||||
|
|
||||||
{rows.map((row, i) => {
|
{rows.map((row, i) => {
|
||||||
const meta = MODES.find((x) => x.mode === row.mode)!;
|
const meta = MODES.find((x) => x.mode === row.mode)!;
|
||||||
const pinMissing = !!row.pin && !devices.some((d) => d.serial === row.pin);
|
const pinMissing = devicesKnown && !!row.pin && !devices.some((d) => d.serial === row.pin);
|
||||||
const state = !row.enabled
|
const state = !row.enabled
|
||||||
? "Off"
|
? "Off"
|
||||||
: dirty
|
: dirty
|
||||||
@@ -173,6 +178,7 @@ export function SdrSettings({ node, canEdit }: { node: NodeRecord; canEdit: bool
|
|||||||
<DeviceSelect
|
<DeviceSelect
|
||||||
value={row.pin}
|
value={row.pin}
|
||||||
devices={devices}
|
devices={devices}
|
||||||
|
devicesKnown={devicesKnown}
|
||||||
autoLabel="Any spare SDR"
|
autoLabel="Any spare SDR"
|
||||||
label={`${meta.name} SDR`}
|
label={`${meta.name} SDR`}
|
||||||
disabled={!canEdit}
|
disabled={!canEdit}
|
||||||
|
|||||||
Reference in New Issue
Block a user