mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-19 19:11:13 +00:00
fix(core): Fix resolve RL values in expressions (#4173)
* update interface * update expression resolving * 🔥 remove ExtractValue functions * add flags * update resolving * update expr * fix for list mode * clean up * Fix up * update guard * fix bug with switching * update to handle expr referencing * fix legacy expression * fix when switching * update spacing Co-authored-by: Valya Bullions <valya@n8n.io>
This commit is contained in:
@@ -174,6 +174,7 @@ import { workflowHelpers } from '../mixins/workflowHelpers';
|
||||
import { nodeHelpers } from '../mixins/nodeHelpers';
|
||||
import { getAppNameFromNodeName } from '../helpers';
|
||||
import { type } from 'os';
|
||||
import { isResourceLocatorValue } from '@/typeGuards';
|
||||
|
||||
interface IResourceLocatorQuery {
|
||||
results: INodeListSearchItems[];
|
||||
@@ -199,10 +200,6 @@ export default mixins(debounceHelper, workflowHelpers, nodeHelpers).extend({
|
||||
value: {
|
||||
type: [Object, String] as PropType<INodeParameterResourceLocator | NodeParameterValue | undefined>,
|
||||
},
|
||||
mode: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
inputSize: {
|
||||
type: String,
|
||||
default: 'small',
|
||||
@@ -423,6 +420,11 @@ export default mixins(debounceHelper, workflowHelpers, nodeHelpers).extend({
|
||||
this.switchFromListMode();
|
||||
}
|
||||
},
|
||||
currentMode(mode: INodePropertyMode) {
|
||||
if (mode.extractValue && mode.extractValue.regex && isResourceLocatorValue(this.value) && this.value.__regex !== mode.extractValue.regex) {
|
||||
this.$emit('input', {...this.value, __regex: mode.extractValue.regex});
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.$on('refreshList', this.refreshList);
|
||||
@@ -505,7 +507,7 @@ export default mixins(debounceHelper, workflowHelpers, nodeHelpers).extend({
|
||||
return null;
|
||||
},
|
||||
onInputChange(value: string): void {
|
||||
const params: INodeParameterResourceLocator = { value, mode: this.selectedMode };
|
||||
const params: INodeParameterResourceLocator = { __rl: true, value, mode: this.selectedMode };
|
||||
if (this.isListMode) {
|
||||
const resource = this.currentQueryResults.find((resource) => resource.value === value);
|
||||
if (resource && resource.name) {
|
||||
@@ -520,13 +522,13 @@ export default mixins(debounceHelper, workflowHelpers, nodeHelpers).extend({
|
||||
},
|
||||
onModeSelected(value: string): void {
|
||||
if (typeof this.value !== 'object') {
|
||||
this.$emit('input', { value: this.value, mode: value });
|
||||
this.$emit('input', { __rl: true, value: this.value, mode: value });
|
||||
} else if (value === 'url' && this.value && this.value.cachedResultUrl) {
|
||||
this.$emit('input', { mode: value, value: this.value.cachedResultUrl });
|
||||
this.$emit('input', { __rl: true, mode: value, value: this.value.cachedResultUrl });
|
||||
} else if (value === 'id' && this.selectedMode === 'list' && this.value && this.value.value) {
|
||||
this.$emit('input', { mode: value, value: this.value.value });
|
||||
this.$emit('input', { __rl: true, mode: value, value: this.value.value });
|
||||
} else {
|
||||
this.$emit('input', { mode: value, value: '' });
|
||||
this.$emit('input', { __rl: true, mode: value, value: '' });
|
||||
}
|
||||
|
||||
this.trackEvent('User changed resource locator mode', { mode: value });
|
||||
@@ -657,7 +659,7 @@ export default mixins(debounceHelper, workflowHelpers, nodeHelpers).extend({
|
||||
}
|
||||
|
||||
if (mode) {
|
||||
this.$emit('input', { value: ((this.value && typeof this.value === 'object')? this.value.value: ''), mode: mode.name });
|
||||
this.$emit('input', { __rl: true, value: ((this.value && typeof this.value === 'object')? this.value.value: ''), mode: mode.name });
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user