1
1
mirror of https://github.com/n8n-io/n8n.git synced 2024-09-11 13:15:28 +03:00

Improvements

This commit is contained in:
ricardo 2020-07-06 12:18:36 -04:00
parent 6f51657ef8
commit c4332634eb
3 changed files with 95 additions and 8 deletions

View File

@ -8,7 +8,7 @@ export class CircleCiApi implements ICredentialType {
displayName = 'CircleCI API';
properties = [
{
displayName: 'API Key',
displayName: 'Personal API Token',
name: 'apiKey',
type: 'string' as NodePropertyTypes,
default: '',

View File

@ -71,16 +71,18 @@ export class CircleCi implements INodeType {
for (let i = 0; i < length; i++) {
if (resource === 'pipeline') {
if (operation === 'get') {
const vcs = this.getNodeParameter('vcs', i) as string;
let slug = this.getNodeParameter('projectSlug', i) as string;
const pipelineNumber = this.getNodeParameter('pipelineNumber', i) as number;
slug = slug.replace(new RegExp(/\//g), '%2F');
const endpoint = `/project/${slug}/pipeline/${pipelineNumber}`;
const endpoint = `/project/${vcs}/${slug}/pipeline/${pipelineNumber}`;
responseData = await circleciApiRequest.call(this, 'GET', endpoint, {}, qs);
}
if (operation === 'getAll') {
const vcs = this.getNodeParameter('vcs', i) as string;
const filters = this.getNodeParameter('filters', i) as IDataObject;
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
let slug = this.getNodeParameter('projectSlug', i) as string;
@ -91,7 +93,7 @@ export class CircleCi implements INodeType {
qs.branch = filters.branch;
}
const endpoint = `/project/${slug}/pipeline`;
const endpoint = `/project/${vcs}/${slug}/pipeline`;
if (returnAll === true) {
responseData = await circleciApiRequestAllItems.call(this, 'items', 'GET', endpoint, {}, qs);
@ -105,13 +107,14 @@ export class CircleCi implements INodeType {
}
if (operation === 'trigger') {
const vcs = this.getNodeParameter('vcs', i) as string;
let slug = this.getNodeParameter('projectSlug', i) as string;
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
slug = slug.replace(new RegExp(/\//g), '%2F');
const endpoint = `/project/${slug}/pipeline`;
const endpoint = `/project/${vcs}/${slug}/pipeline`;
const body: IDataObject = {};

View File

@ -41,6 +41,33 @@ export const pipelineFields = [
/* -------------------------------------------------------------------------- */
/* pipeline:get */
/* -------------------------------------------------------------------------- */
{
displayName: 'VCS',
name: 'vcs',
type: 'options',
options: [
{
name: 'Github',
value: 'github',
},
{
name: 'Bitbucket',
value: 'bitbucket',
},
],
displayOptions: {
show: {
operation: [
'get',
],
resource: [
'pipeline',
],
},
},
default: '',
description: 'Version control system',
},
{
displayName: 'Project Slug',
name: 'projectSlug',
@ -56,12 +83,15 @@ export const pipelineFields = [
},
},
default: '',
description: 'Project slug in the form vcs-slug/org-name/repo-name',
description: 'Project slug in the form org-name/repo-name',
},
{
displayName: 'Pipeline Number',
name: 'pipelineNumber',
type: 'number',
typeOptions: {
minValue: 1,
},
displayOptions: {
show: {
operation: [
@ -72,12 +102,39 @@ export const pipelineFields = [
],
},
},
default: 0,
default: 1,
description: 'The number of the pipeline',
},
/* -------------------------------------------------------------------------- */
/* pipeline:getAll */
/* -------------------------------------------------------------------------- */
{
displayName: 'VCS',
name: 'vcs',
type: 'options',
options: [
{
name: 'Github',
value: 'github',
},
{
name: 'Bitbucket',
value: 'bitbucket',
},
],
displayOptions: {
show: {
operation: [
'getAll',
],
resource: [
'pipeline',
],
},
},
default: '',
description: 'Version control system',
},
{
displayName: 'Project Slug',
name: 'projectSlug',
@ -93,7 +150,7 @@ export const pipelineFields = [
},
},
default: '',
description: 'Project slug in the form vcs-slug/org-name/repo-name',
description: 'Project slug in the form org-name/repo-name',
},
{
displayName: 'Return All',
@ -165,6 +222,33 @@ export const pipelineFields = [
/* -------------------------------------------------------------------------- */
/* pipeline:trigger */
/* -------------------------------------------------------------------------- */
{
displayName: 'VCS',
name: 'vcs',
type: 'options',
options: [
{
name: 'Github',
value: 'github',
},
{
name: 'Bitbucket',
value: 'bitbucket',
},
],
displayOptions: {
show: {
operation: [
'trigger',
],
resource: [
'pipeline',
],
},
},
default: '',
description: 'Version control system',
},
{
displayName: 'Project Slug',
name: 'projectSlug',
@ -180,7 +264,7 @@ export const pipelineFields = [
},
},
default: '',
description: 'Project slug in the form vcs-slug/org-name/repo-name',
description: 'Project slug in the form org-name/repo-name',
},
{
displayName: 'Additional Fields',