mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
⚡ Fix marking as required after cred deletion
This commit is contained in:
parent
9b3e9a27b5
commit
bd02a6127e
|
@ -210,6 +210,10 @@ export const nodeHelpers = mixins(
|
||||||
nodeCredentialType: string;
|
nodeCredentialType: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For HTTP Request node, report missing credential if no selected credential
|
||||||
|
* or if no selected credentials of the chosen generic auth type.
|
||||||
|
*/
|
||||||
if (
|
if (
|
||||||
node.type === HTTP_REQUEST_NODE_TYPE &&
|
node.type === HTTP_REQUEST_NODE_TYPE &&
|
||||||
node.typeVersion === 2 &&
|
node.typeVersion === 2 &&
|
||||||
|
@ -228,6 +232,39 @@ export const nodeHelpers = mixins(
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For HTTP Request node, report missing credential if no selected credential
|
||||||
|
* and if ID of chosen credential ID does not match ID in DB, so it was deleted.
|
||||||
|
*/
|
||||||
|
if (
|
||||||
|
node.type === HTTP_REQUEST_NODE_TYPE &&
|
||||||
|
node.typeVersion === 2 &&
|
||||||
|
authenticateWith === 'nodeCredential' &&
|
||||||
|
nodeCredentialType !== '' &&
|
||||||
|
node.credentials !== undefined
|
||||||
|
) {
|
||||||
|
const credentialType = this.getCredentialTypeByName(nodeCredentialType);
|
||||||
|
|
||||||
|
const dbCredentialsForType: ICredentialsResponse[] | null = this.$store.getters['credentials/getCredentialsByType'](nodeCredentialType);
|
||||||
|
|
||||||
|
const selectedCredentials = node.credentials[nodeCredentialType];
|
||||||
|
|
||||||
|
if (dbCredentialsForType !== null) {
|
||||||
|
const idMatch = dbCredentialsForType.find((c) => c.id === selectedCredentials.id);
|
||||||
|
if (!idMatch) {
|
||||||
|
return {
|
||||||
|
credentials: {
|
||||||
|
[credentialType.name]: [`Credentials for "${credentialType.displayName}" are not set.`],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For HTTP Request node, report missing credential if no selected credential
|
||||||
|
* or if no selected credentials of the chosen node credential type.
|
||||||
|
*/
|
||||||
if (
|
if (
|
||||||
node.type === HTTP_REQUEST_NODE_TYPE &&
|
node.type === HTTP_REQUEST_NODE_TYPE &&
|
||||||
node.typeVersion === 2 &&
|
node.typeVersion === 2 &&
|
||||||
|
|
Loading…
Reference in a new issue