Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ test.describe("Proxy Admin - Teams", () => {

const teamRow = page.locator("tr", { hasText: E2E_TEAM_DELETE_ALIAS }).first();
await expect(teamRow).toBeVisible({ timeout: 10_000 });
await teamRow.locator("svg, img").last().click();
// Actions live in a kebab menu: open it, then click "Delete team".
await teamRow.locator('[data-testid^="team-actions-"]').click();
await page.getByTestId("team-action-delete").click();

const modal = page.locator(".ant-modal:visible");
await expect(modal).toBeVisible({ timeout: 5_000 });
Expand Down
4 changes: 2 additions & 2 deletions ui/litellm-dashboard/eslint-suppressions.json
Original file line number Diff line number Diff line change
Expand Up @@ -1643,13 +1643,13 @@
},
"src/components/Teams.tsx": {
"no-nested-ternary": {
"count": 4
"count": 2
},
"no-restricted-imports": {
"count": 1
},
"react-hooks/set-state-in-effect": {
"count": 4
"count": 3
}
},
"src/components/ToolDetail.tsx": {
Expand Down
18 changes: 18 additions & 0 deletions ui/litellm-dashboard/src/app/(dashboard)/hooks/teams/useTeams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
const baseUrl = getProxyBaseUrl();

const params = new URLSearchParams(
Object.entries({

Check warning on line 46 in ui/litellm-dashboard/src/app/(dashboard)/hooks/teams/useTeams.ts

View workflow job for this annotation

GitHub Actions / frontend-lint

Object literal with 10 properties passed inline as an argument; assign it to a named variable first
team_id: options.teamID,
organization_id: options.organizationID,
team_alias: options.team_alias,
Expand Down Expand Up @@ -84,6 +84,24 @@
}
};

export const teamsTableKeys = createQueryKeys("teamsTable");

export const useTeamsTable = (
page: number,
pageSize: number,
options: TeamListCallOptions = {},
): UseQueryResult<TeamsResponse> => {
const { accessToken } = useAuthorized();

return useQuery<TeamsResponse>({

Check warning on line 96 in ui/litellm-dashboard/src/app/(dashboard)/hooks/teams/useTeams.ts

View workflow job for this annotation

GitHub Actions / frontend-lint

Object literal with 5 properties passed inline as an argument; assign it to a named variable first
queryKey: teamsTableKeys.list({ page, limit: pageSize, ...options }),
queryFn: async () => await teamListCall(accessToken!, page, pageSize, options),
enabled: Boolean(accessToken),
staleTime: 30000,
placeholderData: keepPreviousData,
});
};

const teamKeys = createQueryKeys("teams");
export const useTeams = (): UseQueryResult<Team[]> => {
const { accessToken, userId, userRole } = useAuthorized();
Expand All @@ -109,7 +127,7 @@

export const useAllTeams = (): UseQueryResult<Team[]> => {
const { accessToken } = useAuthorized();
return useQuery<Team[]>({

Check warning on line 130 in ui/litellm-dashboard/src/app/(dashboard)/hooks/teams/useTeams.ts

View workflow job for this annotation

GitHub Actions / frontend-lint

Object literal with 4 properties passed inline as an argument; assign it to a named variable first
queryKey: teamKeys.list({
filters: { scope: "all", pageSize: ALL_TEAMS_PAGE_SIZE, accessToken: accessToken ?? "" },
}),
Expand All @@ -122,7 +140,7 @@
export const useTeam = (teamId?: string) => {
const { accessToken } = useAuthorized();
const queryClient = useQueryClient();
return useQuery<Team>({

Check warning on line 143 in ui/litellm-dashboard/src/app/(dashboard)/hooks/teams/useTeams.ts

View workflow job for this annotation

GitHub Actions / frontend-lint

Object literal with 4 properties passed inline as an argument; assign it to a named variable first
queryKey: teamKeys.detail(teamId!),
enabled: Boolean(accessToken && teamId),

Expand Down Expand Up @@ -150,7 +168,7 @@
const { accessToken, userId, userRole } = useAuthorized();
const isAdmin = userRole === "Admin" || userRole === "Admin Viewer";

return useInfiniteQuery<TeamsResponse>({

Check warning on line 171 in ui/litellm-dashboard/src/app/(dashboard)/hooks/teams/useTeams.ts

View workflow job for this annotation

GitHub Actions / frontend-lint

Object literal with 5 properties passed inline as an argument; assign it to a named variable first
queryKey: infiniteTeamKeys.list({
filters: {
pageSize,
Expand Down Expand Up @@ -190,7 +208,7 @@
const baseUrl = getProxyBaseUrl();

const params = new URLSearchParams(
Object.entries({

Check warning on line 211 in ui/litellm-dashboard/src/app/(dashboard)/hooks/teams/useTeams.ts

View workflow job for this annotation

GitHub Actions / frontend-lint

Object literal with 10 properties passed inline as an argument; assign it to a named variable first
team_id: options.teamID,
organization_id: options.organizationID,
team_alias: options.team_alias,
Expand Down Expand Up @@ -245,7 +263,7 @@
): UseQueryResult<DeletedTeam[]> => {
const { accessToken } = useAuthorized();

return useQuery<DeletedTeam[]>({

Check warning on line 266 in ui/litellm-dashboard/src/app/(dashboard)/hooks/teams/useTeams.ts

View workflow job for this annotation

GitHub Actions / frontend-lint

Object literal with 5 properties passed inline as an argument; assign it to a named variable first
queryKey: deletedTeamKeys.list({ page, limit: pageSize, ...options }),
queryFn: async () => await deletedTeamListCall(accessToken!, page, pageSize, options),
enabled: Boolean(accessToken),
Expand Down
Loading
Loading