Skip to content

ref(sentry10): Refactor event or group components #13594

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,6 @@ class EventOrGroupExtraDetails extends React.Component {
project: SentryTypes.Project,
};

getIssuesPath() {
const {orgId, projectId} = this.props.params;

return projectId
? `/${orgId}/${projectId}/issues/`
: `/organizations/${orgId}/issues/`;
}

render() {
const {
id,
Expand All @@ -52,9 +44,10 @@ class EventOrGroupExtraDetails extends React.Component {
showAssignee,
shortId,
project,
params,
} = this.props;

const issuesPath = this.getIssuesPath();
const issuesPath = `/organizations/${params.orgId}/issues/`;

return (
<GroupExtra align="center">
Expand Down
13 changes: 3 additions & 10 deletions src/sentry/static/sentry/app/components/eventOrGroupHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import styled, {css} from 'react-emotion';
import classNames from 'classnames';
import {capitalize} from 'lodash';

import ProjectLink from 'app/components/projectLink';
import {Metadata} from 'app/sentryTypes';
import EventOrGroupTitle from 'app/components/eventOrGroupTitle';
import Tooltip from 'app/components/tooltip';
Expand Down Expand Up @@ -48,17 +47,15 @@ class EventOrGroupHeader extends React.Component {

getTitle() {
const {hideIcons, hideLevel, includeLink, data, params} = this.props;
const {orgId, projectId} = params;
const {orgId} = params;

const {id, level, groupID} = data || {};
const isEvent = !!data.eventID;

const props = {};
let Wrapper;

const basePath = projectId
? `/${orgId}/${projectId}/issues/`
: `/organizations/${orgId}/issues/`;
const basePath = `/organizations/${orgId}/issues/`;

if (includeLink) {
props.to = {
Expand All @@ -69,11 +66,7 @@ class EventOrGroupHeader extends React.Component {
this.props.query ? `?query=${window.encodeURIComponent(this.props.query)}` : ''
}`,
};
if (projectId) {
Wrapper = ProjectLink;
} else {
Wrapper = Link;
}
Wrapper = Link;
} else {
Wrapper = 'span';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ exports[`EventOrGroupHeader Event hides level tag 1`] = `
}
hideLevel={true}
includeLink={true}
orgId="orgId"
projectId="projectId"
size="normal"
/>
Expand All @@ -47,8 +46,11 @@ exports[`EventOrGroupHeader Event renders with \`type = csp\` 1`] = `
}
}
includeLink={true}
orgId="orgId"
projectId="projectId"
params={
Object {
"orgId": "orgId",
}
}
size="normal"
/>
`;
Expand All @@ -73,8 +75,11 @@ exports[`EventOrGroupHeader Event renders with \`type = default\` 1`] = `
}
}
includeLink={true}
orgId="orgId"
projectId="projectId"
params={
Object {
"orgId": "orgId",
}
}
size="normal"
/>
`;
Expand All @@ -99,8 +104,11 @@ exports[`EventOrGroupHeader Event renders with \`type = error\` 1`] = `
}
}
includeLink={true}
orgId="orgId"
projectId="projectId"
params={
Object {
"orgId": "orgId",
}
}
size="normal"
/>
`;
Expand All @@ -124,8 +132,11 @@ exports[`EventOrGroupHeader Group renders with \`type = csp\` 1`] = `
}
}
includeLink={true}
orgId="orgId"
projectId="projectId"
params={
Object {
"orgId": "orgId",
}
}
size="normal"
/>
`;
Expand All @@ -149,8 +160,11 @@ exports[`EventOrGroupHeader Group renders with \`type = default\` 1`] = `
}
}
includeLink={true}
orgId="orgId"
projectId="projectId"
params={
Object {
"orgId": "orgId",
}
}
size="normal"
/>
`;
Expand All @@ -175,7 +189,6 @@ exports[`EventOrGroupHeader Group renders with \`type = error\` 1`] = `
}
includeLink={true}
orgId="orgId"
projectId="projectId"
size="normal"
/>
`;
17 changes: 5 additions & 12 deletions tests/js/spec/components/eventOrGroupHeader.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ describe('EventOrGroupHeader', function() {
const component = shallow(
<EventOrGroupHeader
orgId="orgId"
projectId="projectId"
data={{
...groupData,
...{
Expand All @@ -42,8 +41,7 @@ describe('EventOrGroupHeader', function() {
it('renders with `type = csp`', function() {
const component = shallow(
<EventOrGroupHeader
orgId="orgId"
projectId="projectId"
params={{orgId: 'orgId'}}
data={{
...groupData,
...{
Expand All @@ -59,8 +57,7 @@ describe('EventOrGroupHeader', function() {
it('renders with `type = default`', function() {
const component = shallow(
<EventOrGroupHeader
orgId="orgId"
projectId="projectId"
params={{orgId: 'orgId'}}
data={{
...groupData,
...{
Expand All @@ -86,8 +83,7 @@ describe('EventOrGroupHeader', function() {
it('renders with `type = error`', function() {
const component = shallow(
<EventOrGroupHeader
orgId="orgId"
projectId="projectId"
params={{orgId: 'orgId'}}
data={{
...eventData,
...{
Expand All @@ -103,8 +99,7 @@ describe('EventOrGroupHeader', function() {
it('renders with `type = csp`', function() {
const component = shallow(
<EventOrGroupHeader
orgId="orgId"
projectId="projectId"
params={{orgId: 'orgId'}}
data={{
...eventData,
...{
Expand All @@ -120,8 +115,7 @@ describe('EventOrGroupHeader', function() {
it('renders with `type = default`', function() {
const component = shallow(
<EventOrGroupHeader
orgId="orgId"
projectId="projectId"
params={{orgId: 'orgId'}}
data={{
...eventData,
...{
Expand All @@ -137,7 +131,6 @@ describe('EventOrGroupHeader', function() {
it('hides level tag', function() {
const component = shallow(
<EventOrGroupHeader
orgId="orgId"
projectId="projectId"
hideLevel
data={{
Expand Down
Loading