import {Fragment, useMemo, useState} from 'react'; import styled from '@emotion/styled'; import {Button} from 'sentry/components/button'; import {DateTime} from 'sentry/components/dateTime'; import KeyValueList from 'sentry/components/events/interfaces/keyValueList'; import Link from 'sentry/components/links/link'; import {t} from 'sentry/locale'; import type {KeyValueListData} from 'sentry/types/group'; import type {DebugIdBundle, DebugIdBundleArtifact} from 'sentry/types/sourceMaps'; import useOrganization from 'sentry/utils/useOrganization'; const formatDist = (dist: string | string[] | null) => { if (Array.isArray(dist)) { return dist.join(', '); } if (dist === null) { return 'none'; } return dist; }; export function DebugIdBundleDetails({ debugIdBundle, }: { debugIdBundle: DebugIdBundle | DebugIdBundleArtifact; }) { const [showAll, setShowAll] = useState(false); const organization = useOrganization(); const detailsData = useMemo(() => { const associations = debugIdBundle.associations; const visibleAssociations = showAll ? associations : associations.slice(0, 3); return [ { key: 'count', subject: t('Artifacts'), value: debugIdBundle.fileCount, }, { key: 'releases', subject: t('Associated Releases'), actionButton: associations.length > 3 && ( ), value: associations.length > 0 ? ( {visibleAssociations.map(association => ( {association.release} {` (Dist: ${formatDist(association.dist)})`}
))}
) : ( t('No releases associated with this bundle') ), }, { key: 'date', subject: t('Date Uploaded'), value: (
            
          
), }, ]; }, [debugIdBundle, organization.slug, showAll]); return ; } const ReleasesWrapper = styled('pre')` max-height: 200px; overflow-y: auto !important; `; const StyledKeyValueList = styled(KeyValueList)` && { margin-bottom: 0; } `;