Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(metric-issues): Allow customizing first/last seen display #83018

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions static/app/utils/issueTypeConfig/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,14 @@ const BASE_CONFIG: IssueTypeConfig = {
},
customCopy: {
resolution: 'Resolved',
firstSeen: 'First seen',
snigdhas marked this conversation as resolved.
Show resolved Hide resolved
},
attachments: {enabled: false},
autofix: false,
events: {enabled: true},
mergedIssues: {enabled: false},
filterAndSearchHeader: {enabled: true},
lastSeen: {prefix: 'Last seen ', showDate: true, showStatus: false},
performanceDurationRegression: {enabled: false},
profilingDurationRegression: {enabled: false},
regression: {enabled: false},
Expand Down
6 changes: 6 additions & 0 deletions static/app/utils/issueTypeConfig/metricIssueConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ const metricIssueConfig: IssueCategoryConfigMapping = {
},
customCopy: {
resolution: t('Back to baseline'),
firstSeen: t('Started'),
},
lastSeen: {
prefix: t('Open period '),
snigdhas marked this conversation as resolved.
Show resolved Hide resolved
showDate: false,
showStatus: true,
},
attachments: {enabled: false},
resources: null,
Expand Down
11 changes: 11 additions & 0 deletions static/app/utils/issueTypeConfig/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ type DisabledWithReasonConfig = {
disabledReason?: string;
};

type LastSeenConfig = {
prefix: string;
showDate: boolean;
showStatus: boolean;
};

export type IssueTypeConfig = {
/**
* Enable/disable actions for an issue type
Expand All @@ -37,6 +43,7 @@ export type IssueTypeConfig = {
* Custom copy for actions and other UI elements
*/
customCopy: {
firstSeen: string;
resolution: string;
};
/**
Expand All @@ -59,6 +66,10 @@ export type IssueTypeConfig = {
* Is the Issue Summary available for this issue
*/
issueSummary: DisabledWithReasonConfig;
/**
* Is the Last Seen data shown for this issue
*/
lastSeen: LastSeenConfig;
/**
* Is the Merged Issues tab shown for this issue
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import Version from 'sentry/components/version';
import VersionHoverCard from 'sentry/components/versionHoverCard';
import {t, tct} from 'sentry/locale';
import {space} from 'sentry/styles/space';
import type {Group} from 'sentry/types/group';
import {type Group, GroupStatus} from 'sentry/types/group';
import type {Project} from 'sentry/types/project';
import type {Release} from 'sentry/types/release';
import {getConfigForIssueType} from 'sentry/utils/issueTypeConfig';
import {useApiQuery} from 'sentry/utils/queryClient';
import useOrganization from 'sentry/utils/useOrganization';
import {useFetchAllEnvsGroupData} from 'sentry/views/issueDetails/groupSidebar';
Expand All @@ -20,6 +21,7 @@ interface GroupRelease {

export default function FirstLastSeenSection({group}: {group: Group}) {
const organization = useOrganization();
const issueTypeConfig = getConfigForIssueType(group, group.project);
const {project} = group;

const {data: allEnvironments} = useFetchAllEnvsGroupData(organization, group);
Expand All @@ -35,24 +37,29 @@ export default function FirstLastSeenSection({group}: {group: Group}) {
<Flex column gap={space(0.75)}>
<div>
<Flex gap={space(0.5)}>
<Title>{t('Last seen')}</Title>
{group.lastSeen ? (
<SeenInfo
date={group.lastSeen}
dateGlobal={allEnvironments?.lastSeen ?? group.lastSeen}
organization={organization}
projectId={project.id}
projectSlug={project.slug}
/>
) : (
t('N/A')
)}
<Title>
{issueTypeConfig.lastSeen.prefix}
{issueTypeConfig.lastSeen.showStatus &&
(group.status === GroupStatus.RESOLVED ? t('resolved') : t('ongoing'))}
</Title>
{issueTypeConfig.lastSeen.showDate &&
(group.lastSeen ? (
<SeenInfo
date={group.lastSeen}
dateGlobal={allEnvironments?.lastSeen ?? group.lastSeen}
organization={organization}
projectId={project.id}
projectSlug={project.slug}
/>
) : (
t('N/A')
))}
</Flex>
<ReleaseText project={group.project} release={groupReleaseData?.lastRelease} />
</div>
<div>
<Flex gap={space(0.5)}>
<Title>{t('First seen')}</Title>
<Title>{issueTypeConfig.customCopy.firstSeen || t('First seen')}</Title>
{group.firstSeen ? (
<SeenInfo
date={group.firstSeen}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ describe('SolutionsSection', () => {
},
customCopy: {
resolution: 'Resolved',
firstSeen: 'First seen',
},
lastSeen: {
prefix: 'Last seen ',
showDate: true,
showStatus: false,
},
attachments: {enabled: false},
autofix: true,
Expand Down
Loading