From 1cc031b27b224661a1936f26991413a0bed6c08a Mon Sep 17 00:00:00 2001 From: proddy Date: Mon, 28 Mar 2022 17:50:51 +0200 Subject: [PATCH] minor optimizations --- .../src/project/SettingsCustomization.tsx | 47 +++++++------------ 1 file changed, 16 insertions(+), 31 deletions(-) diff --git a/interface/src/project/SettingsCustomization.tsx b/interface/src/project/SettingsCustomization.tsx index 368ec39c9..baf3a7480 100644 --- a/interface/src/project/SettingsCustomization.tsx +++ b/interface/src/project/SettingsCustomization.tsx @@ -14,8 +14,7 @@ import { DialogContent, DialogTitle, ToggleButton, - ToggleButtonGroup, - Tooltip + ToggleButtonGroup } from '@mui/material'; import TableCell, { tableCellClasses } from '@mui/material/TableCell'; @@ -117,10 +116,14 @@ const SettingsCustomization: FC = () => { return ( <> - + - You can mark an entity as a favorite to be listed first in the Web Dashboard, or remove it from the - Dashboard, or disable it's write operation or exclude it from the MQTT and API outputs. + You can mark an entity as a favorite to be listed first in the Dashboard ( + ) ,or remove it entirely from the Dashboard ( + ) ,or disable it's write operation ( + ) or have it excluded from the MQTT and API outputs ( + + ). { const setMask = (de: DeviceEntity, newMask: string[]) => { var new_mask = 0; - if (newMask.includes('1')) { - new_mask |= 1; + for (let entry of newMask) { + 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; setMasks(newMask); }; @@ -220,35 +213,27 @@ const SettingsCustomization: FC = () => { {deviceEntities.map((de) => ( - + { setMask(de, mask); }} > - - - + - - - + - - - + - - - +