Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions api/routers/equipment.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class EquipmentOutputPayload(BaseModel):
type: str = "float"
unit: str = ""
description: str = ""
equipment_parameter_id: str = ""
artifact: bool = False


Expand Down
25 changes: 23 additions & 2 deletions web/app/equipment/register/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,27 @@ const UNIT_OPTIONS = [
{ value: "Torr", label: "Torr" },
{ value: "Pa", label: "Pa" },
{ value: "sccm", label: "sccm" },
{ value: "SLPM", label: "SLPM" },
{ value: "V", label: "V" },
{ value: "VDC", label: "VDC" },
{ value: "VRMS", label: "VRMS" },
{ value: "VAC", label: "VAC" },
{ value: "A", label: "A" },
{ value: "Hz", label: "Hz" },
{ value: "kHz", label: "kHz" },
{ value: "MHz", label: "MHz" },
{ value: "ohms", label: "ohms" },
{ value: "s", label: "s" },
{ value: "min", label: "min" },
{ value: "°C", label: "°C" },
{ value: "nm", label: "nm" },
{ value: "um", label: "um" },
{ value: "nm/min", label: "nm/min" },
{ value: "Å", label: "Å" },
{ value: "Å/min", label: "Å/min" },
{ value: "%", label: "%" },
{ value: "rpm", label: "rpm" },
{ value: "ratio", label: "ratio" },
{ value: "count", label: "count" },
{ value: "a.u.", label: "a.u." },
];
Expand All @@ -77,6 +85,7 @@ interface EquipmentOutput {
type: string;
unit: string;
description: string;
equipment_parameter_id: string;
artifact: boolean;
}

Expand Down Expand Up @@ -352,6 +361,7 @@ function formDataFromEquipment(equipment: EquipmentInfo): FormData {
type: output.type || "float",
unit: output.unit || "",
description: output.description || "",
equipment_parameter_id: output.equipment_parameter_id || "",
artifact: Boolean(output.artifact),
}))
: cloneInitialData().outputs,
Expand Down Expand Up @@ -613,6 +623,7 @@ function EquipmentRegisterContent() {
type: "float",
unit: "",
description: "",
equipment_parameter_id: "",
artifact: false,
},
],
Expand Down Expand Up @@ -735,6 +746,7 @@ function EquipmentRegisterContent() {
name: output.name.trim(),
unit: output.unit.trim(),
description: output.description.trim(),
equipment_parameter_id: output.equipment_parameter_id.trim(),
}))
.filter((output) => output.name);

Expand Down Expand Up @@ -1168,10 +1180,11 @@ function EquipmentRegisterContent() {
experiment outputs, not from equipment registration.
</p>
</div>
<div className="grid grid-cols-[2fr_1fr_1fr_2fr_1fr_auto] gap-2 px-1 text-xs font-medium text-[hsl(var(--muted-foreground))]">
<div className="grid grid-cols-[2fr_1fr_1fr_1fr_2fr_1fr_auto] gap-2 px-1 text-xs font-medium text-[hsl(var(--muted-foreground))]">
<span>Name</span>
<span>Type</span>
<span>Unit</span>
<span>Eq Param ID</span>
<span>Description</span>
<span>Raw file</span>
<span />
Expand All @@ -1180,7 +1193,7 @@ function EquipmentRegisterContent() {
{formData.outputs.map((output, index) => (
<div
key={`output-${index}`}
className="grid grid-cols-[2fr_1fr_1fr_2fr_1fr_auto] items-center gap-2"
className="grid grid-cols-[2fr_1fr_1fr_1fr_2fr_1fr_auto] items-center gap-2"
>
<input
value={output.name}
Expand All @@ -1207,6 +1220,14 @@ function EquipmentRegisterContent() {
<option value="file">file</option>
</select>
{renderUnitSelect("", output.unit, (value) => updateOutput(index, "unit", value))}
<input
value={output.equipment_parameter_id}
onChange={(event) =>
updateOutput(index, "equipment_parameter_id", event.target.value)
}
placeholder="e.g., 413"
className={inputClass}
/>
<input
value={output.description}
onChange={(event) =>
Expand Down
1 change: 1 addition & 0 deletions web/lib/api-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,7 @@ export interface EquipmentOutput {
type: string;
unit: string;
description: string;
equipment_parameter_id?: string;
artifact: boolean;
}

Expand Down