Skip to content

Commit b031a3c

Browse files
committed
feat(projects): warn about eventual removal of Project Details
1 parent ece46f1 commit b031a3c

File tree

4 files changed

+78
-4
lines changed

4 files changed

+78
-4
lines changed

static/app/views/projectDetail/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import {PageAlertProvider} from 'sentry/utils/performance/contexts/pageAlert';
12
import useRouteAnalyticsParams from 'sentry/utils/routeAnalytics/useRouteAnalyticsParams';
23
import {useParams} from 'sentry/utils/useParams';
34
import useProjects from 'sentry/utils/useProjects';
@@ -18,5 +19,9 @@ export default function ProjectDetailContainer() {
1819
: {}
1920
);
2021

21-
return <ProjectDetail />;
22+
return (
23+
<PageAlertProvider>
24+
<ProjectDetail />;
25+
</PageAlertProvider>
26+
);
2227
}

static/app/views/projectDetail/projectDetail.spec.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import * as pageFilters from 'sentry/actionCreators/pageFilters';
1414
import ProjectsStore from 'sentry/stores/projectsStore';
1515

1616
import ProjectDetail from './projectDetail';
17+
import ProjectDetailContainer from './';
1718

1819
jest.mock('sentry/actionCreators/organization');
1920

@@ -112,6 +113,18 @@ describe('ProjectDetail', () => {
112113
expect(screen.getByText(project.slug)).toBeInTheDocument();
113114
});
114115

116+
it('Render deprecation dialog', async () => {
117+
ProjectsStore.loadInitialData([project]);
118+
setupMockResponses();
119+
120+
render(<ProjectDetailContainer />, {
121+
organization,
122+
initialRouterConfig,
123+
});
124+
125+
expect(await screen.findByText(/similar charts are available/i)).toBeInTheDocument();
126+
});
127+
115128
it('Sync project with slug', async () => {
116129
ProjectsStore.loadInitialData([project]);
117130
setupMockResponses();

static/app/views/projectDetail/projectDetail.tsx

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import Feature from 'sentry/components/acl/feature';
99
import {Breadcrumbs} from 'sentry/components/breadcrumbs';
1010
import {ButtonBar} from 'sentry/components/core/button/buttonBar';
1111
import {LinkButton} from 'sentry/components/core/button/linkButton';
12+
import {Link} from 'sentry/components/core/link';
1213
import CreateAlertButton from 'sentry/components/createAlertButton';
1314
import ErrorBoundary from 'sentry/components/errorBoundary';
1415
import FeedbackButton from 'sentry/components/feedbackButton/feedbackButton';
@@ -21,9 +22,10 @@ import MissingProjectMembership from 'sentry/components/projects/missingProjectM
2122
import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle';
2223
import {DEFAULT_RELATIVE_PERIODS} from 'sentry/constants';
2324
import {IconSettings} from 'sentry/icons';
24-
import {t} from 'sentry/locale';
25+
import {t, tctCode} from 'sentry/locale';
2526
import {space} from 'sentry/styles/space';
2627
import {defined} from 'sentry/utils';
28+
import {PageAlert, usePageAlert} from 'sentry/utils/performance/contexts/pageAlert';
2729
import {decodeScalar} from 'sentry/utils/queryString';
2830
import routeTitleGen from 'sentry/utils/routeTitle';
2931
import useApi from 'sentry/utils/useApi';
@@ -80,6 +82,31 @@ export default function ProjectDetail() {
8082
return ['chart1'];
8183
}, [hasTransactions, hasSessions]);
8284

85+
const {setPageInfo, pageAlert} = usePageAlert();
86+
const msg = useMemo(
87+
() =>
88+
tctCode(
89+
'Project Details will be removed soon. Find this project’s settings under [settingsLink:Settings]. Similar charts are available on the [sessionHealth:Session Health] and [backendOverview:Backend Overview] dashboards.',
90+
{
91+
settingsLink: (
92+
<Link to={`/settings/${params.orgId}/projects/${params.projectId}/`} />
93+
),
94+
sessionHealth: (
95+
<Link to={`/organizations/${params.orgId}/insights/frontend/sessions/`} />
96+
),
97+
backendOverview: (
98+
<Link to={`/organizations/${params.orgId}/insights/backend/`} />
99+
),
100+
}
101+
),
102+
[params]
103+
);
104+
useEffect(() => {
105+
if (pageAlert?.message !== msg) {
106+
setPageInfo(msg);
107+
}
108+
}, [msg, pageAlert, setPageInfo]);
109+
83110
const onRetryProjects = useCallback(() => {
84111
fetchOrganizationDetails(api, params.orgId);
85112
}, [api, params.orgId]);
@@ -209,6 +236,7 @@ export default function ProjectDetail() {
209236

210237
<Layout.Body noRowGap>
211238
<Layout.Main>
239+
<PageAlert />
212240
<ProjectFiltersWrapper>
213241
<ProjectFilters
214242
query={query}

static/app/views/projectsDashboard/index.tsx

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import uniqBy from 'lodash/uniqBy';
77

88
import {ButtonBar} from 'sentry/components/core/button/buttonBar';
99
import {LinkButton} from 'sentry/components/core/button/linkButton';
10+
import {Link} from 'sentry/components/core/link';
1011
import * as Layout from 'sentry/components/layouts/thirds';
1112
import LoadingError from 'sentry/components/loadingError';
1213
import LoadingIndicator from 'sentry/components/loadingIndicator';
@@ -16,11 +17,16 @@ import SearchBar from 'sentry/components/searchBar';
1617
import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle';
1718
import {DEFAULT_DEBOUNCE_DURATION} from 'sentry/constants';
1819
import {IconAdd, IconUser} from 'sentry/icons';
19-
import {t} from 'sentry/locale';
20+
import {t, tctCode} from 'sentry/locale';
2021
import ProjectsStatsStore from 'sentry/stores/projectsStatsStore';
2122
import {space} from 'sentry/styles/space';
2223
import type {Team} from 'sentry/types/organization';
2324
import type {Project, TeamWithProjects} from 'sentry/types/project';
25+
import {
26+
PageAlert,
27+
PageAlertProvider,
28+
usePageAlert,
29+
} from 'sentry/utils/performance/contexts/pageAlert';
2430
import {
2531
onRenderCallback,
2632
Profiler,
@@ -141,6 +147,25 @@ function Dashboard() {
141147
const {teams: userTeams, isLoading: loadingTeams, isError} = useUserTeams();
142148
const isAllTeams = location.query.team === '';
143149
const selectedTeams = getTeamParams(location.query.team ?? 'myteams');
150+
const {setPageInfo, pageAlert} = usePageAlert();
151+
152+
const msg = useMemo(
153+
() =>
154+
tctCode(
155+
'Project Details pages will be removed soon. You can edit project settings and create new projects in [settingsLink:Settings].',
156+
{
157+
settingsLink: <Link to={`/settings/${organization.slug}/projects/`} />,
158+
}
159+
),
160+
[organization.slug]
161+
);
162+
163+
useEffect(() => {
164+
if (pageAlert?.message !== msg) {
165+
setPageInfo(msg);
166+
}
167+
}, [setPageInfo, pageAlert, msg]);
168+
144169
const {teams: allTeams} = useTeamsById({
145170
ids: selectedTeams.filter(team => team !== 'myteams'),
146171
});
@@ -251,6 +276,7 @@ function Dashboard() {
251276
</Layout.Header>
252277
<Layout.Body>
253278
<Layout.Main width="full">
279+
<PageAlert />
254280
<SearchAndSelectorWrapper>
255281
<TeamFilter
256282
selectedTeams={selectedTeams}
@@ -281,7 +307,9 @@ function OrganizationDashboard() {
281307
return (
282308
<Layout.Page>
283309
<NoProjectMessage organization={organization}>
284-
<Dashboard />
310+
<PageAlertProvider>
311+
<Dashboard />
312+
</PageAlertProvider>
285313
</NoProjectMessage>
286314
</Layout.Page>
287315
);

0 commit comments

Comments
 (0)