Skip to content

Commit

Permalink
ref(ui): Remove most sentry10 feature gates (#13504)
Browse files Browse the repository at this point in the history
This removes the sentry10 feature gates that controls logic around what URL to link to and feature gates that do not involve cleaning up deprecated components that need to be cleaned up.
  • Loading branch information
billyvg authored Jun 4, 2019
1 parent cdf2829 commit 90a92e3
Show file tree
Hide file tree
Showing 55 changed files with 242 additions and 822 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,9 @@ class ReleaseSeries extends React.Component {
name: release.shortVersion,
value: release.shortVersion,
onClick: () => {
if (organization.features.includes('sentry10')) {
router.push(
`/organizations/${organization.slug}/releases/${release.version}/`
);
}
router.push(
`/organizations/${organization.slug}/releases/${release.version}/`
);
},
label: {
formatter: () => release.shortVersion,
Expand Down
15 changes: 2 additions & 13 deletions src/sentry/static/sentry/app/components/compactIssue.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import SnoozeAction from 'app/components/issues/snoozeAction';
import GroupChart from 'app/components/stream/groupChart';
import GroupStore from 'app/stores/groupStore';
import Link from 'app/components/links/link';
import ProjectLink from 'app/components/projectLink';
import {t} from 'app/locale';
import {PanelItem} from 'app/components/panels';
import SentryTypes from 'app/sentryTypes';
Expand Down Expand Up @@ -68,13 +67,9 @@ class CompactIssueHeader extends React.Component {
render() {
const {data, organization, projectId, eventId} = this.props;

const hasNewRoutes = new Set(organization.features).has('sentry10');

let styles = {};

const basePath = hasNewRoutes
? `/organizations/${organization.slug}/issues/`
: `/${organization.slug}/${projectId}/issues/`;
const basePath = `/organizations/${organization.slug}/issues/`;

const issueLink = eventId
? `/organizations/${organization.slug}/projects/${projectId}/events/${eventId}/`
Expand All @@ -100,13 +95,7 @@ class CompactIssueHeader extends React.Component {
</Flex>
<div className="event-extra">
<span className="project-name">
{hasNewRoutes ? (
<strong>{data.project.slug}</strong>
) : (
<ProjectLink to={`/${organization.slug}/${projectId}/`}>
{data.project.slug}
</ProjectLink>
)}
<strong>{data.project.slug}</strong>
</span>
{data.numComments !== 0 && (
<span>
Expand Down
20 changes: 5 additions & 15 deletions src/sentry/static/sentry/app/components/events/eventTags.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ import InlineSvg from 'app/components/inlineSvg';

class EventTags extends React.Component {
static propTypes = {
// organization is not provided in the shared issue view
organization: SentryTypes.Organization,
group: SentryTypes.Group.isRequired,
event: SentryTypes.Event.isRequired,
orgId: PropTypes.string.isRequired,
Expand All @@ -31,19 +29,11 @@ class EventTags extends React.Component {
return null;
}

const {event, group, organization, orgId, projectId} = this.props;
const {event, group, orgId, projectId} = this.props;

// Just use the sentry 10 paths if we are in a shared view since we
// don't have the organization object to check the feature list
const hasSentry10 = !organization || new Set(organization.features).has('sentry10');
const streamPath = `/organizations/${orgId}/issues/`;

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

const releasesPath = hasSentry10
? `/organizations/${orgId}/releases/`
: `/${orgId}/${projectId}/releases/`;
const releasesPath = `/organizations/${orgId}/releases/`;

return (
<EventDataSection
Expand All @@ -62,7 +52,7 @@ class EventTags extends React.Component {
pathname: streamPath,
query: {
query: `${tag.key}:"${tag.value}"`,
...(hasSentry10 && {project: group.project.id}),
project: group.project.id,
},
}}
>
Expand All @@ -84,7 +74,7 @@ class EventTags extends React.Component {
to={{
pathname: `${releasesPath}${tag.value}/`,
query: {
...(hasSentry10 && {project: group.project.id}),
project: group.project.id,
},
}}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import AttachmentUrl from 'app/utils/attachmentUrl';

class EventsTableRow extends React.Component {
static propTypes = {
organization: SentryTypes.Organization.isRequired,
hasUser: PropTypes.bool,
orgId: PropTypes.string.isRequired,
groupId: PropTypes.string.isRequired,
Expand Down Expand Up @@ -63,24 +62,13 @@ class EventsTableRow extends React.Component {
}

render() {
const {
organization,
className,
event,
orgId,
projectId,
groupId,
tagList,
hasUser,
} = this.props;
const {className, event, orgId, groupId, tagList, hasUser} = this.props;
const tagMap = {};
event.tags.forEach(tag => {
tagMap[tag.key] = tag.value;
});

const basePath = new Set(organization.features).has('sentry10')
? `/organizations/${orgId}/issues/`
: `/${orgId}/${projectId}/issues/`;
const basePath = `/organizations/${orgId}/issues/`;

return (
<tr key={event.id} className={className}>
Expand Down
17 changes: 3 additions & 14 deletions src/sentry/static/sentry/app/components/group/releaseStats.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,16 @@ const GroupReleaseStats = createReactClass({

getInitialState() {
const envList = OrganizationEnvironmentsStore.getActive();

let environments = [];
if (this.hasSentry10()) {
environments = envList.filter(env =>
GlobalSelectionStore.get().environments.includes(env.name)
);
} else {
const latestContextEnv = LatestContextStore.getInitialState().environment;
environments = latestContextEnv ? [latestContextEnv] : [];
}
const environments = envList.filter(env =>
GlobalSelectionStore.get().environments.includes(env.name)
);

return {
envList,
environments,
};
},

hasSentry10() {
return this.getFeatures().has('sentry10');
},

onLatestContextChange(context) {
this.setState({environments: context.environment ? [context.environment] : []});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const GroupTagDistributionMeter = createReactClass({
tag: PropTypes.string.isRequired,
name: PropTypes.string,
organization: SentryTypes.Organization.isRequired,
projectId: PropTypes.string.isRequired,
environment: SentryTypes.Environment,
totalValues: PropTypes.number,
topValues: PropTypes.array,
Expand Down Expand Up @@ -75,14 +74,10 @@ const GroupTagDistributionMeter = createReactClass({
},

render() {
const {organization, projectId, group, tag, totalValues, topValues} = this.props;
const {organization, group, tag, totalValues, topValues} = this.props;
const {loading, error} = this.state;

const hasSentry10 = new Set(organization.features).has('sentry10');

const url = hasSentry10
? `/organizations/${organization.slug}/issues/${group.id}/tags/${tag}/`
: `/${organization.slug}/${projectId}/issues/${group.id}/tags/${tag}/`;
const url = `/organizations/${organization.slug}/issues/${group.id}/tags/${tag}/`;

let segments = [];

Expand Down
9 changes: 2 additions & 7 deletions src/sentry/static/sentry/app/components/issueLink.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import React from 'react';
import classNames from 'classnames';
import {Link} from 'react-router';

import SentryTypes from 'app/sentryTypes';
import Hovercard from 'app/components/hovercard';
import Count from 'app/components/count';
import EventOrGroupTitle from 'app/components/eventOrGroupTitle';
Expand All @@ -12,9 +11,7 @@ import {t} from 'app/locale';

export default class IssueLink extends React.Component {
static propTypes = {
organization: SentryTypes.Organization.isRequired,
orgId: PropTypes.string.isRequired,
projectId: PropTypes.string.isRequired,
issue: PropTypes.object.isRequired,
to: PropTypes.string.isRequired,
card: PropTypes.bool,
Expand All @@ -37,7 +34,7 @@ export default class IssueLink extends React.Component {
}

renderBody() {
const {organization, issue, orgId, projectId} = this.props;
const {issue, orgId} = this.props;
const message = this.getMessage(issue);

const className = classNames(`type-${issue.type}`, `level-${issue.level}`, {
Expand All @@ -46,9 +43,7 @@ export default class IssueLink extends React.Component {
isResolved: issue.status === 'resolved',
});

const streamPath = new Set(organization.features).has('sentry10')
? `/organizations/${orgId}/issues/`
: `/${orgId}/${projectId}/`;
const streamPath = `/organizations/${orgId}/issues/`;

return (
<div className={className}>
Expand Down
104 changes: 41 additions & 63 deletions src/sentry/static/sentry/app/components/sidebar/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -263,21 +263,19 @@ class Sidebar extends React.Component {
: `/${organization.slug}/`
}
/>
<Feature features={['sentry10']} organization={organization}>
<SidebarItem
{...sidebarItemProps}
onClick={(_id, evt) =>
this.navigateWithGlobalSelection(
`/organizations/${organization.slug}/issues/`,
evt
)
}
icon={<InlineSvg src="icon-issues" />}
label={t('Issues')}
to={`/organizations/${organization.slug}/issues/`}
id="issues"
/>
</Feature>
<SidebarItem
{...sidebarItemProps}
onClick={(_id, evt) =>
this.navigateWithGlobalSelection(
`/organizations/${organization.slug}/issues/`,
evt
)
}
icon={<InlineSvg src="icon-issues" />}
label={t('Issues')}
to={`/organizations/${organization.slug}/issues/`}
id="issues"
/>

<Feature
features={['events', 'events-v2']}
Expand Down Expand Up @@ -316,56 +314,36 @@ class Sidebar extends React.Component {
/>
</Feature>

{hasSentry10 && (
<React.Fragment>
<SidebarItem
{...sidebarItemProps}
onClick={(_id, evt) =>
this.navigateWithGlobalSelection(
`/organizations/${organization.slug}/releases/`,
evt
)
}
icon={<InlineSvg src="icon-releases" />}
label={t('Releases')}
to={`/organizations/${organization.slug}/releases/`}
id="releases"
/>
<SidebarItem
{...sidebarItemProps}
onClick={(_id, evt) =>
this.navigateWithGlobalSelection(
`/organizations/${organization.slug}/user-feedback/`,
evt
)
}
icon={<InlineSvg src="icon-support" />}
label={t('User Feedback')}
to={`/organizations/${organization.slug}/user-feedback/`}
id="user-feedback"
/>
</React.Fragment>
)}

{!hasSentry10 && (
<Feature features={['discover']} organization={organization}>
<SidebarItem
{...sidebarItemProps}
onClick={this.hidePanel}
icon={<InlineSvg src="icon-discover" />}
label={t('Discover')}
to={`/organizations/${organization.slug}/discover/`}
id="discover"
/>
</Feature>
)}
<SidebarItem
{...sidebarItemProps}
onClick={(_id, evt) =>
this.navigateWithGlobalSelection(
`/organizations/${organization.slug}/releases/`,
evt
)
}
icon={<InlineSvg src="icon-releases" />}
label={t('Releases')}
to={`/organizations/${organization.slug}/releases/`}
id="releases"
/>
<SidebarItem
{...sidebarItemProps}
onClick={(_id, evt) =>
this.navigateWithGlobalSelection(
`/organizations/${organization.slug}/user-feedback/`,
evt
)
}
icon={<InlineSvg src="icon-support" />}
label={t('User Feedback')}
to={`/organizations/${organization.slug}/user-feedback/`}
id="user-feedback"
/>
</SidebarSection>

<SidebarSection>
<Feature
features={['sentry10', 'discover']}
organization={organization}
>
<Feature features={['discover']} organization={organization}>
<SidebarItem
{...sidebarItemProps}
index
Expand All @@ -377,7 +355,7 @@ class Sidebar extends React.Component {
/>
</Feature>
<Feature
features={['sentry10', 'discover']}
features={['discover']}
hookName="discover-sidebar-item"
organization={organization}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ class SwitchOrganization extends React.Component {
>
<OrganizationList>
{organizations.map(organization => {
const url = new Set(organization.features).has('sentry10')
? `/organizations/${organization.slug}/`
: `/${organization.slug}/`;
const url = `/organizations/${organization.slug}/`;

return (
<SidebarMenuItem key={organization.slug} to={url}>
Expand Down
Loading

0 comments on commit 90a92e3

Please sign in to comment.