Files
helm-dashboard/frontend/src/components/InstalledPackages/HealthStatus.tsx
yuri-sakharov c9b8fb7809 Introduced tsconfig.app.json and tsconfig.base.json + Refactored eslint.config.js to the latest structure (#652)
* Introduced tsconfig.app.json and tsconfig.base.json

* yarn.lock

* Introduced tsconfig.app.json, tsconfig.base.jsonfig.

* Refactored eslint.config.js to latest structure

* Returned previous recommended rules.

* More rules

* Force import rules

* Check

* Check

* Cleanup ESLint configuration and plugins

* Cleanup heap: "writable",DD_RUM: "writable" from ESLint configuration

* "scripts" moved to the top of package.json
2026-02-15 17:41:04 +00:00

46 lines
1.3 KiB
TypeScript

import { Tooltip } from "flowbite-react";
import { HD_RESOURCE_CONDITION_TYPE } from "../../API/releases";
import type { ReleaseHealthStatus } from "../../data/types";
interface Props {
statusData: ReleaseHealthStatus[];
}
const HealthStatus = ({ statusData }: Props) => {
const statuses = statusData.flatMap((item) => {
return item.status?.conditions
?.filter((cond) => cond.type === HD_RESOURCE_CONDITION_TYPE)
.map((cond) => {
const stableKey = item.metadata?.uid
? `${item.metadata.uid}-${item.metadata.namespace ?? "default"}`
: `${item.kind}-${item.metadata?.namespace ?? "default"}-${item.metadata?.name}`;
return (
<Tooltip
key={stableKey}
content={`${cond.status} ${item.kind} ${item.metadata?.name}`}
>
<span
className={`inline-block ${
cond.status === "Healthy"
? "bg-success"
: cond.status === "Progressing"
? "bg-warning"
: "bg-danger"
} h-2.5 w-2.5 rounded-xs`}
></span>
</Tooltip>
);
});
});
if (statuses.length === 0) {
return <div>No health statuses available</div>;
}
return <div className="flex flex-wrap gap-1">{statuses}</div>;
};
export default HealthStatus;