Make it possible to define dependencies for loadOptions

This commit is contained in:
Jan Oberhauser
2020-01-04 22:28:09 -06:00
parent f4acd47f80
commit bf4c8bc3a2
5 changed files with 42 additions and 2 deletions

View File

@@ -116,6 +116,7 @@
<script lang="ts">
import Vue from 'vue';
import { get } from 'lodash';
import {
INodeUi,
@@ -206,11 +207,34 @@ export default mixins(
};
},
watch: {
dependentParametersValues () {
// Reload the remote parameters whenever a parameter
// on which the current field depends on changes
this.loadRemoteParameterOptions();
},
value () {
this.tempValue = this.displayValue as string;
},
},
computed: {
dependentParametersValues (): string | null {
const loadOptionsDependsOn = this.getArgument('loadOptionsDependsOn') as string[] | undefined;
if (loadOptionsDependsOn === undefined) {
return null;
}
// Get the resolved parameter values of the current node
const currentNodeParameters = this.$store.getters.activeNode.parameters;
const resolvedNodeParameters = this.getResolveNodeParameters(currentNodeParameters);
let returnValues: string[] = [];
for (const parameterPath of loadOptionsDependsOn) {
returnValues.push(get(resolvedNodeParameters, parameterPath));
}
return returnValues.join('|');
},
node (): INodeUi | null {
if (this.isCredential === true) {
return null;