Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: resolve issue with adding global variable when input is connected #4289

Merged
merged 3 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ export default function GlobalVariableModal({
initialData,
open: myOpen,
setOpen: mySetOpen,
disabled = false,
}: {
children?: JSX.Element;
asChild?: boolean;
initialData?: GlobalVariable;
open?: boolean;
setOpen?: (a: boolean | ((o?: boolean) => boolean)) => void;
disabled?: boolean;
}): JSX.Element {
const [key, setKey] = useState(initialData?.name ?? "");
const [value, setValue] = useState(initialData?.value ?? "");
Expand Down Expand Up @@ -122,6 +124,7 @@ export default function GlobalVariableModal({
setOpen={setOpen}
size="x-small"
onSubmit={submitForm}
disable={disabled}
>
<BaseModal.Header
description={
Expand All @@ -138,7 +141,9 @@ export default function GlobalVariableModal({
aria-hidden="true"
/>
</BaseModal.Header>
<BaseModal.Trigger asChild={asChild}>{children}</BaseModal.Trigger>
<BaseModal.Trigger disable={disabled} asChild={asChild}>
{children}
</BaseModal.Trigger>
<BaseModal.Content>
<div className="flex h-full w-full flex-col gap-4 align-middle">
<Label>Variable Name</Label>
Expand Down
2 changes: 2 additions & 0 deletions src/frontend/src/components/inputComponent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,11 @@ export default function InputComponent({
className={cn(
password && selectedOption === "" ? "right-8" : "right-0",
"absolute inset-y-0 flex items-center pr-2.5",
disabled && "cursor-not-allowed opacity-50",
)}
>
<button
disabled={disabled}
onClick={(e) => {
if (disabled) return;
setShowOptions(!showOptions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export default function InputGlobalComponent({
optionsPlaceholder={"Global Variables"}
optionsIcon="Globe"
optionsButton={
<GlobalVariableModal>
<GlobalVariableModal disabled={disabled}>
<CommandItem value="doNotFilter-addNewVariable">
<ForwardedIconComponent
name="Plus"
Expand Down
Loading