mirror of
https://github.com/tiennm99/litellm.git
synced 2026-08-23 02:24:18 +00:00
renamed (console), added use clients
This commit is contained in:
+3
-1
@@ -1,3 +1,5 @@
|
||||
"use client";
|
||||
|
||||
import React from "react";
|
||||
import Link from "next/link";
|
||||
import { usePathname, useSearchParams } from "next/navigation";
|
||||
@@ -216,7 +218,7 @@ const Sidebar2: React.FC<SidebarProps> = ({ accessToken, userRole, defaultSelect
|
||||
};
|
||||
|
||||
const selectedMenuKey =
|
||||
pathname === "/virtual-keys"
|
||||
pathname === "/dashboard/virtual-keys"
|
||||
? "1"
|
||||
: pageParam
|
||||
? findMenuItemKey(pageParam)
|
||||
+4
-2
@@ -1,8 +1,10 @@
|
||||
import Sidebar2 from "@/app/(console)/components/Sidebar2";
|
||||
"use client";
|
||||
|
||||
import Sidebar2 from "@/app/dashboard/components/Sidebar2";
|
||||
import Sidebar from "@/components/leftnav";
|
||||
import React from "react";
|
||||
import useFeatureFlags from "@/hooks/useFeatureFlags";
|
||||
import useAuthorized from "@/app/(console)/hooks/useAuthorized";
|
||||
import useAuthorized from "@/app/dashboard/hooks/useAuthorized";
|
||||
|
||||
interface SidebarProviderProps {
|
||||
defaultSelectedKey: string;
|
||||
+5
-3
@@ -1,3 +1,5 @@
|
||||
"use client";
|
||||
|
||||
// TODO: refactor
|
||||
import React, { useState, useEffect } from "react";
|
||||
import { Button, Modal, Form, Input, message, Select, InputNumber, Select as Select2 } from "antd";
|
||||
@@ -27,9 +29,9 @@ import {
|
||||
} from "@/components/networking";
|
||||
import { getModelDisplayName } from "@/components/key_team_helpers/fetch_available_models_team_key";
|
||||
import BulkCreateUsersButton from "@/components/bulk_create_users_button";
|
||||
import { fetchTeams } from "@/app/(console)/virtual-keys/networking";
|
||||
import useTeams from "@/app/(console)/virtual-keys/hooks/useTeams";
|
||||
import useAuthorized from "@/app/(console)/hooks/useAuthorized";
|
||||
import { fetchTeams } from "@/app/dashboard/virtual-keys/networking";
|
||||
import useTeams from "@/app/dashboard/virtual-keys/hooks/useTeams";
|
||||
import useAuthorized from "@/app/dashboard/hooks/useAuthorized";
|
||||
|
||||
// Helper function to generate UUID compatible across all environments
|
||||
const generateUUID = (): string => {
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
import { Router } from "next/router";
|
||||
"use client";
|
||||
|
||||
import { getCookie } from "@/utils/cookieUtils";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { jwtDecode } from "jwt-decode";
|
||||
+2
-3
@@ -3,9 +3,8 @@
|
||||
import React from "react";
|
||||
import Navbar from "@/components/navbar";
|
||||
import { ThemeProvider } from "@/contexts/ThemeContext";
|
||||
import Sidebar2 from "@/app/(console)/components/Sidebar2";
|
||||
import useAuthorized from "@/app/(console)/hooks/useAuthorized";
|
||||
import useFeatureFlags, { FeatureFlagsProvider } from "@/hooks/useFeatureFlags";
|
||||
import Sidebar2 from "@/app/dashboard/components/Sidebar2";
|
||||
import useAuthorized from "@/app/dashboard/hooks/useAuthorized";
|
||||
|
||||
export default function Layout({ children }: { children: React.ReactNode }) {
|
||||
const { accessToken, userRole } = useAuthorized();
|
||||
+3
-3
@@ -6,9 +6,9 @@ import { Modal, Form } from "antd";
|
||||
import { getPossibleUserRoles, Organization } from "@/components/networking";
|
||||
import { rolesWithWriteAccess } from "@/utils/roles";
|
||||
import { Team } from "@/components/key_team_helpers/key_list";
|
||||
import CreateKeyModal from "@/app/(console)/virtual-keys/components/CreateKeyModal/CreateKeyModal";
|
||||
import CreateUserModal from "@/app/(console)/components/modals/CreateUserModal";
|
||||
import useAuthorized from "@/app/(console)/hooks/useAuthorized";
|
||||
import CreateKeyModal from "@/app/dashboard/virtual-keys/components/CreateKeyModal/CreateKeyModal";
|
||||
import CreateUserModal from "@/app/dashboard/components/modals/CreateUserModal";
|
||||
import useAuthorized from "@/app/dashboard/hooks/useAuthorized";
|
||||
|
||||
interface CreateKeyProps {
|
||||
team: Team | null;
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
"use client";
|
||||
|
||||
import { TextInput, Title } from "@tremor/react";
|
||||
import { Form, FormInstance, Select, Tooltip } from "antd";
|
||||
import { InfoCircleOutlined } from "@ant-design/icons";
|
||||
+3
-1
@@ -1,3 +1,5 @@
|
||||
"use client";
|
||||
|
||||
import { Accordion, AccordionBody, AccordionHeader, Text, Title } from "@tremor/react";
|
||||
import { Form, FormInstance, Input, Select, Tooltip } from "antd";
|
||||
import { InfoCircleOutlined } from "@ant-design/icons";
|
||||
@@ -15,7 +17,7 @@ import SchemaFormFields from "@/components/common_components/check_openapi_schem
|
||||
import { Team } from "@/components/key_team_helpers/key_list";
|
||||
import React from "react";
|
||||
import { DefaultOptionType } from "rc-select/lib/Select";
|
||||
import { ModelAliases } from "@/app/(console)/virtual-keys/components/CreateKeyModal/types";
|
||||
import { ModelAliases } from "@/app/dashboard/virtual-keys/components/CreateKeyModal/types";
|
||||
|
||||
export interface OptionalSettingsSectionProps {
|
||||
form: FormInstance;
|
||||
+3
-1
@@ -1,10 +1,12 @@
|
||||
"use client";
|
||||
|
||||
import { Button as Button2, Form, Radio, Select, Tooltip } from "antd";
|
||||
import { Title } from "@tremor/react";
|
||||
import { InfoCircleOutlined } from "@ant-design/icons";
|
||||
import TeamDropdown from "@/components/common_components/team_dropdown";
|
||||
import React from "react";
|
||||
import { Team } from "@/components/key_team_helpers/key_list";
|
||||
import { UserOption } from "@/app/(console)/virtual-keys/components/CreateKeyModal/types";
|
||||
import { UserOption } from "@/app/dashboard/virtual-keys/components/CreateKeyModal/types";
|
||||
|
||||
interface OwnershipSectionProps {
|
||||
team: Team | null;
|
||||
+12
-10
@@ -1,9 +1,11 @@
|
||||
"use client";
|
||||
|
||||
import { Button as Button2, Form, FormInstance, Modal } from "antd";
|
||||
import { Text } from "@tremor/react";
|
||||
import { keyCreateCall, keyCreateServiceAccountCall } from "@/components/networking";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { Team } from "@/components/key_team_helpers/key_list";
|
||||
import SaveKeyModal from "@/app/(console)/virtual-keys/components/SaveKeyModal";
|
||||
import SaveKeyModal from "@/app/dashboard/virtual-keys/components/SaveKeyModal";
|
||||
import NotificationsManager from "@/components/molecules/notifications_manager";
|
||||
import {
|
||||
useGuardrailsAndPrompts,
|
||||
@@ -11,15 +13,15 @@ import {
|
||||
useTeamModels,
|
||||
useUserModels,
|
||||
useUserSearch,
|
||||
} from "@/app/(console)/virtual-keys/components/CreateKeyModal/hooks";
|
||||
import OwnershipSection from "@/app/(console)/virtual-keys/components/CreateKeyModal/CreateKeyForm/OwnershipSection";
|
||||
import KeyDetailsSection from "@/app/(console)/virtual-keys/components/CreateKeyModal/CreateKeyForm/KeyDetailsSection";
|
||||
import OptionalSettingsSection from "@/app/(console)/virtual-keys/components/CreateKeyModal/CreateKeyForm/OptionalSettingsSection";
|
||||
import { ModelAliases } from "@/app/(console)/virtual-keys/components/CreateKeyModal/types";
|
||||
import { getPredefinedTags, prepareFormValues } from "@/app/(console)/virtual-keys/components/CreateKeyModal/utils";
|
||||
import { fetchTeams } from "@/app/(console)/virtual-keys/networking";
|
||||
import useTeams from "@/app/(console)/virtual-keys/hooks/useTeams";
|
||||
import useAuthorized from "@/app/(console)/hooks/useAuthorized";
|
||||
} from "@/app/dashboard/virtual-keys/components/CreateKeyModal/hooks";
|
||||
import OwnershipSection from "@/app/dashboard/virtual-keys/components/CreateKeyModal/CreateKeyForm/OwnershipSection";
|
||||
import KeyDetailsSection from "@/app/dashboard/virtual-keys/components/CreateKeyModal/CreateKeyForm/KeyDetailsSection";
|
||||
import OptionalSettingsSection from "@/app/dashboard/virtual-keys/components/CreateKeyModal/CreateKeyForm/OptionalSettingsSection";
|
||||
import { ModelAliases } from "@/app/dashboard/virtual-keys/components/CreateKeyModal/types";
|
||||
import { getPredefinedTags, prepareFormValues } from "@/app/dashboard/virtual-keys/components/CreateKeyModal/utils";
|
||||
import { fetchTeams } from "@/app/dashboard/virtual-keys/networking";
|
||||
import useTeams from "@/app/dashboard/virtual-keys/hooks/useTeams";
|
||||
import useAuthorized from "@/app/dashboard/hooks/useAuthorized";
|
||||
|
||||
export interface CreateKeyModalProps {
|
||||
isModalVisible: boolean;
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { fetchGuardrails, fetchPrompts } from "@/app/(console)/virtual-keys/components/CreateKeyModal/networking";
|
||||
import useAuthorized from "@/app/(console)/hooks/useAuthorized";
|
||||
import { fetchGuardrails, fetchPrompts } from "@/app/dashboard/virtual-keys/components/CreateKeyModal/networking";
|
||||
import useAuthorized from "@/app/dashboard/hooks/useAuthorized";
|
||||
|
||||
export const useGuardrailsAndPrompts = () => {
|
||||
const [guardrails, setGuardrails] = useState<string[]>([]);
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { getMCPAccessGroups } from "@/app/(console)/virtual-keys/components/CreateKeyModal/networking";
|
||||
import useAuthorized from "@/app/(console)/hooks/useAuthorized";
|
||||
import { getMCPAccessGroups } from "@/app/dashboard/virtual-keys/components/CreateKeyModal/networking";
|
||||
import useAuthorized from "@/app/dashboard/hooks/useAuthorized";
|
||||
|
||||
export const useMcpAccessGroups = () => {
|
||||
const [mcpAccessGroups, setMcpAccessGroups] = useState<string[]>([]);
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import type { Team } from "@/components/key_team_helpers/key_list";
|
||||
import { fetchTeamModels } from "@/app/(console)/virtual-keys/components/CreateKeyModal/networking";
|
||||
import useAuthorized from "@/app/(console)/hooks/useAuthorized";
|
||||
import { fetchTeamModels } from "@/app/dashboard/virtual-keys/components/CreateKeyModal/networking";
|
||||
import useAuthorized from "@/app/dashboard/hooks/useAuthorized";
|
||||
|
||||
export const useTeamModels = (selectedTeam: Team | null) => {
|
||||
const { userId: userID, userRole, accessToken } = useAuthorized();
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { getUserModelNames } from "@/app/(console)/virtual-keys/components/CreateKeyModal/networking";
|
||||
import useAuthorized from "@/app/(console)/hooks/useAuthorized";
|
||||
import { getUserModelNames } from "@/app/dashboard/virtual-keys/components/CreateKeyModal/networking";
|
||||
import useAuthorized from "@/app/dashboard/hooks/useAuthorized";
|
||||
|
||||
export const useUserModels = () => {
|
||||
const { userId: userID, userRole, accessToken } = useAuthorized();
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import { debounce } from "lodash";
|
||||
import { searchUserOptionsByEmail } from "@/app/(console)/virtual-keys/components/CreateKeyModal/networking";
|
||||
import useAuthorized from "@/app/(console)/hooks/useAuthorized";
|
||||
import { searchUserOptionsByEmail } from "@/app/dashboard/virtual-keys/components/CreateKeyModal/networking";
|
||||
import useAuthorized from "@/app/dashboard/hooks/useAuthorized";
|
||||
|
||||
type User = { user_id: string; user_email: string; role?: string };
|
||||
export interface UserOption {
|
||||
+1
-1
@@ -6,7 +6,7 @@ import {
|
||||
User,
|
||||
userFilterUICall,
|
||||
} from "@/components/networking";
|
||||
import { ModelAvailableResponse, UserOption } from "@/app/(console)/virtual-keys/components/CreateKeyModal/types";
|
||||
import { ModelAvailableResponse, UserOption } from "@/app/dashboard/virtual-keys/components/CreateKeyModal/types";
|
||||
|
||||
export const fetchGuardrails = async (accessToken: string) => {
|
||||
try {
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { mapDisplayToInternalNames } from "@/components/callback_info_helpers";
|
||||
import { ModelAliases } from "@/app/(console)/virtual-keys/components/CreateKeyModal/types";
|
||||
import { ModelAliases } from "@/app/dashboard/virtual-keys/components/CreateKeyModal/types";
|
||||
|
||||
export const getPredefinedTags = (data: any[] | null) => {
|
||||
let allTags = [];
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
"use client";
|
||||
|
||||
import React, { useEffect, useState } from "react";
|
||||
import {
|
||||
Card,
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
"use client";
|
||||
|
||||
import { Button, Col, Grid, Text, Title } from "@tremor/react";
|
||||
import { CopyToClipboard } from "react-copy-to-clipboard";
|
||||
import { Modal } from "antd";
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
// TODO: refactor
|
||||
"use client";
|
||||
// TODO: refactor
|
||||
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { ColumnDef } from "@tanstack/react-table";
|
||||
@@ -16,9 +16,9 @@ import { Organization, userListCall } from "@/components/networking";
|
||||
import { getModelDisplayName } from "@/components/key_team_helpers/fetch_available_models_team_key";
|
||||
import FilterComponent, { FilterOption } from "@/components/molecules/filter";
|
||||
import { useFilterLogic } from "@/components/key_team_helpers/filter_logic";
|
||||
import useTeams from "@/app/(console)/virtual-keys/hooks/useTeams";
|
||||
import useAuthorized from "@/app/(console)/hooks/useAuthorized";
|
||||
import KeyInfoView from "@/app/(console)/virtual-keys/components/KeyInfoView";
|
||||
import useTeams from "@/app/dashboard/virtual-keys/hooks/useTeams";
|
||||
import useAuthorized from "@/app/dashboard/hooks/useAuthorized";
|
||||
import KeyInfoView from "@/app/dashboard/virtual-keys/components/KeyInfoView";
|
||||
|
||||
interface AllKeysTableProps {
|
||||
keys: KeyResponse[];
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { fetchTeams } from "@/app/(console)/virtual-keys/networking";
|
||||
import { fetchTeams } from "@/app/dashboard/virtual-keys/networking";
|
||||
import { Team } from "@/components/key_team_helpers/key_list";
|
||||
import useAuthorized from "@/app/(console)/hooks/useAuthorized";
|
||||
import useAuthorized from "@/app/dashboard/hooks/useAuthorized";
|
||||
|
||||
const useTeams = () => {
|
||||
const [teams, setTeams] = useState<Team[]>([]);
|
||||
+3
-6
@@ -1,15 +1,12 @@
|
||||
"use client";
|
||||
|
||||
import VirtualKeysTable from "@/app/(console)/virtual-keys/components/VirtualKeysTable/VirtualKeysTable";
|
||||
import { getCookie } from "@/utils/cookieUtils";
|
||||
import { jwtDecode } from "jwt-decode";
|
||||
import VirtualKeysTable from "@/app/dashboard/virtual-keys/components/VirtualKeysTable/VirtualKeysTable";
|
||||
import { useState } from "react";
|
||||
import useKeyList from "@/components/key_team_helpers/key_list";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
import { Col, Grid } from "@tremor/react";
|
||||
import CreateKey from "@/app/(console)/virtual-keys/components/CreateKey";
|
||||
import useAuthorized from "@/app/(console)/hooks/useAuthorized"
|
||||
import CreateKey from "@/app/dashboard/virtual-keys/components/CreateKey";
|
||||
import useAuthorized from "@/app/dashboard/hooks/useAuthorized"
|
||||
|
||||
const VirtualKeysPage = () => {
|
||||
const {accessToken, userRole} = useAuthorized();
|
||||
@@ -40,8 +40,8 @@ import UIThemeSettings from "@/components/ui_theme_settings";
|
||||
import { UiLoadingSpinner } from "@/components/ui/ui-loading-spinner";
|
||||
import { cx } from "@/lib/cva.config";
|
||||
import useFeatureFlags, { FeatureFlagsProvider } from "@/hooks/useFeatureFlags";
|
||||
import Sidebar2 from "@/app/(console)/components/Sidebar2";
|
||||
import SidebarProvider from "@/app/(console)/components/SidebarProvider";
|
||||
import Sidebar2 from "@/app/dashboard/components/Sidebar2";
|
||||
import SidebarProvider from "@/app/dashboard/components/SidebarProvider";
|
||||
|
||||
function getCookie(name: string) {
|
||||
const cookieValue = document.cookie.split("; ").find((row) => row.startsWith(name + "="));
|
||||
|
||||
@@ -135,7 +135,7 @@ export const fetchUserModels = async (
|
||||
/**
|
||||
* ─────────────────────────────────────────────────────────────────────────
|
||||
* @deprecated
|
||||
* This component is being DEPRECATED in favor of src/app/(console)/virtual-keys/components/CreateKey.tsx
|
||||
* This component is being DEPRECATED in favor of src/app/dashboard/virtual-keys/components/CreateKey.tsx
|
||||
* Please contribute to the new refactor.
|
||||
* ─────────────────────────────────────────────────────────────────────────
|
||||
*/
|
||||
|
||||
@@ -50,7 +50,7 @@ interface KeyInfoViewProps {
|
||||
/**
|
||||
* ─────────────────────────────────────────────────────────────────────────
|
||||
* @deprecated
|
||||
* This component is being DEPRECATED in favor of src/app/(console)/virtual-keys/components/KeyInfoView.tsx
|
||||
* This component is being DEPRECATED in favor of src/app/dashboard/virtual-keys/components/KeyInfoView.tsx
|
||||
* Please contribute to the new refactor.
|
||||
* ─────────────────────────────────────────────────────────────────────────
|
||||
*/
|
||||
|
||||
@@ -138,7 +138,7 @@ interface CombinedLimits {
|
||||
/**
|
||||
* ─────────────────────────────────────────────────────────────────────────
|
||||
* @deprecated
|
||||
* This component is being DEPRECATED in favor of src/app/(console)/virtual-keys/components/VirtualKeysTable/
|
||||
* This component is being DEPRECATED in favor of src/app/dashboard/virtual-keys/components/VirtualKeysTable/
|
||||
* Please contribute to the new refactor.
|
||||
* ─────────────────────────────────────────────────────────────────────────
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user