feat: Added columns selection in the Net Control

This commit is contained in:
2026-07-17 20:21:29 +02:00
parent 9f08df1c39
commit 6322a425d8
2 changed files with 11 additions and 3 deletions
@@ -130,10 +130,18 @@ function MotorAntennaWidget({ ant, refetch, t }: { ant: AntStatus; refetch: () =
// Send an absolute length to one element and remember it as the new baseline.
const setLen = async (i: number, mm: number) => {
const next = Math.max(0, Math.round(mm));
const prev = lengths[i] ?? 0;
setBusyEl(i); setErr('');
setLengths((ls) => { const c = [...ls]; c[i] = next; return c; }); // optimistic
try { await MotorSetElement(i, next); refetch(); }
catch (e: any) { setErr(String(e?.message ?? e)); }
catch (e: any) {
// Rejected by the controller — most often the element is at its travel
// limit for this band (extending on a low band). Revert the optimistic
// value so the display stays truthful, and explain the likely cause when
// the failed move was an extension.
setLengths((ls) => { const c = [...ls]; c[i] = prev; return c; });
setErr(next > prev ? t('station.atMax') : String(e?.message ?? e));
}
finally { setBusyEl(null); }
};
// Nudge one element by ±2 mm from its current known length.