Skip to content

Commit

Permalink
Revert "feat(nav): Update alerts links to /issues/alerts/ (#85005)"
Browse files Browse the repository at this point in the history
This reverts commit fbc5110.

Co-authored-by: gaprl <[email protected]>
  • Loading branch information
getsentry-bot and gaprl committed Feb 14, 2025
1 parent ac161e9 commit 34bd16d
Show file tree
Hide file tree
Showing 42 changed files with 120 additions and 362 deletions.
13 changes: 2 additions & 11 deletions static/app/components/createAlertButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import type EventView from 'sentry/utils/discover/eventView';
import useApi from 'sentry/utils/useApi';
import useProjects from 'sentry/utils/useProjects';
import useRouter from 'sentry/utils/useRouter';
import {makeAlertsPathname} from 'sentry/views/alerts/pathnames';
import type {AlertType, AlertWizardAlertNames} from 'sentry/views/alerts/wizard/options';
import {
AlertWizardRuleTemplates,
Expand Down Expand Up @@ -76,10 +75,7 @@ function CreateAlertFromViewButton({
: DEFAULT_WIZARD_TEMPLATE;

const to = {
pathname: makeAlertsPathname({
path: '/new/metric/',
organization,
}),
pathname: `/organizations/${organization.slug}/alerts/new/metric/`,
query: {
...queryParams,
createFromDiscover: true,
Expand Down Expand Up @@ -147,12 +143,7 @@ export default function CreateAlertButton({
if (alertOption) {
params.append('alert_option', alertOption);
}
return (
makeAlertsPathname({
path: '/wizard/',
organization,
}) + `?${params.toString()}`
);
return `/organizations/${organization.slug}/alerts/wizard/?${params.toString()}`;
};

function handleClickWithoutProject(event: React.MouseEvent) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import type {Organization} from 'sentry/types/organization';
import type {Project} from 'sentry/types/project';
import {useDimensions} from 'sentry/utils/useDimensions';
import {useLocation} from 'sentry/utils/useLocation';
import {makeAlertsPathname} from 'sentry/views/alerts/pathnames';
import {SectionKey} from 'sentry/views/issueDetails/streamline/context';
import {InterimSection} from 'sentry/views/issueDetails/streamline/interimSection';
import {ResolutionSelector} from 'sentry/views/monitors/components/overviewTimeline/resolutionSelector';
Expand Down Expand Up @@ -78,10 +77,7 @@ export function CronTimelineSection({event, organization, project}: Props) {
size="xs"
icon={<IconOpen />}
to={{
pathname: makeAlertsPathname({
path: `/rules/crons/${project.slug}/${monitorSlug}/details/`,
organization,
}),
pathname: `/organizations/${organization.slug}/alerts/rules/crons/${project.slug}/${monitorSlug}/details/`,
query: {environment},
}}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ import type {Event} from 'sentry/types/event';
import {type Group, GroupActivityType, GroupStatus} from 'sentry/types/group';
import type {Project} from 'sentry/types/project';
import {defined} from 'sentry/utils';
import normalizeUrl from 'sentry/utils/url/normalizeUrl';
import {useDebouncedValue} from 'sentry/utils/useDebouncedValue';
import {useDimensions} from 'sentry/utils/useDimensions';
import {useLocation} from 'sentry/utils/useLocation';
import useOrganization from 'sentry/utils/useOrganization';
import {makeAlertsPathname} from 'sentry/views/alerts/pathnames';
import {
checkStatusPrecedent,
statusToText,
Expand Down Expand Up @@ -133,10 +133,9 @@ export function UptimeDataSection({group, event, project}: Props) {
<LinkButton
icon={<IconSettings />}
size="xs"
to={makeAlertsPathname({
path: `/rules/uptime/${project.slug}/${alertRuleId}/details/`,
organization,
})}
to={normalizeUrl(
`/organizations/${organization.slug}/alerts/rules/uptime/${project.slug}/${alertRuleId}/details/`
)}
>
{t('Uptime Alert Rule')}
</LinkButton>
Expand Down
11 changes: 2 additions & 9 deletions static/app/components/onboardingWizard/taskConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import type {Organization} from 'sentry/types/organization';
import type {Project} from 'sentry/types/project';
import {isDemoModeEnabled} from 'sentry/utils/demoMode';
import {getDemoWalkthroughTasks} from 'sentry/utils/demoMode/guides';
import {makeAlertsPathname} from 'sentry/views/alerts/pathnames';
import {getPerformanceBaseUrl} from 'sentry/views/performance/utils';
import {makeReplaysPathname} from 'sentry/views/replays/pathnames';

Expand All @@ -48,18 +47,12 @@ type Options = {

function getIssueAlertUrl({projects, organization}: Options) {
if (!projects || !projects.length) {
return makeAlertsPathname({
path: '/rules/',
organization,
});
return `/organizations/${organization.slug}/alerts/rules/`;
}
// pick the first project with events if we have that, otherwise just pick the first project
const firstProjectWithEvents = projects.find(project => !!project.firstEvent);
const project = firstProjectWithEvents ?? projects[0]!;
return makeAlertsPathname({
path: `/${project.slug}/wizard/`,
organization,
});
return `/organizations/${organization.slug}/alerts/${project.slug}/wizard/`;
}

function getOnboardingInstructionsUrl({projects, organization}: Options) {
Expand Down
6 changes: 1 addition & 5 deletions static/app/components/sidebar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ import useMedia from 'sentry/utils/useMedia';
import useOrganization from 'sentry/utils/useOrganization';
import usePageFilters from 'sentry/utils/usePageFilters';
import useProjects from 'sentry/utils/useProjects';
import {makeAlertsPathname} from 'sentry/views/alerts/pathnames';
import {MODULE_BASE_URLS} from 'sentry/views/insights/common/utils/useModuleURL';
import {
AI_LANDING_SUB_PATH,
Expand Down Expand Up @@ -329,10 +328,7 @@ function Sidebar() {
{...sidebarItemProps}
icon={<IconSiren />}
label={t('Alerts')}
to={makeAlertsPathname({
path: '/rules/',
organization,
})}
to={`/organizations/${organization.slug}/alerts/rules/`}
id="alerts"
/>
);
Expand Down
11 changes: 2 additions & 9 deletions static/app/views/alerts/builder/builderBreadCrumbs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import type {Crumb, CrumbDropdown} from 'sentry/components/breadcrumbs';
import Breadcrumbs from 'sentry/components/breadcrumbs';
import {t} from 'sentry/locale';
import type {Organization} from 'sentry/types/organization';
import {makeAlertsPathname} from 'sentry/views/alerts/pathnames';

interface Props {
organization: Organization;
Expand All @@ -14,21 +13,15 @@ interface Props {
function BuilderBreadCrumbs({title, alertName, projectSlug, organization}: Props) {
const crumbs: Array<Crumb | CrumbDropdown> = [
{
to: makeAlertsPathname({
path: '/rules/',
organization,
}),
to: `/organizations/${organization.slug}/alerts/rules/`,
label: t('Alerts'),
preservePageFilters: true,
},
{
label: title,
...(alertName
? {
to: makeAlertsPathname({
path: `/${projectSlug}/wizard/`,
organization,
}),
to: `/organizations/${organization.slug}/alerts/${projectSlug}/wizard`,
preservePageFilters: true,
}
: {}),
Expand Down
6 changes: 1 addition & 5 deletions static/app/views/alerts/builder/projectProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import useApi from 'sentry/utils/useApi';
import {useIsMountedRef} from 'sentry/utils/useIsMountedRef';
import useProjects from 'sentry/utils/useProjects';
import useScrollToTop from 'sentry/utils/useScrollToTop';
import {makeAlertsPathname} from 'sentry/views/alerts/pathnames';

type Props = RouteComponentProps<RouteParams, {}> & {
hasMetricAlerts: boolean;
Expand Down Expand Up @@ -58,10 +57,7 @@ function AlertBuilderProjectProvider(props: Props) {
// If there's no project show the project selector modal
if (!project && !fetchError) {
navigateTo(
makeAlertsPathname({
path: '/wizard/',
organization,
}) + `?referrer=${props.location.query.referrer}&project=:projectId`,
`/organizations/${organization.slug}/alerts/wizard/?referrer=${props.location.query.referrer}&project=:projectId`,
props.router
);
}
Expand Down
26 changes: 13 additions & 13 deletions static/app/views/alerts/create.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ describe('ProjectAlertsCreate', function () {
await waitFor(() => {
expect(wrapper.router.replace).toHaveBeenCalledWith(
expect.objectContaining({
pathname: '/organizations/org-slug/alerts/new/metric/',
pathname: '/organizations/org-slug/alerts/new/metric',
query: {
aggregate: 'count()',
dataset: 'events',
Expand Down Expand Up @@ -360,9 +360,9 @@ describe('ProjectAlertsCreate', function () {
expect(metric.startSpan).toHaveBeenCalledWith({name: 'saveAlertRule'});

await waitFor(() => {
expect(wrapper.router.push).toHaveBeenCalledWith(
'/organizations/org-slug/alerts/rules/project-slug/1/details/'
);
expect(wrapper.router.push).toHaveBeenCalledWith({
pathname: '/organizations/org-slug/alerts/rules/project-slug/1/details/',
});
});
});

Expand Down Expand Up @@ -415,9 +415,9 @@ describe('ProjectAlertsCreate', function () {
expect(metric.startSpan).toHaveBeenCalledWith({name: 'saveAlertRule'});

await waitFor(() => {
expect(wrapper.router.push).toHaveBeenCalledWith(
'/organizations/org-slug/alerts/rules/project-slug/1/details/'
);
expect(wrapper.router.push).toHaveBeenCalledWith({
pathname: '/organizations/org-slug/alerts/rules/project-slug/1/details/',
});
});
});

Expand Down Expand Up @@ -464,9 +464,9 @@ describe('ProjectAlertsCreate', function () {
expect(metric.startSpan).toHaveBeenCalledWith({name: 'saveAlertRule'});

await waitFor(() => {
expect(wrapper.router.push).toHaveBeenCalledWith(
'/organizations/org-slug/alerts/rules/project-slug/1/details/'
);
expect(wrapper.router.push).toHaveBeenCalledWith({
pathname: '/organizations/org-slug/alerts/rules/project-slug/1/details/',
});
});
});

Expand Down Expand Up @@ -510,9 +510,9 @@ describe('ProjectAlertsCreate', function () {
expect(metric.startSpan).toHaveBeenCalledWith({name: 'saveAlertRule'});

await waitFor(() => {
expect(wrapper.router.push).toHaveBeenCalledWith(
'/organizations/org-slug/alerts/rules/project-slug/1/details/'
);
expect(wrapper.router.push).toHaveBeenCalledWith({
pathname: '/organizations/org-slug/alerts/rules/project-slug/1/details/',
});
});
});
});
Expand Down
14 changes: 4 additions & 10 deletions static/app/views/alerts/create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import normalizeUrl from 'sentry/utils/url/normalizeUrl';
import {useNavigate} from 'sentry/utils/useNavigate';
import {useUserTeams} from 'sentry/utils/useUserTeams';
import BuilderBreadCrumbs from 'sentry/views/alerts/builder/builderBreadCrumbs';
import {makeAlertsPathname} from 'sentry/views/alerts/pathnames';
import IssueRuleEditor from 'sentry/views/alerts/rules/issue';
import MetricRulesCreate from 'sentry/views/alerts/rules/metric/create';
import MetricRuleDuplicate from 'sentry/views/alerts/rules/metric/duplicate';
Expand Down Expand Up @@ -75,10 +74,7 @@ function Create(props: Props) {
router.replace(
normalizeUrl({
...location,
pathname: makeAlertsPathname({
path: `/new/${alertType}/`,
organization,
}),
pathname: `/organizations/${organization.slug}/alerts/new/${alertType}`,
query: {
...location.query,
...DEFAULT_WIZARD_TEMPLATE,
Expand All @@ -97,7 +93,6 @@ function Create(props: Props) {
location,
organization.slug,
project.slug,
organization,
]);

const {teams, isLoading} = useUserTeams();
Expand Down Expand Up @@ -159,10 +154,9 @@ function Create(props: Props) {
apiEndpoint={`/organizations/${organization.slug}/monitors/`}
onSubmitSuccess={(data: Monitor) =>
navigate(
makeAlertsPathname({
path: `/rules/crons/${data.project.slug}/${data.slug}/details/`,
organization,
})
normalizeUrl(
`/organizations/${organization.slug}/alerts/rules/crons/${data.project.slug}/${data.slug}/details/`
)
)
}
submitLabel={t('Create')}
Expand Down
12 changes: 3 additions & 9 deletions static/app/views/alerts/list/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import {TabList} from 'sentry/components/tabs';
import {IconSettings} from 'sentry/icons';
import {t} from 'sentry/locale';
import ProjectsStore from 'sentry/stores/projectsStore';
import normalizeUrl from 'sentry/utils/url/normalizeUrl';
import useOrganization from 'sentry/utils/useOrganization';
import usePageFilters from 'sentry/utils/usePageFilters';
import useRouter from 'sentry/utils/useRouter';
import {makeAlertsPathname} from 'sentry/views/alerts/pathnames';

type Props = {
activeTab: 'stream' | 'rules';
Expand All @@ -34,10 +34,7 @@ function AlertHeader({activeTab}: Props) {
const alertRulesLink = (
<TabList.Item
key="rules"
to={makeAlertsPathname({
path: '/rules/',
organization,
})}
to={normalizeUrl(`/organizations/${organization.slug}/alerts/rules/`)}
>
{t('Alert Rules')}
</TabList.Item>
Expand Down Expand Up @@ -88,10 +85,7 @@ function AlertHeader({activeTab}: Props) {
{alertRulesLink}
<TabList.Item
key="stream"
to={makeAlertsPathname({
path: '/',
organization,
})}
to={normalizeUrl(`/organizations/${organization.slug}/alerts/`)}
>
{t('History')}
</TabList.Item>
Expand Down
2 changes: 1 addition & 1 deletion static/app/views/alerts/list/rules/alertRulesList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ function AlertRulesList() {
projectsLoaded={initiallyLoaded}
projects={projects as Project[]}
rule={rule}
organization={organization}
orgId={organization.slug}
onOwnerChange={handleOwnerChange}
onDelete={handleDeleteRule}
hasEditAccess={hasEditAccess}
Expand Down
Loading

0 comments on commit 34bd16d

Please sign in to comment.