From f802e98910da793e4677036b055975edcc3b650f Mon Sep 17 00:00:00 2001 From: maheskett Date: Tue, 16 Jul 2019 22:38:36 -0700 Subject: [PATCH 1/3] Add hook --- .../app/components/events/eventEntries.jsx | 19 ++++++----- .../static/sentry/app/stores/hookStore.jsx | 1 + .../groupEventDetails.spec.jsx | 32 ------------------- 3 files changed, 10 insertions(+), 42 deletions(-) diff --git a/src/sentry/static/sentry/app/components/events/eventEntries.jsx b/src/sentry/static/sentry/app/components/events/eventEntries.jsx index 99a07be000fbdd..0fa9bd9e03b239 100644 --- a/src/sentry/static/sentry/app/components/events/eventEntries.jsx +++ b/src/sentry/static/sentry/app/components/events/eventEntries.jsx @@ -7,12 +7,10 @@ import {logException} from 'app/utils/logging'; import {objectIsEmpty} from 'app/utils'; import {t} from 'app/locale'; import BreadcrumbsInterface from 'app/components/events/interfaces/breadcrumbs'; -import ConfigStore from 'app/stores/configStore'; import CspInterface from 'app/components/events/interfaces/csp'; import DebugMetaInterface from 'app/components/events/interfaces/debugmeta'; import EventAttachments from 'app/components/events/eventAttachments'; import EventCause from 'app/components/events/eventCause'; -import EventCauseEmpty from 'app/components/events/eventCauseEmpty'; import EventContextSummary from 'app/components/events/contextSummary'; import EventContexts from 'app/components/events/contexts'; import EventDataSection from 'app/components/events/eventDataSection'; @@ -27,6 +25,7 @@ import EventTags from 'app/components/events/eventTags'; import EventUserFeedback from 'app/components/events/userFeedback'; import ExceptionInterface from 'app/components/events/interfaces/exception'; import GenericInterface from 'app/components/events/interfaces/generic'; +import HookOrDefault from 'app/components/hookOrDefault'; import MessageInterface from 'app/components/events/interfaces/message'; import RequestInterface from 'app/components/events/interfaces/request'; import SentryTypes from 'app/sentryTypes'; @@ -51,6 +50,13 @@ export const INTERFACES = { debugmeta: DebugMetaInterface, }; +const EventCauseEmptyHook = HookOrDefault({ + hookName: 'component:event-cause-empty', + defaultComponent: () => { + return null; + }, +}); + class EventEntries extends React.Component { static propTypes = { // organization is not provided in the shared issue view @@ -100,11 +106,6 @@ class EventEntries extends React.Component { }); } - get isSuperUser() { - const user = ConfigStore.get('user'); - return user && user.isSuperuser; - } - renderEntries() { const {event, project, isShare} = this.props; @@ -173,9 +174,7 @@ class EventEntries extends React.Component { {!objectIsEmpty(event.errors) && }{' '} {!isShare && (showExampleCommit ? ( - this.isSuperUser && ( - - ) + ) : ( ))} diff --git a/src/sentry/static/sentry/app/stores/hookStore.jsx b/src/sentry/static/sentry/app/stores/hookStore.jsx index c65f94ba5368c5..798fda08c04a5c 100644 --- a/src/sentry/static/sentry/app/stores/hookStore.jsx +++ b/src/sentry/static/sentry/app/stores/hookStore.jsx @@ -26,6 +26,7 @@ const validHookNames = new Set([ 'component:org-members-view', 'component:header-date-range', 'component:header-selector-items', + 'component:event-cause-empty', // Additional settings 'settings:organization-navigation', diff --git a/tests/js/spec/views/organizationGroupDetails/groupEventDetails.spec.jsx b/tests/js/spec/views/organizationGroupDetails/groupEventDetails.spec.jsx index f303cbc25fdb30..5db17ceb7dea98 100644 --- a/tests/js/spec/views/organizationGroupDetails/groupEventDetails.spec.jsx +++ b/tests/js/spec/views/organizationGroupDetails/groupEventDetails.spec.jsx @@ -3,7 +3,6 @@ import {mount} from 'enzyme'; import {browserHistory} from 'react-router'; import {initializeOrg} from 'app-test/helpers/initializeOrg'; -import ConfigStore from 'app/stores/configStore'; import {GroupEventDetails} from 'app/views/organizationGroupDetails/groupEventDetails'; describe('groupEventDetails', () => { @@ -243,37 +242,6 @@ describe('groupEventDetails', () => { expect(wrapper.find('EventCause').exists()).toBe(false); }); - it('renders suspect commit empty state for super users', async function() { - ConfigStore.set('user', TestStubs.User({isSuperuser: true})); - MockApiClient.addMockResponse({ - url: `/projects/${org.slug}/${project.slug}/releases/completion/`, - body: [ - { - step: 'commit', - complete: false, - }, - ], - }); - - const wrapper = mount( - , - routerContext - ); - await tick(); - wrapper.update(); - - expect(wrapper.find('EventCauseEmpty').exists()).toBe(true); - expect(wrapper.find('EventCause').exists()).toBe(false); - }); - it('renders suspect commit', async function() { MockApiClient.addMockResponse({ url: `/projects/${org.slug}/${project.slug}/releases/completion/`, From 470d7e04b88f5a540e6011378a5b77c38f9d1361 Mon Sep 17 00:00:00 2001 From: maheskett Date: Wed, 17 Jul 2019 13:40:46 -0700 Subject: [PATCH 2/3] Fix button focus color --- .../sentry/app/components/events/eventCauseEmpty.jsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/sentry/static/sentry/app/components/events/eventCauseEmpty.jsx b/src/sentry/static/sentry/app/components/events/eventCauseEmpty.jsx index 8a8c39e14253db..b7ca549f6e51b3 100644 --- a/src/sentry/static/sentry/app/components/events/eventCauseEmpty.jsx +++ b/src/sentry/static/sentry/app/components/events/eventCauseEmpty.jsx @@ -99,13 +99,13 @@ class EventCauseEmpty extends React.Component {

{t('Identify which commit caused this issue')}

- +
@@ -177,6 +177,12 @@ const ButtonList = styled('div')` margin-bottom: 16px; `; +const DocsButton = styled(Button)` + &:focus { + color: ${p => p.theme.white}; + } +`; + const SnoozeButton = styled(Button)` border-right: 0; border-top-right-radius: 0; From 30712a4d30f945340290a125e604b0d1a3cc0f8a Mon Sep 17 00:00:00 2001 From: maheskett Date: Wed, 17 Jul 2019 15:22:27 -0700 Subject: [PATCH 3/3] Use hook component --- .../sentry/app/components/events/eventEntries.jsx | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/sentry/static/sentry/app/components/events/eventEntries.jsx b/src/sentry/static/sentry/app/components/events/eventEntries.jsx index 0fa9bd9e03b239..38a6f108ee3db6 100644 --- a/src/sentry/static/sentry/app/components/events/eventEntries.jsx +++ b/src/sentry/static/sentry/app/components/events/eventEntries.jsx @@ -25,7 +25,7 @@ import EventTags from 'app/components/events/eventTags'; import EventUserFeedback from 'app/components/events/userFeedback'; import ExceptionInterface from 'app/components/events/interfaces/exception'; import GenericInterface from 'app/components/events/interfaces/generic'; -import HookOrDefault from 'app/components/hookOrDefault'; +import Hook from 'app/components/hook'; import MessageInterface from 'app/components/events/interfaces/message'; import RequestInterface from 'app/components/events/interfaces/request'; import SentryTypes from 'app/sentryTypes'; @@ -50,13 +50,6 @@ export const INTERFACES = { debugmeta: DebugMetaInterface, }; -const EventCauseEmptyHook = HookOrDefault({ - hookName: 'component:event-cause-empty', - defaultComponent: () => { - return null; - }, -}); - class EventEntries extends React.Component { static propTypes = { // organization is not provided in the shared issue view @@ -174,7 +167,11 @@ class EventEntries extends React.Component { {!objectIsEmpty(event.errors) && }{' '} {!isShare && (showExampleCommit ? ( - + ) : ( ))}