added the switch in the interaction setting to enable/disable interactions, also set the framework for the feature in the device model but all the firmware version are 'N/A' for now until i know what version this feature is in
This commit is contained in:
parent
7ac469f9db
commit
26dfd0db01
3 changed files with 53 additions and 3 deletions
2
package-lock.json
generated
2
package-lock.json
generated
|
|
@ -11752,7 +11752,7 @@
|
||||||
},
|
},
|
||||||
"node_modules/protobuf-ts": {
|
"node_modules/protobuf-ts": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#aa9a59d8cc0b7ba1ee27d9bdcdade6136a00d1fb",
|
"resolved": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#888ba52a4e56911ecb7df432009ecfc820c00eaf",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"protobufjs": "^6.8.8"
|
"protobufjs": "^6.8.8"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -150,6 +150,7 @@ export default function InteractionSettings(props: Props) {
|
||||||
const [timezone, setTimezone] = useState<string | undefined>(undefined);
|
const [timezone, setTimezone] = useState<string | undefined>(undefined);
|
||||||
//whether is any node(0), average of all nodes(1), single node(2), or node diff(3)
|
//whether is any node(0), average of all nodes(1), single node(2), or node diff(3)
|
||||||
const [subtypeDropdown, setSubtypeDropdown] = useState<number>(0);
|
const [subtypeDropdown, setSubtypeDropdown] = useState<number>(0);
|
||||||
|
const [interactionEnabled, setInteractionEnabled] = useState(true); //by default interactions are enabled
|
||||||
|
|
||||||
const initialConditions = useCallback(
|
const initialConditions = useCallback(
|
||||||
(type: quack.ComponentType): pond.InteractionCondition[] => {
|
(type: quack.ComponentType): pond.InteractionCondition[] => {
|
||||||
|
|
@ -168,6 +169,8 @@ export default function InteractionSettings(props: Props) {
|
||||||
let interaction = getDefaultInteraction();
|
let interaction = getDefaultInteraction();
|
||||||
if (initialInteraction && mode === "update") {
|
if (initialInteraction && mode === "update") {
|
||||||
interaction = initialInteraction;
|
interaction = initialInteraction;
|
||||||
|
//set the switch's state value
|
||||||
|
setInteractionEnabled(!interaction.settings.inactive);
|
||||||
if (interaction.settings.subtype === 0 || interaction.settings.subtype === 1) {
|
if (interaction.settings.subtype === 0 || interaction.settings.subtype === 1) {
|
||||||
setSubtypeDropdown(interaction.settings.subtype);
|
setSubtypeDropdown(interaction.settings.subtype);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -427,6 +430,13 @@ export default function InteractionSettings(props: Props) {
|
||||||
setInteraction(updatedInteraction);
|
setInteraction(updatedInteraction);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const changeInactive = (event: any) => {
|
||||||
|
let updatedInteraction = Interaction.clone(interaction);
|
||||||
|
//the switch uses true for active but the settings use true for inactive, so need to use the opposite of the switch
|
||||||
|
updatedInteraction.settings.inactive = !event.target.checked;
|
||||||
|
setInteraction(updatedInteraction);
|
||||||
|
};
|
||||||
|
|
||||||
const describeSource = (measurementType: quack.MeasurementType): MeasurementDescriber => {
|
const describeSource = (measurementType: quack.MeasurementType): MeasurementDescriber => {
|
||||||
const source: Component = or(
|
const source: Component = or(
|
||||||
mappedComponents.get(componentIDToString(interaction.settings.source)),
|
mappedComponents.get(componentIDToString(interaction.settings.source)),
|
||||||
|
|
@ -1532,6 +1542,27 @@ export default function InteractionSettings(props: Props) {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const activeSwitch = () => {
|
||||||
|
return (
|
||||||
|
<FormControlLabel
|
||||||
|
control={
|
||||||
|
<Switch
|
||||||
|
id="active"
|
||||||
|
checked={interactionEnabled}
|
||||||
|
onChange={(event) => {
|
||||||
|
setInteractionEnabled(!interactionEnabled)
|
||||||
|
changeInactive(event)
|
||||||
|
}}
|
||||||
|
value="active"
|
||||||
|
color="secondary"
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
label="Active"
|
||||||
|
disabled={!canEdit}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
const content = () => {
|
const content = () => {
|
||||||
return (
|
return (
|
||||||
<Grid container direction="row" spacing={2}>
|
<Grid container direction="row" spacing={2}>
|
||||||
|
|
@ -1540,10 +1571,14 @@ export default function InteractionSettings(props: Props) {
|
||||||
</Grid>
|
</Grid>
|
||||||
{hasDeviceFeature(device.settings.upgradeChannel, "better-controls") && (
|
{hasDeviceFeature(device.settings.upgradeChannel, "better-controls") && (
|
||||||
<Grid size={{ xs: 12 }}>
|
<Grid size={{ xs: 12 }}>
|
||||||
<div style={{ display: "flex", flexDirection: "row" }}>
|
<div style={{ display: "flex", flexDirection: "row", gap: 20 }}>
|
||||||
{priorityInput()}
|
{priorityInput()}
|
||||||
<div style={{ marginLeft: theme.spacing(2) }}></div>
|
{/* <div style={{ marginLeft: theme.spacing(2) }}></div> */}
|
||||||
{sortingInput()}
|
{sortingInput()}
|
||||||
|
{/* this will do the check for the feature once we know what version the feature is supported on */}
|
||||||
|
{/* {device.featureSupported("disableInteractions") && activeSwitch()} */}
|
||||||
|
{/* this is for testing on dev */}
|
||||||
|
{activeSwitch()}
|
||||||
</div>
|
</div>
|
||||||
</Grid>
|
</Grid>
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,21 @@ const featureVersions: Map<string, FeatureVersionByPlatform> = new Map([
|
||||||
v2CellBlue: "2.1.10",
|
v2CellBlue: "2.1.10",
|
||||||
v2EthBlue: "2.1.10"
|
v2EthBlue: "2.1.10"
|
||||||
}
|
}
|
||||||
|
],[
|
||||||
|
"disableInteractions",
|
||||||
|
{
|
||||||
|
photon: "N/A",
|
||||||
|
electron: "N/A",
|
||||||
|
v2Wifi: "N/A",
|
||||||
|
v2Cell: "N/A",
|
||||||
|
v2WifiS3: "N/A",
|
||||||
|
v2CellS3: "N/A",
|
||||||
|
v2CellBlack: "N/A",
|
||||||
|
v2CellGreen: "N/A",
|
||||||
|
v2WifiBlue: "N/A",
|
||||||
|
v2CellBlue: "N/A",
|
||||||
|
v2EthBlue: "N/A"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
export class Device {
|
export class Device {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue