message optional in MessageBox

This commit is contained in:
proddy
2025-01-14 22:09:23 +01:00
parent 570678e3d3
commit b23bcf3f0b
3 changed files with 14 additions and 17 deletions

View File

@@ -264,7 +264,7 @@ const Dashboard = () => {
</Box> </Box>
{!loading && !hasFavEntities && ( {!loading && !hasFavEntities && (
<MessageBox my={1} level="info" message=""> <MessageBox my={1} level="info">
<Typography> <Typography>
{LL.NO_DATA_1()}&nbsp; {LL.NO_DATA_1()}&nbsp;
<Link to="/customizations" style={{ color: 'white' }}> <Link to="/customizations" style={{ color: 'white' }}>

View File

@@ -11,7 +11,7 @@ type MessageBoxLevel = 'warning' | 'success' | 'info' | 'error';
export interface MessageBoxProps extends BoxProps { export interface MessageBoxProps extends BoxProps {
level: MessageBoxLevel; level: MessageBoxLevel;
message: string; message?: string;
} }
const LEVEL_ICONS: { const LEVEL_ICONS: {
@@ -53,8 +53,8 @@ const MessageBox: FC<MessageBoxProps> = ({
{...rest} {...rest}
> >
<Icon /> <Icon />
<Typography sx={{ ml: 2, flexGrow: 1 }} variant="body1"> <Typography sx={{ ml: 2 }} variant="body1">
{message} {message ?? ''}
</Typography> </Typography>
{children} {children}
</Box> </Box>

View File

@@ -268,10 +268,10 @@ function updateMask(entity: any, de: any, dd: any) {
const old_custom_name = dd.nodes[dd_objIndex].cn; const old_custom_name = dd.nodes[dd_objIndex].cn;
console.log( console.log(
'comparing names, old (' + 'comparing names, old (' +
old_custom_name + old_custom_name +
') with new (' + ') with new (' +
new_custom_name + new_custom_name +
')' ')'
); );
if (old_custom_name !== new_custom_name) { if (old_custom_name !== new_custom_name) {
changed = true; changed = true;
@@ -366,15 +366,15 @@ function check_upgrade(version: string) {
const stable_version = version.split(',')[1]; const stable_version = version.split(',')[1];
console.log( console.log(
'latest dev version: ' + 'latest dev version: ' +
dev_version + dev_version +
', latest stable version: ' + ', latest stable version: ' +
stable_version stable_version
); );
console.log( console.log(
'Version upgrade check from version ' + 'Version upgrade check from version ' +
THIS_VERSION + THIS_VERSION +
', upgradable: ' + ', upgradable: ' +
VERSION_IS_UPGRADEABLE VERSION_IS_UPGRADEABLE
); );
data = { data = {
emsesp_version: THIS_VERSION, emsesp_version: THIS_VERSION,
@@ -4608,7 +4608,6 @@ router
t: DeviceType.CUSTOM, t: DeviceType.CUSTOM,
nodes: getDashboardEntityData(DeviceTypeUniqueID.CUSTOM_UID) nodes: getDashboardEntityData(DeviceTypeUniqueID.CUSTOM_UID)
}; };
// only add to dashboard if we have values
if ((dashboard_object.nodes ?? []).length > 0) { if ((dashboard_object.nodes ?? []).length > 0) {
dashboard_data.push(dashboard_object); dashboard_data.push(dashboard_object);
} }
@@ -4629,8 +4628,6 @@ router
// t: DeviceType.SCHEDULER, // t: DeviceType.SCHEDULER,
// nodes: scheduler_data2 // nodes: scheduler_data2
// }; // };
// only add to dashboard if we have values
// if ((dashboard_object.nodes ?? []).length > 0) { // if ((dashboard_object.nodes ?? []).length > 0) {
// dashboard_data.push(dashboard_object); // dashboard_data.push(dashboard_object);
// } // }