mirror of
https://github.com/fosrl/pangolin.git
synced 2026-05-17 06:24:32 +00:00
Add health to the resource
This commit is contained in:
@@ -12,6 +12,7 @@ type CertificateStatusProps = {
|
|||||||
autoFetch?: boolean;
|
autoFetch?: boolean;
|
||||||
showLabel?: boolean;
|
showLabel?: boolean;
|
||||||
className?: string;
|
className?: string;
|
||||||
|
disableRestartButton?: boolean;
|
||||||
onRefresh?: () => void;
|
onRefresh?: () => void;
|
||||||
polling?: boolean;
|
polling?: boolean;
|
||||||
pollingInterval?: number;
|
pollingInterval?: number;
|
||||||
@@ -23,6 +24,7 @@ export default function CertificateStatus({
|
|||||||
fullDomain,
|
fullDomain,
|
||||||
autoFetch = true,
|
autoFetch = true,
|
||||||
showLabel = true,
|
showLabel = true,
|
||||||
|
disableRestartButton = false,
|
||||||
className = "",
|
className = "",
|
||||||
onRefresh,
|
onRefresh,
|
||||||
polling = false,
|
polling = false,
|
||||||
@@ -153,7 +155,7 @@ export default function CertificateStatus({
|
|||||||
variant="ghost"
|
variant="ghost"
|
||||||
className="p-0 w-3 h-auto align-middle"
|
className="p-0 w-3 h-auto align-middle"
|
||||||
onClick={handleRefresh}
|
onClick={handleRefresh}
|
||||||
disabled={refreshing}
|
disabled={refreshing || disableRestartButton}
|
||||||
title={t("restartCertificate", {
|
title={t("restartCertificate", {
|
||||||
defaultValue: "Restart Certificate"
|
defaultValue: "Restart Certificate"
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
|
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
|
||||||
import { ShieldCheck, ShieldOff, Eye, EyeOff } from "lucide-react";
|
import { ShieldCheck, ShieldOff, Eye, EyeOff, CheckCircle2, XCircle, Clock } from "lucide-react";
|
||||||
import { useResourceContext } from "@app/hooks/useResourceContext";
|
import { useResourceContext } from "@app/hooks/useResourceContext";
|
||||||
import CopyToClipboard from "@app/components/CopyToClipboard";
|
import CopyToClipboard from "@app/components/CopyToClipboard";
|
||||||
import {
|
import {
|
||||||
@@ -18,8 +18,7 @@ import { useEnvContext } from "@app/hooks/useEnvContext";
|
|||||||
type ResourceInfoBoxType = {};
|
type ResourceInfoBoxType = {};
|
||||||
|
|
||||||
export default function ResourceInfoBox({}: ResourceInfoBoxType) {
|
export default function ResourceInfoBox({}: ResourceInfoBoxType) {
|
||||||
const { resource, authInfo, updateResource } = useResourceContext();
|
const { resource, authInfo } = useResourceContext();
|
||||||
const { env } = useEnvContext();
|
|
||||||
|
|
||||||
const t = useTranslations();
|
const t = useTranslations();
|
||||||
|
|
||||||
@@ -29,9 +28,7 @@ export default function ResourceInfoBox({}: ResourceInfoBoxType) {
|
|||||||
<Alert>
|
<Alert>
|
||||||
<AlertDescription>
|
<AlertDescription>
|
||||||
{/* 4 cols because of the certs */}
|
{/* 4 cols because of the certs */}
|
||||||
<InfoSections
|
<InfoSections cols={resource.http ? 6 : 5}>
|
||||||
cols={resource.http ? 5 : 4}
|
|
||||||
>
|
|
||||||
<InfoSection>
|
<InfoSection>
|
||||||
<InfoSectionTitle>{t("identifier")}</InfoSectionTitle>
|
<InfoSectionTitle>{t("identifier")}</InfoSectionTitle>
|
||||||
<InfoSectionContent>
|
<InfoSectionContent>
|
||||||
@@ -155,6 +152,35 @@ export default function ResourceInfoBox({}: ResourceInfoBoxType) {
|
|||||||
</InfoSectionContent>
|
</InfoSectionContent>
|
||||||
</InfoSection>
|
</InfoSection>
|
||||||
)}
|
)}
|
||||||
|
<InfoSection>
|
||||||
|
<InfoSectionTitle>{t("health")}</InfoSectionTitle>
|
||||||
|
<InfoSectionContent>
|
||||||
|
{resource.health === "healthy" && (
|
||||||
|
<div className="flex items-center space-x-2">
|
||||||
|
<CheckCircle2 className="w-4 h-4 flex-shrink-0 text-green-500" />
|
||||||
|
<span>{t("resourcesTableHealthy")}</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{resource.health === "degraded" && (
|
||||||
|
<div className="flex items-center space-x-2">
|
||||||
|
<CheckCircle2 className="w-4 h-4 flex-shrink-0 text-yellow-500" />
|
||||||
|
<span>{t("resourcesTableDegraded")}</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{resource.health === "unhealthy" && (
|
||||||
|
<div className="flex items-center space-x-2">
|
||||||
|
<XCircle className="w-4 h-4 flex-shrink-0 text-destructive" />
|
||||||
|
<span>{t("resourcesTableUnhealthy")}</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{(!resource.health || resource.health === "unknown") && (
|
||||||
|
<div className="flex items-center space-x-2 text-muted-foreground">
|
||||||
|
<Clock className="w-4 h-4 flex-shrink-0" />
|
||||||
|
<span>{t("resourcesTableUnknown")}</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</InfoSectionContent>
|
||||||
|
</InfoSection>
|
||||||
<InfoSection>
|
<InfoSection>
|
||||||
<InfoSectionTitle>{t("visibility")}</InfoSectionTitle>
|
<InfoSectionTitle>{t("visibility")}</InfoSectionTitle>
|
||||||
<InfoSectionContent>
|
<InfoSectionContent>
|
||||||
|
|||||||
Reference in New Issue
Block a user