Skip to content

Commit ed98ca2

Browse files
fix(Jira Trigger Node): Update credentials UI (#9198)
1 parent 741e829 commit ed98ca2

File tree

3 files changed

+61
-11
lines changed

3 files changed

+61
-11
lines changed

packages/editor-ui/src/components/NodeCredentials.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,7 @@ export default defineComponent({
561561
return !KEEP_AUTH_IN_NDV_FOR_NODES.includes(this.node.type || '') && isRequired;
562562
},
563563
getCredentialsFieldLabel(credentialType: INodeCredentialDescription): string {
564+
if (credentialType.displayName) return credentialType.displayName;
564565
const credentialTypeName = this.credentialTypeNames[credentialType.name];
565566
const isCredentialOnlyNode = this.node.type.startsWith(CREDENTIAL_ONLY_NODE_PREFIX);
566567

packages/nodes-base/nodes/Jira/JiraTrigger.node.ts

Lines changed: 59 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export class JiraTrigger implements INodeType {
1717
name: 'jiraTrigger',
1818
icon: 'file:jira.svg',
1919
group: ['trigger'],
20-
version: 1,
20+
version: [1, 1.1],
2121
description: 'Starts the workflow when Jira events occur',
2222
defaults: {
2323
name: 'Jira Trigger',
@@ -26,6 +26,7 @@ export class JiraTrigger implements INodeType {
2626
outputs: ['main'],
2727
credentials: [
2828
{
29+
displayName: 'Credentials to Connect to Jira',
2930
name: 'jiraSoftwareCloudApi',
3031
required: true,
3132
displayOptions: {
@@ -35,6 +36,7 @@ export class JiraTrigger implements INodeType {
3536
},
3637
},
3738
{
39+
displayName: 'Credentials to Connect to Jira',
3840
name: 'jiraSoftwareServerApi',
3941
required: true,
4042
displayOptions: {
@@ -46,7 +48,17 @@ export class JiraTrigger implements INodeType {
4648
{
4749
// eslint-disable-next-line n8n-nodes-base/node-class-description-credentials-name-unsuffixed
4850
name: 'httpQueryAuth',
49-
required: true,
51+
displayName: 'Credentials to Authenticate Webhook',
52+
displayOptions: {
53+
show: {
54+
authenticateWebhook: [true],
55+
},
56+
},
57+
},
58+
{
59+
// eslint-disable-next-line n8n-nodes-base/node-class-description-credentials-name-unsuffixed
60+
name: 'httpQueryAuth',
61+
displayName: 'Credentials to Authenticate Webhook',
5062
displayOptions: {
5163
show: {
5264
incomingAuthentication: ['queryAuth'],
@@ -80,7 +92,20 @@ export class JiraTrigger implements INodeType {
8092
default: 'cloud',
8193
},
8294
{
83-
displayName: 'Incoming Authentication',
95+
displayName: 'Authenticate Incoming Webhook',
96+
name: 'authenticateWebhook',
97+
type: 'boolean',
98+
default: false,
99+
description:
100+
'Whether authentication should be activated for the incoming webhooks (makes it more secure)',
101+
displayOptions: {
102+
show: {
103+
'@version': [{ _cnd: { gte: 1.1 } }],
104+
},
105+
},
106+
},
107+
{
108+
displayName: 'Authenticate Webhook With',
84109
name: 'incomingAuthentication',
85110
type: 'options',
86111
options: [
@@ -95,6 +120,11 @@ export class JiraTrigger implements INodeType {
95120
],
96121
default: 'none',
97122
description: 'If authentication should be activated for the webhook (makes it more secure)',
123+
displayOptions: {
124+
show: {
125+
'@version': [1],
126+
},
127+
},
98128
},
99129
{
100130
displayName: 'Events',
@@ -382,17 +412,24 @@ export class JiraTrigger implements INodeType {
382412
return false;
383413
},
384414
async create(this: IHookFunctions): Promise<boolean> {
415+
const nodeVersion = this.getNode().typeVersion;
385416
const webhookUrl = this.getNodeWebhookUrl('default') as string;
386-
387417
let events = this.getNodeParameter('events', []) as string[];
388-
389418
const additionalFields = this.getNodeParameter('additionalFields') as IDataObject;
390-
391419
const endpoint = '/webhooks/1.0/webhook';
392-
393420
const webhookData = this.getWorkflowStaticData('node');
394421

395-
const incomingAuthentication = this.getNodeParameter('incomingAuthentication') as string;
422+
let authenticateWebhook = false;
423+
424+
if (nodeVersion === 1) {
425+
const incomingAuthentication = this.getNodeParameter('incomingAuthentication') as string;
426+
427+
if (incomingAuthentication === 'queryAuth') {
428+
authenticateWebhook = true;
429+
}
430+
} else {
431+
authenticateWebhook = this.getNodeParameter('authenticateWebhook') as boolean;
432+
}
396433

397434
if (events.includes('*')) {
398435
events = allEvents;
@@ -418,7 +455,7 @@ export class JiraTrigger implements INodeType {
418455

419456
const parameters: any = {};
420457

421-
if (incomingAuthentication === 'queryAuth') {
458+
if (authenticateWebhook) {
422459
let httpQueryAuth;
423460
try {
424461
httpQueryAuth = await this.getCredentials('httpQueryAuth');
@@ -477,13 +514,24 @@ export class JiraTrigger implements INodeType {
477514
};
478515

479516
async webhook(this: IWebhookFunctions): Promise<IWebhookResponseData> {
517+
const nodeVersion = this.getNode().typeVersion;
480518
const bodyData = this.getBodyData();
481519
const queryData = this.getQueryData() as IDataObject;
482520
const response = this.getResponseObject();
483521

484-
const incomingAuthentication = this.getNodeParameter('incomingAuthentication') as string;
522+
let authenticateWebhook = false;
523+
524+
if (nodeVersion === 1) {
525+
const incomingAuthentication = this.getNodeParameter('incomingAuthentication') as string;
526+
527+
if (incomingAuthentication === 'queryAuth') {
528+
authenticateWebhook = true;
529+
}
530+
} else {
531+
authenticateWebhook = this.getNodeParameter('authenticateWebhook') as boolean;
532+
}
485533

486-
if (incomingAuthentication === 'queryAuth') {
534+
if (authenticateWebhook) {
487535
let httpQueryAuth: ICredentialDataDecryptedObject | undefined;
488536

489537
try {

packages/workflow/src/Interfaces.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1487,6 +1487,7 @@ export interface INodeCredentialTestRequest {
14871487
export interface INodeCredentialDescription {
14881488
name: string;
14891489
required?: boolean;
1490+
displayName?: string;
14901491
displayOptions?: ICredentialsDisplayOptions;
14911492
testedBy?: ICredentialTestRequest | string; // Name of a function inside `loadOptions.credentialTest`
14921493
}

0 commit comments

Comments
 (0)