diff --git a/src/components/dashboard/EnvironmentList.tsx b/src/components/dashboard/EnvironmentList.tsx index 915cb11..25dcb59 100644 --- a/src/components/dashboard/EnvironmentList.tsx +++ b/src/components/dashboard/EnvironmentList.tsx @@ -11,7 +11,7 @@ interface EnvironmentListProps { export default function EnvironmentList({ environments }: EnvironmentListProps) { const envItems = environments.map((env) => { return ( - + environment: diff --git a/src/components/dashboard/ServiceCard.tsx b/src/components/dashboard/ServiceCard.tsx index 58a0c2e..f795898 100644 --- a/src/components/dashboard/ServiceCard.tsx +++ b/src/components/dashboard/ServiceCard.tsx @@ -7,6 +7,7 @@ import Stack from "@mui/material/Stack"; import IconButton from "@mui/material/IconButton"; import LaunchIcon from "@mui/icons-material/Launch"; import Tooltip from "@mui/material/Tooltip"; +import Chip from "@mui/material/Chip"; import Grid from "@mui/material/Unstable_Grid2"; interface ServiceCardProps { @@ -26,22 +27,50 @@ interface ServiceNodePropps { } function ServiceNode({ node }: ServiceNodePropps) { + const nodeName = node.health_check_status?.status_ok ? ( + + + + ) : ( + + + + ); + + let tenantsHealth: boolean[] = []; + if (node.health_check_status?.status_per_tenant) { + tenantsHealth = Object.values(node.health_check_status?.status_per_tenant); + } + + let tenantsStatus = null; + if (tenantsHealth.length > 0) { + const okValues = tenantsHealth.filter((t) => t === true); + + switch (okValues.length) { + case 0: + tenantsStatus = ; + break; + case tenantsHealth.length: + tenantsStatus = ; + break; + default: + tenantsStatus = ; + } + } + return ( - - - {node.name} - - + {nodeName} {node.app_details?.app_version || "no version"} - + - + + {tenantsStatus} ); @@ -49,19 +78,19 @@ function ServiceNode({ node }: ServiceNodePropps) { export default function ServiceCard({ service }: ServiceCardProps) { const nodes = service.nodes.map((node) => { - return ( - <> - - - ); + return ; }); return ( - - - + + + {normalizeServiceName(service.name)} + {/* */} + + + {nodes} diff --git a/src/components/dashboard/TenantList.tsx b/src/components/dashboard/TenantList.tsx index 33873b3..9a220f7 100644 --- a/src/components/dashboard/TenantList.tsx +++ b/src/components/dashboard/TenantList.tsx @@ -8,11 +8,11 @@ interface TenantListProps { tenants: Tenant[]; } -export default function TenantList({ tenants: tenants }: TenantListProps) { +export default function TenantList({ tenants }: TenantListProps) { const tenantItems = tenants.map((tenant) => { const tenantName = tenant.name !== "default" ? `Tenant: ${tenant.name}` : "Multitenant"; return ( - + {tenantName} diff --git a/src/scss/_service-card.scss b/src/scss/_service-card.scss new file mode 100644 index 0000000..0bc5578 --- /dev/null +++ b/src/scss/_service-card.scss @@ -0,0 +1,46 @@ +$color-ok: #27cb30; +$color-warning: #ed6c02; +$color-danger: #d32f2f; + +.service-card { + width: 400px; + .service-title-container { + color: white; + background-color: #15232d; + padding: 0.5rem 1rem; + justify-content: space-between; + align-items: center; + } + + &.ok { + .indicator { + color: $color-ok; + } + } + &.warning { + .indicator { + color: $color-warning; + } + } + &.danger { + .indicator { + color: $color-danger; + } + } + + .service-node { + .node-name { + font-weight: bold; + } + .status { + display: flex; + align-items: center; + .docs-url { + margin-left: auto; + } + .status-icon { + margin-left: 0.5rem; + } + } + } +} diff --git a/src/scss/styles.scss b/src/scss/styles.scss index 6157728..cc9bcc0 100644 --- a/src/scss/styles.scss +++ b/src/scss/styles.scss @@ -1,3 +1,4 @@ @import "common"; @import "app-header"; @import "linear-progress"; +@import "service-card";