From d46f77fd58f7ba8c4701a436e461f596c2209246 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Tue, 2 Apr 2024 15:01:42 -0700 Subject: [PATCH] ui use all_models alias --- .../src/components/create_key_button.tsx | 16 +--------------- ui/litellm-dashboard/src/components/teams.tsx | 16 +++++----------- .../src/components/view_key_table.tsx | 11 +---------- 3 files changed, 7 insertions(+), 36 deletions(-) diff --git a/ui/litellm-dashboard/src/components/create_key_button.tsx b/ui/litellm-dashboard/src/components/create_key_button.tsx index 17476232c..2b1a199c2 100644 --- a/ui/litellm-dashboard/src/components/create_key_button.tsx +++ b/ui/litellm-dashboard/src/components/create_key_button.tsx @@ -91,19 +91,6 @@ const CreateKey: React.FC = ({ } }; - - const handleModelSelection = (selectedModels: string[]) => { - if (selectedModels.includes("all_models")) { - // Select all models except "All Models" - const allModelsExceptAll = team ? team.models : userModels; - form.setFieldsValue({ - models: allModelsExceptAll - }); - } - }; - - - const handleCopy = () => { message.success('API Key copied to clipboard'); }; @@ -154,9 +141,8 @@ const CreateKey: React.FC = ({ mode="multiple" placeholder="Select models" style={{ width: "100%" }} - onChange={(selectedModels) => handleModelSelection(selectedModels)} > - {team && team.models ? ( diff --git a/ui/litellm-dashboard/src/components/teams.tsx b/ui/litellm-dashboard/src/components/teams.tsx index a3136ce1b..af7d59df9 100644 --- a/ui/litellm-dashboard/src/components/teams.tsx +++ b/ui/litellm-dashboard/src/components/teams.tsx @@ -115,6 +115,9 @@ const Team: React.FC = ({ + + All Models + ) => { setIsDeleteModalOpen(true); }; - const handleModelSelection = (selectedModels: string[]) => { - if (selectedModels.includes("all_models")) { - // Select all models except "All Models" - const allModelsExceptAll = userModels.filter(model => model !== "all"); - form.setFieldsValue({ - models: allModelsExceptAll - }); - } - }; + const confirmDelete = async () => { @@ -484,9 +479,8 @@ const handleEditSubmit = async (formValues: Record) => { mode="multiple" placeholder="Select models" style={{ width: "100%" }} - onChange={(selectedModels) => handleModelSelection(selectedModels)} > - + All Models {userModels.map((model) => ( diff --git a/ui/litellm-dashboard/src/components/view_key_table.tsx b/ui/litellm-dashboard/src/components/view_key_table.tsx index d8abcb493..5d7bdf2d0 100644 --- a/ui/litellm-dashboard/src/components/view_key_table.tsx +++ b/ui/litellm-dashboard/src/components/view_key_table.tsx @@ -100,15 +100,7 @@ const ViewKeyTable: React.FC = ({ } - const handleModelSelection = (selectedModels: string[]) => { - if (selectedModels.includes("all_models")) { - // Select all models except "All Models" - const allModelsExceptAll = selectedTeam ? selectedTeam.models : userModels; - form.setFieldsValue({ - models: allModelsExceptAll - }); - } - }; + const handleOk = () => { form @@ -155,7 +147,6 @@ const ViewKeyTable: React.FC = ({ mode="multiple" placeholder="Select models" style={{ width: "100%" }} - onChange={(selectedModels) => handleModelSelection(selectedModels)} >