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

chore: code generator button should only display in code node #9842

Merged
merged 1 commit into from
Oct 25, 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 @@ -29,6 +29,7 @@ type Props = {
codeLanguages: CodeLanguage
fileList?: FileEntity[]
showFileList?: boolean
showCodeGenerator?: boolean
}

const Base: FC<Props> = ({
Expand All @@ -44,6 +45,7 @@ const Base: FC<Props> = ({
codeLanguages,
fileList = [],
showFileList,
showCodeGenerator = false,
}) => {
const ref = useRef<HTMLDivElement>(null)
const {
Expand Down Expand Up @@ -76,9 +78,11 @@ const Base: FC<Props> = ({
e.stopPropagation()
}}>
{headerRight}
<div className='ml-1'>
<CodeGeneratorButton onGenerated={onGenerated} codeLanguages={codeLanguages}/>
</div>
{showCodeGenerator && (
<div className='ml-1'>
<CodeGeneratorButton onGenerated={onGenerated} codeLanguages={codeLanguages}/>
</div>
)}
{!isCopied
? (
<Clipboard className='mx-1 w-3.5 h-3.5 text-gray-500 cursor-pointer' onClick={handleCopy} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export type Props = {
noWrapper?: boolean
isExpand?: boolean
showFileList?: boolean
showCodeGenerator?: boolean
}

export const languageMap = {
Expand Down Expand Up @@ -63,6 +64,7 @@ const CodeEditor: FC<Props> = ({
noWrapper,
isExpand,
showFileList,
showCodeGenerator = false,
}) => {
const [isFocus, setIsFocus] = React.useState(false)
const [isMounted, setIsMounted] = React.useState(false)
Expand Down Expand Up @@ -207,6 +209,7 @@ const CodeEditor: FC<Props> = ({
codeLanguages={language}
fileList={fileList}
showFileList={showFileList}
showCodeGenerator={showCodeGenerator}
>
{main}
</Base>
Expand Down
1 change: 1 addition & 0 deletions web/app/components/workflow/nodes/code/panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ const Panel: FC<NodePanelProps<CodeNodeType>> = ({
language={inputs.code_language}
value={inputs.code}
onChange={handleCodeChange}
showCodeGenerator={true}
/>
</div>
<Split />
Expand Down