diff --git a/.changeset/purple-tigers-tell.md b/.changeset/purple-tigers-tell.md new file mode 100644 index 0000000000..9c3d61bcff --- /dev/null +++ b/.changeset/purple-tigers-tell.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-sentry': patch +--- + +Do not show [No Type] when issue metadata includes title instead of type diff --git a/plugins/sentry/src/components/ErrorCell/ErrorCell.test.tsx b/plugins/sentry/src/components/ErrorCell/ErrorCell.test.tsx index 98833aaeba..ff1960aa4f 100644 --- a/plugins/sentry/src/components/ErrorCell/ErrorCell.test.tsx +++ b/plugins/sentry/src/components/ErrorCell/ErrorCell.test.tsx @@ -44,4 +44,24 @@ describe('Sentry error cell component', () => { 'http://example.com', ); }); + it('should render the title if type is not present', async () => { + const testIssue = { + ...mockIssue, + title: 'Exception: Could not load credentials from any providers', + count: '1', + metadata: {}, + userCount: 2, + permalink: 'http://example.com', + }; + const cell = render( + + + , + ); + const errorType = await cell.findByText('Exception: Could not load cr...'); + expect(errorType.closest('a')).toHaveAttribute( + 'href', + 'http://example.com', + ); + }); }); diff --git a/plugins/sentry/src/components/ErrorCell/ErrorCell.tsx b/plugins/sentry/src/components/ErrorCell/ErrorCell.tsx index 57f9cddc05..d2da63f01f 100644 --- a/plugins/sentry/src/components/ErrorCell/ErrorCell.tsx +++ b/plugins/sentry/src/components/ErrorCell/ErrorCell.tsx @@ -44,13 +44,18 @@ const useStyles = makeStyles(theme => ({ export const ErrorCell = ({ sentryIssue }: { sentryIssue: SentryIssue }) => { const classes = useStyles(); + let issueType = '[No Type]'; + if (sentryIssue.metadata.type) { + issueType = sentryIssue.metadata.type; + } else if (sentryIssue.title) { + issueType = sentryIssue.title; + } + return (
- {sentryIssue.metadata.type - ? stripText(sentryIssue.metadata.type, 28) - : '[No type]'} + {stripText(issueType, 28)}