Skip to content

Commit 96b781a

Browse files
committed
removes provider check from fetchTeams, instead brings up all repos from all providers (github and gitlab)
1 parent 2eca0dc commit 96b781a

File tree

9 files changed

+19
-25
lines changed

9 files changed

+19
-25
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const repoSchema = yup.object().shape({
4242

4343
const getSchema = yup.object().shape({
4444
providers: yup.array(
45-
yup.string().oneOf(Object.values(Integration)).required()
45+
yup.string().oneOf(Object.values(Integration)).optional()
4646
)
4747
});
4848

@@ -86,7 +86,9 @@ endpoint.handle.GET(getSchema, async (req, res) => {
8686
const teams = await getQuery;
8787
const reposWithWorkflows = await getSelectedReposForOrg(
8888
org_id,
89-
providers as Integration[]
89+
providers?.length
90+
? (providers as Integration[])
91+
: [Integration.GITHUB, Integration.GITLAB]
9092
).then((res) => res.flat());
9193

9294
res.send({

web-server/pages/integrations.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,7 @@ const Content = () => {
110110
if (hasCodeProviderLinked && !teamCount) {
111111
dispatch(
112112
fetchTeams({
113-
org_id: orgId,
114-
providers: integrationList
113+
org_id: orgId
115114
})
116115
).finally(loadedTeams.true);
117116
}

web-server/pages/teams/index.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,11 @@ function Page() {
2424
depFn(loading.true);
2525
await dispatch(
2626
fetchTeams({
27-
org_id: orgId,
28-
providers: integrationList
27+
org_id: orgId
2928
})
3029
);
3130
depFn(loading.false);
32-
}, [dispatch, integrationList, loading.false, loading.true, orgId]);
31+
}, [dispatch, loading.false, loading.true, orgId]);
3332

3433
useEffect(() => {
3534
if (!orgId) return;

web-server/src/components/TeamSelector/useTeamSelectorSetup.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ export const useTeamSelectorSetup = ({ mode }: UseTeamSelectorSetupArgs) => {
5252

5353
const fetchAllTeams = useCallback(async () => {
5454
await Promise.all([
55-
dispatch(fetchTeams({ org_id: orgId, providers: integrationList })),
55+
dispatch(fetchTeams({ org_id: orgId })),
5656
dispatch(updateTeamBranchesMap({ orgId }))
5757
]);
58-
}, [dispatch, integrationList, orgId]);
58+
}, [dispatch, orgId]);
5959

6060
const apiTeams = useSelector((state) => state.team.teams);
6161
const loadingTeams = useSelector(

web-server/src/components/Teams/useTeamsConfig.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export const TeamsCRUDProvider: React.FC<{
8686
const dispatch = useDispatch();
8787
const teamReposMaps = useSelector((s) => s.team.teamReposMaps);
8888
const teams = useSelector((s) => s.team.teams);
89-
const { orgId, integrationList } = useAuth();
89+
const { orgId } = useAuth();
9090

9191
const isPageLoading = useSelector(
9292
(s) => s.team.requests?.teams === FetchState.REQUEST
@@ -97,11 +97,10 @@ export const TeamsCRUDProvider: React.FC<{
9797
dispatch(fetchCurrentOrg());
9898
dispatch(
9999
fetchTeams({
100-
org_id: orgId,
101-
providers: integrationList
100+
org_id: orgId
102101
})
103102
);
104-
}, [dispatch, integrationList, orgId]);
103+
}, [dispatch, orgId]);
105104

106105
// team name logic
107106
const teamName = useEasyState('');

web-server/src/components/TeamsList.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ const TeamCard: React.FC<TeamCardProps> = ({ team, onEdit }) => {
257257
const MoreOptions = ({ teamId }: { teamId: ID }) => {
258258
const dispatch = useDispatch();
259259
const { enqueueSnackbar } = useSnackbar();
260-
const { orgId, integrationList } = useAuth();
260+
const { orgId } = useAuth();
261261
const anchorEl = useEasyState();
262262
const loading = useBoolState(false);
263263
const cancelMenu = useBoolState(false);
@@ -285,7 +285,7 @@ const MoreOptions = ({ teamId }: { teamId: ID }) => {
285285
variant: 'success',
286286
autoHideDuration: 2000
287287
});
288-
dispatch(fetchTeams({ org_id: orgId, providers: integrationList }));
288+
dispatch(fetchTeams({ org_id: orgId }));
289289
handleCloseMenu();
290290
} else {
291291
enqueueSnackbar('Failed to delete team', {
@@ -301,7 +301,6 @@ const MoreOptions = ({ teamId }: { teamId: ID }) => {
301301
dispatch,
302302
enqueueSnackbar,
303303
handleCloseMenu,
304-
integrationList,
305304
loading.false,
306305
loading.true,
307306
orgId

web-server/src/content/Dashboards/ConfigureGithubModalBody.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const ConfigureGithubModalBody: FC<{
2323
onClose: () => void;
2424
}> = ({ onClose }) => {
2525
const token = useEasyState('');
26-
const { orgId, integrationList } = useAuth();
26+
const { orgId } = useAuth();
2727
const { enqueueSnackbar } = useSnackbar();
2828
const dispatch = useDispatch();
2929
const isLoading = useBoolState();
@@ -78,8 +78,7 @@ export const ConfigureGithubModalBody: FC<{
7878
dispatch(fetchCurrentOrg());
7979
dispatch(
8080
fetchTeams({
81-
org_id: orgId,
82-
providers: integrationList
81+
org_id: orgId
8382
})
8483
);
8584
enqueueSnackbar('Github linked successfully', {
@@ -96,7 +95,6 @@ export const ConfigureGithubModalBody: FC<{
9695
}, [
9796
dispatch,
9897
enqueueSnackbar,
99-
integrationList,
10098
isLoading.false,
10199
isLoading.true,
102100
onClose,

web-server/src/content/Dashboards/ConfigureGitlabModalBody.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const ConfigureGitlabModalBody: FC<{
2424
}> = ({ onClose }) => {
2525
const token = useEasyState('');
2626
const customDomain = useEasyState('');
27-
const { orgId, integrationList } = useAuth();
27+
const { orgId } = useAuth();
2828
const { enqueueSnackbar } = useSnackbar();
2929
const dispatch = useDispatch();
3030
const isLoading = useBoolState();
@@ -105,8 +105,7 @@ export const ConfigureGitlabModalBody: FC<{
105105
dispatch(fetchCurrentOrg());
106106
dispatch(
107107
fetchTeams({
108-
org_id: orgId,
109-
providers: integrationList
108+
org_id: orgId
110109
})
111110
);
112111
enqueueSnackbar('Gitlab linked successfully', {
@@ -124,7 +123,6 @@ export const ConfigureGitlabModalBody: FC<{
124123
customDomain.value,
125124
dispatch,
126125
enqueueSnackbar,
127-
integrationList,
128126
isLoading.false,
129127
isLoading.true,
130128
onClose,

web-server/src/slices/team.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ export const teamSlice = createSlice({
135135

136136
export const fetchTeams = createAsyncThunk(
137137
'teams/fetchTeams',
138-
async (params: { org_id: ID; providers: Integration[] }) => {
138+
async (params: { org_id: ID; providers?: Integration[] }) => {
139139
return await handleApi<{
140140
teams: Team[];
141141
teamReposMap: Record<ID, DB_OrgRepo[]>;

0 commit comments

Comments
 (0)