updated the component and device api's to have as be a parameter for the function
This commit is contained in:
parent
c617ebf868
commit
b62c7dbe5c
39 changed files with 346 additions and 651 deletions
|
|
@ -108,7 +108,7 @@ export default function BinComponents(props: Props) {
|
|||
let mounted = true;
|
||||
setDevicesLoading(true);
|
||||
deviceAPI
|
||||
.list(100000, 0, "asc", "name")
|
||||
.list(100000, 0, "asc", "name",undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,as)
|
||||
.then(response => {
|
||||
if (mounted) {
|
||||
let data = response.data.devices ? response.data.devices : [];
|
||||
|
|
@ -135,7 +135,7 @@ export default function BinComponents(props: Props) {
|
|||
return () => {
|
||||
mounted = false;
|
||||
};
|
||||
}, [deviceAPI]);
|
||||
}, [deviceAPI, as]);
|
||||
|
||||
useEffect(() => {
|
||||
loadDevices();
|
||||
|
|
@ -149,7 +149,7 @@ export default function BinComponents(props: Props) {
|
|||
comps = [];
|
||||
setComponentsLoading(true);
|
||||
componentAPI
|
||||
.list(selectedDevice, false, [selectedDevice.toString()], ["device"], true)
|
||||
.list(selectedDevice, false, [selectedDevice.toString()], ["device"], true, as)
|
||||
.then(resp => {
|
||||
let d = pond.ListComponentsResponse.fromObject(resp.data);
|
||||
d.components.forEach(comp => {
|
||||
|
|
@ -171,7 +171,7 @@ export default function BinComponents(props: Props) {
|
|||
});
|
||||
}
|
||||
},
|
||||
[selectedDevice, componentAPI, deviceComponents, snackbar]
|
||||
[selectedDevice, componentAPI, deviceComponents, snackbar, as]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
|
|
@ -326,7 +326,7 @@ export default function BinComponents(props: Props) {
|
|||
settings.grainType = binGrain;
|
||||
settings.defaultMutations = [pond.Mutator.MUTATOR_EMC];
|
||||
componentAPI
|
||||
.update(device, settings)
|
||||
.update(device, settings, undefined, undefined, as)
|
||||
.then(resp => {
|
||||
snackbar.info("Component added to bin, and updated cables grain type");
|
||||
})
|
||||
|
|
|
|||
|
|
@ -150,29 +150,12 @@ const useStyles = makeStyles((theme: Theme) => {
|
|||
bottomSpacing: {
|
||||
marginBottom: theme.spacing(1)
|
||||
},
|
||||
sliderRoot: {},
|
||||
sliderThumb: {
|
||||
left: 23
|
||||
},
|
||||
mobileSliderThumb: {
|
||||
left: 28
|
||||
},
|
||||
sliderTrack: {
|
||||
height: "100%",
|
||||
},
|
||||
sliderRail: {
|
||||
height: "100%",
|
||||
},
|
||||
sliderValLabel: {
|
||||
// left: -20,
|
||||
height: 30,
|
||||
width: 30,
|
||||
top: -15,
|
||||
//top: -15,
|
||||
background: "transparent"
|
||||
},
|
||||
sliderLabel: {
|
||||
background: "gold"
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -1483,10 +1466,10 @@ export default function BinVisualizer(props: Props) {
|
|||
orientation="vertical"
|
||||
value={fillPercentage}
|
||||
classes={{
|
||||
root: classes.sliderRoot,
|
||||
rail: classes.sliderRail,
|
||||
track: classes.sliderTrack,
|
||||
thumb: isMobile ? classes.mobileSliderThumb : classes.sliderThumb,
|
||||
// root: classes.sliderRoot,
|
||||
// rail: classes.sliderRail,
|
||||
// track: classes.sliderTrack,
|
||||
// thumb: isMobile ? classes.mobileSliderThumb : classes.sliderThumb,
|
||||
valueLabel: classes.sliderValLabel,
|
||||
}}
|
||||
style={{ height: "100%", color: sliderColour }}
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ export default function GrainNodeInteractions(props: Props) {
|
|||
settings.defaultMutations = [pond.Mutator.MUTATOR_EMC];
|
||||
settings.grainType = grain;
|
||||
componentAPI
|
||||
.update(device.id(), settings, [binKey], ["bin"])
|
||||
.update(device.id(), settings, [binKey], ["bin"], as)
|
||||
.then(resp => {
|
||||
openSnack("EMC set on cable " + cable.name());
|
||||
updateComponentCallback(cable.key());
|
||||
|
|
@ -157,7 +157,7 @@ export default function GrainNodeInteractions(props: Props) {
|
|||
|
||||
const submit = () => {
|
||||
componentAPI
|
||||
.update(device.id(), cable.settings, [binKey], ["bin"])
|
||||
.update(device.id(), cable.settings, [binKey], ["bin"], as)
|
||||
.then(resp => {
|
||||
//after updating the component update the interactions with the new subtypes
|
||||
//TODO-CS: make function to update multiple interactions at once to avoid this loop if it becomes a problem
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue