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>
|
||||
</Grid>
|
||||
<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">
|
||||
<IconButton
|
||||
color="default"
|
||||
disabled={!canEdit}
|
||||
aria-label="Remove condition"
|
||||
onClick={() => removeCondition(index)}
|
||||
className={classNames(classes.redButton, classes.noPadding)}>
|
||||
<RemoveIcon />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
)}
|
||||
<Tooltip title="Remove this condition">
|
||||
<IconButton
|
||||
color="default"
|
||||
disabled={numConditions === 1 ||!canEdit}
|
||||
aria-label="Remove condition"
|
||||
onClick={() => removeCondition(index)}
|
||||
className={classNames(classes.redButton, classes.noPadding)}>
|
||||
<RemoveIcon />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
</Grid>
|
||||
</Grid>
|
||||
{multiNodeSource() && !sensor && (
|
||||
|
|
@ -1076,6 +1063,16 @@ export default function InteractionSettings(props: Props) {
|
|||
) : (
|
||||
<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>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
let versions = featureVersions.get(feature);
|
||||
if (!versions) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue