mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 16:29:51 +03:00
show "no data" if there is no data and move help tooltip
This commit is contained in:
@@ -283,115 +283,121 @@ const Dashboard = memo(() => {
|
|||||||
</MessageBox>
|
</MessageBox>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{data.nodes.length > 0 && (
|
<Box
|
||||||
<>
|
display="flex"
|
||||||
<Box
|
justifyContent="flex-end"
|
||||||
display="flex"
|
flexWrap="nowrap"
|
||||||
justifyContent="flex-end"
|
whiteSpace="nowrap"
|
||||||
flexWrap="nowrap"
|
>
|
||||||
whiteSpace="nowrap"
|
<ToggleButtonGroup
|
||||||
|
size="small"
|
||||||
|
color="primary"
|
||||||
|
value={showAll}
|
||||||
|
exclusive
|
||||||
|
onChange={handleShowAll}
|
||||||
|
>
|
||||||
|
<ButtonTooltip title={LL.ALLVALUES()}>
|
||||||
|
<ToggleButton value={true}>
|
||||||
|
<UnfoldMoreIcon sx={{ fontSize: 18 }} />
|
||||||
|
</ToggleButton>
|
||||||
|
</ButtonTooltip>
|
||||||
|
<ButtonTooltip title={LL.COMPACT()}>
|
||||||
|
<ToggleButton value={false}>
|
||||||
|
<UnfoldLessIcon sx={{ fontSize: 18 }} />
|
||||||
|
</ToggleButton>
|
||||||
|
</ButtonTooltip>
|
||||||
|
</ToggleButtonGroup>
|
||||||
|
</Box>
|
||||||
|
|
||||||
|
{data.nodes.length > 0 ? (
|
||||||
|
<Box mt={1} justifyContent="center" flexDirection="column">
|
||||||
|
<IconContext.Provider
|
||||||
|
value={{
|
||||||
|
color: 'lightblue',
|
||||||
|
size: '18',
|
||||||
|
style: { verticalAlign: 'middle' }
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<ToggleButtonGroup
|
<Table
|
||||||
size="small"
|
data={{ nodes: data.nodes }}
|
||||||
color="primary"
|
theme={dashboard_theme}
|
||||||
value={showAll}
|
layout={{ custom: true }}
|
||||||
exclusive
|
tree={tree}
|
||||||
onChange={handleShowAll}
|
|
||||||
>
|
>
|
||||||
<ButtonTooltip title={LL.ALLVALUES()}>
|
{(tableList: DashboardItem[]) => (
|
||||||
<ToggleButton value={true}>
|
<Body>
|
||||||
<UnfoldMoreIcon sx={{ fontSize: 18 }} />
|
{tableList.map((di: DashboardItem) => (
|
||||||
</ToggleButton>
|
<Row
|
||||||
</ButtonTooltip>
|
key={di.id}
|
||||||
<ButtonTooltip title={LL.COMPACT()}>
|
item={di}
|
||||||
<ToggleButton value={false}>
|
onClick={() => editDashboardValue(di)}
|
||||||
<UnfoldLessIcon sx={{ fontSize: 18 }} />
|
>
|
||||||
</ToggleButton>
|
{di.id > 99 ? (
|
||||||
</ButtonTooltip>
|
<>
|
||||||
</ToggleButtonGroup>
|
<Cell>{showName(di)}</Cell>
|
||||||
<Tooltip title={LL.DASHBOARD_1()}>
|
<Cell>
|
||||||
<HelpOutlineIcon
|
<ButtonTooltip
|
||||||
sx={{
|
title={formatValue(LL, di.dv?.v, di.dv?.u)}
|
||||||
ml: 1,
|
>
|
||||||
mt: 1,
|
<span>{formatValue(LL, di.dv?.v, di.dv?.u)}</span>
|
||||||
fontSize: 20,
|
</ButtonTooltip>
|
||||||
verticalAlign: 'middle'
|
</Cell>
|
||||||
}}
|
|
||||||
color="primary"
|
|
||||||
/>
|
|
||||||
</Tooltip>
|
|
||||||
</Box>
|
|
||||||
|
|
||||||
<Box mt={1} justifyContent="center" flexDirection="column">
|
<Cell>
|
||||||
<IconContext.Provider
|
{me.admin &&
|
||||||
value={{
|
di.dv?.c &&
|
||||||
color: 'lightblue',
|
!hasMask(di.dv.id, DeviceEntityMask.DV_READONLY) && (
|
||||||
size: '18',
|
<IconButton
|
||||||
style: { verticalAlign: 'middle' }
|
size="small"
|
||||||
|
aria-label={
|
||||||
|
LL.CHANGE_VALUE() + ' ' + LL.VALUE(0)
|
||||||
|
}
|
||||||
|
onClick={() => editDashboardValue(di)}
|
||||||
|
>
|
||||||
|
<EditIcon
|
||||||
|
color="primary"
|
||||||
|
sx={{ fontSize: 16 }}
|
||||||
|
/>
|
||||||
|
</IconButton>
|
||||||
|
)}
|
||||||
|
</Cell>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
<CellTree item={di}>{showName(di)}</CellTree>
|
||||||
|
<Cell />
|
||||||
|
<Cell />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</Row>
|
||||||
|
))}
|
||||||
|
</Body>
|
||||||
|
)}
|
||||||
|
</Table>
|
||||||
|
</IconContext.Provider>
|
||||||
|
</Box>
|
||||||
|
) : (
|
||||||
|
<Box
|
||||||
|
display="flex"
|
||||||
|
// justifyContent="flex-end"
|
||||||
|
// flexWrap="nowrap"
|
||||||
|
// whiteSpace="nowrap"
|
||||||
|
>
|
||||||
|
<Typography mt={1} color="warning.main" variant="body1">
|
||||||
|
no data
|
||||||
|
</Typography>
|
||||||
|
<Tooltip title={LL.DASHBOARD_1()}>
|
||||||
|
<HelpOutlineIcon
|
||||||
|
sx={{
|
||||||
|
ml: 1,
|
||||||
|
mt: 1,
|
||||||
|
fontSize: 20,
|
||||||
|
verticalAlign: 'middle'
|
||||||
}}
|
}}
|
||||||
>
|
color="primary"
|
||||||
<Table
|
/>
|
||||||
data={{ nodes: data.nodes }}
|
</Tooltip>
|
||||||
theme={dashboard_theme}
|
</Box>
|
||||||
layout={{ custom: true }}
|
|
||||||
tree={tree}
|
|
||||||
>
|
|
||||||
{(tableList: DashboardItem[]) => (
|
|
||||||
<Body>
|
|
||||||
{tableList.map((di: DashboardItem) => (
|
|
||||||
<Row
|
|
||||||
key={di.id}
|
|
||||||
item={di}
|
|
||||||
onClick={() => editDashboardValue(di)}
|
|
||||||
>
|
|
||||||
{di.id > 99 ? (
|
|
||||||
<>
|
|
||||||
<Cell>{showName(di)}</Cell>
|
|
||||||
<Cell>
|
|
||||||
<ButtonTooltip
|
|
||||||
title={formatValue(LL, di.dv?.v, di.dv?.u)}
|
|
||||||
>
|
|
||||||
<span>{formatValue(LL, di.dv?.v, di.dv?.u)}</span>
|
|
||||||
</ButtonTooltip>
|
|
||||||
</Cell>
|
|
||||||
|
|
||||||
<Cell>
|
|
||||||
{me.admin &&
|
|
||||||
di.dv?.c &&
|
|
||||||
!hasMask(
|
|
||||||
di.dv.id,
|
|
||||||
DeviceEntityMask.DV_READONLY
|
|
||||||
) && (
|
|
||||||
<IconButton
|
|
||||||
size="small"
|
|
||||||
aria-label={
|
|
||||||
LL.CHANGE_VALUE() + ' ' + LL.VALUE(0)
|
|
||||||
}
|
|
||||||
onClick={() => editDashboardValue(di)}
|
|
||||||
>
|
|
||||||
<EditIcon
|
|
||||||
color="primary"
|
|
||||||
sx={{ fontSize: 16 }}
|
|
||||||
/>
|
|
||||||
</IconButton>
|
|
||||||
)}
|
|
||||||
</Cell>
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
<CellTree item={di}>{showName(di)}</CellTree>
|
|
||||||
<Cell />
|
|
||||||
<Cell />
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</Row>
|
|
||||||
))}
|
|
||||||
</Body>
|
|
||||||
)}
|
|
||||||
</Table>
|
|
||||||
</IconContext.Provider>
|
|
||||||
</Box>
|
|
||||||
</>
|
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user