projectReleaseDetails.tsx 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. import styled from '@emotion/styled';
  2. import Count from 'sentry/components/count';
  3. import {DateTime} from 'sentry/components/dateTime';
  4. import {KeyValueTable, KeyValueTableRow} from 'sentry/components/keyValueTable';
  5. import Link from 'sentry/components/links/link';
  6. import * as SidebarSection from 'sentry/components/sidebarSection';
  7. import TextOverflow from 'sentry/components/textOverflow';
  8. import TimeSince from 'sentry/components/timeSince';
  9. import Version from 'sentry/components/version';
  10. import {t, tn} from 'sentry/locale';
  11. import type {ReleaseMeta, ReleaseWithHealth} from 'sentry/types/release';
  12. import useOrganization from 'sentry/utils/useOrganization';
  13. import {isVersionInfoSemver} from 'sentry/views/releases/utils';
  14. type Props = {
  15. projectSlug: string;
  16. release: ReleaseWithHealth;
  17. releaseMeta: ReleaseMeta;
  18. };
  19. function ProjectReleaseDetails({release, releaseMeta, projectSlug}: Props) {
  20. const organization = useOrganization();
  21. const orgSlug = organization.slug;
  22. const {version, versionInfo, dateCreated, firstEvent, lastEvent} = release;
  23. const {releaseFileCount, isArtifactBundle} = releaseMeta;
  24. return (
  25. <SidebarSection.Wrap>
  26. <SidebarSection.Title>{t('Project Release Details')}</SidebarSection.Title>
  27. <SidebarSection.Content>
  28. <KeyValueTable>
  29. <KeyValueTableRow
  30. keyName={t('Created')}
  31. value={<DateTime date={dateCreated} seconds={false} />}
  32. />
  33. <KeyValueTableRow
  34. keyName={t('Version')}
  35. value={<Version version={version} anchor={false} />}
  36. />
  37. <KeyValueTableRow
  38. keyName={t('Semver')}
  39. value={isVersionInfoSemver(versionInfo.version) ? t('Yes') : t('No')}
  40. />
  41. <KeyValueTableRow
  42. keyName={t('Package')}
  43. value={
  44. <StyledTextOverflow ellipsisDirection="left">
  45. {versionInfo.package ?? '\u2014'}
  46. </StyledTextOverflow>
  47. }
  48. />
  49. <KeyValueTableRow
  50. keyName={t('First Event')}
  51. value={firstEvent ? <TimeSince date={firstEvent} /> : '\u2014'}
  52. />
  53. <KeyValueTableRow
  54. keyName={t('Last Event')}
  55. value={lastEvent ? <TimeSince date={lastEvent} /> : '\u2014'}
  56. />
  57. <KeyValueTableRow
  58. keyName={t('Source Maps')}
  59. value={
  60. <Link
  61. to={
  62. isArtifactBundle
  63. ? `/settings/${orgSlug}/projects/${projectSlug}/source-maps/artifact-bundles/?query=${encodeURIComponent(
  64. version
  65. )}`
  66. : `/settings/${orgSlug}/projects/${projectSlug}/source-maps/release-bundles/${encodeURIComponent(
  67. version
  68. )}/`
  69. }
  70. >
  71. <Count value={releaseFileCount} />{' '}
  72. {tn('artifact', 'artifacts', releaseFileCount)}
  73. </Link>
  74. }
  75. />
  76. </KeyValueTable>
  77. </SidebarSection.Content>
  78. </SidebarSection.Wrap>
  79. );
  80. }
  81. const StyledTextOverflow = styled(TextOverflow)`
  82. line-height: inherit;
  83. text-align: right;
  84. `;
  85. export default ProjectReleaseDetails;