import { Badge } from '@/react/components/Badge'; import { localizeDate } from '@/react/common/date-utils'; import { Alert } from '@@/Alert'; import { HelmRelease } from '../types'; import { DeploymentStatus, getStatusColor, getStatusText, } from '../helm-status-utils'; interface Props { release: HelmRelease; } export function HelmSummary({ release }: Props) { const isSuccess = release.info?.status === DeploymentStatus.DEPLOYED || release.info?.status === DeploymentStatus.SUPERSEDED; return (
{getStatusText(release.info?.status)}
{!!release.info?.description && !isSuccess && ( {release.info?.description} )}
{!!release.namespace && Namespace: {release.namespace}} {!!release.version && Revision: #{release.version}} {!!release.chart?.metadata?.name && ( Chart: {release.chart.metadata.name} )} {!!release.chart?.metadata?.appVersion && ( App version: {release.chart.metadata.appVersion} )} {!!release.chart?.metadata?.version && ( Chart version: {release.chart.metadata.name}- {release.chart.metadata.version} )} {!!release.info?.last_deployed && ( Last deployed:{' '} {localizeDate(new Date(release.info.last_deployed))} )}
); } function getAlertColor(status?: string) { switch (status?.toLowerCase()) { case DeploymentStatus.DEPLOYED: return 'success'; case DeploymentStatus.FAILED: return 'error'; case DeploymentStatus.PENDING: case DeploymentStatus.PENDINGUPGRADE: case DeploymentStatus.PENDINGROLLBACK: case DeploymentStatus.UNINSTALLING: return 'warn'; case DeploymentStatus.SUPERSEDED: default: return 'info'; } }