Merge pull request 'ui: display overlay when no machines available' (#533) from DavHau-dave into main
All checks were successful
checks / test (push) Successful in 47s
assets1 / test (push) Successful in 49s
checks-impure / test (push) Successful in 1m40s

This commit is contained in:
clan-bot 2023-11-18 09:42:58 +00:00
commit 584bcc5334
3 changed files with 38 additions and 31 deletions

View File

@ -2,7 +2,7 @@
source_up
files=(flake-module.nix package.json package-lock.json)
files=(../../flake.nix ../theme default.nix flake-module.nix package.json package-lock.json)
if type nix_direnv_watch_file &>/dev/null; then
nix_direnv_watch_file "${files[@]}"
else

View File

@ -75,7 +75,7 @@ export function NoDataOverlay(props: NoDataOverlayProps) {
</g>
</g>
</svg>
<Box sx={{ mt: 1 }}>{label}</Box>
<Box sx={{ mt: 1, textAlign: "center" }}>{label}</Box>
</StyledGridOverlay>
);
}

View File

@ -13,6 +13,7 @@ import { visuallyHidden } from "@mui/utils";
import { NodeRow } from "./nodeRow";
import { Machine } from "@/api/model/machine";
import { NoDataOverlay } from "../noDataOverlay";
interface HeadCell {
disablePadding: boolean;
@ -163,35 +164,41 @@ export function NodeTableContainer(props: NodeTableContainerProps) {
);
return (
<TableContainer>
<Table aria-labelledby="tableTitle" size={dense ? "small" : "medium"}>
<EnhancedTableHead
order={order}
orderBy={orderBy}
onRequestSort={handleRequestSort}
rowCount={tableData.length}
/>
<TableBody>
{visibleRows.map((row, index) => {
return (
<NodeRow
key={index}
row={row}
selected={selected}
setSelected={setSelected}
/>
);
})}
{emptyRows > 0 && (
<TableRow
style={{
height: (dense ? 33 : 53) * emptyRows,
}}
>
<TableCell colSpan={6} />
</TableRow>
)}
</TableBody>
</Table>
{tableData.length === 0 ? (
<div className="my-8 flex w-full items-center justify-center">
<NoDataOverlay label={"No Machines"} />
</div>
) : (
<Table aria-labelledby="tableTitle" size={dense ? "small" : "medium"}>
<EnhancedTableHead
order={order}
orderBy={orderBy}
onRequestSort={handleRequestSort}
rowCount={tableData.length}
/>
<TableBody>
{visibleRows.map((row, index) => {
return (
<NodeRow
key={index}
row={row}
selected={selected}
setSelected={setSelected}
/>
);
})}
{emptyRows > 0 && (
<TableRow
style={{
height: (dense ? 33 : 53) * emptyRows,
}}
>
<TableCell colSpan={6} />
</TableRow>
)}
</TableBody>
</Table>
)}
</TableContainer>
);
}