mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
minor optimizations
This commit is contained in:
@@ -14,8 +14,7 @@ import {
|
|||||||
DialogContent,
|
DialogContent,
|
||||||
DialogTitle,
|
DialogTitle,
|
||||||
ToggleButton,
|
ToggleButton,
|
||||||
ToggleButtonGroup,
|
ToggleButtonGroup
|
||||||
Tooltip
|
|
||||||
} from '@mui/material';
|
} from '@mui/material';
|
||||||
|
|
||||||
import TableCell, { tableCellClasses } from '@mui/material/TableCell';
|
import TableCell, { tableCellClasses } from '@mui/material/TableCell';
|
||||||
@@ -117,10 +116,14 @@ const SettingsCustomization: FC = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Box color="warning.main">
|
<Box mb={2} color="warning.main">
|
||||||
<Typography variant="body2">
|
<Typography variant="body2">
|
||||||
You can mark an entity as a favorite to be listed first in the Web Dashboard, or remove it from the
|
You can mark an entity as a favorite to be listed first in the Dashboard (
|
||||||
Dashboard, or disable it's write operation or exclude it from the MQTT and API outputs.
|
<FavoriteBorderOutlinedIcon fontSize="small" />) ,or remove it entirely from the Dashboard (
|
||||||
|
<VisibilityOffOutlinedIcon fontSize="small" />) ,or disable it's write operation (
|
||||||
|
<EditOffOutlinedIcon fontSize="small" />) or have it excluded from the MQTT and API outputs (
|
||||||
|
<CommentsDisabledOutlinedIcon fontSize="small" />
|
||||||
|
).
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
<ValidatedTextField
|
<ValidatedTextField
|
||||||
@@ -174,19 +177,9 @@ const SettingsCustomization: FC = () => {
|
|||||||
|
|
||||||
const setMask = (de: DeviceEntity, newMask: string[]) => {
|
const setMask = (de: DeviceEntity, newMask: string[]) => {
|
||||||
var new_mask = 0;
|
var new_mask = 0;
|
||||||
if (newMask.includes('1')) {
|
for (let entry of newMask) {
|
||||||
new_mask |= 1;
|
new_mask |= Number(entry);
|
||||||
}
|
}
|
||||||
if (newMask.includes('2')) {
|
|
||||||
new_mask |= 2;
|
|
||||||
}
|
|
||||||
if (newMask.includes('4')) {
|
|
||||||
new_mask |= 4;
|
|
||||||
}
|
|
||||||
if (newMask.includes('8')) {
|
|
||||||
new_mask |= 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
de.m = new_mask;
|
de.m = new_mask;
|
||||||
setMasks(newMask);
|
setMasks(newMask);
|
||||||
};
|
};
|
||||||
@@ -220,35 +213,27 @@ const SettingsCustomization: FC = () => {
|
|||||||
</TableHead>
|
</TableHead>
|
||||||
<TableBody>
|
<TableBody>
|
||||||
{deviceEntities.map((de) => (
|
{deviceEntities.map((de) => (
|
||||||
<TableRow key={de.i}>
|
<TableRow key={de.i} hover>
|
||||||
<StyledTableCell padding="checkbox">
|
<StyledTableCell padding="checkbox">
|
||||||
<ToggleButtonGroup
|
<ToggleButtonGroup
|
||||||
size="small"
|
size="small"
|
||||||
color="error"
|
color="secondary"
|
||||||
value={getMask(de)}
|
value={getMask(de)}
|
||||||
onChange={(event, mask) => {
|
onChange={(event, mask) => {
|
||||||
setMask(de, mask);
|
setMask(de, mask);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ToggleButton value="8" color="success" disabled={(de.m & 1) !== 0}>
|
<ToggleButton value="8" color="success" disabled={(de.m & 1) !== 0}>
|
||||||
<Tooltip title="Favorite">
|
<FavoriteBorderOutlinedIcon fontSize="small" />
|
||||||
<FavoriteBorderOutlinedIcon fontSize="small" />
|
|
||||||
</Tooltip>
|
|
||||||
</ToggleButton>
|
</ToggleButton>
|
||||||
<ToggleButton value="4" disabled={!de.w}>
|
<ToggleButton value="4" disabled={!de.w}>
|
||||||
<Tooltip title="Force read-only">
|
<EditOffOutlinedIcon fontSize="small" />
|
||||||
<EditOffOutlinedIcon fontSize="small" />
|
|
||||||
</Tooltip>
|
|
||||||
</ToggleButton>
|
</ToggleButton>
|
||||||
<ToggleButton value="2">
|
<ToggleButton value="2">
|
||||||
<Tooltip title="Exclude in MQTT and API">
|
<CommentsDisabledOutlinedIcon fontSize="small" />
|
||||||
<CommentsDisabledOutlinedIcon fontSize="small" />
|
|
||||||
</Tooltip>
|
|
||||||
</ToggleButton>
|
</ToggleButton>
|
||||||
<ToggleButton value="1">
|
<ToggleButton value="1">
|
||||||
<Tooltip title="Don't show Web Dashboard">
|
<VisibilityOffOutlinedIcon fontSize="small" />
|
||||||
<VisibilityOffOutlinedIcon fontSize="small" />
|
|
||||||
</Tooltip>
|
|
||||||
</ToggleButton>
|
</ToggleButton>
|
||||||
</ToggleButtonGroup>
|
</ToggleButtonGroup>
|
||||||
</StyledTableCell>
|
</StyledTableCell>
|
||||||
|
|||||||
Reference in New Issue
Block a user