Add select for relays

This commit is contained in:
2024-07-30 22:54:47 +02:00
parent 596d22739d
commit 3004b03d92
4 changed files with 103 additions and 4 deletions

View File

@ -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>