simplify to just auth

This commit is contained in:
Mutasem 2022-10-13 15:23:13 +02:00
parent 0eb98f4a86
commit 042c9cc30f

View file

@ -1393,7 +1393,6 @@ export default mixins(
await this.loadNodesProperties([newNodeData].map(node => ({name: node.type, version: node.typeVersion})));
const nodeType = this.$store.getters['nodeTypes/getNodeType'](newNodeData.type, newNodeData.typeVersion) as INodeTypeDescription;
const nodeParameters = NodeHelpers.getNodeParameters(nodeType.properties, {}, true, false, newNodeData);
if (nodeTypeData.credentials) {
const authentication = nodeTypeData.credentials.find(type => type.name === defaultCredential.type);
@ -1407,25 +1406,21 @@ export default mixins(
return newNodeData;
}
// ignore complex case when there's multiple dependencies
if (Object.keys(authDisplayOptions).length === 1 && authDisplayOptions['authentication']) {
// ignore complex case when there's multiple dependencies
const authProperty = (nodeType.properties || []).find((property) => property.name === 'authentication');
// ignore complex case when auth has dependencies
if (authProperty?.displayOptions) {
return newNodeData;
}
newNodeData.credentials = credentials;
let parameters: { [key:string]: string } = {};
for (const displayOption of Object.keys(authDisplayOptions)) {
if (nodeParameters && !nodeParameters[displayOption]) {
parameters = {};
newNodeData.credentials = undefined;
break;
}
const optionValue = get(authentication, `displayOptions.show[${displayOption}][0]`);
if (optionValue) {
parameters[displayOption] = optionValue;
}
newNodeData.parameters = {
...newNodeData.parameters,
...parameters,
};
// set authentication parameter value
const optionValue = authDisplayOptions?.authentication[0];
if (optionValue) {
newNodeData.parameters.authentication = optionValue;
}
}
}