diff --git a/alfalfa_web/components.yml b/alfalfa_web/components.yml
new file mode 100644
index 00000000..95e9cf84
--- /dev/null
+++ b/alfalfa_web/components.yml
@@ -0,0 +1,73 @@
+components:
+ schemas:
+ runId:
+ type: string
+ pointId:
+ type: string
+ format: uuid
+ pointName:
+ type: string
+ default: Outdoor Air Temperature Sensor
+ pointType:
+ type: string
+ enum:
+ - "input"
+ - "output"
+ - "bidirectional"
+ runMetadata:
+ type: object
+ properties:
+ id:
+ $ref: "#/components/schemas/runId"
+ pointMetadata:
+ type: object
+ properties:
+ id:
+ $ref: "#/components/schemas/pointId"
+ name:
+ $ref: "#/components/schemas/pointName"
+ description:
+ type: string
+ default: An outdoor air temperature sensor for an air handling unit
+ readOnly: true
+ unit:
+ type: string
+ default: °F
+ readOnly: true
+ min:
+ type: number
+ readOnly: true
+ max:
+ type: number
+ type:
+ $ref: "#/components/schemas/pointType"
+ required:
+ - id
+ - type
+ pointValue:
+ type: object
+ properties:
+ id:
+ $ref: "#/components/schemas/pointId"
+ value:
+ type: number
+ default: 24.3
+ pointData:
+ allOf:
+ - $ref: "#/components/schemas/pointMetadata"
+ - $ref: "#/components/schemas/pointValue"
+ parameters:
+ runId:
+ in: path
+ name: runId
+ schema:
+ $ref: "#/components/schemas/runId"
+ required: true
+ description: UUID of run
+ pointId:
+ in: path
+ name: pointId
+ schema:
+ $ref: "#/components/schemas/pointId"
+ required: true
+ description: UUID of point
diff --git a/alfalfa_web/components/Sites/ErrorDialog.js b/alfalfa_web/components/Sites/ErrorDialog.js
index 01efeb62..edf90492 100644
--- a/alfalfa_web/components/Sites/ErrorDialog.js
+++ b/alfalfa_web/components/Sites/ErrorDialog.js
@@ -2,20 +2,20 @@ import React from "react";
import { Close } from "@mui/icons-material";
import { Dialog, DialogContent, DialogTitle, Grid, IconButton } from "@mui/material";
-export const ErrorDialog = ({ onClose, site }) => {
+export const ErrorDialog = ({ onClose, run }) => {
return (
diff --git a/alfalfa_web/components/Sites/PointDialog.js b/alfalfa_web/components/Sites/PointDialog.js
index fad908a2..e3ab7523 100644
--- a/alfalfa_web/components/Sites/PointDialog.js
+++ b/alfalfa_web/components/Sites/PointDialog.js
@@ -19,13 +19,23 @@ import {
} from "@mui/material";
import ky from "ky";
-export const PointDialog = ({ onClose, site }) => {
+export const PointDialog = ({ onClose, run }) => {
const [expanded, setExpanded] = useState(false);
const [points, setPoints] = useState();
useEffect(async () => {
- const { data: points } = await ky(`/api/v2/sites/${site.id}/points`).json();
- setPoints(points);
+ const { payload: points } = await ky(`/api/v2/runs/${run.id}/points`).json();
+ await ky(`/api/v2/runs/${run.id}/points/values`)
+ .json()
+ .then(({ payload: values }) => {
+ for (const i in points) {
+ const point = points[i];
+ if (point.id in values) {
+ point.value = values[point.id];
+ }
+ }
+ setPoints(points);
+ });
}, []);
const handleChange = (pointId) => (event, expanded) => {
@@ -48,7 +58,7 @@ export const PointDialog = ({ onClose, site }) => {
return (
{!points.length ? (
-
— No points associated with site —
+
— No points associated with run —
) : (
points.sort(sortPoints).map((point, i) => {
return (
@@ -90,7 +100,7 @@ export const PointDialog = ({ onClose, site }) => {