Skip to content

Commit

Permalink
feat: Changed the status bar component to an icon based component (#1198
Browse files Browse the repository at this point in the history
)

Co-authored-by: Darshan Simha <[email protected]>
Co-authored-by: mshakira <[email protected]>
  • Loading branch information
3 people authored Oct 12, 2023
1 parent 13264e3 commit 71c048e
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 13 deletions.
33 changes: 33 additions & 0 deletions ui/src/components/common/StatusCounts/StatusCounts.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import React from "react";
import { IconsStatusMap } from "../../../utils";

import "./style.css";
export interface StatusCountsProps {
counts: {
healthy: number;
warning: number;
critical: number;
};
}

export function StatusCounts(counts: StatusCountsProps) {
return (
<div className="flex row" style={{ marginLeft: "0.5rem" }}>
{Object.keys(counts.counts).map((key) => {
return (
<div className="flex row status-block">
<div className="flex column">
<div className="flex row">
<img src={IconsStatusMap[key]} alt={key} />
<span style={{ marginLeft: "0.5rem" }} className="bold-text">
: {counts.counts[key]}
</span>
</div>
<div className="flex row title-case regular-text">{key}</div>
</div>
</div>
);
})}
</div>
);
}
35 changes: 35 additions & 0 deletions ui/src/components/common/StatusCounts/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
.flex{
display: flex;
}
.row{
flex-direction: row;
}
.column{
flex-direction: column;
}
.status-block{
align-items: center;
justify-content: center;
flex-grow: 1;
}
.title-case{
text-transform: capitalize;
}
.regular-text{
color: #3C4348;
font-size: 12px;
font-weight: 400;
line-height: 23.50px;
word-wrap: break-word
}
.bold-text{
color: #3C4348;
font-size: 12px;
font-weight: 600;
line-height: 23.50px;
word-wrap: break-word
}
img{
width: 1.5rem;
height: 1.5rem;
}
30 changes: 17 additions & 13 deletions ui/src/components/pages/Cluster/partials/NamespaceCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import Box from "@mui/material/Box";
import Paper from "@mui/material/Paper";
import Grid from "@mui/material/Grid";
import { Link } from "react-router-dom";
import { StatusBar } from "../../../../common/StatusBar";
import { NamespaceCardProps } from "../../../../../types/declarations/cluster";
import { StatusCounts } from "../../../../common/StatusCounts/StatusCounts";

import "./style.css";

Expand Down Expand Up @@ -41,7 +41,7 @@ export function NamespaceCard({ data }: NamespaceCardProps) {
marginTop: "0.5rem",
}}
>
<Grid item xs={4}>
<Grid item xs={3}>
<span className="namespace-card-section-text-14-normal">
Status:
</span>
Expand Down Expand Up @@ -83,16 +83,18 @@ export function NamespaceCard({ data }: NamespaceCardProps) {
marginTop: "0.5rem",
}}
>
<Grid item xs={4}>
<Grid item xs={2}>
<span className="namespace-card-section-text-14-normal">
Health:
</span>
</Grid>
<Grid item xs={8} sx={{ padding: "0.3125rem 0" }}>
<StatusBar
healthy={data?.pipelinesHealthyCount}
warning={data?.pipelinesWarningCount}
critical={data?.pipelinesCriticalCount}
<StatusCounts
counts={{
healthy: data?.pipelinesHealthyCount,
warning: data?.pipelinesWarningCount,
critical: data?.pipelinesCriticalCount,
}}
/>
</Grid>
</Grid>
Expand All @@ -117,7 +119,7 @@ export function NamespaceCard({ data }: NamespaceCardProps) {
marginTop: "0.5rem",
}}
>
<Grid item xs={4}>
<Grid item xs={3}>
<span className="namespace-card-section-text-14-normal">
Status:
</span>
Expand Down Expand Up @@ -158,16 +160,18 @@ export function NamespaceCard({ data }: NamespaceCardProps) {
marginTop: "0.5rem",
}}
>
<Grid item xs={4}>
<Grid item xs={2}>
<span className="namespace-card-section-text-14-normal">
Health:
</span>
</Grid>
<Grid item xs={8} sx={{ padding: "0.3125rem 0" }}>
<StatusBar
healthy={data?.isbsHealthyCount}
warning={data?.isbsWarningCount}
critical={data?.isbsCriticalCount}
<StatusCounts
counts={{
healthy: data?.isbsHealthyCount,
warning: data?.isbsWarningCount,
critical: data?.isbsCriticalCount,
}}
/>
</Grid>
</Grid>
Expand Down
Binary file modified ui/src/images/critical.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 71c048e

Please sign in to comment.