forked from phoenix/litellm-mirror
ui - setup sso on admin ui
This commit is contained in:
parent
09ef6f827c
commit
cfb250903d
1 changed files with 101 additions and 46 deletions
|
@ -57,6 +57,33 @@ const AdminPanel: React.FC<AdminPanelProps> = ({
|
||||||
const [isAddMemberModalVisible, setIsAddMemberModalVisible] = useState(false);
|
const [isAddMemberModalVisible, setIsAddMemberModalVisible] = useState(false);
|
||||||
const [isAddAdminModalVisible, setIsAddAdminModalVisible] = useState(false);
|
const [isAddAdminModalVisible, setIsAddAdminModalVisible] = useState(false);
|
||||||
const [isUpdateMemberModalVisible, setIsUpdateModalModalVisible] = useState(false);
|
const [isUpdateMemberModalVisible, setIsUpdateModalModalVisible] = useState(false);
|
||||||
|
const [isAddSSOModalVisible, setIsAddSSOModalVisible] = useState(false);
|
||||||
|
const [isInstructionsModalVisible, setIsInstructionsModalVisible] = useState(false);
|
||||||
|
|
||||||
|
const handleAddSSOOk = () => {
|
||||||
|
setIsAddSSOModalVisible(false);
|
||||||
|
form.resetFields();
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleAddSSOCancel = () => {
|
||||||
|
setIsAddSSOModalVisible(false);
|
||||||
|
form.resetFields();
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleShowInstructions = (formValues: Record<string, any>) => {
|
||||||
|
setIsAddSSOModalVisible(false);
|
||||||
|
setIsInstructionsModalVisible(true);
|
||||||
|
// Optionally, you can call handleSSOUpdate here with the formValues
|
||||||
|
// handleSSOUpdate(formValues);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleInstructionsOk = () => {
|
||||||
|
setIsInstructionsModalVisible(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleInstructionsCancel = () => {
|
||||||
|
setIsInstructionsModalVisible(false);
|
||||||
|
};
|
||||||
|
|
||||||
const roles = ["proxy_admin", "proxy_admin_viewer"]
|
const roles = ["proxy_admin", "proxy_admin_viewer"]
|
||||||
|
|
||||||
|
@ -393,42 +420,45 @@ const AdminPanel: React.FC<AdminPanelProps> = ({
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Title level={4}>Add SSO</Title>
|
<Title level={4}>Add SSO</Title>
|
||||||
<Card>
|
<div className="flex justify-start mb-4">
|
||||||
|
<Button onClick={() => setIsAddSSOModalVisible(true)}>Add SSO</Button>
|
||||||
|
<Modal
|
||||||
|
title="Add SSO"
|
||||||
|
visible={isAddSSOModalVisible}
|
||||||
|
width={800}
|
||||||
|
footer={null}
|
||||||
|
onOk={handleAddSSOOk}
|
||||||
|
onCancel={handleAddSSOCancel}
|
||||||
|
>
|
||||||
|
|
||||||
<Form
|
<Form
|
||||||
form={form}
|
form={form}
|
||||||
onFinish={handleSSOUpdate}
|
onFinish={handleShowInstructions}
|
||||||
labelCol={{ span: 8 }}
|
labelCol={{ span: 8 }}
|
||||||
wrapperCol={{ span: 16 }}
|
wrapperCol={{ span: 16 }}
|
||||||
labelAlign="left"
|
labelAlign="left"
|
||||||
>
|
>
|
||||||
<>
|
<>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label="PROXY_BASE_URL"
|
label="PROXY BASE URL"
|
||||||
name="proxy_base_url"
|
name="proxy_base_url"
|
||||||
rules={[
|
rules={[{ required: true, message: "Please enter the public key" }]}
|
||||||
{ required: true, message: "Please enter the public key" },
|
|
||||||
]}
|
|
||||||
>
|
>
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
|
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label="GOOGLE_CLIENT_ID"
|
label="GOOGLE CLIENT ID"
|
||||||
name="google_client_id"
|
name="google_client_id"
|
||||||
rules={[
|
rules={[{ required: true, message: "Please enter the public key" }]}
|
||||||
{ required: true, message: "Please enter the public key" },
|
|
||||||
]}
|
|
||||||
>
|
>
|
||||||
<Input.Password />
|
<Input.Password />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label="GOOGLE_CLIENT_SECRET"
|
label="GOOGLE CLIENT SECRET"
|
||||||
name="google_client_secret"
|
name="google_client_secret"
|
||||||
rules={[
|
rules={[{ required: true, message: "Please enter the private key" }]}
|
||||||
{ required: true, message: "Please enter the private key" },
|
|
||||||
]}
|
|
||||||
>
|
>
|
||||||
<Input.Password />
|
<Input.Password />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
@ -438,8 +468,33 @@ const AdminPanel: React.FC<AdminPanelProps> = ({
|
||||||
</div>
|
</div>
|
||||||
</Form>
|
</Form>
|
||||||
|
|
||||||
</Card>
|
</Modal>
|
||||||
|
<Modal
|
||||||
|
title="SSO Setup Instructions"
|
||||||
|
visible={isInstructionsModalVisible}
|
||||||
|
width={800}
|
||||||
|
footer={null}
|
||||||
|
onOk={handleInstructionsOk}
|
||||||
|
onCancel={handleInstructionsCancel}
|
||||||
|
>
|
||||||
|
<p>Follow these steps to complete the SSO setup:</p>
|
||||||
|
<Text className="mt-2">
|
||||||
|
1. DO NOT Exit this TAB
|
||||||
|
</Text>
|
||||||
|
<Text className="mt-2">
|
||||||
|
2. Open a new tab, visit your proxy base url
|
||||||
|
</Text>
|
||||||
|
<Text className="mt-2">
|
||||||
|
3. Confirm your SSO is configured correctly and you can login on the new Tab
|
||||||
|
</Text>
|
||||||
|
<Text className="mt-2">
|
||||||
|
4. If Step 3 is successful, you can close this tab
|
||||||
|
</Text>
|
||||||
|
<div style={{ textAlign: "right", marginTop: "10px" }}>
|
||||||
|
<Button2 onClick={handleInstructionsOk}>Done</Button2>
|
||||||
|
</div>
|
||||||
|
</Modal>
|
||||||
|
</div>
|
||||||
</Grid>
|
</Grid>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue