diff --git a/interface/src/app/main/Customizations.tsx b/interface/src/app/main/Customizations.tsx
index 013492275..a6caf8b06 100644
--- a/interface/src/app/main/Customizations.tsx
+++ b/interface/src/app/main/Customizations.tsx
@@ -23,6 +23,7 @@ import {
TextField,
ToggleButton,
ToggleButtonGroup,
+ Tooltip,
Typography
} from '@mui/material';
@@ -292,6 +293,17 @@ const Customizations = () => {
return value as string;
}
+ function formatLimit(value: number | null | undefined) {
+ if (value === null) {
+ return (
+
+
+
+ );
+ }
+ return formatValue(value);
+ }
+
const isCommand = (de: DeviceEntity) => {
return de.n && de.n[0] === '!';
};
@@ -385,10 +397,13 @@ const Customizations = () => {
if (!selectedIds.has(de.id)) {
return de;
}
- const next: DeviceEntity = { ...de, m: 0, c: false };
- delete next.cn;
- delete next.mi;
- delete next.ma;
+ const next: DeviceEntity = { ...de, m: 0, cn: '', c: false };
+ if (de.mi !== undefined) {
+ next.mi = null;
+ }
+ if (de.ma !== undefined) {
+ next.ma = null;
+ }
return next;
})
);
@@ -829,10 +844,10 @@ const Customizations = () => {
|
- {!(de.m & DeviceEntityMask.DV_READONLY) && formatValue(de.mi)}
+ {!(de.m & DeviceEntityMask.DV_READONLY) && formatLimit(de.mi)}
|
- {!(de.m & DeviceEntityMask.DV_READONLY) && formatValue(de.ma)}
+ {!(de.m & DeviceEntityMask.DV_READONLY) && formatLimit(de.ma)}
|
{formatValue(de.v)} |
diff --git a/interface/src/app/main/CustomizationsDialog.tsx b/interface/src/app/main/CustomizationsDialog.tsx
index d701487bb..bd2d78cc2 100644
--- a/interface/src/app/main/CustomizationsDialog.tsx
+++ b/interface/src/app/main/CustomizationsDialog.tsx
@@ -4,6 +4,7 @@ import CancelIcon from '@mui/icons-material/Cancel';
import CloseIcon from '@mui/icons-material/Close';
import DoneIcon from '@mui/icons-material/Done';
import SettingsBackupRestoreIcon from '@mui/icons-material/SettingsBackupRestore';
+import WarningIcon from '@mui/icons-material/Warning';
import {
Box,
Button,
@@ -12,7 +13,9 @@ import {
DialogContent,
DialogTitle,
Grid,
+ InputAdornment,
TextField,
+ Tooltip,
Typography
} from '@mui/material';
@@ -103,13 +106,25 @@ const CustomizationsDialog = ({
};
const remove = () => {
- const next: DeviceEntity = { ...editItem, m: 0, c: false };
- delete next.cn;
- delete next.mi;
- delete next.ma;
+ const next: DeviceEntity = { ...editItem, m: 0, cn: '', c: false };
+ if (editItem.mi !== undefined) {
+ next.mi = null;
+ }
+ if (editItem.ma !== undefined) {
+ next.ma = null;
+ }
onSave(next);
};
+ const limitAdornment = (cleared: boolean) =>
+ cleared ? (
+
+
+
+
+
+ ) : undefined;
+
return (