1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Fix storing subflow credential type when input has multiple types

Fixes #3749
This commit is contained in:
Nick O'Leary 2022-07-11 20:19:48 +01:00 committed by Steve-Mcl
parent 5c5855751c
commit aed2b8e46d

View File

@ -923,6 +923,7 @@ RED.subflow = (function() {
function buildEnvUIRow(row, tenv, ui, node) { function buildEnvUIRow(row, tenv, ui, node) {
console.log(tenv, ui)
ui.label = ui.label||{}; ui.label = ui.label||{};
if ((tenv.type === "cred" || (tenv.parent && tenv.parent.type === "cred")) && !ui.type) { if ((tenv.type === "cred" || (tenv.parent && tenv.parent.type === "cred")) && !ui.type) {
ui.type = "cred"; ui.type = "cred";
@ -983,6 +984,17 @@ RED.subflow = (function() {
default: inputType default: inputType
}) })
input.typedInput('value',val.value) input.typedInput('value',val.value)
if (inputType === 'cred') {
if (node.credentials) {
if (node.credentials[tenv.name]) {
input.typedInput('value', node.credentials[tenv.name]);
} else if (node.credentials['has_'+tenv.name]) {
input.typedInput('value', "__PWRD__")
} else {
input.typedInput('value', "");
}
}
}
} else { } else {
input.val(val.value) input.val(val.value)
} }