added toggle for node reversal to the component form, limited it to firmware version 2.1.8 or higher
This commit is contained in:
parent
d831677769
commit
54d995ae2d
4 changed files with 64 additions and 5 deletions
|
|
@ -133,7 +133,7 @@ export default function ComponentForm(props: Props) {
|
|||
length: "0",
|
||||
height: "0",
|
||||
width: "0",
|
||||
sensorDistance: "0"
|
||||
sensorDistance: "0",
|
||||
});
|
||||
const [compMode, setCompMode] = useState<any>();
|
||||
//const [numCalibrations, setNumCalibrations] = useState(0)
|
||||
|
|
@ -204,7 +204,7 @@ export default function ComponentForm(props: Props) {
|
|||
length: length.toFixed(2),
|
||||
width: width.toFixed(2),
|
||||
height: height.toFixed(2),
|
||||
sensorDistance: sensorDistance.toFixed(2)
|
||||
sensorDistance: sensorDistance.toFixed(2),
|
||||
});
|
||||
}, [component]);
|
||||
|
||||
|
|
@ -377,6 +377,12 @@ export default function ComponentForm(props: Props) {
|
|||
setForm(f);
|
||||
};
|
||||
|
||||
const toggleReverseNodes = (event: any) => {
|
||||
let f = cloneDeep(form);
|
||||
f.component.settings.reverseNodes = event.target.checked;
|
||||
setForm(f);
|
||||
};
|
||||
|
||||
const updateGrainType = (option: Option | null) => {
|
||||
let f = cloneDeep(form);
|
||||
|
||||
|
|
@ -908,6 +914,42 @@ export default function ComponentForm(props: Props) {
|
|||
);
|
||||
};
|
||||
|
||||
const reverseCheck = () => {
|
||||
const {reverseNodes} = form.component.settings
|
||||
let ext = extension(component.type(), component.subType())
|
||||
|
||||
if (ext.isArray && device.featureSupported("reverseNodes")) {
|
||||
return (
|
||||
<Grid
|
||||
container
|
||||
direction="row"
|
||||
justifyContent="space-between"
|
||||
alignItems="center"
|
||||
alignContent="center"
|
||||
spacing={1}>
|
||||
<Grid container size={{ xs: 4, sm: 3 }} justifyContent="center">
|
||||
<FormControlLabel
|
||||
control={
|
||||
<Switch
|
||||
checked={reverseNodes}
|
||||
onChange={toggleReverseNodes}
|
||||
name="nodesReversed"
|
||||
aria-label="nodesReversed"
|
||||
color="secondary"
|
||||
/>
|
||||
}
|
||||
label={<Typography variant="caption">Reverse Nodes</Typography>}
|
||||
labelPlacement="top"
|
||||
className={classes.switchControl}
|
||||
disabled={!canEdit}
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
const generalForm = () => {
|
||||
const {
|
||||
component,
|
||||
|
|
@ -975,6 +1017,7 @@ export default function ComponentForm(props: Props) {
|
|||
)}
|
||||
{component.settings.type === quack.ComponentType.COMPONENT_TYPE_GRAIN_CABLE &&
|
||||
grainSelect()}
|
||||
{reverseCheck()}
|
||||
{component.settings.type === quack.ComponentType.COMPONENT_TYPE_GRAIN_CABLE && (
|
||||
<Grid
|
||||
container
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue