|
@@ -1,18 +1,12 @@
|
|
|
import {Fragment, useEffect} from 'react';
|
|
|
-import {browserHistory} from 'react-router';
|
|
|
import {css} from '@emotion/react';
|
|
|
import styled from '@emotion/styled';
|
|
|
import {Location} from 'history';
|
|
|
-import * as qs from 'query-string';
|
|
|
|
|
|
import {hideSidebar, showSidebar} from 'sentry/actionCreators/preferences';
|
|
|
import Feature from 'sentry/components/acl/feature';
|
|
|
import GuideAnchor from 'sentry/components/assistant/guideAnchor';
|
|
|
import HookOrDefault from 'sentry/components/hookOrDefault';
|
|
|
-import {
|
|
|
- doesPathHaveNewFilters,
|
|
|
- extractSelectionParameters,
|
|
|
-} from 'sentry/components/organizations/pageFilters/utils';
|
|
|
import {
|
|
|
IconChevron,
|
|
|
IconDashboard,
|
|
@@ -110,50 +104,6 @@ function Sidebar({location, organization}: Props) {
|
|
|
}
|
|
|
}, [location?.hash]);
|
|
|
|
|
|
- /**
|
|
|
- * Navigate to a path, but keep the page filter query strings.
|
|
|
- */
|
|
|
- const navigateWithPageFilters = (
|
|
|
- pathname: string,
|
|
|
- evt: React.MouseEvent<HTMLAnchorElement>
|
|
|
- ) => {
|
|
|
- // XXX(epurkhiser): No need to navigate w/ the page filters in the world
|
|
|
- // of new page filter selection. You must pin your filters in which case
|
|
|
- // they will persist anyway.
|
|
|
- if (organization) {
|
|
|
- if (doesPathHaveNewFilters(pathname, organization)) {
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- const globalSelectionRoutes = [
|
|
|
- 'alerts',
|
|
|
- 'alerts/rules',
|
|
|
- 'dashboards',
|
|
|
- 'issues',
|
|
|
- 'releases',
|
|
|
- 'user-feedback',
|
|
|
- 'discover',
|
|
|
- 'discover/results', // Team plans do not have query landing page
|
|
|
- 'performance',
|
|
|
- ].map(route => `/organizations/${organization?.slug}/${route}/`);
|
|
|
-
|
|
|
- // Only keep the querystring if the current route matches one of the above
|
|
|
- if (globalSelectionRoutes.includes(pathname)) {
|
|
|
- const query = extractSelectionParameters(location?.query ?? {});
|
|
|
-
|
|
|
- // Handle cmd-click (mac) and meta-click (linux)
|
|
|
- if (evt.metaKey) {
|
|
|
- const q = qs.stringify(query);
|
|
|
- evt.currentTarget.href = `${evt.currentTarget.href}?${q}`;
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- evt.preventDefault();
|
|
|
- browserHistory.push({pathname, query});
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
const hasPanel = !!activePanel;
|
|
|
const hasOrganization = !!organization;
|
|
|
const orientation: SidebarOrientation = horizontal ? 'top' : 'left';
|
|
@@ -179,9 +129,6 @@ function Sidebar({location, organization}: Props) {
|
|
|
const issues = hasOrganization && (
|
|
|
<SidebarItem
|
|
|
{...sidebarItemProps}
|
|
|
- onClick={(_id, evt) =>
|
|
|
- navigateWithPageFilters(`/organizations/${organization.slug}/issues/`, evt)
|
|
|
- }
|
|
|
icon={<IconIssues size="md" />}
|
|
|
label={<GuideAnchor target="issues">{t('Issues')}</GuideAnchor>}
|
|
|
to={`/organizations/${organization.slug}/issues/`}
|
|
@@ -197,9 +144,6 @@ function Sidebar({location, organization}: Props) {
|
|
|
>
|
|
|
<SidebarItem
|
|
|
{...sidebarItemProps}
|
|
|
- onClick={(_id, evt) =>
|
|
|
- navigateWithPageFilters(getDiscoverLandingUrl(organization), evt)
|
|
|
- }
|
|
|
icon={<IconTelescope size="md" />}
|
|
|
label={<GuideAnchor target="discover">{t('Discover')}</GuideAnchor>}
|
|
|
to={getDiscoverLandingUrl(organization)}
|
|
@@ -218,12 +162,6 @@ function Sidebar({location, organization}: Props) {
|
|
|
{(overideProps: Partial<React.ComponentProps<typeof SidebarItem>>) => (
|
|
|
<SidebarItem
|
|
|
{...sidebarItemProps}
|
|
|
- onClick={(_id, evt) =>
|
|
|
- navigateWithPageFilters(
|
|
|
- `/organizations/${organization.slug}/performance/`,
|
|
|
- evt
|
|
|
- )
|
|
|
- }
|
|
|
icon={<IconLightning size="md" />}
|
|
|
label={<GuideAnchor target="performance">{t('Performance')}</GuideAnchor>}
|
|
|
to={`/organizations/${organization.slug}/performance/`}
|
|
@@ -238,9 +176,6 @@ function Sidebar({location, organization}: Props) {
|
|
|
const releases = hasOrganization && (
|
|
|
<SidebarItem
|
|
|
{...sidebarItemProps}
|
|
|
- onClick={(_id, evt) =>
|
|
|
- navigateWithPageFilters(`/organizations/${organization.slug}/releases/`, evt)
|
|
|
- }
|
|
|
icon={<IconReleases size="md" />}
|
|
|
label={<GuideAnchor target="releases">{t('Releases')}</GuideAnchor>}
|
|
|
to={`/organizations/${organization.slug}/releases/`}
|
|
@@ -251,9 +186,6 @@ function Sidebar({location, organization}: Props) {
|
|
|
const userFeedback = hasOrganization && (
|
|
|
<SidebarItem
|
|
|
{...sidebarItemProps}
|
|
|
- onClick={(_id, evt) =>
|
|
|
- navigateWithPageFilters(`/organizations/${organization.slug}/user-feedback/`, evt)
|
|
|
- }
|
|
|
icon={<IconSupport size="md" />}
|
|
|
label={t('User Feedback')}
|
|
|
to={`/organizations/${organization.slug}/user-feedback/`}
|
|
@@ -264,9 +196,6 @@ function Sidebar({location, organization}: Props) {
|
|
|
const alerts = hasOrganization && (
|
|
|
<SidebarItem
|
|
|
{...sidebarItemProps}
|
|
|
- onClick={(_id, evt) =>
|
|
|
- navigateWithPageFilters(`/organizations/${organization.slug}/alerts/rules/`, evt)
|
|
|
- }
|
|
|
icon={<IconSiren size="md" />}
|
|
|
label={t('Alerts')}
|
|
|
to={`/organizations/${organization.slug}/alerts/rules/`}
|
|
@@ -278,9 +207,6 @@ function Sidebar({location, organization}: Props) {
|
|
|
<Feature features={['monitors']} organization={organization}>
|
|
|
<SidebarItem
|
|
|
{...sidebarItemProps}
|
|
|
- onClick={(_id, evt) =>
|
|
|
- navigateWithPageFilters(`/organizations/${organization.slug}/monitors/`, evt)
|
|
|
- }
|
|
|
icon={<IconLab size="md" />}
|
|
|
label={t('Monitors')}
|
|
|
to={`/organizations/${organization.slug}/monitors/`}
|
|
@@ -293,9 +219,6 @@ function Sidebar({location, organization}: Props) {
|
|
|
<Feature features={['session-replay']} organization={organization}>
|
|
|
<SidebarItem
|
|
|
{...sidebarItemProps}
|
|
|
- onClick={(_id, evt) =>
|
|
|
- navigateWithPageFilters(`/organizations/${organization.slug}/replays/`, evt)
|
|
|
- }
|
|
|
icon={<IconPlay size="md" />}
|
|
|
label={t('Replays')}
|
|
|
to={`/organizations/${organization.slug}/replays/`}
|
|
@@ -314,9 +237,6 @@ function Sidebar({location, organization}: Props) {
|
|
|
<SidebarItem
|
|
|
{...sidebarItemProps}
|
|
|
index
|
|
|
- onClick={(_id, evt) =>
|
|
|
- navigateWithPageFilters(`/organizations/${organization.slug}/dashboards/`, evt)
|
|
|
- }
|
|
|
icon={<IconDashboard size="md" />}
|
|
|
label={t('Dashboards')}
|
|
|
to={`/organizations/${organization.slug}/dashboards/`}
|
|
@@ -335,9 +255,6 @@ function Sidebar({location, organization}: Props) {
|
|
|
<SidebarItem
|
|
|
{...sidebarItemProps}
|
|
|
index
|
|
|
- onClick={(_id, evt) =>
|
|
|
- navigateWithPageFilters(`/organizations/${organization.slug}/profiling/`, evt)
|
|
|
- }
|
|
|
icon={<IconSpan size="md" />}
|
|
|
label={t('Profiling')}
|
|
|
to={`/organizations/${organization.slug}/profiling/`}
|