another scan lens fix

This commit is contained in:
makearmy 2025-09-28 16:56:06 -04:00
parent 50723718e4
commit b8028c0be9

View file

@ -91,15 +91,17 @@ function useOptions(path: string) {
url = `${API}/items/laser_focus_lens?fields=id,name&limit=1000&sort=name`;
normalize = (rows) => rows.map((r) => ({ id: String(r.id), label: String(r.name ?? r.id) }));
} else {
url = `${API}/items/laser_scan_lens?fields=id,name,field_size,focal_length&limit=1000&sort=name`;
// SCAN LENSES (fiber, uv, co2-galvo): no `name` field in this collection
url = `${API}/items/laser_scan_lens?fields=id,field_size,focal_length&limit=1000&sort=focal_length`;
normalize = (rows) =>
rows.map((r) => {
const fs = r.field_size != null ? `${r.field_size}` : "";
const fl = r.focal_length != null ? `${r.focal_length}` : "";
const composed = r.name ?? [fs && `${fs} mm`, fl && `${fl} mm`].filter(Boolean).join(" — ");
const composed = [fs && `${fs} mm`, fl && `${fl} mm`].filter(Boolean).join(" — ");
return { id: String(r.id), label: composed || String(r.id) };
});
}
} else if (rawPath === "repeater-choices") {
// reads from fields meta: target=<collection>, group=<repeater>, field=<subfield>
const group = params.get("group") || "";