Skip to content

Commit d9c2bb2

Browse files
committed
centralize event and group types + event types
1 parent 2f8884c commit d9c2bb2

File tree

2 files changed

+14
-20
lines changed

2 files changed

+14
-20
lines changed

src/sentry/static/sentry/app/components/eventOrGroupHeader.jsx

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import styled, {css} from 'react-emotion';
55
import classNames from 'classnames';
66
import {capitalize} from 'lodash';
77

8-
import {Metadata} from 'app/sentryTypes';
8+
import SentryTypes from 'app/sentryTypes';
99
import EventOrGroupTitle from 'app/components/eventOrGroupTitle';
1010
import Tooltip from 'app/components/tooltip';
1111
import {getMessage, getLocation} from 'app/utils/events';
@@ -17,23 +17,7 @@ class EventOrGroupHeader extends React.Component {
1717
static propTypes = {
1818
params: PropTypes.object,
1919
/** Either an issue or event **/
20-
data: PropTypes.shape({
21-
id: PropTypes.string,
22-
level: PropTypes.string,
23-
type: PropTypes.oneOf([
24-
'error',
25-
'csp',
26-
'hpkp',
27-
'expectct',
28-
'expectstaple',
29-
'default',
30-
'transaction',
31-
]).isRequired,
32-
title: PropTypes.string,
33-
metadata: Metadata,
34-
groupID: PropTypes.string,
35-
culprit: PropTypes.string,
36-
}),
20+
data: PropTypes.oneOfType([SentryTypes.Event, SentryTypes.Group]),
3721
includeLink: PropTypes.bool,
3822
hideIcons: PropTypes.bool,
3923
hideLevel: PropTypes.bool,

src/sentry/static/sentry/app/sentryTypes.jsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,16 @@ export const Member = PropTypes.shape({
148148
user: User,
149149
});
150150

151+
const EventOrGroupType = PropTypes.oneOf([
152+
'error',
153+
'csp',
154+
'hpkp',
155+
'expectct',
156+
'expectstaple',
157+
'default',
158+
'transaction',
159+
]);
160+
151161
export const Group = PropTypes.shape({
152162
id: PropTypes.string.isRequired,
153163
annotations: PropTypes.array,
@@ -174,7 +184,7 @@ export const Group = PropTypes.shape({
174184
status: PropTypes.string,
175185
statusDetails: PropTypes.object,
176186
title: PropTypes.string,
177-
type: PropTypes.oneOf(['error', 'csp', 'default', 'transaction']),
187+
type: EventOrGroupType,
178188
userCount: PropTypes.number,
179189
});
180190

@@ -212,7 +222,7 @@ export const Event = PropTypes.shape({
212222
value: PropTypes.string,
213223
})
214224
),
215-
type: PropTypes.oneOf(['error', 'csp', 'default', 'transaction']),
225+
type: EventOrGroupType,
216226
user: PropTypes.object,
217227
});
218228

0 commit comments

Comments
 (0)