-
+
{page == "api-keys" ? (
) : page == "models" ? (
{
token={token}
accessToken={accessToken}
/>
- )
- : page == "users" ? (
+ ) : page == "users" ? (
- )
- : (
+ ) : page == "teams" ? (
+
+ ) : (
{
+ const [userRole, setUserRole] = useState("");
+ const [userEmail, setUserEmail] = useState(null);
+ const [teams, setTeams] = useState(null);
+ const searchParams = useSearchParams();
+
+ const userID = searchParams.get("userID");
+ const token = searchParams.get("token");
+
+ const [page, setPage] = useState("team");
+ const [accessToken, setAccessToken] = useState(null);
+
+ useEffect(() => {
+ if (token) {
+ const decoded = jwtDecode(token) as { [key: string]: any };
+ if (decoded) {
+ // cast decoded to dictionary
+ console.log("Decoded token:", decoded);
+
+ console.log("Decoded key:", decoded.key);
+ // set accessToken
+ setAccessToken(decoded.key);
+
+ // check if userRole is defined
+ if (decoded.user_role) {
+ const formattedUserRole = formatUserRole(decoded.user_role);
+ console.log("Decoded user_role:", formattedUserRole);
+ setUserRole(formattedUserRole);
+ } else {
+ console.log("User role not defined");
+ }
+
+ if (decoded.user_email) {
+ setUserEmail(decoded.user_email);
+ } else {
+ console.log(`User Email is not set ${decoded}`);
+ }
+ }
+ }
+ }, [token]);
+
+ function formatUserRole(userRole: string) {
+ if (!userRole) {
+ return "Undefined Role";
+ }
+ console.log(`Received user role: ${userRole}`);
+ switch (userRole.toLowerCase()) {
+ case "app_owner":
+ return "App Owner";
+ case "demo_app_owner":
+ return "App Owner";
+ case "app_admin":
+ return "Admin";
+ case "app_user":
+ return "App User";
+ default:
+ return "Unknown Role";
+ }
+ }
+
+ return (
+ Loading...
}>
+
+
+
+
+
+
+
+
+
+ Team Name
+ Spend (USD)
+ Budget (USD)
+ TPM / RPM Limits
+ Settings
+
+
+
+
+
+ Wilhelm Tell
+ 1
+ Uri, Schwyz, Unterwalden
+ National Hero
+
+
+
+
+
+ The Witcher
+ 129
+ Kaedwen
+ Legend
+
+
+
+
+
+ Mizutsune
+ 82
+ Japan
+ N/A
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+};
+export default TeamSettingsPage;
diff --git a/ui/litellm-dashboard/src/components/create_key_button.tsx b/ui/litellm-dashboard/src/components/create_key_button.tsx
index 03ef9a89e..ededfec98 100644
--- a/ui/litellm-dashboard/src/components/create_key_button.tsx
+++ b/ui/litellm-dashboard/src/components/create_key_button.tsx
@@ -18,6 +18,7 @@ const { Option } = Select;
interface CreateKeyProps {
userID: string;
+ teamID: string | null;
userRole: string | null;
accessToken: string;
data: any[] | null;
@@ -27,6 +28,7 @@ interface CreateKeyProps {
const CreateKey: React.FC
= ({
userID,
+ teamID,
userRole,
accessToken,
data,
@@ -36,7 +38,6 @@ const CreateKey: React.FC = ({
const [form] = Form.useForm();
const [isModalVisible, setIsModalVisible] = useState(false);
const [apiKey, setApiKey] = useState(null);
-
const handleOk = () => {
setIsModalVisible(false);
form.resetFields();
@@ -89,7 +90,10 @@ const CreateKey: React.FC = ({
-
+