Skip to content

Commit e3245b5

Browse files
committed
converts checks for github to include all integrations
1 parent 63dcbae commit e3245b5

File tree

5 files changed

+25
-26
lines changed

5 files changed

+25
-26
lines changed

web-server/pages/api/resources/orgs/[org_id]/teams/v2.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ const getSchema = yup.object().shape({
4747
});
4848

4949
const postSchema = yup.object().shape({
50-
provider: yup.string().oneOf(Object.values(Integration)).required(),
5150
name: yup.string().required(),
5251
org_repos: yup.lazy((obj) =>
5352
yup.object(mapObjIndexed(() => yup.array().of(repoSchema), obj))

web-server/pages/dora-metrics/index.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ function Page() {
1515
const isLoading = useSelector(
1616
(s) => s.doraMetrics.requests?.metrics_summary === FetchState.REQUEST
1717
);
18-
const {
19-
integrations: { github: isGithubIntegrated }
20-
} = useAuth();
18+
const { integrationList } = useAuth();
2119

2220
return (
2321
<PageWrapper
@@ -30,7 +28,7 @@ function Page() {
3028
isLoading={isLoading}
3129
teamDateSelectorMode="single"
3230
>
33-
{isGithubIntegrated ? <DoraMetricsBody /> : <Loader />}
31+
{integrationList.length > 0 ? <DoraMetricsBody /> : <Loader />}
3432
</PageWrapper>
3533
);
3634
}

web-server/pages/settings.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
1+
import { Box } from '@mui/material';
12
import { Authenticated } from 'src/components/Authenticated';
23

34
import { FlexBox } from '@/components/FlexBox';
5+
import { SyncDaysSetting } from '@/components/Settings/SyncDaysSetting';
46
import { FetchState } from '@/constants/ui-states';
7+
import { useRedirectWithSession } from '@/constants/useRoute';
58
import { PageWrapper } from '@/content/PullRequests/PageWrapper';
9+
import { useAuth } from '@/hooks/useAuth';
610
import ExtendedSidebarLayout from '@/layouts/ExtendedSidebarLayout';
711
import { useSelector } from '@/store';
812
import { PageLayout } from '@/types/resources';
9-
import { SyncDaysSetting } from '@/components/Settings/SyncDaysSetting';
10-
import { Box } from '@mui/material';
11-
import { useRedirectWithSession } from '@/constants/useRoute';
12-
import { useAuth } from '@/hooks/useAuth';
1313

1414
function Settings() {
1515
useRedirectWithSession();
16-
const {
17-
integrations: { github: isGithubIntegrated }
18-
} = useAuth();
16+
const { integrationList } = useAuth();
1917
const isLoading = useSelector(
2018
(s) => s.org.requests?.defaultSyncDays === FetchState.REQUEST
2119
);
@@ -33,7 +31,7 @@ function Settings() {
3331
showEvenIfNoTeamSelected={true}
3432
isLoading={isLoading}
3533
>
36-
{isGithubIntegrated && <Content />}
34+
{integrationList.length > 0 && <Content />}
3735
</PageWrapper>
3836
</>
3937
);

web-server/src/content/DoraMetrics/DoraMetricsBody.tsx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { AutoGraphRounded } from '@mui/icons-material';
22
import { Grid, Divider, Button } from '@mui/material';
33
import Link from 'next/link';
4-
import { FC, useEffect } from 'react';
4+
import { FC, useEffect, useMemo } from 'react';
55

66
import { AiButton } from '@/components/AiButton';
77
import { DoraMetricsConfigurationSettings } from '@/components/DoraMetricsConfigurationSettings';
@@ -37,10 +37,11 @@ import { WeeklyDeliveryVolumeCard } from './DoraCards/WeeklyDeliveryVolumeCard';
3737

3838
export const DoraMetricsBody = () => {
3939
const dispatch = useDispatch();
40-
const {
41-
orgId,
42-
integrations: { github: isGithubIntegrated }
43-
} = useAuth();
40+
const { orgId, integrationList } = useAuth();
41+
const isCodeProviderIntegrated = useMemo(
42+
() => integrationList.length > 0,
43+
[integrationList.length]
44+
);
4445
const { singleTeamId, dates } = useSingleTeamConfig();
4546
const branchPayloadForPrFilters = useBranchesForPrFilters();
4647
const isLoading = useSelector(
@@ -65,9 +66,11 @@ export const DoraMetricsBody = () => {
6566

6667
const { addPage } = useOverlayPage();
6768

69+
console.log('DEbugging', isCodeProviderIntegrated);
70+
6871
useEffect(() => {
69-
if (!singleTeamId) return;
70-
if (!isGithubIntegrated) return;
72+
// if (!singleTeamId) return;
73+
// if (!isCodeProviderIntegrated) return;
7174
dispatch(
7275
fetchTeamDoraMetrics({
7376
orgId,
@@ -83,7 +86,7 @@ export const DoraMetricsBody = () => {
8386
dispatch,
8487
orgId,
8588
singleTeamId,
86-
isGithubIntegrated,
89+
isCodeProviderIntegrated,
8790
branchPayloadForPrFilters
8891
]);
8992

web-server/src/layouts/ExtendedSidebarLayout/Sidebar/SidebarMenu/useFilteredSidebarItems.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ const checkTag = (tag: string | number[] | number, check: string | number) => {
1616
};
1717

1818
export const useFilteredSidebarItems = () => {
19-
const {
20-
integrations: { github: isGithubIntegrated }
21-
} = useAuth();
19+
const { integrationList } = useAuth();
2220

2321
const flagFilteredMenuItems = useMemo(() => {
2422
return menuItems();
@@ -27,7 +25,10 @@ export const useFilteredSidebarItems = () => {
2725
const sidebarItems = useMemo(() => {
2826
const filterCheck = (item: MenuItem): boolean => {
2927
if (checkTag(item.tag, ItemTags.HideItem)) return false;
30-
if (!isGithubIntegrated && item.name !== SideBarItems.MANAGE_INTEGRATIONS)
28+
if (
29+
!integrationList.length &&
30+
item.name !== SideBarItems.MANAGE_INTEGRATIONS
31+
)
3132
return false;
3233
return true;
3334
};
@@ -45,7 +46,7 @@ export const useFilteredSidebarItems = () => {
4546
items: itemsFilter(section.items)
4647
}))
4748
.filter((section) => section.items?.length);
48-
}, [flagFilteredMenuItems, isGithubIntegrated]);
49+
}, [flagFilteredMenuItems, integrationList]);
4950

5051
return sidebarItems;
5152
};

0 commit comments

Comments
 (0)