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

Bugfixes #1795

Merged
merged 2 commits into from
Nov 30, 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 @@ -2,6 +2,7 @@ import useWorkflowNodeDetailsPanelStore from '@/pages/platform/workflow-editor/s
import getNestedObject from '@/pages/platform/workflow-editor/utils/getNestedObject';
import {TYPE_ICONS} from '@/shared/typeIcons';
import {PropertyAllType} from '@/shared/types';
import resolvePath from 'object-resolve-path';
import {MouseEvent} from 'react';
import {twMerge} from 'tailwind-merge';

Expand All @@ -24,7 +25,7 @@ const DataPill = ({
/* eslint-disable @typescript-eslint/no-explicit-any */
sampleOutput?: any;
}) => {
const {focusedInput} = useWorkflowNodeDetailsPanelStore();
const {currentComponent, focusedInput} = useWorkflowNodeDetailsPanelStore();

const mentionInput = focusedInput?.getEditor().getModule('mention');

Expand Down Expand Up @@ -52,6 +53,16 @@ const DataPill = ({
? `${workflowNodeName}.${(path || dataPillName).replaceAll('/', '.').replaceAll('.[index]', '[index]')}`
: workflowNodeName;

const parameters = currentComponent?.parameters || {};

if (Object.keys(parameters).length) {
const paramValue = resolvePath(parameters, mentionInput.options.path);

if (mentionInput.options.singleMention && paramValue) {
return;
}
}

mentionInput.insertItem(
{
componentIcon,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,7 @@ const Property = ({
event.preventDefault();
}
}}
path={path}
placeholder={placeholder}
ref={editorRef}
required={required}
Expand Down Expand Up @@ -988,7 +989,7 @@ const Property = ({
/>
)}

{controlType === 'OBJECT_BUILDER' && (
{(controlType === 'OBJECT_BUILDER' || type === 'FILE_ENTRY') && (
<ObjectProperty
arrayIndex={arrayIndex}
arrayName={arrayName}
Expand All @@ -999,8 +1000,6 @@ const Property = ({
/>
)}

{type === 'FILE_ENTRY' && <ObjectProperty operationName={operationName} property={property} />}

{control && (isValidControlType || isNumericalInput) && path && (
<>
<Controller
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ interface PropertyMentionsInputProps {
onChange?: (value: string) => void;
onKeyPress?: (event: KeyboardEvent) => void;
overriddenDataPills?: Array<DataPillType>;
path?: string;
placeholder?: string;
required?: boolean;
singleMention?: boolean;
Expand All @@ -74,6 +75,7 @@ const PropertyMentionsInput = forwardRef(
onChange,
onKeyPress,
overriddenDataPills,
path,
placeholder,
required = false,
showInputTypeSwitchButton = false,
Expand Down Expand Up @@ -148,8 +150,10 @@ const PropertyMentionsInput = forwardRef(
}
);
},
path,
renderItem: (item: DataPillType) => MentionInputListItem(item),
showDenotationChar: false,
singleMention,
source: (searchTerm: string, renderList: (arg1: Array<object>, arg2: string) => void) => {
if (overriddenDataPills) {
dataPills = overriddenDataPills;
Expand Down