mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-04 02:31:27 +00:00
feat(ui): tremor chart files + AddSSOSettingsModal
- ScoreChart, EndpointUsageBarChart, EndpointUsageLineChart: tremor chart primitives kept with inline eslint-disable on the import line (chart migration is phase 2). - AddSSOSettingsModal: antd Modal/Button/Space shell \u2192 shadcn Dialog + Button. BaseSSOSettingsForm (antd Form) is still mounted inside the dialog; the submit button triggers form.submit() as before. Gates: TS \u2713 | Build \u2713. Co-authored-by: yuneng-jiang <yuneng-berri@users.noreply.github.com>
This commit is contained in:
parent
64d6a41ae0
commit
cf30ba43ef
4 changed files with 35 additions and 17 deletions
|
|
@ -1,3 +1,4 @@
|
|||
// eslint-disable-next-line litellm-ui/no-banned-ui-imports
|
||||
import { BarChart, Card, Title } from "@tremor/react";
|
||||
import React from "react";
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,15 @@
|
|||
|
||||
import NotificationsManager from "@/components/molecules/notifications_manager";
|
||||
import { parseErrorMessage } from "@/components/shared/errorUtils";
|
||||
import { Button, Form, Modal, Space } from "antd";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogFooter,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
} from "@/components/ui/dialog";
|
||||
import { Form } from "antd";
|
||||
import React from "react";
|
||||
import BaseSSOSettingsForm from "./BaseSSOSettingsForm";
|
||||
import { useEditSSOSettings } from "@/app/(dashboard)/hooks/sso/useEditSSOSettings";
|
||||
|
|
@ -14,11 +22,15 @@ interface AddSSOSettingsModalProps {
|
|||
onSuccess: () => void;
|
||||
}
|
||||
|
||||
const AddSSOSettingsModal: React.FC<AddSSOSettingsModalProps> = ({ isVisible, onCancel, onSuccess }) => {
|
||||
const AddSSOSettingsModal: React.FC<AddSSOSettingsModalProps> = ({
|
||||
isVisible,
|
||||
onCancel,
|
||||
onSuccess,
|
||||
}) => {
|
||||
const [form] = Form.useForm();
|
||||
const { mutateAsync, isPending } = useEditSSOSettings();
|
||||
|
||||
// Enhanced form submission handler
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const handleFormSubmit = async (formValues: Record<string, any>) => {
|
||||
const payload = processSSOSettingsPayload(formValues);
|
||||
|
||||
|
|
@ -28,7 +40,9 @@ const AddSSOSettingsModal: React.FC<AddSSOSettingsModalProps> = ({ isVisible, on
|
|||
onSuccess();
|
||||
},
|
||||
onError: (error) => {
|
||||
NotificationsManager.fromBackend("Failed to save SSO settings: " + parseErrorMessage(error));
|
||||
NotificationsManager.fromBackend(
|
||||
"Failed to save SSO settings: " + parseErrorMessage(error),
|
||||
);
|
||||
},
|
||||
});
|
||||
};
|
||||
|
|
@ -39,24 +53,25 @@ const AddSSOSettingsModal: React.FC<AddSSOSettingsModalProps> = ({ isVisible, on
|
|||
};
|
||||
|
||||
return (
|
||||
<Modal
|
||||
title="Add SSO"
|
||||
<Dialog
|
||||
open={isVisible}
|
||||
width={800}
|
||||
footer={
|
||||
<Space>
|
||||
<Button onClick={handleCancel} disabled={isPending}>
|
||||
onOpenChange={(o) => (!o ? handleCancel() : undefined)}
|
||||
>
|
||||
<DialogContent className="max-w-[800px]">
|
||||
<DialogHeader>
|
||||
<DialogTitle>Add SSO</DialogTitle>
|
||||
</DialogHeader>
|
||||
<BaseSSOSettingsForm form={form} onFormSubmit={handleFormSubmit} />
|
||||
<DialogFooter>
|
||||
<Button variant="outline" onClick={handleCancel} disabled={isPending}>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button loading={isPending} onClick={() => form.submit()}>
|
||||
<Button onClick={() => form.submit()} disabled={isPending}>
|
||||
{isPending ? "Adding..." : "Add SSO"}
|
||||
</Button>
|
||||
</Space>
|
||||
}
|
||||
onCancel={handleCancel}
|
||||
>
|
||||
<BaseSSOSettingsForm form={form} onFormSubmit={handleFormSubmit} />
|
||||
</Modal>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import React from "react";
|
||||
// eslint-disable-next-line litellm-ui/no-banned-ui-imports
|
||||
import { BarChart, Card, Title } from "@tremor/react";
|
||||
import { CustomLegend, CustomTooltip } from "@/components/common_components/chartUtils";
|
||||
import { MetricWithMetadata } from "../../../types";
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
// eslint-disable-next-line litellm-ui/no-banned-ui-imports
|
||||
import { Card, LineChart, Title } from "@tremor/react";
|
||||
import { useMemo } from "react";
|
||||
import { DailyData } from "../../../types";
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue