forked from phoenix/litellm-mirror
(feat) add enter proxy url screen
This commit is contained in:
parent
dda115fcb7
commit
5ac449a518
2 changed files with 59 additions and 0 deletions
44
ui/litellm-dashboard/src/components/enter_proxy_url.tsx
Normal file
44
ui/litellm-dashboard/src/components/enter_proxy_url.tsx
Normal file
|
@ -0,0 +1,44 @@
|
|||
"use client";
|
||||
|
||||
import React, { use, useState } from "react";
|
||||
import { Button, TextInput } from "@tremor/react";
|
||||
|
||||
import { Card, Metric, Text } from "@tremor/react";
|
||||
import { createKeyCall } from "./networking";
|
||||
// Define the props type
|
||||
interface EnterProxyUrlProps {
|
||||
onUrlChange: (url: string) => void;
|
||||
}
|
||||
|
||||
const EnterProxyUrl: React.FC<EnterProxyUrlProps> = ({ onUrlChange }) => {
|
||||
const [proxyUrl, setProxyUrl] = useState<string>('');
|
||||
|
||||
const handleUrlChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||
setProxyUrl(event.target.value);
|
||||
};
|
||||
|
||||
const handleSaveClick = () => {
|
||||
// You can perform any additional validation or actions here
|
||||
// For now, let's just pass the entered URL to the parent component
|
||||
onUrlChange(proxyUrl);
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Card decoration="top" decorationColor="blue" style={{ width: '100%' }}>
|
||||
<Text>Admin Configuration</Text>
|
||||
<label htmlFor="proxyUrl">Enter Proxy URL:</label>
|
||||
<TextInput
|
||||
type="text"
|
||||
id="proxyUrl"
|
||||
value={proxyUrl}
|
||||
onChange={handleUrlChange}
|
||||
placeholder="https://your-proxy-endpoint.com"
|
||||
/>
|
||||
<Button onClick={handleSaveClick}>Save</Button>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default EnterProxyUrl;
|
|
@ -3,14 +3,29 @@ import React from "react";
|
|||
import { Grid, Col, Card, Text } from "@tremor/react";
|
||||
import CreateKey from "./create_key_button";
|
||||
import ViewKeyTable from "./view_key_table";
|
||||
import EnterProxyUrl from "./enter_proxy_url";
|
||||
import { useSearchParams } from "next/navigation";
|
||||
|
||||
|
||||
|
||||
export default function UserDashboard() {
|
||||
const searchParams = useSearchParams();
|
||||
const userID = searchParams.get("userID");
|
||||
const accessToken = searchParams.get("accessToken");
|
||||
const proxyBaseUrl = searchParams.get("proxyBaseUrl");
|
||||
|
||||
const handleProxyUrlChange = (url: string) => {
|
||||
// Do something with the entered proxy URL, e.g., save it in the state
|
||||
console.log('Entered Proxy URL:', url);
|
||||
};
|
||||
|
||||
if (proxyBaseUrl == null) {
|
||||
return (
|
||||
<div>
|
||||
<EnterProxyUrl onUrlChange={handleProxyUrlChange} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
if (userID == null || accessToken == null || proxyBaseUrl == null) {
|
||||
return (
|
||||
<Card
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue