Skip to content

Commit

Permalink
ref(insights): Use consistent ModulePageProviders wrapping (#70782)
Browse files Browse the repository at this point in the history
- always lift `ModulePageProviders` out of the component
- always call it `PageWithProviders`
  • Loading branch information
gggritso committed May 14, 2024
1 parent 9ae4b44 commit 85ededb
Show file tree
Hide file tree
Showing 11 changed files with 82 additions and 43 deletions.
23 changes: 16 additions & 7 deletions static/app/views/performance/browser/resources/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from 'react';
import styled from '@emotion/styled';

import {Breadcrumbs} from 'sentry/components/breadcrumbs';
Expand Down Expand Up @@ -35,11 +36,7 @@ function ResourcesLandingPage() {
const filters = useResourceModuleFilters();

return (
<ModulePageProviders
title={[t('Performance'), t('Resources')].join(' — ')}
baseURL="/performance/browser/resources"
features="spans-first-ui"
>
<React.Fragment>
<PageAlertProvider>
<Layout.Header>
<Layout.HeaderContent>
Expand Down Expand Up @@ -86,12 +83,24 @@ function ResourcesLandingPage() {
</Layout.Main>
</Layout.Body>
</PageAlertProvider>
</React.Fragment>
);
}

function PageWithProviders() {
return (
<ModulePageProviders
title={[t('Performance'), t('Resources')].join(' — ')}
baseURL="/performance/browser/resources"
features="spans-first-ui"
>
<ResourcesLandingPage />
</ModulePageProviders>
);
}

export default PageWithProviders;

export const PaddedContainer = styled('div')`
margin-bottom: ${space(2)};
`;

export default ResourcesLandingPage;
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from 'react';
import styled from '@emotion/styled';

import {Breadcrumbs} from 'sentry/components/breadcrumbs';
Expand Down Expand Up @@ -80,11 +81,7 @@ function ResourceSummary() {
) ||
(uniqueSpanOps.size === 1 && spanMetrics[SPAN_OP] === ResourceSpanOps.IMAGE);
return (
<ModulePageProviders
title={[t('Performance'), t('Resources'), t('Resource Summary')].join(' — ')}
baseURL="/performance/browser/resources"
features="spans-first-ui"
>
<React.Fragment>
<Layout.Header>
<Layout.HeaderContent>
<Breadcrumbs
Expand Down Expand Up @@ -155,14 +152,26 @@ function ResourceSummary() {
/>
</Layout.Main>
</Layout.Body>
</React.Fragment>
);
}

function PageWithProviders() {
return (
<ModulePageProviders
title={[t('Performance'), t('Resources'), t('Resource Summary')].join(' — ')}
baseURL="/performance/browser/resources"
features="spans-first-ui"
>
<ResourceSummary />
</ModulePageProviders>
);
}

export default PageWithProviders;

const HeaderContainer = styled('div')`
display: flex;
justify-content: space-between;
flex-wrap: wrap;
`;

export default ResourceSummary;
24 changes: 17 additions & 7 deletions static/app/views/performance/browser/webVitals/pageOverview.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {useMemo, useState} from 'react';
import React, {useMemo, useState} from 'react';
import styled from '@emotion/styled';
import omit from 'lodash/omit';
import moment from 'moment';
Expand Down Expand Up @@ -74,7 +74,7 @@ function getCurrentTabSelection(selectedTab) {
return LandingDisplayField.OVERVIEW;
}

export default function PageOverview() {
export function PageOverview() {
const organization = useOrganization();
const location = useLocation();
const {projects} = useProjects();
Expand Down Expand Up @@ -138,11 +138,7 @@ export default function PageOverview() {
moment(FID_DEPRECATION_DATE).format('DD MMMM YYYY');

return (
<ModulePageProviders
title={[t('Performance'), t('Web Vitals')].join(' — ')}
baseURL="/performance/browser/pageloads"
features="spans-first-ui"
>
<React.Fragment>
<Tabs
value={tab}
onChange={value => {
Expand Down Expand Up @@ -303,10 +299,24 @@ export default function PageOverview() {
}}
/>
</Tabs>
</React.Fragment>
);
}

function PageWithProviders() {
return (
<ModulePageProviders
title={[t('Performance'), t('Web Vitals')].join(' — ')}
baseURL="/performance/browser/pageloads"
features="spans-first-ui"
>
<PageOverview />
</ModulePageProviders>
);
}

export default PageWithProviders;

const ViewAllPagesButton = styled(LinkButton)`
margin-right: ${space(1)};
`;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Fragment, useState} from 'react';
import React, {Fragment, useState} from 'react';
import styled from '@emotion/styled';
import omit from 'lodash/omit';
import moment from 'moment';
Expand Down Expand Up @@ -36,7 +36,7 @@ import {WebVitalsDetailPanel} from 'sentry/views/performance/browser/webVitals/w
import {ModulePageProviders} from 'sentry/views/performance/modulePageProviders';
import Onboarding from 'sentry/views/performance/onboarding';

export default function WebVitalsLandingPage() {
export function WebVitalsLandingPage() {
const organization = useOrganization();
const location = useLocation();
const onboardingProject = useOnboardingProject();
Expand Down Expand Up @@ -68,11 +68,7 @@ export default function WebVitalsLandingPage() {
moment(FID_DEPRECATION_DATE).format('DD MMMM YYYY');

return (
<ModulePageProviders
title={[t('Performance'), t('Web Vitals')].join(' — ')}
baseURL="/performance/browser/pageloads"
features="spans-first-ui"
>
<React.Fragment>
<Layout.Header>
<Layout.HeaderContent>
<Breadcrumbs
Expand Down Expand Up @@ -178,10 +174,24 @@ export default function WebVitalsLandingPage() {
setState({...state, webVital: null});
}}
/>
</React.Fragment>
);
}

function PageWithProviders() {
return (
<ModulePageProviders
title={[t('Performance'), t('Web Vitals')].join(' — ')}
baseURL="/performance/browser/pageloads"
features="spans-first-ui"
>
<WebVitalsLandingPage />
</ModulePageProviders>
);
}

export default PageWithProviders;

const TopMenuContainer = styled('div')`
display: flex;
`;
Expand Down
6 changes: 3 additions & 3 deletions static/app/views/performance/cache/cacheLandingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ export function CacheLandingPage() {
);
}

export function LandingPageWithProviders() {
function PageWithProviders() {
return (
<ModulePageProviders
title={[t('Performance'), MODULE_TITLE].join(' — ')}
Expand All @@ -214,6 +214,8 @@ export function LandingPageWithProviders() {
);
}

export default PageWithProviders;

const combineMeta = (
meta1?: EventsMetaType,
meta2?: EventsMetaType
Expand Down Expand Up @@ -247,5 +249,3 @@ const DEFAULT_SORT = {
};

const TRANSACTIONS_TABLE_ROW_COUNT = 20;

export default LandingPageWithProviders;
4 changes: 2 additions & 2 deletions static/app/views/performance/database/databaseLandingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ const SelectorContainer = styled('div')`

const LIMIT: number = 25;

function LandingPageWithProviders() {
function PageWithProviders() {
return (
<ModulePageProviders
title={[t('Performance'), t('Database')].join(' — ')}
Expand All @@ -277,4 +277,4 @@ function LandingPageWithProviders() {
);
}

export default LandingPageWithProviders;
export default PageWithProviders;
4 changes: 2 additions & 2 deletions static/app/views/performance/http/httpDomainSummaryPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ const MetricsRibbon = styled('div')`
gap: ${space(4)};
`;

function LandingPageWithProviders() {
function PageWithProviders() {
return (
<ModulePageProviders
baseURL="/performance/http"
Expand All @@ -366,4 +366,4 @@ function LandingPageWithProviders() {
);
}

export default LandingPageWithProviders;
export default PageWithProviders;
4 changes: 2 additions & 2 deletions static/app/views/performance/http/httpLandingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ const DEFAULT_SORT = {

const DOMAIN_TABLE_ROW_COUNT = 10;

function LandingPageWithProviders() {
function PageWithProviders() {
return (
<ModulePageProviders
title={[t('Performance'), MODULE_TITLE].join(' — ')}
Expand All @@ -259,4 +259,4 @@ function LandingPageWithProviders() {
);
}

export default LandingPageWithProviders;
export default PageWithProviders;
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {useLocation} from 'sentry/utils/useLocation';
import useOrganization from 'sentry/utils/useOrganization';
import usePageFilters from 'sentry/utils/usePageFilters';
import useProjects from 'sentry/utils/useProjects';
import DestinationSummaryPageWithProviders from 'sentry/views/performance/queues/destinationSummary/destinationSummaryPage';
import PageWithProviders from 'sentry/views/performance/queues/destinationSummary/destinationSummaryPage';

jest.mock('sentry/utils/useLocation');
jest.mock('sentry/utils/usePageFilters');
Expand Down Expand Up @@ -72,7 +72,7 @@ describe('destinationSummaryPage', () => {
});

it('renders', async () => {
render(<DestinationSummaryPageWithProviders />);
render(<PageWithProviders />);
await screen.findByRole('table', {name: 'Transactions'});
await waitForElementToBeRemoved(() => screen.queryAllByTestId('loading-indicator'));
screen.getByText('Avg Latency');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ function DestinationSummaryPage() {
);
}

function DestinationSummaryPageWithProviders() {
function PageWithProviders() {
return (
<ModulePageProviders
title={[t('Performance'), MODULE_TITLE].join(' — ')}
Expand All @@ -171,7 +171,7 @@ function DestinationSummaryPageWithProviders() {
</ModulePageProviders>
);
}
export default DestinationSummaryPageWithProviders;
export default PageWithProviders;

const Flex = styled('div')`
display: flex;
Expand Down
5 changes: 3 additions & 2 deletions static/app/views/performance/queues/queuesLandingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ function QueuesLandingPage() {
);
}

function LandingPageWithProviders() {
function PageWithProviders() {
return (
<ModulePageProviders
title={[t('Performance'), MODULE_TITLE].join(' — ')}
Expand All @@ -111,7 +111,8 @@ function LandingPageWithProviders() {
</ModulePageProviders>
);
}
export default LandingPageWithProviders;

export default PageWithProviders;

const Flex = styled('div')`
display: flex;
Expand Down

0 comments on commit 85ededb

Please sign in to comment.