From 9244db0c24a1bca8ff4f8adcab9cd86ec51affee Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Mon, 4 Mar 2024 10:37:13 -0300 Subject: [PATCH] Update RunFlow and RefreshButton components --- src/backend/langflow/components/utilities/RunFlow.py | 4 ++-- src/frontend/src/components/ui/refreshButton.tsx | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/backend/langflow/components/utilities/RunFlow.py b/src/backend/langflow/components/utilities/RunFlow.py index 70e92f380..035476ba8 100644 --- a/src/backend/langflow/components/utilities/RunFlow.py +++ b/src/backend/langflow/components/utilities/RunFlow.py @@ -21,8 +21,8 @@ class RunFlowComponent(CustomComponent): "multiline": True, }, "flow_name": { - "display_name": "Flow ID", - "info": "The ID of the flow to run.", + "display_name": "Flow Name", + "info": "The name of the flow to run.", "options": self.get_flow_names, }, "tweaks": { diff --git a/src/frontend/src/components/ui/refreshButton.tsx b/src/frontend/src/components/ui/refreshButton.tsx index 5ff581faf..1c2a0c17f 100644 --- a/src/frontend/src/components/ui/refreshButton.tsx +++ b/src/frontend/src/components/ui/refreshButton.tsx @@ -1,7 +1,8 @@ -import { useState } from "react"; +import { useEffect, useState } from "react"; import IconComponent from "../../components/genericIconComponent"; import { NodeDataType } from "../../types/flow"; import { cn } from "../../utils/utils"; + function RefreshButton({ disabled, name, @@ -15,6 +16,10 @@ function RefreshButton({ }) { const [isLoading, setIsLoading] = useState(false); + useEffect(() => { + handleUpdateValues(name, data); + }, []); // Empty dependency array to run only once + const handleClick = async () => { if (disabled) return; setIsLoading(true); @@ -31,10 +36,12 @@ function RefreshButton({ setIsLoading(false); } }; + const className = cn( "extra-side-bar-buttons ml-2 mt-1 w-1/6", disabled ? "cursor-not-allowed" : "cursor-pointer" ); + // icon class name should take into account the disabled state and the loading state const disabledIconTextClass = disabled ? "text-muted-foreground" : ""; const iconClassName = cn(