-
Notifications
You must be signed in to change notification settings - Fork 7.1k
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
N8 n 4179 resource locator list mode #3933
Changes from all commits
0510e17
fe58554
e9c60d6
d08e874
547e229
f1b9dfa
3eadaf2
ce98df2
ff428f4
79310fd
c2c6939
0574ade
65cf95e
5254248
28cdddd
31c3be1
f10202e
91e0758
f9a7c8c
ee1a580
143e7b7
6dd96f7
9361323
402e036
a45d1eb
2f34c90
fdb55b4
b2ba979
249e563
362586f
2271f15
cad2747
0138725
1d4ab8e
28b753f
7c7c491
06b837c
9b0b541
d048a50
cbaa6ae
ccaa184
87f6743
b3bfe36
ee5e4e2
98e80b0
a31679e
507cc95
bae794f
00b04b9
f49d0a1
f7fc11f
0c45aa3
cbb8781
1874990
c29607d
9063bc1
380786e
c74fcd5
046e706
bdc8f5e
dcd2c25
5bb4bc7
1eec3f8
02b1a53
02a9f4a
2ed0a67
3b55043
848ff00
e508c86
501f1bd
c88bb23
fa58cd6
39e414c
f6890e4
bdde870
f930ebc
69bc4b5
bbceab7
0e7b32f
7933cf8
9cf35af
922f325
f0606fc
3c9d526
7d5f011
0eb7045
34604e5
7862360
200ec40
6c37d5e
0b9b817
e8a7d0f
aa4bdef
8baf27c
b880dbe
33cabf6
1160d11
b91d90a
a6d2952
b2ba457
ebdf203
c14ac23
8bebc55
0b30361
13c57c0
5c94628
19f22d9
159c378
aa57d76
afc06a0
4d16e78
0afef91
fb53493
8fc6b7a
ab0c995
8194e88
3cd0948
59cc082
2db293c
dc6f6dc
f68f3c2
5d421cf
1ddb7b4
44114a6
f8ebd94
b02c1ab
c70efc1
1aeef10
24ae7de
c18640b
bedb900
fc3798b
ed19774
6c2025f
1d405eb
1090cc4
9917aaa
e8a26ba
0572e86
3f490ad
d413e09
3c08494
d1b2a59
12c4bae
853ef19
2f5b09e
507b6a5
abd4a21
ef083e8
7b427f9
8bcc534
55dd826
45e1148
2b89030
30e197d
953f0e2
f20cab0
3d88620
5e03d7d
d4b5709
3527d60
90607fa
85efa94
6fa60a5
38af388
dfade2f
c17fc32
827949b
55bcfe5
f12b294
11b0180
53bb950
7feff2f
b92c13a
6cb08c4
ca097e6
9df2b60
3cd89e0
2d17df1
a41bbfe
1cc4cd9
eb63bf1
ebd822f
14aed4c
f727cb4
0a4c05e
c6edcb2
53546e0
258290c
0661d3d
2ddbfaf
27576c3
5496a2c
3dd5f23
d1010a4
0b24297
0c875f8
543b67e
5e80b7d
ae42b0c
b368fcc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
<div @keydown.stop :class="parameterInputClasses"> | ||
<expression-edit | ||
:dialogVisible="expressionEditDialogVisible" | ||
:value="isResourceLocatorParameter ? value.value || '' : value" | ||
:value="isResourceLocatorParameter ? (value ? value.value : '') : value" | ||
:parameter="parameter" | ||
:path="path" | ||
:eventSource="eventSource || 'ndv'" | ||
|
@@ -18,22 +18,20 @@ | |
v-if="isResourceLocatorParameter" | ||
ref="resourceLocator" | ||
:parameter="parameter" | ||
:value="typeof value === 'string' ? value : value.value" | ||
:mode="value.mode || ''" | ||
:displayValue="displayValue" | ||
:value="value" | ||
:displayTitle="displayTitle" | ||
:parameterInputClasses="parameterInputClasses" | ||
:expressionDisplayValue="expressionDisplayValue" | ||
:isValueExpression="isValueExpression" | ||
:isReadOnly="isReadOnly" | ||
:parameterIssues="getIssues" | ||
:droppable="droppable" | ||
@valueChanged="valueChanged" | ||
@modeChanged="valueChanged" | ||
:node="node" | ||
:path="path" | ||
@input="valueChanged" | ||
@focus="setFocus" | ||
@blur="onBlur" | ||
@drop="onDrop" | ||
></resource-locator> | ||
@drop="onResourceLocatorDrop" | ||
/> | ||
<n8n-input | ||
v-else-if="isValueExpression || droppable || forceShowExpression" | ||
:size="inputSize" | ||
|
@@ -98,7 +96,7 @@ | |
<div slot="suffix" class="expand-input-icon-container"> | ||
<font-awesome-icon | ||
v-if="!isReadOnly" | ||
icon="external-link-alt" | ||
icon="expand-alt" | ||
class="edit-window-button clickable" | ||
:title="$locale.baseText('parameterInput.openEditWindow')" | ||
@click="displayEditDialog()" | ||
|
@@ -278,7 +276,7 @@ | |
/> | ||
</div> | ||
|
||
<parameter-issues v-if="parameter.type !== 'credentialsSelect'" :issues="getIssues" /> | ||
<parameter-issues v-if="parameter.type !== 'credentialsSelect' && !isResourceLocatorParameter" :issues="getIssues" /> | ||
</div> | ||
</template> | ||
|
||
|
@@ -317,7 +315,8 @@ import { workflowHelpers } from '@/components/mixins/workflowHelpers'; | |
import mixins from 'vue-typed-mixins'; | ||
import { CUSTOM_API_CALL_KEY } from '@/constants'; | ||
import { mapGetters } from 'vuex'; | ||
import { hasExpressionMapping } from './helpers'; | ||
import { hasExpressionMapping, isValueExpression } from './helpers'; | ||
import { isResourceLocatorValue } from '@/typeGuards'; | ||
|
||
export default mixins( | ||
externalHooks, | ||
|
@@ -326,7 +325,7 @@ export default mixins( | |
workflowHelpers, | ||
) | ||
.extend({ | ||
name: 'ParameterInput', | ||
name: 'parameter-input', | ||
components: { | ||
CodeEdit, | ||
ExpressionEdit, | ||
|
@@ -353,7 +352,6 @@ export default mixins( | |
'activeDrop', | ||
'droppable', | ||
'forceShowExpression', | ||
'isValueExpression', | ||
], | ||
data () { | ||
return { | ||
|
@@ -415,6 +413,9 @@ export default mixins( | |
}, | ||
computed: { | ||
...mapGetters('credentials', ['allCredentialTypes']), | ||
isValueExpression(): boolean { | ||
return isValueExpression(this.parameter, this.value); | ||
}, | ||
areExpressionsDisabled(): boolean { | ||
return this.$store.getters['ui/areExpressionsDisabled']; | ||
}, | ||
|
@@ -479,7 +480,7 @@ export default mixins( | |
|
||
let returnValue; | ||
if (this.isValueExpression === false) { | ||
returnValue = this.isResourceLocatorParameter ? this.value.value : this.value; | ||
returnValue = this.isResourceLocatorParameter ? (this.value ? this.value.value: '') : this.value; | ||
} else { | ||
returnValue = this.expressionValueComputed; | ||
} | ||
|
@@ -670,7 +671,7 @@ export default mixins( | |
const styles = { | ||
width: '100%', | ||
}; | ||
if (this.parameter.type === 'credentialsSelect') { | ||
if (this.parameter.type === 'credentialsSelect' || this.isResourceLocatorParameter) { | ||
return styles; | ||
} | ||
if (this.getIssues.length) { | ||
|
@@ -744,9 +745,9 @@ export default mixins( | |
this.remoteParameterOptions.length = 0; | ||
|
||
// Get the resolved parameter values of the current node | ||
const currentNodeParameters = this.$store.getters.activeNode.parameters; | ||
|
||
try { | ||
const currentNodeParameters = (this.$store.getters.activeNode as INodeUi).parameters; | ||
const resolvedNodeParameters = this.resolveParameter(currentNodeParameters) as INodeParameters; | ||
const loadOptionsMethod = this.getArgument('loadOptionsMethod') as string | undefined; | ||
const loadOptions = this.getArgument('loadOptions') as ILoadOptions | undefined; | ||
|
@@ -834,7 +835,7 @@ export default mixins( | |
onBlur () { | ||
this.$emit('blur'); | ||
}, | ||
onDrop(data: string) { | ||
onResourceLocatorDrop(data: string) { | ||
this.$emit('drop', data); | ||
}, | ||
setFocus () { | ||
|
@@ -936,7 +937,11 @@ export default mixins( | |
if (this.parameter.type === 'number' || this.parameter.type === 'boolean') { | ||
this.valueChanged({ value: `={{${this.value}}}`, mode: this.value.mode }); | ||
} else if (this.isResourceLocatorParameter) { | ||
this.valueChanged({ value: `=${this.value.value}`, mode: this.value.mode }); | ||
if (isResourceLocatorValue(this.value)) { | ||
this.valueChanged({ value: `=${this.value.value}`, mode: this.value.mode }); | ||
} else { | ||
this.valueChanged({ value: `=${this.value}`, mode: '' }); | ||
} | ||
} else { | ||
this.valueChanged(`=${this.value}`); | ||
} | ||
|
@@ -959,6 +964,12 @@ export default mixins( | |
this.valueChanged(typeof value !== 'undefined' ? value : null); | ||
} | ||
} else if (command === 'refreshOptions') { | ||
if (this.isResourceLocatorParameter) { | ||
const resourceLocator = this.$refs.resourceLocator; | ||
if (resourceLocator) { | ||
(resourceLocator as Vue).$emit('refreshList'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can this be triggered in some nicer way instead of emitting child component event (which is handled inside that same component, if i see it correctly)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not sure.. one approach I could think of is creating an event bus and passing it down but that's not much better.. or moving data to a store.. but not sure if a store makes sense here... since we don't reuse the data and only needed when directly using a parameter.. |
||
} | ||
} | ||
this.loadRemoteParameterOptions(); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can
IResourceLocatorReqParams
be made to extendIDataObject
so we can avoid ugly type conversions like this?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool idea.. I tried but IDataObject does not support unknown.. changing that might break too many things