submit formatting fixes for build
This commit is contained in:
parent
98ae049804
commit
7f61e63131
2 changed files with 18 additions and 10 deletions
|
|
@ -91,7 +91,7 @@ function useOptions(path: string) {
|
|||
url = `${API}/items/laser_focus_lens?fields=id,name&limit=1000`;
|
||||
normalize = (rows) => rows.map((r) => ({ id: String(r.id), label: String(r.name ?? r.id) }));
|
||||
} else {
|
||||
// SCAN LENSES (fiber, uv, co2-galvo): collection has no `name`; sort numerically by focal_length
|
||||
// SCAN LENSES (fiber, uv, co2-galvo): sort numerically by focal_length
|
||||
url = `${API}/items/laser_scan_lens?fields=id,field_size,focal_length&limit=1000`;
|
||||
normalize = (rows) => {
|
||||
const toNum = (v: any) => {
|
||||
|
|
@ -118,14 +118,17 @@ function useOptions(path: string) {
|
|||
const metaJson = await metaRes.json();
|
||||
const rows = metaJson?.data ?? [];
|
||||
|
||||
// find the repeater parent (e.g. "fill_settings" / "line_settings" / "raster_settings")
|
||||
// Approach 1: check nested children under the repeater parent
|
||||
const parent = rows.find((r: any) => r?.field === group);
|
||||
const children = parent?.meta?.options?.fields || []; // Directus stores repeater children here
|
||||
const children = parent?.meta?.options?.fields || [];
|
||||
let child = children.find((f: any) => f?.field === field);
|
||||
|
||||
// find the child definition (e.g. "type", "dither")
|
||||
const child = children.find((f: any) => f?.field === field);
|
||||
// Approach 2: fallback to flat "group.field" entry if present
|
||||
if (!child) {
|
||||
const full = `${group}.${field}`;
|
||||
child = rows.find((r: any) => r?.field === full);
|
||||
}
|
||||
|
||||
// pull choices from the child interface meta
|
||||
const choices: any[] = child?.meta?.options?.choices || [];
|
||||
const mapped: Opt[] = choices.map((c: any) => ({
|
||||
id: String(c.value ?? c.key ?? c.id),
|
||||
|
|
@ -138,6 +141,11 @@ function useOptions(path: string) {
|
|||
setOpts(filtered);
|
||||
setLoading(false);
|
||||
}
|
||||
return; // short-circuit: no fetch below
|
||||
} else {
|
||||
// unknown path → empty
|
||||
setOpts([]);
|
||||
setLoading(false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -282,10 +290,10 @@ export default function SettingsSubmit({ initialTarget }: { initialTarget?: Targ
|
|||
}, []);
|
||||
|
||||
const meLabel =
|
||||
(me?.username?.trim()) ||
|
||||
(me?.email?.trim()) ||
|
||||
([me?.first_name, me?.last_name].filter(Boolean).join(" ").trim()) ||
|
||||
(me?.display_name?.trim()) ||
|
||||
me?.username?.trim() ||
|
||||
me?.email?.trim() ||
|
||||
[me?.first_name, me?.last_name].filter(Boolean).join(" ").trim() ||
|
||||
me?.display_name?.trim() ||
|
||||
(me?.id ? `User ${me.id.slice(0, 8)}…${me.id.slice(-4)}` : "Unknown user");
|
||||
|
||||
// Options
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue