Add select for relays
This commit is contained in:
@ -17,8 +17,9 @@ import { useSnackbar } from "../hooks/context_providers/SnackbarProvider";
|
||||
import { dayjsToTimeOfDay, timeOfDay } from "../utils/DateUtils";
|
||||
import { lenValid } from "../utils/StringsUtils";
|
||||
import { CheckboxInput } from "../widgets/forms/CheckboxInput";
|
||||
import { TextInput } from "../widgets/forms/TextInput";
|
||||
import { MultipleSelectInput } from "../widgets/forms/MultipleSelectInput";
|
||||
import { SelectMultipleRelaysInput } from "../widgets/forms/SelectMultipleRelaysInput";
|
||||
import { TextInput } from "../widgets/forms/TextInput";
|
||||
|
||||
export function EditDeviceRelaysDialog(p: {
|
||||
onClose: () => void;
|
||||
@ -270,6 +271,42 @@ export function EditDeviceRelaysDialog(p: {
|
||||
</>
|
||||
)}
|
||||
</Grid>
|
||||
|
||||
<DialogFormTitle>Constraints</DialogFormTitle>
|
||||
<Grid container spacing={2}>
|
||||
<Grid item xs={6}>
|
||||
<SelectMultipleRelaysInput
|
||||
label="Required relays"
|
||||
exclude={[relay.id]}
|
||||
value={relay.depends_on}
|
||||
onValueChange={(v) =>
|
||||
setRelay((r) => {
|
||||
return {
|
||||
...r,
|
||||
depends_on: v,
|
||||
};
|
||||
})
|
||||
}
|
||||
helperText="Relays that must be already up for this relay to be started"
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={6}>
|
||||
<SelectMultipleRelaysInput
|
||||
label="Conflicting relays"
|
||||
exclude={[relay.id]}
|
||||
value={relay.conflicts_with}
|
||||
onValueChange={(v) =>
|
||||
setRelay((r) => {
|
||||
return {
|
||||
...r,
|
||||
conflicts_with: v,
|
||||
};
|
||||
})
|
||||
}
|
||||
helperText="Relays that must be off before this relay can be started"
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button onClick={p.onClose}>Cancel</Button>
|
||||
|
Reference in New Issue
Block a user