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]";
|
||||
|
||||
function DeviceSelect({
|
||||
value, devices, autoLabel, label, disabled, onChange,
|
||||
value, devices, devicesKnown, autoLabel, label, disabled, onChange,
|
||||
}: {
|
||||
value: string;
|
||||
devices: SdrDevice[];
|
||||
devicesKnown: boolean;
|
||||
autoLabel: string;
|
||||
label: string;
|
||||
disabled: boolean;
|
||||
@@ -44,7 +45,9 @@ function DeviceSelect({
|
||||
SDR {d.index + 1} · serial {d.serial ?? "unknown"}{d.duplicate_serial ? " (shared serial!)" : ""}
|
||||
</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>
|
||||
);
|
||||
}
|
||||
@@ -57,6 +60,7 @@ export function SdrSettings({ node, canEdit }: { node: NodeRecord; canEdit: bool
|
||||
const reported = node.secondary_sdr_running != null;
|
||||
const running = node.secondary_sdr_running ?? [];
|
||||
const devices = node.sdr_devices ?? [];
|
||||
const devicesKnown = reported && node.sdr_devices != null;
|
||||
|
||||
const [rows, setRows] = useState<Row[]>(() => rowsFrom(priority, pins));
|
||||
const [op25Pin, setOp25Pin] = useState(pins.op25 ?? "");
|
||||
@@ -114,7 +118,7 @@ export function SdrSettings({ node, canEdit }: { node: NodeRecord; canEdit: bool
|
||||
<section>
|
||||
<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">
|
||||
{reported && node.sdr_devices != null
|
||||
{devicesKnown
|
||||
? `This node reports ${devices.length} SDR${devices.length === 1 ? "" : "s"}.`
|
||||
: "This node hasn't reported its SDRs yet."}
|
||||
</p>
|
||||
@@ -134,6 +138,7 @@ export function SdrSettings({ node, canEdit }: { node: NodeRecord; canEdit: bool
|
||||
<DeviceSelect
|
||||
value={op25Pin}
|
||||
devices={devices}
|
||||
devicesKnown={devicesKnown}
|
||||
autoLabel="Automatic (first SDR)"
|
||||
label="OP25 SDR"
|
||||
disabled={!canEdit}
|
||||
@@ -143,7 +148,7 @@ export function SdrSettings({ node, canEdit }: { node: NodeRecord; canEdit: bool
|
||||
|
||||
{rows.map((row, i) => {
|
||||
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
|
||||
? "Off"
|
||||
: dirty
|
||||
@@ -173,6 +178,7 @@ export function SdrSettings({ node, canEdit }: { node: NodeRecord; canEdit: bool
|
||||
<DeviceSelect
|
||||
value={row.pin}
|
||||
devices={devices}
|
||||
devicesKnown={devicesKnown}
|
||||
autoLabel="Any spare SDR"
|
||||
label={`${meta.name} SDR`}
|
||||
disabled={!canEdit}
|
||||
|
||||
Reference in New Issue
Block a user