fix: resolve issue with adding global variable when input is connected (#4289)
* fix: prevent add global variable when inpiut is connected * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
This commit is contained in:
parent
a1cddbc335
commit
472b5fbda5
3 changed files with 9 additions and 2 deletions
|
|
@ -25,12 +25,14 @@ export default function GlobalVariableModal({
|
||||||
initialData,
|
initialData,
|
||||||
open: myOpen,
|
open: myOpen,
|
||||||
setOpen: mySetOpen,
|
setOpen: mySetOpen,
|
||||||
|
disabled = false,
|
||||||
}: {
|
}: {
|
||||||
children?: JSX.Element;
|
children?: JSX.Element;
|
||||||
asChild?: boolean;
|
asChild?: boolean;
|
||||||
initialData?: GlobalVariable;
|
initialData?: GlobalVariable;
|
||||||
open?: boolean;
|
open?: boolean;
|
||||||
setOpen?: (a: boolean | ((o?: boolean) => boolean)) => void;
|
setOpen?: (a: boolean | ((o?: boolean) => boolean)) => void;
|
||||||
|
disabled?: boolean;
|
||||||
}): JSX.Element {
|
}): JSX.Element {
|
||||||
const [key, setKey] = useState(initialData?.name ?? "");
|
const [key, setKey] = useState(initialData?.name ?? "");
|
||||||
const [value, setValue] = useState(initialData?.value ?? "");
|
const [value, setValue] = useState(initialData?.value ?? "");
|
||||||
|
|
@ -122,6 +124,7 @@ export default function GlobalVariableModal({
|
||||||
setOpen={setOpen}
|
setOpen={setOpen}
|
||||||
size="x-small"
|
size="x-small"
|
||||||
onSubmit={submitForm}
|
onSubmit={submitForm}
|
||||||
|
disable={disabled}
|
||||||
>
|
>
|
||||||
<BaseModal.Header
|
<BaseModal.Header
|
||||||
description={
|
description={
|
||||||
|
|
@ -138,7 +141,9 @@ export default function GlobalVariableModal({
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
/>
|
/>
|
||||||
</BaseModal.Header>
|
</BaseModal.Header>
|
||||||
<BaseModal.Trigger asChild={asChild}>{children}</BaseModal.Trigger>
|
<BaseModal.Trigger disable={disabled} asChild={asChild}>
|
||||||
|
{children}
|
||||||
|
</BaseModal.Trigger>
|
||||||
<BaseModal.Content>
|
<BaseModal.Content>
|
||||||
<div className="flex h-full w-full flex-col gap-4 align-middle">
|
<div className="flex h-full w-full flex-col gap-4 align-middle">
|
||||||
<Label>Variable Name</Label>
|
<Label>Variable Name</Label>
|
||||||
|
|
|
||||||
|
|
@ -159,9 +159,11 @@ export default function InputComponent({
|
||||||
className={cn(
|
className={cn(
|
||||||
password && selectedOption === "" ? "right-8" : "right-0",
|
password && selectedOption === "" ? "right-8" : "right-0",
|
||||||
"absolute inset-y-0 flex items-center pr-2.5",
|
"absolute inset-y-0 flex items-center pr-2.5",
|
||||||
|
disabled && "cursor-not-allowed opacity-50",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
|
disabled={disabled}
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
if (disabled) return;
|
if (disabled) return;
|
||||||
setShowOptions(!showOptions);
|
setShowOptions(!showOptions);
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ export default function InputGlobalComponent({
|
||||||
optionsPlaceholder={"Global Variables"}
|
optionsPlaceholder={"Global Variables"}
|
||||||
optionsIcon="Globe"
|
optionsIcon="Globe"
|
||||||
optionsButton={
|
optionsButton={
|
||||||
<GlobalVariableModal>
|
<GlobalVariableModal disabled={disabled}>
|
||||||
<CommandItem value="doNotFilter-addNewVariable">
|
<CommandItem value="doNotFilter-addNewVariable">
|
||||||
<ForwardedIconComponent
|
<ForwardedIconComponent
|
||||||
name="Plus"
|
name="Plus"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue