mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
grey out entities with no value
This commit is contained in:
@@ -285,13 +285,17 @@ const Customizations = () => {
|
|||||||
return value as string;
|
return value as string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isCommand = useCallback((de: DeviceEntity) => {
|
||||||
|
return de.n && de.n[0] === '!';
|
||||||
|
}, []);
|
||||||
|
|
||||||
const formatName = useCallback(
|
const formatName = useCallback(
|
||||||
(de: DeviceEntity, withShortname: boolean) => {
|
(de: DeviceEntity, withShortname: boolean) => {
|
||||||
let name: string;
|
let name: string;
|
||||||
if (de.n && de.n[0] === '!') {
|
if (isCommand(de)) {
|
||||||
name = de.t
|
name = de.t
|
||||||
? `${LL.COMMAND(1)}: ${de.t} ${de.n.slice(1)}`
|
? `${LL.COMMAND(1)}: ${de.t} ${de.n?.slice(1)}`
|
||||||
: `${LL.COMMAND(1)}: ${de.n.slice(1)}`;
|
: `${LL.COMMAND(1)}: ${de.n?.slice(1)}`;
|
||||||
} else if (de.cn && de.cn !== '') {
|
} else if (de.cn && de.cn !== '') {
|
||||||
name = de.t ? `${de.t} ${de.cn}` : de.cn;
|
name = de.t ? `${de.t} ${de.cn}` : de.cn;
|
||||||
} else {
|
} else {
|
||||||
@@ -543,7 +547,7 @@ const Customizations = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Box color="warning.main">
|
<Box color="warning.main">
|
||||||
<Typography variant="body2" mt={1}>
|
<Typography variant="body2" mt={1} mb={1}>
|
||||||
<OptionIcon type="favorite" isSet={true} />={LL.CUSTOMIZATIONS_HELP_2()}
|
<OptionIcon type="favorite" isSet={true} />={LL.CUSTOMIZATIONS_HELP_2()}
|
||||||
|
|
||||||
<OptionIcon type="readonly" isSet={true} />={LL.CUSTOMIZATIONS_HELP_3()}
|
<OptionIcon type="readonly" isSet={true} />={LL.CUSTOMIZATIONS_HELP_3()}
|
||||||
@@ -666,14 +670,27 @@ const Customizations = () => {
|
|||||||
<EntityMaskToggle onUpdate={updateDeviceEntity} de={de} />
|
<EntityMaskToggle onUpdate={updateDeviceEntity} de={de} />
|
||||||
</Cell>
|
</Cell>
|
||||||
<Cell>
|
<Cell>
|
||||||
{formatName(de, false)} (
|
<span
|
||||||
<Link
|
style={{
|
||||||
target="_blank"
|
color:
|
||||||
href={APIURL + selectedDeviceTypeNameURL + '/' + de.id}
|
de.v === undefined && !isCommand(de) ? 'grey' : 'inherit'
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{de.id}
|
{formatName(de, false)} (
|
||||||
</Link>
|
<Link
|
||||||
)
|
style={{
|
||||||
|
color:
|
||||||
|
de.v === undefined && !isCommand(de)
|
||||||
|
? 'grey'
|
||||||
|
: 'primary'
|
||||||
|
}}
|
||||||
|
target="_blank"
|
||||||
|
href={APIURL + selectedDeviceTypeNameURL + '/' + de.id}
|
||||||
|
>
|
||||||
|
{de.id}
|
||||||
|
</Link>
|
||||||
|
)
|
||||||
|
</span>
|
||||||
</Cell>
|
</Cell>
|
||||||
<Cell>
|
<Cell>
|
||||||
{!(de.m & DeviceEntityMask.DV_READONLY) && formatValue(de.mi)}
|
{!(de.m & DeviceEntityMask.DV_READONLY) && formatValue(de.mi)}
|
||||||
|
|||||||
Reference in New Issue
Block a user