import React from 'react'; import { Icon } from '@spinnaker/presentation'; import { AnimatingPill, Pill } from '../Pill'; import { getArtifactVersionDisplayName } from '../displayNames'; import type { IManagedArtifactSummary, IManagedEnvironmentSummary } from '../../domain'; export interface ResourceDeploymentStatusProps { environment?: string; artifactVersionsByState?: IManagedEnvironmentSummary['artifacts'][0]['versions']; artifactDetails?: IManagedArtifactSummary; showReferenceName?: boolean; } export const ResourceDeploymentStatus = ({ environment, artifactVersionsByState, artifactDetails, showReferenceName, }: ResourceDeploymentStatusProps) => { const current = artifactVersionsByState?.current ? artifactDetails?.versions.find(({ version }) => version === artifactVersionsByState?.current) : undefined; const deploying = artifactVersionsByState?.deploying && artifactDetails?.versions.find(({ version }) => version === artifactVersionsByState?.deploying); const isCurrentVersionPinned = !!current?.environments.find(({ name }) => name === environment)?.pinned; const currentPill = current && ( ); const deployingPill = deploying && ( <> ); return ( <> {currentPill} {deployingPill} ); };