settings overhaul and reset
This commit is contained in:
parent
3195ff5d74
commit
ee055b4060
1 changed files with 18 additions and 5 deletions
|
|
@ -92,14 +92,27 @@ export default function SettingsSubmit({ mode = "create", submissionId, initialV
|
||||||
url = `${API}/items/laser_software?fields=id,name&limit=1000&sort=name`;
|
url = `${API}/items/laser_software?fields=id,name&limit=1000&sort=name`;
|
||||||
} else if (path === "laser_source_co2_galvo") {
|
} else if (path === "laser_source_co2_galvo") {
|
||||||
url = `${API}/items/laser_source?fields=submission_id,make,model,nm&limit=2000&sort=make,model`;
|
url = `${API}/items/laser_source?fields=submission_id,make,model,nm&limit=2000&sort=make,model`;
|
||||||
map = (rows) =>
|
// Patched: robust numeric parsing to avoid JSX/Element inference and ensure number comparisons
|
||||||
|
type Row = { submission_id?: string | number; make?: string; model?: string; nm?: string | number | null };
|
||||||
|
const toNum = (v: unknown): number | null => {
|
||||||
|
if (typeof v === "number") return Number.isFinite(v) ? v : null;
|
||||||
|
if (typeof v === "string") {
|
||||||
|
const m = v.match(/-?\d+(\.\d+)?/);
|
||||||
|
const n = m ? Number(m[0]) : NaN;
|
||||||
|
return Number.isFinite(n) ? n : null;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
map = (rows: Row[]) =>
|
||||||
rows
|
rows
|
||||||
.filter((r) => {
|
.filter((r) => {
|
||||||
const m = String(r.nm ?? "").match(/-?\d+(\.\d+)?/);
|
const nmVal = toNum(r.nm);
|
||||||
const nm = m ? Number(m[0]) : null;
|
return nmVal !== null && nmVal >= 10000 && nmVal <= 11000;
|
||||||
return nm != null && nm >= 10000 && nm <= 11000;
|
|
||||||
})
|
})
|
||||||
.map((r) => ({ id: String(r.submission_id), label: [r.make, r.model].filter(Boolean).join(" ") || String(r.submission_id) }));
|
.map((r) => ({
|
||||||
|
id: String(r.submission_id ?? ""),
|
||||||
|
label: [r.make, r.model].filter(Boolean).join(" ") || String(r.submission_id ?? ""),
|
||||||
|
}));
|
||||||
} else if (path === "laser_scan_lens") {
|
} else if (path === "laser_scan_lens") {
|
||||||
url = `${API}/items/laser_scan_lens?fields=id,field_size,focal_length&limit=1000`;
|
url = `${API}/items/laser_scan_lens?fields=id,field_size,focal_length&limit=1000`;
|
||||||
map = (rows) =>
|
map = (rows) =>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue