projectReleaseDetails.tsx 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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';
  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. {organization.features.includes('issue-release-semver') ? (
  38. <KeyValueTableRow
  39. keyName={t('Semver')}
  40. value={isVersionInfoSemver(versionInfo.version) ? t('Yes') : t('No')}
  41. />
  42. ) : null}
  43. <KeyValueTableRow
  44. keyName={t('Package')}
  45. value={
  46. <StyledTextOverflow ellipsisDirection="left">
  47. {versionInfo.package ?? '\u2014'}
  48. </StyledTextOverflow>
  49. }
  50. />
  51. <KeyValueTableRow
  52. keyName={t('First Event')}
  53. value={firstEvent ? <TimeSince date={firstEvent} /> : '\u2014'}
  54. />
  55. <KeyValueTableRow
  56. keyName={t('Last Event')}
  57. value={lastEvent ? <TimeSince date={lastEvent} /> : '\u2014'}
  58. />
  59. <KeyValueTableRow
  60. keyName={t('Source Maps')}
  61. value={
  62. <Link
  63. to={
  64. isArtifactBundle
  65. ? `/settings/${orgSlug}/projects/${projectSlug}/source-maps/artifact-bundles/?query=${encodeURIComponent(
  66. version
  67. )}`
  68. : `/settings/${orgSlug}/projects/${projectSlug}/source-maps/release-bundles/${encodeURIComponent(
  69. version
  70. )}/`
  71. }
  72. >
  73. <Count value={releaseFileCount} />{' '}
  74. {tn('artifact', 'artifacts', releaseFileCount)}
  75. </Link>
  76. }
  77. />
  78. </KeyValueTable>
  79. </SidebarSection.Content>
  80. </SidebarSection.Wrap>
  81. );
  82. }
  83. const StyledTextOverflow = styled(TextOverflow)`
  84. line-height: inherit;
  85. text-align: right;
  86. `;
  87. export default ProjectReleaseDetails;