Skip to content
Snippets Groups Projects
Unverified Commit 9f2a12fd authored by Tony Salomone's avatar Tony Salomone Committed by GitHub
Browse files

Merge pull request #221 from transformerlab/hide-the-use-button-if-a-plugin-isnt-installed

disables the use button for a recipe if a plugin isnt installed
parents 52bfc8f0 01a394e3
No related branches found
No related tags found
No related merge requests found
...@@ -35,6 +35,17 @@ export default function ImportRecipeModal({ open, setOpen, mutate }) { ...@@ -35,6 +35,17 @@ export default function ImportRecipeModal({ open, setOpen, mutate }) {
const recipes = recipesData; const recipes = recipesData;
const {
data: pluginsData,
error: pluginsError,
isLoading: pluginsLoading,
} = useSWR(chatAPI.Endpoints.Plugins.List(), fetcher);
const installedPlugins = pluginsData
? pluginsData.map(plugin => plugin.uniqueId)
: [];
// For any variables that need to be reset on close // For any variables that need to be reset on close
const handleClose = () => { const handleClose = () => {
mutate(); mutate();
...@@ -225,6 +236,7 @@ export default function ImportRecipeModal({ open, setOpen, mutate }) { ...@@ -225,6 +236,7 @@ export default function ImportRecipeModal({ open, setOpen, mutate }) {
<td> <td>
<Button <Button
size="sm" size="sm"
disabled = {!(installedPlugins.includes(row.training?.plugin))}
onClick={() => { onClick={() => {
const recipe_text = YAML.stringify(row); const recipe_text = YAML.stringify(row);
uploadRecipe(row.metadata?.name, recipe_text); uploadRecipe(row.metadata?.name, recipe_text);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment