Skip to content

Commit 187a4ff

Browse files
authored
ref(suspect-commits): Add hook (#14057)
1 parent 0a0c4eb commit 187a4ff

File tree

4 files changed

+15
-44
lines changed

4 files changed

+15
-44
lines changed

src/sentry/static/sentry/app/components/events/eventCauseEmpty.jsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ class EventCauseEmpty extends React.Component {
128128
<p>{t('Identify which commit caused this issue')}</p>
129129
</Description>
130130
<ButtonList>
131-
<Button
131+
<DocsButton
132132
size="small"
133133
priority="primary"
134134
href="https://docs.sentry.io/workflow/releases/#create-release"
@@ -141,7 +141,7 @@ class EventCauseEmpty extends React.Component {
141141
data-test-id="read-the-docs"
142142
>
143143
{t('Read the docs')}
144-
</Button>
144+
</DocsButton>
145145

146146
<div>
147147
<Tooltip title={t('Remind me next week')}>
@@ -225,6 +225,12 @@ const ButtonList = styled('div')`
225225
margin-bottom: 16px;
226226
`;
227227

228+
const DocsButton = styled(Button)`
229+
&:focus {
230+
color: ${p => p.theme.white};
231+
}
232+
`;
233+
228234
const SnoozeButton = styled(Button)`
229235
border-right: 0;
230236
border-top-right-radius: 0;

src/sentry/static/sentry/app/components/events/eventEntries.jsx

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,10 @@ import {logException} from 'app/utils/logging';
77
import {objectIsEmpty} from 'app/utils';
88
import {t} from 'app/locale';
99
import BreadcrumbsInterface from 'app/components/events/interfaces/breadcrumbs';
10-
import ConfigStore from 'app/stores/configStore';
1110
import CspInterface from 'app/components/events/interfaces/csp';
1211
import DebugMetaInterface from 'app/components/events/interfaces/debugmeta';
1312
import EventAttachments from 'app/components/events/eventAttachments';
1413
import EventCause from 'app/components/events/eventCause';
15-
import EventCauseEmpty from 'app/components/events/eventCauseEmpty';
1614
import EventContextSummary from 'app/components/events/contextSummary';
1715
import EventContexts from 'app/components/events/contexts';
1816
import EventDataSection from 'app/components/events/eventDataSection';
@@ -27,6 +25,7 @@ import EventTags from 'app/components/events/eventTags';
2725
import EventUserFeedback from 'app/components/events/userFeedback';
2826
import ExceptionInterface from 'app/components/events/interfaces/exception';
2927
import GenericInterface from 'app/components/events/interfaces/generic';
28+
import Hook from 'app/components/hook';
3029
import MessageInterface from 'app/components/events/interfaces/message';
3130
import RequestInterface from 'app/components/events/interfaces/request';
3231
import SentryTypes from 'app/sentryTypes';
@@ -100,11 +99,6 @@ class EventEntries extends React.Component {
10099
});
101100
}
102101

103-
get isSuperUser() {
104-
const user = ConfigStore.get('user');
105-
return user && user.isSuperuser;
106-
}
107-
108102
renderEntries() {
109103
const {event, project, isShare} = this.props;
110104

@@ -173,9 +167,11 @@ class EventEntries extends React.Component {
173167
{!objectIsEmpty(event.errors) && <EventErrors event={event} />}{' '}
174168
{!isShare &&
175169
(showExampleCommit ? (
176-
this.isSuperUser && (
177-
<EventCauseEmpty organization={organization} project={project} />
178-
)
170+
<Hook
171+
name="component:event-cause-empty"
172+
organization={organization}
173+
project={project}
174+
/>
179175
) : (
180176
<EventCause event={event} orgId={orgId} projectId={project.slug} />
181177
))}

src/sentry/static/sentry/app/stores/hookStore.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const validHookNames = new Set([
2626
'component:org-members-view',
2727
'component:header-date-range',
2828
'component:header-selector-items',
29+
'component:event-cause-empty',
2930

3031
// Additional settings
3132
'settings:organization-navigation',

tests/js/spec/views/organizationGroupDetails/groupEventDetails.spec.jsx

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {mount} from 'enzyme';
33
import {browserHistory} from 'react-router';
44

55
import {initializeOrg} from 'app-test/helpers/initializeOrg';
6-
import ConfigStore from 'app/stores/configStore';
76
import {GroupEventDetails} from 'app/views/organizationGroupDetails/groupEventDetails';
87

98
describe('groupEventDetails', () => {
@@ -243,37 +242,6 @@ describe('groupEventDetails', () => {
243242
expect(wrapper.find('EventCause').exists()).toBe(false);
244243
});
245244

246-
it('renders suspect commit empty state for super users', async function() {
247-
ConfigStore.set('user', TestStubs.User({isSuperuser: true}));
248-
MockApiClient.addMockResponse({
249-
url: `/projects/${org.slug}/${project.slug}/releases/completion/`,
250-
body: [
251-
{
252-
step: 'commit',
253-
complete: false,
254-
},
255-
],
256-
});
257-
258-
const wrapper = mount(
259-
<GroupEventDetails
260-
api={new MockApiClient()}
261-
group={group}
262-
project={project}
263-
organization={org}
264-
environments={[{id: '1', name: 'dev', displayName: 'Dev'}]}
265-
params={{orgId: org.slug, groupId: group.id, eventId: '1'}}
266-
location={{query: {environment: 'dev'}}}
267-
/>,
268-
routerContext
269-
);
270-
await tick();
271-
wrapper.update();
272-
273-
expect(wrapper.find('EventCauseEmpty').exists()).toBe(true);
274-
expect(wrapper.find('EventCause').exists()).toBe(false);
275-
});
276-
277245
it('renders suspect commit', async function() {
278246
MockApiClient.addMockResponse({
279247
url: `/projects/${org.slug}/${project.slug}/releases/completion/`,

0 commit comments

Comments
 (0)