Skip to content

Commit 208faed

Browse files
committed
Added state to redirect the user to managa teams if PR_Merge
1 parent f9e85d2 commit 208faed

File tree

1 file changed

+27
-5
lines changed

1 file changed

+27
-5
lines changed

web-server/src/content/PullRequests/DeploymentInsightsOverlay.tsx

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ import { useDispatch, useSelector } from '@/store';
3131
import { Deployment, PR, RepoWorkflowExtended } from '@/types/resources';
3232
import { percent } from '@/utils/datatype';
3333
import { depFn } from '@/utils/fn';
34+
import Link from 'next/link';
35+
import { ROUTES } from '@/constants/routes';
36+
import { DeploymentSources } from '@/types/resources';
3437

3538
import { DeploymentItem } from './DeploymentItem';
3639

@@ -195,6 +198,10 @@ export const DeploymentInsightsOverlay = () => {
195198

196199
const dateRangeLabel = useCurrentDateRangeReactNode();
197200

201+
// Determine if the selected repository uses PR_MERGE as its deployment source
202+
const currentBaseRepo = selectedRepo.value ? teamDeployments.repos_map[selectedRepo.value] : null;
203+
const isPRMergeSource = currentBaseRepo?.deployment_type === DeploymentSources.PR_MERGE;
204+
198205
if (!team) return <Line>Please select a team first...</Line>;
199206

200207
return (
@@ -348,11 +355,26 @@ export const DeploymentInsightsOverlay = () => {
348355
/>
349356
</FlexBox>
350357
</Box>
351-
<FlexBox>
352-
<DoraMetricsDuration deployments={deployments} />
353-
</FlexBox>
354-
<FlexBox></FlexBox>
355-
<DoraMetricsTrend />
358+
{!isPRMergeSource ? (
359+
<>
360+
<FlexBox>
361+
<DoraMetricsDuration deployments={deployments} />
362+
</FlexBox>
363+
<FlexBox></FlexBox>
364+
<DoraMetricsTrend />
365+
</>
366+
) : (
367+
<Box sx={{ mb: '10px' }}>
368+
<Line small white>
369+
Deployment trends are only available for repos with workflows as source.{' '}
370+
<Link href={ROUTES.TEAMS.ROUTE.PATH} passHref>
371+
<Line component="a" small color="primary" bold underline pointer>
372+
Go to settings →
373+
</Line>
374+
</Link>
375+
</Line>
376+
</Box>
377+
)}
356378
</FlexBox>
357379
) : (
358380
<>

0 commit comments

Comments
 (0)