feat: adding onclick action to tow and differentiating background main dark from background accent dark
This commit is contained in:
1 parent
273294cbb0
commit
55e3c674b6
2 files changed
+72
-62
No files matched your search
@@ -124,6 +124,7 @@ function Infrastructure(/* {isAdmin} */) {
|
|||||||
console.log({ monitors });
|
console.log({ monitors });
|
||||||
console.log(monitors[0]?.checks[0]?.memory.usage_percent);
|
console.log(monitors[0]?.checks[0]?.memory.usage_percent);
|
||||||
const monitorsAsRows = monitors.map((monitor) => ({
|
const monitorsAsRows = monitors.map((monitor) => ({
|
||||||
|
id: monitor._id,
|
||||||
url: monitor.url,
|
url: monitor.url,
|
||||||
name: monitor.name,
|
name: monitor.name,
|
||||||
status: determineState(monitor),
|
status: determineState(monitor),
|
||||||
@@ -132,10 +133,12 @@ function Infrastructure(/* {isAdmin} */) {
|
|||||||
mem: monitor?.checks[0]?.memory.usage_percent * 100,
|
mem: monitor?.checks[0]?.memory.usage_percent * 100,
|
||||||
disk: monitor?.checks[0]?.disk[0]?.usage_percent * 100,
|
disk: monitor?.checks[0]?.disk[0]?.usage_percent * 100,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
/* Fix search in monitors page */
|
|
||||||
/* Adding actions to the table */
|
|
||||||
/* Adding click on row action */
|
/* Adding click on row action */
|
||||||
|
/* Adding actions to the table */
|
||||||
|
|
||||||
|
function openDetails(id) {
|
||||||
|
navigate(`/infrastructure/${id}`);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack
|
<Stack
|
||||||
@@ -211,66 +214,73 @@ function Infrastructure(/* {isAdmin} */) {
|
|||||||
</TableRow>
|
</TableRow>
|
||||||
</TableHead>
|
</TableHead>
|
||||||
<TableBody>
|
<TableBody>
|
||||||
{
|
{monitorsAsRows.map((row) => (
|
||||||
/* ROWS */ monitorsAsRows.map((row, index) => (
|
<TableRow
|
||||||
<TableRow key={index}>
|
key={row.id}
|
||||||
{/* TODO iterate over column and get column id, applying row[column.id] */}
|
onClick={() => openDetails(row.id)}
|
||||||
<TableCell>
|
sx={{
|
||||||
<Host
|
cursor: "pointer",
|
||||||
title={row.name}
|
"&:hover": {
|
||||||
url={row.url}
|
backgroundColor: theme.palette.background.accent,
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{/* TODO iterate over column and get column id, applying row[column.id] */}
|
||||||
|
<TableCell>
|
||||||
|
<Host
|
||||||
|
title={row.name}
|
||||||
|
url={row.url}
|
||||||
|
/>
|
||||||
|
</TableCell>
|
||||||
|
<TableCell align="center">
|
||||||
|
<StatusLabel
|
||||||
|
status={row.status}
|
||||||
|
text={row.status}
|
||||||
|
/* Use capitalize inside of Status Label */
|
||||||
|
/* Update component so we don't need to pass text and status separately*/
|
||||||
|
customStyles={{ textTransform: "capitalize" }}
|
||||||
|
/>
|
||||||
|
</TableCell>
|
||||||
|
<TableCell align="center">
|
||||||
|
<Stack
|
||||||
|
direction={"row"}
|
||||||
|
justifyContent={"center"}
|
||||||
|
alignItems={"center"}
|
||||||
|
gap=".25rem"
|
||||||
|
>
|
||||||
|
<CPUChipIcon
|
||||||
|
width={20}
|
||||||
|
height={20}
|
||||||
/>
|
/>
|
||||||
</TableCell>
|
{row.processor}
|
||||||
<TableCell align="center">
|
</Stack>
|
||||||
<StatusLabel
|
</TableCell>
|
||||||
status={row.status}
|
<TableCell align="center">
|
||||||
text={row.status}
|
<CustomGauge progress={row.cpu} />
|
||||||
/* Use capitalize inside of Status Label */
|
</TableCell>
|
||||||
/* Update component so we don't need to pass text and status separately*/
|
<TableCell align="center">
|
||||||
customStyles={{ textTransform: "capitalize" }}
|
<CustomGauge progress={row.mem} />
|
||||||
|
</TableCell>
|
||||||
|
<TableCell align="center">
|
||||||
|
<CustomGauge progress={row.disk} />
|
||||||
|
</TableCell>
|
||||||
|
<TableCell align="center">
|
||||||
|
{/* Get ActionsMenu from Monitor Table and create a component */}
|
||||||
|
<IconButton
|
||||||
|
sx={{
|
||||||
|
"& svg path": {
|
||||||
|
stroke: theme.palette.other.icon,
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<GearIcon
|
||||||
|
width={20}
|
||||||
|
height={20}
|
||||||
/>
|
/>
|
||||||
</TableCell>
|
</IconButton>
|
||||||
<TableCell align="center">
|
</TableCell>
|
||||||
<Stack
|
</TableRow>
|
||||||
direction={"row"}
|
))}
|
||||||
justifyContent={"center"}
|
|
||||||
alignItems={"center"}
|
|
||||||
gap=".25rem"
|
|
||||||
>
|
|
||||||
<CPUChipIcon
|
|
||||||
width={20}
|
|
||||||
height={20}
|
|
||||||
/>
|
|
||||||
{row.processor}
|
|
||||||
</Stack>
|
|
||||||
</TableCell>
|
|
||||||
<TableCell align="center">
|
|
||||||
<CustomGauge progress={row.cpu} />
|
|
||||||
</TableCell>
|
|
||||||
<TableCell align="center">
|
|
||||||
<CustomGauge progress={row.mem} />
|
|
||||||
</TableCell>
|
|
||||||
<TableCell align="center">
|
|
||||||
<CustomGauge progress={row.disk} />
|
|
||||||
</TableCell>
|
|
||||||
<TableCell align="center">
|
|
||||||
{/* Get ActionsMenu from Monitor Table and create a component */}
|
|
||||||
<IconButton
|
|
||||||
sx={{
|
|
||||||
"& svg path": {
|
|
||||||
stroke: theme.palette.other.icon,
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<GearIcon
|
|
||||||
width={20}
|
|
||||||
height={20}
|
|
||||||
/>
|
|
||||||
</IconButton>
|
|
||||||
</TableCell>
|
|
||||||
</TableRow>
|
|
||||||
))
|
|
||||||
}
|
|
||||||
</TableBody>
|
</TableBody>
|
||||||
</Table>
|
</Table>
|
||||||
</TableContainer>
|
</TableContainer>
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ const semanticColors = {
|
|||||||
background: {
|
background: {
|
||||||
main: {
|
main: {
|
||||||
light: paletteColors.white,
|
light: paletteColors.white,
|
||||||
dark: paletteColors.gray850,
|
dark: paletteColors.gray890,
|
||||||
},
|
},
|
||||||
alt: {
|
alt: {
|
||||||
light: paletteColors.gray90,
|
light: paletteColors.gray90,
|
||||||
|
|||||||
Reference in new issue
Block a user