-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(feedback): display tracked issues on list (#60485)
Display an icon in the feedback list to show which (if any) external issue tracking is used: https://github.com/getsentry/sentry/assets/56095982/7b52fe05-ad12-4cc4-8cf2-cca94430cec0 1+ platform used: <img width="358" alt="SCR-20231122-lkjt" src="https://github.com/getsentry/sentry/assets/56095982/6620b29c-21b5-4755-84ce-736931f55e78"> Only 1 platform used: icon changes depending on type <img width="387" alt="SCR-20231122-lits" src="https://github.com/getsentry/sentry/assets/56095982/2b5fad1f-dc7b-4cf8-ac25-6bcd359f06be"> <img width="365" alt="SCR-20231122-lizs" src="https://github.com/getsentry/sentry/assets/56095982/74b1e2bb-25b9-49fb-a642-2f71bd1f4f2d"> Closes #60367
- Loading branch information
1 parent
b080c59
commit 5cad8d9
Showing
3 changed files
with
89 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
static/app/components/feedback/list/issueTrackingSignals.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import {FeedbackIcon} from 'sentry/components/feedback/list/feedbackListItem'; | ||
import {ExternalIssueComponent} from 'sentry/components/group/externalIssuesList/types'; | ||
import useExternalIssueData from 'sentry/components/group/externalIssuesList/useExternalIssueData'; | ||
import {IconLink} from 'sentry/icons'; | ||
import {t} from 'sentry/locale'; | ||
import {Event, Group} from 'sentry/types'; | ||
import {getIntegrationIcon} from 'sentry/utils/integrationUtil'; | ||
|
||
interface Props { | ||
group: Group; | ||
} | ||
|
||
function filterLinkedPlugins(actions: ExternalIssueComponent[]) { | ||
// Plugins: need to do some extra logic to detect if the issue is linked, | ||
// by checking if there exists an issue object | ||
const plugins = actions.filter( | ||
a => | ||
(a.type === 'plugin-issue' || a.type === 'plugin-action') && | ||
'issue' in a.props.plugin | ||
); | ||
|
||
// Non plugins: can read directly from the `hasLinkedIssue` property | ||
const nonPlugins = actions.filter( | ||
a => a.hasLinkedIssue && !(a.type === 'plugin-issue' || a.type === 'plugin-action') | ||
); | ||
|
||
return plugins.concat(nonPlugins); | ||
} | ||
|
||
export default function IssueTrackingSignals({group}: Props) { | ||
const {actions} = useExternalIssueData({ | ||
group, | ||
event: {} as Event, | ||
project: group.project, | ||
}); | ||
|
||
const linkedIssues = filterLinkedPlugins(actions); | ||
|
||
if (!linkedIssues.length) { | ||
return null; | ||
} | ||
|
||
if (linkedIssues.length > 1) { | ||
return ( | ||
<FeedbackIcon | ||
tooltipText={t('Linked Tickets: %d', linkedIssues.length)} | ||
icon={<IconLink size="xs" />} | ||
/> | ||
); | ||
} | ||
|
||
const name = | ||
linkedIssues[0].type === 'plugin-issue' || linkedIssues[0].type === 'plugin-action' | ||
? linkedIssues[0].props.plugin.slug ?? '' | ||
: linkedIssues[0].key; | ||
|
||
return ( | ||
<FeedbackIcon | ||
tooltipText={t('Linked %s Issue', name)} | ||
icon={getIntegrationIcon(name, 'xs')} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters