increasing the limit for conditions on devices running 2.1.9 to 4, and changing the button logic for adding and removing them
This commit is contained in:
parent
d2b2bd2f8b
commit
79c29f6f81
2 changed files with 32 additions and 23 deletions
|
|
@ -957,29 +957,16 @@ export default function InteractionSettings(props: Props) {
|
||||||
</TextField>
|
</TextField>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid size={{ xs: 2, sm: 1 }}>
|
<Grid size={{ xs: 2, sm: 1 }}>
|
||||||
{index === 0 ? (
|
|
||||||
<Tooltip title="Add another condition">
|
|
||||||
<IconButton
|
|
||||||
color="primary"
|
|
||||||
disabled={numConditions > 1 || !canEdit}
|
|
||||||
aria-label="Add another condition"
|
|
||||||
onClick={addCondition}
|
|
||||||
className={classNames(classes.greenButton, classes.noPadding)}>
|
|
||||||
<AddIcon />
|
|
||||||
</IconButton>
|
|
||||||
</Tooltip>
|
|
||||||
) : (
|
|
||||||
<Tooltip title="Remove this condition">
|
<Tooltip title="Remove this condition">
|
||||||
<IconButton
|
<IconButton
|
||||||
color="default"
|
color="default"
|
||||||
disabled={!canEdit}
|
disabled={numConditions === 1 ||!canEdit}
|
||||||
aria-label="Remove condition"
|
aria-label="Remove condition"
|
||||||
onClick={() => removeCondition(index)}
|
onClick={() => removeCondition(index)}
|
||||||
className={classNames(classes.redButton, classes.noPadding)}>
|
className={classNames(classes.redButton, classes.noPadding)}>
|
||||||
<RemoveIcon />
|
<RemoveIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)}
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
{multiNodeSource() && !sensor && (
|
{multiNodeSource() && !sensor && (
|
||||||
|
|
@ -1076,6 +1063,16 @@ export default function InteractionSettings(props: Props) {
|
||||||
) : (
|
) : (
|
||||||
<FormHelperText>You must select a source before adding conditions</FormHelperText>
|
<FormHelperText>You must select a source before adding conditions</FormHelperText>
|
||||||
)}
|
)}
|
||||||
|
<Tooltip title="Add another condition">
|
||||||
|
<IconButton
|
||||||
|
color="primary"
|
||||||
|
disabled={numConditions >= device.maxConditions() || !canEdit}
|
||||||
|
aria-label="Add another condition"
|
||||||
|
onClick={addCondition}
|
||||||
|
className={classNames(classes.greenButton, classes.noPadding)}>
|
||||||
|
<AddIcon />
|
||||||
|
</IconButton>
|
||||||
|
</Tooltip>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -154,6 +154,18 @@ export class Device {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public maxConditions(): number {
|
||||||
|
let max = 2
|
||||||
|
switch (this.settings.platform) {
|
||||||
|
case pond.DevicePlatform.DEVICE_PLATFORM_V2_CELLULAR_BLACK:
|
||||||
|
case pond.DevicePlatform.DEVICE_PLATFORM_V2_WIFI_BLUE:
|
||||||
|
case pond.DevicePlatform.DEVICE_PLATFORM_V2_CELLULAR_BLUE:
|
||||||
|
case pond.DevicePlatform.DEVICE_PLATFORM_V2_ETHERNET_BLUE:
|
||||||
|
max = this.status.firmwareVersion >= "2.1.9" ? 4 : 2;
|
||||||
|
}
|
||||||
|
return max
|
||||||
|
}
|
||||||
|
|
||||||
public featureSupported(feature: string): boolean {
|
public featureSupported(feature: string): boolean {
|
||||||
let versions = featureVersions.get(feature);
|
let versions = featureVersions.get(feature);
|
||||||
if (!versions) {
|
if (!versions) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue