co2 galvo owner test
This commit is contained in:
parent
8b9987c0a0
commit
39d9723e23
1 changed files with 8 additions and 10 deletions
|
|
@ -10,7 +10,6 @@ export default function CO2GalvoSettingDetailPage() {
|
||||||
const [setting, setSetting] = useState<any>(null);
|
const [setting, setSetting] = useState<any>(null);
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
|
|
||||||
// claim UI state
|
|
||||||
const [claimBusy, setClaimBusy] = useState(false);
|
const [claimBusy, setClaimBusy] = useState(false);
|
||||||
const [claimMsg, setClaimMsg] = useState<string | null>(null);
|
const [claimMsg, setClaimMsg] = useState<string | null>(null);
|
||||||
const [claimErr, setClaimErr] = useState<string | null>(null);
|
const [claimErr, setClaimErr] = useState<string | null>(null);
|
||||||
|
|
@ -25,7 +24,7 @@ export default function CO2GalvoSettingDetailPage() {
|
||||||
"submission_id",
|
"submission_id",
|
||||||
"setting_title",
|
"setting_title",
|
||||||
"uploader",
|
"uploader",
|
||||||
// ✅ fetch username directly
|
// ✅ request username explicitly
|
||||||
"owner.id",
|
"owner.id",
|
||||||
"owner.username",
|
"owner.username",
|
||||||
"setting_notes",
|
"setting_notes",
|
||||||
|
|
@ -46,7 +45,7 @@ export default function CO2GalvoSettingDetailPage() {
|
||||||
"lens_apt.name",
|
"lens_apt.name",
|
||||||
"lens_exp.name",
|
"lens_exp.name",
|
||||||
"focus",
|
"focus",
|
||||||
// ✅ handle both shapes
|
// ✅ handle string-or-relation
|
||||||
"laser_soft",
|
"laser_soft",
|
||||||
"laser_soft.name",
|
"laser_soft.name",
|
||||||
"repeat_all",
|
"repeat_all",
|
||||||
|
|
@ -68,10 +67,11 @@ export default function CO2GalvoSettingDetailPage() {
|
||||||
if (loading) return <p className="p-6">Loading setting...</p>;
|
if (loading) return <p className="p-6">Loading setting...</p>;
|
||||||
if (!setting) return <p className="p-6">Setting not found.</p>;
|
if (!setting) return <p className="p-6">Setting not found.</p>;
|
||||||
|
|
||||||
// ✅ prefer username
|
// ✅ prefer username; fall back to id or uploader (just in case)
|
||||||
const ownerName = (row: any) => row?.owner?.username ?? null;
|
const ownerName = (row: any) =>
|
||||||
|
row?.owner?.username ?? (row?.owner?.id ? String(row.owner.id) : null) ?? null;
|
||||||
|
|
||||||
// Render “name” if relation, or raw string if the field is plain text.
|
// ✅ show string or relation.name
|
||||||
const softwareLabel =
|
const softwareLabel =
|
||||||
typeof setting.laser_soft === "object"
|
typeof setting.laser_soft === "object"
|
||||||
? setting.laser_soft?.name ?? "—"
|
? setting.laser_soft?.name ?? "—"
|
||||||
|
|
@ -97,10 +97,8 @@ export default function CO2GalvoSettingDetailPage() {
|
||||||
return (
|
return (
|
||||||
<p key={key} className="text-sm">
|
<p key={key} className="text-sm">
|
||||||
<strong>{label}:</strong>{" "}
|
<strong>{label}:</strong>{" "}
|
||||||
{typeof value === "boolean"
|
{typeof value === "boolean" ? formatBoolean(value) : value || "—"}
|
||||||
? formatBoolean(value)
|
</p>
|
||||||
: value || "—"}
|
|
||||||
</p>
|
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue