updated as in the interactions api

This commit is contained in:
csawatzky 2025-04-21 16:40:30 -06:00
parent e8e32e1886
commit c617ebf868
12 changed files with 66 additions and 50 deletions

View file

@ -94,7 +94,7 @@ export default function BinConditioningInteraction(props: Props) {
const [sliderMarks, setSliderMarks] = useState<Map<quack.MeasurementType, number>>(new Map());
//this is the emc value calculated from the interactions temp and humidity conditions
const [baseEMC, setBaseEMC] = useState<number | undefined>();
const [{ user }] = useGlobalState();
const [{ user, as }] = useGlobalState();
const classes = useStyles();
const interactionAPI = useInteractionsAPI();
const { openSnack } = useSnackbar();
@ -144,7 +144,7 @@ export default function BinConditioningInteraction(props: Props) {
const updateInteraction = () => {
interactionAPI
.updateInteraction(deviceId, interaction.settings)
.updateInteraction(deviceId, interaction.settings, as)
.then(resp => {
openSnack("Updated Interaction Conditions");
})

View file

@ -108,10 +108,10 @@ export default function GrainNodeInteractions(props: Props) {
}, [selectedNode]);
useEffect(() => {
interactionAPI.listInteractionsByComponent(device.id(), cable.location()).then(resp => {
interactionAPI.listInteractionsByComponent(device.id(), cable.location(), undefined, as).then(resp => {
setCableInteractions(resp);
});
}, [cable, device, interactionAPI]);
}, [cable, device, interactionAPI, as]);
useEffect(() => {
//do the reversing to make the selected node match the array in the
@ -163,7 +163,7 @@ export default function GrainNodeInteractions(props: Props) {
//TODO-CS: make function to update multiple interactions at once to avoid this loop if it becomes a problem
cableInteractions.forEach(interaction => {
interactionAPI
.updateInteraction(device.id(), interaction.settings)
.updateInteraction(device.id(), interaction.settings, as)
.then(resp => {})
.catch(err => {});
});
@ -359,7 +359,7 @@ export default function GrainNodeInteractions(props: Props) {
permissions={permissions}
refreshCallback={() => {
interactionAPI
.listInteractionsByComponent(device.id(), cable.location())
.listInteractionsByComponent(device.id(), cable.location(), undefined, as)
.then(resp => {
setCableInteractions(resp);
});
@ -440,7 +440,7 @@ export default function GrainNodeInteractions(props: Props) {
setNewInteraction(false);
}}
refreshCallback={() => {
interactionAPI.listInteractionsByComponent(device.id(), cable.location()).then(resp => {
interactionAPI.listInteractionsByComponent(device.id(), cable.location(), undefined, as).then(resp => {
setCableInteractions(resp);
});
}}