✏️ Add i18n to reportUnsetCredential()

This commit is contained in:
Iván Ovejero 2022-05-05 15:21:53 +02:00
parent 43f7e2c8aa
commit 760ef5a32b
2 changed files with 21 additions and 11 deletions

View file

@ -124,6 +124,23 @@ export const nodeHelpers = mixins(
return false; return false;
}, },
reportUnsetCredential(credentialType: ICredentialType) {
return {
credentials: {
[credentialType.name]: [
this.$locale.baseText(
'nodeHelpers.credentialsUnset',
{
interpolate: {
credentialType: credentialType.displayName,
},
},
),
],
},
};
},
// Updates the execution issues. // Updates the execution issues.
updateNodesExecutionIssues () { updateNodesExecutionIssues () {
const nodes = this.$store.getters.allNodes; const nodes = this.$store.getters.allNodes;
@ -219,7 +236,7 @@ export const nodeHelpers = mixins(
selectedCredsAreUnusable(node, genericAuthType) selectedCredsAreUnusable(node, genericAuthType)
) { ) {
const credential = this.getCredentialTypeByName(genericAuthType); const credential = this.getCredentialTypeByName(genericAuthType);
return reportUnsetCredential(credential); return this.reportUnsetCredential(credential);
} }
if ( if (
@ -232,7 +249,7 @@ export const nodeHelpers = mixins(
if (selectedCredsDoNotExist(node, nodeCredentialType, stored)) { if (selectedCredsDoNotExist(node, nodeCredentialType, stored)) {
const credential = this.getCredentialTypeByName(nodeCredentialType); const credential = this.getCredentialTypeByName(nodeCredentialType);
return reportUnsetCredential(credential); return this.reportUnsetCredential(credential);
} }
} }
@ -243,7 +260,7 @@ export const nodeHelpers = mixins(
selectedCredsAreUnusable(node, nodeCredentialType) selectedCredsAreUnusable(node, nodeCredentialType)
) { ) {
const credential = this.getCredentialTypeByName(nodeCredentialType); const credential = this.getCredentialTypeByName(nodeCredentialType);
return reportUnsetCredential(credential); return this.reportUnsetCredential(credential);
} }
for (const credentialTypeDescription of nodeType!.credentials!) { for (const credentialTypeDescription of nodeType!.credentials!) {
@ -469,14 +486,6 @@ function selectedCredsDoNotExist(
return !storedCredsByType.find((c) => c.id === selectedCredsByType.id); return !storedCredsByType.find((c) => c.id === selectedCredsByType.id);
} }
function reportUnsetCredential(credentialType: ICredentialType) {
return {
credentials: {
[credentialType.name]: [`Credentials for "${credentialType.displayName}" are not set.`],
},
};
}
declare namespace HttpRequestNode { declare namespace HttpRequestNode {
namespace V2 { namespace V2 {
type AuthParams = { type AuthParams = {

View file

@ -387,6 +387,7 @@
"nodeErrorView.stack": "Stack", "nodeErrorView.stack": "Stack",
"nodeErrorView.theErrorCauseIsTooLargeToBeDisplayed": "The error cause is too large to be displayed", "nodeErrorView.theErrorCauseIsTooLargeToBeDisplayed": "The error cause is too large to be displayed",
"nodeErrorView.time": "Time", "nodeErrorView.time": "Time",
"nodeHelpers.credentialsUnset": "Credentials for '{credentialType}' are not set.",
"nodeSettings.alwaysOutputData.description": "If active, will output a single, empty item when the output would have been empty. Use to prevent the workflow finishing on this node.", "nodeSettings.alwaysOutputData.description": "If active, will output a single, empty item when the output would have been empty. Use to prevent the workflow finishing on this node.",
"nodeSettings.alwaysOutputData.displayName": "Always Output Data", "nodeSettings.alwaysOutputData.displayName": "Always Output Data",
"nodeSettings.clickOnTheQuestionMarkIcon": "Click the '?' icon to open this node on n8n.io", "nodeSettings.clickOnTheQuestionMarkIcon": "Click the '?' icon to open this node on n8n.io",