Service card

This commit is contained in:
Eden Kirin
2024-01-26 23:09:05 +01:00
parent f940967950
commit 94ee8da3bd
2 changed files with 37 additions and 18 deletions

View File

@ -23,7 +23,25 @@ function normalizeServiceName(name: string): string {
.replace(/\b\w/g, (s) => s.toUpperCase());
}
function TenantsStatusTooltip(tenantsStatus: StatusPerTenant) {}
interface TenantsStatusTooltipProps {
tenantsStatus: StatusPerTenant;
}
function TenantsStatusTooltip({ tenantsStatus }: TenantsStatusTooltipProps) {
const statusItems = Object.entries(tenantsStatus).map(([key, value]) => {
console.log(`key: ${key}, value: ${value}`);
return null;
});
// console.log(tenantsStatus);
// console.log(statusItems);
return (
<Box className="tenants-status-tooltip">
<Typography color="inherit">Tooltip with HTML</Typography>
<em>{"And here's"}</em> <b>{"some"}</b> <u>{"amazing content"}</u>. {"It's very engaging. Right?"}
</Box>
);
}
interface ServiceNodePropps {
node: Node;
@ -45,31 +63,28 @@ function ServiceNode({ node }: ServiceNodePropps) {
tenantsHealth = Object.values(node.health_check_status?.status_per_tenant);
}
let tenantsStatus = null;
let tenantsStatusContent = null;
if (tenantsHealth.length > 0) {
const okValues = tenantsHealth.filter((t) => t === true);
switch (okValues.length) {
case 0:
tenantsStatus = (
<Tooltip
title={
<Box className="tenants-status-tooltip">
<Typography color="inherit">Tooltip with HTML</Typography>
<em>{"And here's"}</em> <b>{"some"}</b> <u>{"amazing content"}</u>.{" "}
{"It's very engaging. Right?"}
</Box>
}
>
<Chip label="tenants" color="error" className="node-name" />
</Tooltip>
);
tenantsStatusContent = <Chip label="tenants" color="error" className="node-name" />;
break;
case tenantsHealth.length:
tenantsStatus = <Chip label="tenants" color="success" className="node-name" />;
tenantsStatusContent = <Chip label="tenants" color="success" className="node-name" />;
break;
default:
tenantsStatus = <Chip label="tenants" color="warning" className="node-name" />;
tenantsStatusContent = <Chip label="tenants" color="warning" className="node-name" />;
}
if (node.health_check_status?.status_per_tenant) {
tenantsStatusContent = (
<Tooltip title={<TenantsStatusTooltip tenantsStatus={node.health_check_status.status_per_tenant} />}>
{tenantsStatusContent}
</Tooltip>
);
} else {
}
}
@ -85,7 +100,7 @@ function ServiceNode({ node }: ServiceNodePropps) {
<LaunchIcon />
</IconButton>
</Tooltip>
{tenantsStatus}
{tenantsStatusContent}
</Grid>
</Grid>
);

View File

@ -43,6 +43,10 @@ $color-danger: #d32f2f;
}
}
}
.MuiCardContent-root {
padding-bottom: 16px !important;
}
}
.MuiTooltip-tooltip .tenants-status-tooltip {