Skip to content

Commit

Permalink
chore(performance-landing): Removing webvital tab. (getsentry#59615)
Browse files Browse the repository at this point in the history
- This PR removes the **Perfomance > Web Vitals** tab and redirects
navigations to it, with the **Perfomance > Frontend** tab.
- Updated the tooltips for Best Page opportunities widget.

---------

Co-authored-by: Abdullah Khan <abdullahkhan@PG9Y57YDXQ.local>
  • Loading branch information
2 people authored and pull[bot] committed Mar 16, 2024
1 parent 56ee11c commit 0ebcb04
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function PerformanceBadge({score}: Props) {
);
}

const Badge = styled('div')<{status: string}>`
export const Badge = styled('div')<{status: string}>`
white-space: nowrap;
border-radius: 12px;
color: ${p => p.theme[PERFORMANCE_SCORE_COLORS[p.status].normal]};
Expand Down
30 changes: 5 additions & 25 deletions static/app/views/performance/landing/index.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,26 +154,6 @@ describe('Performance > Landing > Index', function () {
expect(screen.getByTestId('performance-landing-v3')).toBeInTheDocument();
});

it('renders frontend pageload view', function () {
const data = initializeData({
query: {landingDisplay: LandingDisplayField.FRONTEND_PAGELOAD},
});

wrapper = render(<WrappedComponent data={data} />, data.routerContext);

expect(screen.getByTestId('frontend-pageload-view')).toBeInTheDocument();
expect(screen.getByTestId('performance-table')).toBeInTheDocument();

const titles = screen.getAllByTestId('performance-widget-title');
expect(titles).toHaveLength(5);

expect(titles[0]).toHaveTextContent('Worst LCP Web Vitals');
expect(titles[1]).toHaveTextContent('Worst FCP Web Vitals');
expect(titles[2]).toHaveTextContent('p75 LCP');
expect(titles[3]).toHaveTextContent('LCP Distribution');
expect(titles[4]).toHaveTextContent('FCP Distribution');
});

it('renders frontend other view', function () {
const data = initializeData({
query: {landingDisplay: LandingDisplayField.FRONTEND_OTHER},
Expand Down Expand Up @@ -264,11 +244,11 @@ describe('Performance > Landing > Index', function () {

it('Can switch between landing displays', async function () {
const data = initializeData({
query: {landingDisplay: LandingDisplayField.FRONTEND_PAGELOAD, abc: '123'},
query: {landingDisplay: LandingDisplayField.FRONTEND_OTHER, abc: '123'},
});

wrapper = render(<WrappedComponent data={data} />, data.routerContext);
expect(screen.getByTestId('frontend-pageload-view')).toBeInTheDocument();
expect(screen.getByTestId('frontend-other-view')).toBeInTheDocument();
await userEvent.click(screen.getByRole('tab', {name: 'All Transactions'}));

expect(browserHistory.push).toHaveBeenNthCalledWith(
Expand All @@ -282,12 +262,12 @@ describe('Performance > Landing > Index', function () {

it('Updating projects switches performance view', function () {
const data = initializeData({
query: {landingDisplay: LandingDisplayField.FRONTEND_PAGELOAD},
query: {landingDisplay: LandingDisplayField.FRONTEND_OTHER},
});

wrapper = render(<WrappedComponent data={data} />, data.routerContext);

expect(screen.getByTestId('frontend-pageload-view')).toBeInTheDocument();
expect(screen.getByTestId('frontend-other-view')).toBeInTheDocument();

const updatedData = initializeData({
projects: [TestStubs.Project({id: 123, platform: 'unknown'})],
Expand All @@ -306,7 +286,7 @@ describe('Performance > Landing > Index', function () {
});

wrapper = render(<WrappedComponent data={data} />, data.routerContext);
expect(screen.getByTestId('frontend-pageload-view')).toBeInTheDocument();
expect(screen.getByTestId('frontend-other-view')).toBeInTheDocument();
});

describe('With transaction search feature', function () {
Expand Down
4 changes: 2 additions & 2 deletions static/app/views/performance/landing/utils.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ describe('Utils', function () {
const projects = [TestStubs.Project()];
const data = initializeData(projects, {landingDisplay: 'frontend_pageload'});
expect(getCurrentLandingDisplay(data.router.location, projects).label).toEqual(
'Web Vitals'
'All Transactions'
);
});
it('returns frontend display if project matches', function () {
const projects = [TestStubs.Project({id: '22', platform: 'javascript-react'})];
const data = initializeData(projects, {project: 22});
expect(
getCurrentLandingDisplay(data.router.location, projects, data.eventView).label
).toEqual('Web Vitals');
).toEqual('Frontend');
});
it('returns backend display if project matches', function () {
const projects = [TestStubs.Project({id: '22', platform: 'php'})];
Expand Down
8 changes: 3 additions & 5 deletions static/app/views/performance/landing/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,13 @@ export enum LandingDisplayField {
MOBILE = 'mobile',
}

// TODO Abdullah Khan: Remove code for Web Vitals tab in performance landing
// page when new starfish web vitals module is mature.
export const LANDING_DISPLAYS = [
{
label: t('All Transactions'),
field: LandingDisplayField.ALL,
},
{
label: t('Web Vitals'),
field: LandingDisplayField.FRONTEND_PAGELOAD,
},
{
label: t('Frontend'),
field: LandingDisplayField.FRONTEND_OTHER,
Expand Down Expand Up @@ -169,7 +167,7 @@ export function getDefaultDisplayFieldForPlatform(

const performanceTypeToDisplay = {
[ProjectPerformanceType.ANY]: LandingDisplayField.ALL,
[ProjectPerformanceType.FRONTEND]: LandingDisplayField.FRONTEND_PAGELOAD,
[ProjectPerformanceType.FRONTEND]: LandingDisplayField.FRONTEND_OTHER,
[ProjectPerformanceType.BACKEND]: LandingDisplayField.BACKEND,
[ProjectPerformanceType.MOBILE]: LandingDisplayField.MOBILE,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export function FrontendOtherView(props: BasePerformanceViewProps) {
<PerformanceDisplayProvider
value={{performanceType: ProjectPerformanceType.FRONTEND_OTHER}}
>
<div>
<div data-test-id="frontend-other-view">
<DoubleChartRow {...props} allowedCharts={doubleChartRowCharts} />
<TripleChartRow
{...props}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ export function PerformanceScoreWidget(props: PerformanceWidgetProps) {
<GenericPerformanceWidget
{...props}
location={location}
Subtitle={() => (
<Subtitle>{props.subTitle ?? t('P75 in Top Transactions')}</Subtitle>
)}
Subtitle={() => <Subtitle>{props.subTitle}</Subtitle>}
HeaderActions={() => (
<div>
<LinkButton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import _EventsRequest from 'sentry/components/charts/eventsRequest';
import StackedAreaChart from 'sentry/components/charts/stackedAreaChart';
import {getInterval} from 'sentry/components/charts/utils';
import Count from 'sentry/components/count';
import ExternalLink from 'sentry/components/links/externalLink';
import LoadingIndicator from 'sentry/components/loadingIndicator';
import {Tooltip} from 'sentry/components/tooltip';
import Truncate from 'sentry/components/truncate';
Expand All @@ -29,7 +30,10 @@ import {usePageError} from 'sentry/utils/performance/contexts/pageError';
import {MutableSearch} from 'sentry/utils/tokenizeSearch';
import {useLocation} from 'sentry/utils/useLocation';
import withApi from 'sentry/utils/withApi';
import {PerformanceBadge} from 'sentry/views/performance/browser/webVitals/components/performanceBadge';
import {
Badge,
PerformanceBadge,
} from 'sentry/views/performance/browser/webVitals/components/performanceBadge';
import {formatTimeSeriesResultsToChartData} from 'sentry/views/performance/browser/webVitals/components/performanceScoreBreakdownChart';
import {calculateOpportunity} from 'sentry/views/performance/browser/webVitals/utils/calculateOpportunity';
import {calculatePerformanceScore} from 'sentry/views/performance/browser/webVitals/utils/calculatePerformanceScore';
Expand Down Expand Up @@ -432,14 +436,37 @@ export function StackedAreaChartListWidget(props: PerformanceWidgetProps) {
<Truncate value={transaction} maxLength={40} />
</GrowLink>
<StyledRightAlignedCell>
<PerformanceBadge score={rowScore.totalScore} />
<Tooltip
title={
<span>
{t('The overall performance rating of this page.')}
<br />
<ExternalLink href="https://docs.sentry.io/product/performance/web-vitals/#performance-score">
{t('How is this calculated?')}
</ExternalLink>
</span>
}
isHoverable
>
<PerformanceBadgeWrapper>
<PerformanceBadge score={rowScore.totalScore} />
</PerformanceBadgeWrapper>
</Tooltip>
{isProjectWebVitalDataLoading ? (
<StyledLoadingIndicator size={20} />
) : (
<Tooltip
title={t(
'The opportunity to improve your cumulative performance score.'
)}
title={
<span>
{t(
"A number rating how impactful a performance improvement on this page would be to your application's overall Performance Score."
)}
<br />
<ExternalLink href="https://docs.sentry.io/product/performance/web-vitals/#opportunity">
{t('How is this calculated?')}
</ExternalLink>
</span>
}
isHoverable
showUnderline
skipWrapper
Expand Down Expand Up @@ -547,4 +574,11 @@ const StyledLoadingIndicator = styled(LoadingIndicator)`
margin: 0;
}
`;

const PerformanceBadgeWrapper = styled('span')`
${Badge} {
text-decoration: underline dotted;
}
`;

const EventsRequest = withApi(_EventsRequest);
2 changes: 1 addition & 1 deletion static/app/views/performance/transactionSummary/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function TransactionHeader({
// frontend projects should always show the web vitals tab
if (
getCurrentLandingDisplay(location, projects, eventView).field ===
LandingDisplayField.FRONTEND_PAGELOAD
LandingDisplayField.FRONTEND_OTHER
) {
return true;
}
Expand Down

0 comments on commit 0ebcb04

Please sign in to comment.