diff --git a/packages/editor-ui/src/components/NodeCredentials.vue b/packages/editor-ui/src/components/NodeCredentials.vue index 5f2562042133f..1d236f6a2b443 100644 --- a/packages/editor-ui/src/components/NodeCredentials.vue +++ b/packages/editor-ui/src/components/NodeCredentials.vue @@ -561,6 +561,7 @@ export default defineComponent({ return !KEEP_AUTH_IN_NDV_FOR_NODES.includes(this.node.type || '') && isRequired; }, getCredentialsFieldLabel(credentialType: INodeCredentialDescription): string { + if (credentialType.displayName) return credentialType.displayName; const credentialTypeName = this.credentialTypeNames[credentialType.name]; const isCredentialOnlyNode = this.node.type.startsWith(CREDENTIAL_ONLY_NODE_PREFIX); diff --git a/packages/nodes-base/nodes/Jira/JiraTrigger.node.ts b/packages/nodes-base/nodes/Jira/JiraTrigger.node.ts index 8a2e1113d4456..bfd869f7d20e8 100644 --- a/packages/nodes-base/nodes/Jira/JiraTrigger.node.ts +++ b/packages/nodes-base/nodes/Jira/JiraTrigger.node.ts @@ -17,7 +17,7 @@ export class JiraTrigger implements INodeType { name: 'jiraTrigger', icon: 'file:jira.svg', group: ['trigger'], - version: 1, + version: [1, 1.1], description: 'Starts the workflow when Jira events occur', defaults: { name: 'Jira Trigger', @@ -26,6 +26,7 @@ export class JiraTrigger implements INodeType { outputs: ['main'], credentials: [ { + displayName: 'Credentials to Connect to Jira', name: 'jiraSoftwareCloudApi', required: true, displayOptions: { @@ -35,6 +36,7 @@ export class JiraTrigger implements INodeType { }, }, { + displayName: 'Credentials to Connect to Jira', name: 'jiraSoftwareServerApi', required: true, displayOptions: { @@ -46,7 +48,17 @@ export class JiraTrigger implements INodeType { { // eslint-disable-next-line n8n-nodes-base/node-class-description-credentials-name-unsuffixed name: 'httpQueryAuth', - required: true, + displayName: 'Credentials to Authenticate Webhook', + displayOptions: { + show: { + authenticateWebhook: [true], + }, + }, + }, + { + // eslint-disable-next-line n8n-nodes-base/node-class-description-credentials-name-unsuffixed + name: 'httpQueryAuth', + displayName: 'Credentials to Authenticate Webhook', displayOptions: { show: { incomingAuthentication: ['queryAuth'], @@ -80,7 +92,20 @@ export class JiraTrigger implements INodeType { default: 'cloud', }, { - displayName: 'Incoming Authentication', + displayName: 'Authenticate Incoming Webhook', + name: 'authenticateWebhook', + type: 'boolean', + default: false, + description: + 'Whether authentication should be activated for the incoming webhooks (makes it more secure)', + displayOptions: { + show: { + '@version': [{ _cnd: { gte: 1.1 } }], + }, + }, + }, + { + displayName: 'Authenticate Webhook With', name: 'incomingAuthentication', type: 'options', options: [ @@ -95,6 +120,11 @@ export class JiraTrigger implements INodeType { ], default: 'none', description: 'If authentication should be activated for the webhook (makes it more secure)', + displayOptions: { + show: { + '@version': [1], + }, + }, }, { displayName: 'Events', @@ -382,17 +412,24 @@ export class JiraTrigger implements INodeType { return false; }, async create(this: IHookFunctions): Promise { + const nodeVersion = this.getNode().typeVersion; const webhookUrl = this.getNodeWebhookUrl('default') as string; - let events = this.getNodeParameter('events', []) as string[]; - const additionalFields = this.getNodeParameter('additionalFields') as IDataObject; - const endpoint = '/webhooks/1.0/webhook'; - const webhookData = this.getWorkflowStaticData('node'); - const incomingAuthentication = this.getNodeParameter('incomingAuthentication') as string; + let authenticateWebhook = false; + + if (nodeVersion === 1) { + const incomingAuthentication = this.getNodeParameter('incomingAuthentication') as string; + + if (incomingAuthentication === 'queryAuth') { + authenticateWebhook = true; + } + } else { + authenticateWebhook = this.getNodeParameter('authenticateWebhook') as boolean; + } if (events.includes('*')) { events = allEvents; @@ -418,7 +455,7 @@ export class JiraTrigger implements INodeType { const parameters: any = {}; - if (incomingAuthentication === 'queryAuth') { + if (authenticateWebhook) { let httpQueryAuth; try { httpQueryAuth = await this.getCredentials('httpQueryAuth'); @@ -477,13 +514,24 @@ export class JiraTrigger implements INodeType { }; async webhook(this: IWebhookFunctions): Promise { + const nodeVersion = this.getNode().typeVersion; const bodyData = this.getBodyData(); const queryData = this.getQueryData() as IDataObject; const response = this.getResponseObject(); - const incomingAuthentication = this.getNodeParameter('incomingAuthentication') as string; + let authenticateWebhook = false; + + if (nodeVersion === 1) { + const incomingAuthentication = this.getNodeParameter('incomingAuthentication') as string; + + if (incomingAuthentication === 'queryAuth') { + authenticateWebhook = true; + } + } else { + authenticateWebhook = this.getNodeParameter('authenticateWebhook') as boolean; + } - if (incomingAuthentication === 'queryAuth') { + if (authenticateWebhook) { let httpQueryAuth: ICredentialDataDecryptedObject | undefined; try { diff --git a/packages/workflow/src/Interfaces.ts b/packages/workflow/src/Interfaces.ts index 362fb5347e237..47db8ff5c30a9 100644 --- a/packages/workflow/src/Interfaces.ts +++ b/packages/workflow/src/Interfaces.ts @@ -1487,6 +1487,7 @@ export interface INodeCredentialTestRequest { export interface INodeCredentialDescription { name: string; required?: boolean; + displayName?: string; displayOptions?: ICredentialsDisplayOptions; testedBy?: ICredentialTestRequest | string; // Name of a function inside `loadOptions.credentialTest` }