Skip to content

Commit

Permalink
feat: code editor and code input can not insert file type vars
Browse files Browse the repository at this point in the history
  • Loading branch information
iamjoel committed Nov 19, 2024
1 parent 2d8a720 commit 1d19662
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ const CodeEditor: FC<Props> = ({
hideSearch
vars={availableVars}
onChange={handleSelectVar}
isSupportFileVar={false}
/>
</div>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type Props = {
isSupportConstantValue?: boolean
onlyLeafNodeVar?: boolean
filterVar?: (payload: Var, valueSelector: ValueSelector) => boolean
isSupportFileVar?: boolean
}

const VarList: FC<Props> = ({
Expand All @@ -29,6 +30,7 @@ const VarList: FC<Props> = ({
isSupportConstantValue,
onlyLeafNodeVar,
filterVar,
isSupportFileVar = true,
}) => {
const { t } = useTranslation()

Expand Down Expand Up @@ -94,6 +96,7 @@ const VarList: FC<Props> = ({
defaultVarKindType={item.variable_type}
onlyLeafNodeVar={onlyLeafNodeVar}
filterVar={filterVar}
isSupportFileVar={isSupportFileVar}
/>
{!readonly && (
<RemoveButton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ type Props = {
isInTable?: boolean
onRemove?: () => void
typePlaceHolder?: string
isSupportFileVar?: boolean
}

const VarReferencePicker: FC<Props> = ({
Expand All @@ -81,6 +82,7 @@ const VarReferencePicker: FC<Props> = ({
isInTable,
onRemove,
typePlaceHolder,
isSupportFileVar = true,
}) => {
const { t } = useTranslation()
const store = useStoreApi()
Expand Down Expand Up @@ -382,6 +384,7 @@ const VarReferencePicker: FC<Props> = ({
vars={outputVars}
onChange={handleVarReferenceChange}
itemWidth={isAddBtnTrigger ? 260 : triggerWidth}
isSupportFileVar={isSupportFileVar}
/>
)}
</PortalToFollowElemContent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ type Props = {
vars: NodeOutPutVar[]
onChange: (value: ValueSelector, varDetail: Var) => void
itemWidth?: number
isSupportFileVar?: boolean
}
const VarReferencePopup: FC<Props> = ({
vars,
onChange,
itemWidth,
isSupportFileVar = true,
}) => {
// max-h-[300px] overflow-y-auto todo: use portal to handle long list
return (
Expand All @@ -24,7 +26,7 @@ const VarReferencePopup: FC<Props> = ({
vars={vars}
onChange={onChange}
itemWidth={itemWidth}
isSupportFileVar
isSupportFileVar={isSupportFileVar}
/>
</div >
)
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 @@ -89,6 +89,7 @@ const Panel: FC<NodePanelProps<CodeNodeType>> = ({
list={inputs.variables}
onChange={handleVarListChange}
filterVar={filterVar}
isSupportFileVar={false}
/>
</Field>
<Split />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const Panel: FC<NodePanelProps<TemplateTransformNodeType>> = ({
onChange={handleVarListChange}
onVarNameChange={handleVarNameChange}
filterVar={filterVar}
isSupportFileVar={false}
/>
</Field>
<Split />
Expand Down

0 comments on commit 1d19662

Please sign in to comment.