added to the device settings and the chip for if a device needs the I2C bus component to power the I2C Line
This commit is contained in:
parent
989ca20a31
commit
a2c68e0089
4 changed files with 40 additions and 5 deletions
4
package-lock.json
generated
4
package-lock.json
generated
|
|
@ -43,7 +43,7 @@
|
||||||
"mui-tel-input": "^7.0.0",
|
"mui-tel-input": "^7.0.0",
|
||||||
"notistack": "^3.0.1",
|
"notistack": "^3.0.1",
|
||||||
"openweathermap-ts": "^1.2.10",
|
"openweathermap-ts": "^1.2.10",
|
||||||
"protobuf-ts": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#staging",
|
"protobuf-ts": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#bus_chip",
|
||||||
"query-string": "^9.2.1",
|
"query-string": "^9.2.1",
|
||||||
"react": "^18.3.1",
|
"react": "^18.3.1",
|
||||||
"react-beautiful-dnd": "^13.1.1",
|
"react-beautiful-dnd": "^13.1.1",
|
||||||
|
|
@ -11967,7 +11967,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#080793fb450e5721fefd7a6f6f28df98e810ba90",
|
"resolved": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#dbe6d5a395c8fe8a098574e645aa14a99cdd7c85",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"protobufjs": "^6.8.8"
|
"protobufjs": "^6.8.8"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@
|
||||||
"mui-tel-input": "^7.0.0",
|
"mui-tel-input": "^7.0.0",
|
||||||
"notistack": "^3.0.1",
|
"notistack": "^3.0.1",
|
||||||
"openweathermap-ts": "^1.2.10",
|
"openweathermap-ts": "^1.2.10",
|
||||||
"protobuf-ts": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#staging",
|
"protobuf-ts": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#bus_chip",
|
||||||
"query-string": "^9.2.1",
|
"query-string": "^9.2.1",
|
||||||
"react": "^18.3.1",
|
"react": "^18.3.1",
|
||||||
"react-beautiful-dnd": "^13.1.1",
|
"react-beautiful-dnd": "^13.1.1",
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { Chip, Grid2 as Grid, Theme, Tooltip, Skeleton } from "@mui/material";
|
import { Chip, Grid2 as Grid, Theme, Tooltip, Skeleton } from "@mui/material";
|
||||||
import { DataUsage, SimCard, Launch } from "@mui/icons-material";
|
import { DataUsage, SimCard, Launch, DeviceHub } from "@mui/icons-material";
|
||||||
import StatusChip from "common/StatusChip";
|
import StatusChip from "common/StatusChip";
|
||||||
import DeviceTags from "device/DeviceTags";
|
import DeviceTags from "device/DeviceTags";
|
||||||
import VersionChip from "device/VersionChip";
|
import VersionChip from "device/VersionChip";
|
||||||
|
|
@ -233,6 +233,17 @@ export default function DeviceOverview(props: Props) {
|
||||||
<StatusChip status="pending" />
|
<StatusChip status="pending" />
|
||||||
</Grid>
|
</Grid>
|
||||||
)}
|
)}
|
||||||
|
{device.settings.needsBusControl && (
|
||||||
|
<Grid>
|
||||||
|
<Tooltip title="Device needs the Bus Control component to power the I2C port">
|
||||||
|
<Chip
|
||||||
|
variant="outlined"
|
||||||
|
label={"I2C Bus"}
|
||||||
|
icon={<DeviceHub />}
|
||||||
|
/>
|
||||||
|
</Tooltip>
|
||||||
|
</Grid>
|
||||||
|
)}
|
||||||
{<DeviceTags device={device} disableAdd={disableAddTag} />}
|
{<DeviceTags device={device} disableAdd={disableAddTag} />}
|
||||||
</Grid>
|
</Grid>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -235,6 +235,12 @@ export default function DeviceSettings(props: Props) {
|
||||||
setDeviceForm(updatedForm);
|
setDeviceForm(updatedForm);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const toggleBusRequired = (event: any) => {
|
||||||
|
let updatedForm = Device.clone(deviceForm);
|
||||||
|
updatedForm.settings.needsBusControl = event.target.checked;
|
||||||
|
setDeviceForm(updatedForm);
|
||||||
|
};
|
||||||
|
|
||||||
const toggleSleeps = (event: any) => {
|
const toggleSleeps = (event: any) => {
|
||||||
let updatedForm = Device.clone(deviceForm);
|
let updatedForm = Device.clone(deviceForm);
|
||||||
let updatedSleeps = event.target.checked;
|
let updatedSleeps = event.target.checked;
|
||||||
|
|
@ -500,7 +506,8 @@ export default function DeviceSettings(props: Props) {
|
||||||
</Grid>
|
</Grid>
|
||||||
)}
|
)}
|
||||||
{user.hasAdmin() && (
|
{user.hasAdmin() && (
|
||||||
<Grid size={{ xs: 12, sm: 12 }}>
|
<React.Fragment>
|
||||||
|
<Grid size={{ xs: 12, sm: 6 }}>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
control={
|
control={
|
||||||
<Switch
|
<Switch
|
||||||
|
|
@ -516,6 +523,23 @@ export default function DeviceSettings(props: Props) {
|
||||||
labelPlacement="end"
|
labelPlacement="end"
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
<Grid size={{ xs: 12, sm: 6 }}>
|
||||||
|
<FormControlLabel
|
||||||
|
control={
|
||||||
|
<Switch
|
||||||
|
checked={deviceForm.settings.needsBusControl}
|
||||||
|
onChange={toggleBusRequired}
|
||||||
|
name="needsI2CBus"
|
||||||
|
aria-label="needsI2CBus"
|
||||||
|
color="secondary"
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
disabled={!canEdit}
|
||||||
|
label="I2C Bus Required"
|
||||||
|
labelPlacement="end"
|
||||||
|
/>
|
||||||
|
</Grid>
|
||||||
|
</React.Fragment>
|
||||||
)}
|
)}
|
||||||
</Grid>
|
</Grid>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue