feat(editor): update expressions display (#4171)

* N8n 4673 expressions res1 (#4149)

* hide hints if necessary

* refactor out parameter input

* refactor param input in creds

* remove any

* add expression result before

* update case

* add types

* fix spacing

* update types

* update expr

* update parameter input

* update param input

* update param input

* remove import

* fix typo

* update value

* fix drop for rl

* add state to track hovering item

* add hover behavior to resolve values

* update index

* fix run selector bug

* add run item to eval expr

* add paired item mappings

* fix rec bug

* Fix for loops

* handle pinned data

* add missing pinned

* fix bug

* support parent

* add input

* map back from output

* clean up

* fix output bug

* fix branching bug

* update preview

* only if expr

* fix output

* fix expr eval for outputs

* add default hover state

* fix hover state

* fix branching

* hide hint if expr

* remove duplicate logic

* update style

* allow opening expr in demo

* update expr

* update row hover

* update param name

* clean up

* update hovering state

* update default output

* fix duplicate import

* update hover behavior

* update package lock

* fix pinned data case

* address case when no input
This commit is contained in:
Mutasem Aldmour
2022-10-12 14:06:28 +02:00
committed by GitHub
parent fe7c8a85ce
commit 6b538494ce
28 changed files with 842 additions and 228 deletions

View File

@@ -82,7 +82,7 @@
v-if="isValueExpression || droppable || forceShowExpression"
type="text"
:size="inputSize"
:value="activeDrop || forceShowExpression ? '' : expressionDisplayValue"
:value="expressionDisplayValue"
:title="displayTitle"
@keydown.stop
ref="input"
@@ -137,7 +137,6 @@
</div>
</div>
</resource-locator-dropdown>
<parameter-input-hint v-if="infoText" class="mt-4xs" :hint="infoText" />
</div>
</template>
@@ -163,7 +162,6 @@ import {
import DraggableTarget from '@/components/DraggableTarget.vue';
import ExpressionEdit from '@/components/ExpressionEdit.vue';
import ParameterIssues from '@/components/ParameterIssues.vue';
import ParameterInputHint from '@/components/ParameterInputHint.vue';
import ResourceLocatorDropdown from './ResourceLocatorDropdown.vue';
import Vue, { PropType } from 'vue';
import { INodeUi, IResourceLocatorReqParams, IResourceLocatorResultExpanded } from '@/Interface';
@@ -172,7 +170,6 @@ import stringify from 'fast-json-stable-stringify';
import { workflowHelpers } from '../mixins/workflowHelpers';
import { nodeHelpers } from '../mixins/nodeHelpers';
import { getAppNameFromNodeName } from '../helpers';
import { type } from 'os';
import { isResourceLocatorValue } from '@/typeGuards';
interface IResourceLocatorQuery {
@@ -188,7 +185,6 @@ export default mixins(debounceHelper, workflowHelpers, nodeHelpers).extend({
DraggableTarget,
ExpressionEdit,
ParameterIssues,
ParameterInputHint,
ResourceLocatorDropdown,
},
props: {
@@ -216,7 +212,7 @@ export default mixins(debounceHelper, workflowHelpers, nodeHelpers).extend({
type: String,
default: '',
},
expressionDisplayValue: {
expressionComputedValue: {
type: String,
default: '',
},
@@ -224,6 +220,9 @@ export default mixins(debounceHelper, workflowHelpers, nodeHelpers).extend({
type: Boolean,
default: false,
},
expressionDisplayValue: {
type: String,
},
forceShowExpression: {
type: Boolean,
default: false,
@@ -298,9 +297,6 @@ export default mixins(debounceHelper, workflowHelpers, nodeHelpers).extend({
return defaults[this.selectedMode] || '';
},
infoText(): string {
return this.currentMode.hint ? this.currentMode.hint : '';
},
currentMode(): INodePropertyMode {
return this.findModeByName(this.selectedMode) || ({} as INodePropertyMode);
},
@@ -327,8 +323,8 @@ export default mixins(debounceHelper, workflowHelpers, nodeHelpers).extend({
}
if (this.selectedMode === 'url') {
if (this.isValueExpression && typeof this.expressionDisplayValue === 'string' && this.expressionDisplayValue.startsWith('http')) {
return this.expressionDisplayValue;
if (this.isValueExpression && typeof this.expressionComputedValue === 'string' && this.expressionComputedValue.startsWith('http')) {
return this.expressionComputedValue;
}
if (typeof this.valueToDisplay === 'string' && this.valueToDisplay.startsWith('http')) {
@@ -337,7 +333,7 @@ export default mixins(debounceHelper, workflowHelpers, nodeHelpers).extend({
}
if (this.currentMode.url) {
const value = this.isValueExpression? this.expressionDisplayValue : this.valueToDisplay;
const value = this.isValueExpression? this.expressionComputedValue : this.valueToDisplay;
if (typeof value === 'string') {
const expression = this.currentMode.url.replace(/\{\{\$value\}\}/g, value);
const resolved = this.resolveExpression(expression);