fix(editor): Resolve expressions for grandparent nodes (#5859)

* fix(editor): Resolve expressions for grandparent nodes

* test: add tests

* test: add tests for bug

* test: add todos

* test: lintfix

* test: add small waits

* test: add linking tests

* test: add test for branch mapping

* test: update workflow values

* test: comment out test

* test: fix up tests with new values

* chore: remove todos

* test: add ticket number for broken test

* test: refactor a bit

* test: uncomment

* test: fix mapping test

* fix: lint issue

* test: split tests

* Revert "test: split tests"

0290d51d7c983320a718346ccb80fbad93894c6e

* test: update mousedown

* test: split up tests

* test: fix test

* test: fix test

* test: make less flaky

* test: make less flaky

* test: enable teset
This commit is contained in:
Mutasem Aldmour
2023-04-21 14:08:51 +02:00
committed by GitHub
parent d17d050a16
commit a19d4447ac
13 changed files with 759 additions and 100 deletions

View File

@@ -115,7 +115,11 @@ export default Vue.extend({
return (this.hoveringItem?.itemIndex ?? 0) + 1;
},
hoveringItem(): TargetItem | null {
return this.ndvStore.hoveringItem;
if (this.ndvStore.isInputParentOfActiveNode) {
return this.ndvStore.hoveringItem;
}
return null;
},
isDragging(): boolean {
return this.ndvStore.isDraggableDragging;

View File

@@ -28,7 +28,7 @@
:class="$style.hint"
data-test-id="parameter-expression-preview"
class="ph-no-capture"
:highlight="!!(expressionOutput && targetItem)"
:highlight="!!(expressionOutput && targetItem) && isInputParentOfActiveNode"
:hint="expressionOutput"
:singleLine="true"
/>
@@ -153,25 +153,29 @@ export default mixins(showMessage, workflowHelpers).extend({
targetItem(): TargetItem | null {
return this.ndvStore.hoveringItem;
},
isInputParentOfActiveNode(): boolean {
return this.ndvStore.isInputParentOfActiveNode;
},
expressionValueComputed(): string | null {
const inputNodeName: string | undefined = this.ndvStore.ndvInputNodeName;
const value = isResourceLocatorValue(this.value) ? this.value.value : this.value;
if (this.activeNode === null || !this.isValueExpression || typeof value !== 'string') {
if (!this.activeNode || !this.isValueExpression || typeof value !== 'string') {
return null;
}
const inputRunIndex: number | undefined = this.ndvStore.ndvInputRunIndex;
const inputBranchIndex: number | undefined = this.ndvStore.ndvInputBranchIndex;
let computedValue: NodeParameterValue;
try {
const targetItem = this.targetItem ?? undefined;
computedValue = this.resolveExpression(value, undefined, {
targetItem,
inputNodeName,
inputRunIndex,
inputBranchIndex,
});
let opts;
if (this.ndvStore.isInputParentOfActiveNode) {
opts = {
targetItem: this.targetItem ?? undefined,
inputNodeName: this.ndvStore.ndvInputNodeName,
inputRunIndex: this.ndvStore.ndvInputRunIndex,
inputBranchIndex: this.ndvStore.ndvInputBranchIndex,
};
}
computedValue = this.resolveExpression(value, undefined, opts);
if (computedValue === null) {
return null;
}

View File

@@ -121,7 +121,12 @@
</div>
</div>
<div :class="$style.runSelector" v-if="maxRunIndex > 0" v-show="!editMode.enabled">
<div
:class="$style.runSelector"
v-if="maxRunIndex > 0"
v-show="!editMode.enabled"
data-test-id="run-selector"
>
<n8n-select
size="small"
:value="runIndex"
@@ -157,7 +162,11 @@
<slot name="run-info"></slot>
</div>
<div v-if="maxOutputIndex > 0 && branches.length > 1" :class="$style.tabs">
<div
v-if="maxOutputIndex > 0 && branches.length > 1"
:class="$style.tabs"
data-test-id="branches"
>
<n8n-tabs :value="currentOutputIndex" @input="onBranchChange" :options="branches" />
</div>

View File

@@ -107,6 +107,7 @@
v-for="(row, index1) in tableData.data"
:key="index1"
:class="{ [$style.hoveringRow]: isHoveringRow(index1) }"
:data-test-id="isHoveringRow(index1) ? 'hovering-item' : undefined"
>
<td
v-for="(data, index2) in row"