mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
fix(editor): Only show previews if the param is an expression (#14720)
Co-authored-by: Elias Meire <elias@meire.dev>
This commit is contained in:
@@ -62,4 +62,11 @@ describe('Assignment.vue', () => {
|
||||
|
||||
expect(emitted('remove')).toEqual([[]]);
|
||||
});
|
||||
|
||||
it('should not display parameter input hint if expressionOutput is not set', () => {
|
||||
const { getByTestId } = renderComponent();
|
||||
|
||||
// Check if the parameter input hint is not displayed
|
||||
expect(() => getByTestId('parameter-input-hint')).toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -188,6 +188,7 @@ const onBlur = (): void => {
|
||||
@blur="onBlur"
|
||||
/>
|
||||
<ParameterInputHint
|
||||
v-if="resolvedExpressionString"
|
||||
data-test-id="parameter-expression-preview-value"
|
||||
:class="$style.hint"
|
||||
:highlight="highlightHint"
|
||||
|
||||
@@ -121,14 +121,6 @@ const { resolvedExpression, resolvedExpressionString } = useResolvedExpression({
|
||||
stringifyObject: props.parameter.type !== 'multiOptions',
|
||||
});
|
||||
|
||||
const expressionOutput = computed(() => {
|
||||
if (isExpression.value && resolvedExpressionString.value) {
|
||||
return resolvedExpressionString.value;
|
||||
}
|
||||
|
||||
return null;
|
||||
});
|
||||
|
||||
const parsedParameterName = computed(() => {
|
||||
return parseResourceMapperFieldName(props.parameter?.name ?? '');
|
||||
});
|
||||
@@ -199,14 +191,14 @@ defineExpose({
|
||||
<slot v-if="$slots.overrideButton" name="overrideButton" />
|
||||
</template>
|
||||
</ParameterInput>
|
||||
<div v-if="!hideHint && (expressionOutput || parameterHint)" :class="$style.hint">
|
||||
<div v-if="!hideHint && (resolvedExpressionString || parameterHint)" :class="$style.hint">
|
||||
<div>
|
||||
<InputHint
|
||||
v-if="expressionOutput"
|
||||
v-if="resolvedExpressionString"
|
||||
:class="{ [$style.hint]: true, 'ph-no-capture': isForCredential }"
|
||||
:data-test-id="`parameter-expression-preview-${parsedParameterName}`"
|
||||
:highlight="!!(expressionOutput && targetItem) && isInputParentOfActiveNode"
|
||||
:hint="expressionOutput"
|
||||
:highlight="!!(resolvedExpressionString && targetItem) && isInputParentOfActiveNode"
|
||||
:hint="resolvedExpressionString"
|
||||
:single-line="true"
|
||||
/>
|
||||
<InputHint v-else-if="parameterHint" :render-h-t-m-l="true" :hint="parameterHint" />
|
||||
|
||||
Reference in New Issue
Block a user