mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
n8n-3867-progressively-apply-prettier-to-all (#3873)
* 🔨 formatting nodes with prettier
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
ICredentialsDecrypted,
|
||||
@@ -15,10 +13,7 @@ import {
|
||||
NodeApiError,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
jenkinsApiRequest,
|
||||
tolerateTrailingSlash
|
||||
} from './GenericFunctions';
|
||||
import { jenkinsApiRequest, tolerateTrailingSlash } from './GenericFunctions';
|
||||
|
||||
export type JenkinsApiCredentials = {
|
||||
username: string;
|
||||
@@ -80,9 +75,7 @@ export class Jenkins implements INodeType {
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'job',
|
||||
],
|
||||
resource: ['job'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -116,17 +109,14 @@ export class Jenkins implements INodeType {
|
||||
noDataExpression: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Make sure the job is setup to support triggering with parameters. <a href="https://wiki.jenkins.io/display/JENKINS/Parameterized+Build" target="_blank">More info</a>',
|
||||
displayName:
|
||||
'Make sure the job is setup to support triggering with parameters. <a href="https://wiki.jenkins.io/display/JENKINS/Parameterized+Build" target="_blank">More info</a>',
|
||||
name: 'triggerParamsNotice',
|
||||
type: 'notice',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'job',
|
||||
],
|
||||
operation: [
|
||||
'triggerParams',
|
||||
],
|
||||
resource: ['job'],
|
||||
operation: ['triggerParams'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -140,19 +130,14 @@ export class Jenkins implements INodeType {
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'job',
|
||||
],
|
||||
operation: [
|
||||
'trigger',
|
||||
'triggerParams',
|
||||
'copy',
|
||||
],
|
||||
resource: ['job'],
|
||||
operation: ['trigger', 'triggerParams', 'copy'],
|
||||
},
|
||||
},
|
||||
required: true,
|
||||
default: '',
|
||||
description: 'Name of the job. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'Name of the job. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------
|
||||
@@ -165,12 +150,8 @@ export class Jenkins implements INodeType {
|
||||
placeholder: 'Add Parameter',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'job',
|
||||
],
|
||||
operation: [
|
||||
'triggerParams',
|
||||
],
|
||||
resource: ['job'],
|
||||
operation: ['triggerParams'],
|
||||
},
|
||||
},
|
||||
required: true,
|
||||
@@ -187,12 +168,11 @@ export class Jenkins implements INodeType {
|
||||
displayName: 'Name or ID',
|
||||
name: 'name',
|
||||
type: 'options',
|
||||
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getJobParameters',
|
||||
loadOptionsDependsOn: [
|
||||
'job',
|
||||
],
|
||||
loadOptionsDependsOn: ['job'],
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
@@ -217,13 +197,8 @@ export class Jenkins implements INodeType {
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'job',
|
||||
],
|
||||
operation: [
|
||||
'copy',
|
||||
'create',
|
||||
],
|
||||
resource: ['job'],
|
||||
operation: ['copy', 'create'],
|
||||
},
|
||||
},
|
||||
required: true,
|
||||
@@ -239,12 +214,8 @@ export class Jenkins implements INodeType {
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'job',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['job'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
required: true,
|
||||
@@ -252,18 +223,15 @@ export class Jenkins implements INodeType {
|
||||
description: 'XML of Jenkins config',
|
||||
},
|
||||
{
|
||||
displayName: 'To get the XML of an existing job, add ‘config.xml’ to the end of the job URL',
|
||||
displayName:
|
||||
'To get the XML of an existing job, add ‘config.xml’ to the end of the job URL',
|
||||
name: 'createNotice',
|
||||
type: 'notice',
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'job',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['job'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -277,9 +245,7 @@ export class Jenkins implements INodeType {
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'instance',
|
||||
],
|
||||
resource: ['instance'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -292,7 +258,8 @@ export class Jenkins implements INodeType {
|
||||
{
|
||||
name: 'Quiet Down',
|
||||
value: 'quietDown',
|
||||
description: 'Put Jenkins in quiet mode, no builds can be started, Jenkins is ready for shutdown',
|
||||
description:
|
||||
'Put Jenkins in quiet mode, no builds can be started, Jenkins is ready for shutdown',
|
||||
action: 'Quiet Down an instance',
|
||||
},
|
||||
{
|
||||
@@ -304,7 +271,8 @@ export class Jenkins implements INodeType {
|
||||
{
|
||||
name: 'Safely Restart',
|
||||
value: 'safeRestart',
|
||||
description: 'Restart Jenkins once no jobs are running on environments where it is possible',
|
||||
description:
|
||||
'Restart Jenkins once no jobs are running on environments where it is possible',
|
||||
action: 'Safely Restart an instance',
|
||||
},
|
||||
{
|
||||
@@ -330,27 +298,22 @@ export class Jenkins implements INodeType {
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'instance',
|
||||
],
|
||||
operation: [
|
||||
'quietDown',
|
||||
],
|
||||
resource: ['instance'],
|
||||
operation: ['quietDown'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'Freeform reason for quiet down mode',
|
||||
},
|
||||
{
|
||||
displayName: 'Instance operation can shutdown Jenkins instance and make it unresponsive. Some commands may not be available depending on instance implementation.',
|
||||
displayName:
|
||||
'Instance operation can shutdown Jenkins instance and make it unresponsive. Some commands may not be available depending on instance implementation.',
|
||||
name: 'instanceNotice',
|
||||
type: 'notice',
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'instance',
|
||||
],
|
||||
resource: ['instance'],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -364,9 +327,7 @@ export class Jenkins implements INodeType {
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'build',
|
||||
],
|
||||
resource: ['build'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -389,17 +350,14 @@ export class Jenkins implements INodeType {
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'build',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: ['build'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
required: true,
|
||||
default: '',
|
||||
description: 'Name of the job. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'Name of the job. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Return All',
|
||||
@@ -408,12 +366,8 @@ export class Jenkins implements INodeType {
|
||||
default: false,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'build',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: ['build'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
description: 'Whether to return all results or only up to a given limit',
|
||||
@@ -428,15 +382,9 @@ export class Jenkins implements INodeType {
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'build',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
resource: ['build'],
|
||||
operation: ['getAll'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
description: 'Max number of results to return',
|
||||
@@ -493,8 +441,12 @@ export class Jenkins implements INodeType {
|
||||
});
|
||||
}
|
||||
returnData.sort((a, b) => {
|
||||
if (a.name < b.name) { return -1; }
|
||||
if (a.name > b.name) { return 1; }
|
||||
if (a.name < b.name) {
|
||||
return -1;
|
||||
}
|
||||
if (a.name > b.name) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
|
||||
@@ -516,8 +468,12 @@ export class Jenkins implements INodeType {
|
||||
}
|
||||
}
|
||||
returnData.sort((a, b) => {
|
||||
if (a.name < b.name) { return -1; }
|
||||
if (a.name > b.name) { return 1; }
|
||||
if (a.name < b.name) {
|
||||
return -1;
|
||||
}
|
||||
if (a.name > b.name) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
|
||||
@@ -554,7 +510,12 @@ export class Jenkins implements INodeType {
|
||||
}, {});
|
||||
}
|
||||
const endpoint = `/job/${job}/buildWithParameters`;
|
||||
await jenkinsApiRequest.call(this, 'POST', endpoint, {}, {},
|
||||
await jenkinsApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
endpoint,
|
||||
{},
|
||||
{},
|
||||
{
|
||||
form: body,
|
||||
headers: {
|
||||
@@ -577,8 +538,7 @@ export class Jenkins implements INodeType {
|
||||
try {
|
||||
await jenkinsApiRequest.call(this, 'POST', endpoint, queryParams);
|
||||
responseData = { success: true };
|
||||
}
|
||||
catch (error) {
|
||||
} catch (error) {
|
||||
if (error.httpCode === '302') {
|
||||
responseData = { success: true };
|
||||
} else {
|
||||
@@ -598,7 +558,10 @@ export class Jenkins implements INodeType {
|
||||
const body = this.getNodeParameter('xml', i) as string;
|
||||
|
||||
const endpoint = `/createItem`;
|
||||
await jenkinsApiRequest.call(this, 'POST', endpoint, queryParams, body, { headers, json: false });
|
||||
await jenkinsApiRequest.call(this, 'POST', endpoint, queryParams, body, {
|
||||
headers,
|
||||
json: false,
|
||||
});
|
||||
responseData = { success: true };
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user