1
1
mirror of https://github.com/n8n-io/n8n.git synced 2024-11-11 12:26:30 +03:00

Small improvements on Jira-Node

This commit is contained in:
Jan Oberhauser 2020-02-06 19:03:29 -08:00
parent 9fbf6b4307
commit 201dd95c90
4 changed files with 67 additions and 65 deletions

View File

@ -24,6 +24,7 @@ export class JiraSoftwareCloudApi implements ICredentialType {
name: 'domain',
type: 'string' as NodePropertyTypes,
default: '',
placeholder: 'https://example.atlassian.net',
},
];
}

View File

@ -27,6 +27,7 @@ export class JiraSoftwareServerApi implements ICredentialType {
name: 'domain',
type: 'string' as NodePropertyTypes,
default: '',
placeholder: 'https://example.com',
},
];
}

View File

@ -2,10 +2,9 @@ import { OptionsWithUri } from 'request';
import {
IExecuteFunctions,
IExecuteSingleFunctions,
IHookFunctions,
ILoadOptionsFunctions,
IExecuteSingleFunctions,
BINARY_ENCODING
} from 'n8n-core';
import {
@ -16,21 +15,22 @@ export async function jiraSoftwareCloudApiRequest(this: IHookFunctions | IExecut
let data; let domain;
const jiraCloudCredentials = this.getCredentials('jiraSoftwareCloudApi');
const jiraServerCredentials = this.getCredentials('jiraSoftwareServerApi');
if (jiraCloudCredentials === undefined
&& jiraServerCredentials === undefined) {
if (jiraCloudCredentials === undefined && jiraServerCredentials === undefined) {
throw new Error('No credentials got returned!');
}
if (jiraCloudCredentials !== undefined) {
domain = jiraCloudCredentials!.domain;
data = Buffer.from(`${jiraCloudCredentials!.email}:${jiraCloudCredentials!.apiToken}`).toString(BINARY_ENCODING);
data = Buffer.from(`${jiraCloudCredentials!.email}:${jiraCloudCredentials!.apiToken}`).toString('base64');
} else {
domain = jiraServerCredentials!.domain;
data = Buffer.from(`${jiraServerCredentials!.email}:${jiraServerCredentials!.password}`).toString(BINARY_ENCODING);
data = Buffer.from(`${jiraServerCredentials!.email}:${jiraServerCredentials!.password}`).toString('base64');
}
const headerWithAuthentication = Object.assign({},
{ Authorization: `Basic ${data}`, Accept: 'application/json', 'Content-Type': 'application/json' });
const options: OptionsWithUri = {
headers: headerWithAuthentication,
headers: {
Authorization: `Basic ${data}`,
Accept: 'application/json',
'Content-Type': 'application/json',
},
method,
qs: query,
uri: uri || `${domain}/rest/api/2${endpoint}`,

View File

@ -518,14 +518,53 @@ export const issueFields = [
default: {},
options: [
{
displayName: ' JQL',
name: 'jql',
type: 'string',
displayName: 'Expand',
name: 'expand',
type: 'options',
default: '',
typeOptions: {
alwaysOpenEditWindow: true,
},
description: 'A JQL expression.',
options: [
{
name: 'Changelog',
value: 'changelog',
description: 'Returns a list of recent updates to an issue, sorted by date, starting from the most recent.',
},
{
name: 'Editmeta',
value: 'editmeta',
description: 'Returns information about how each field can be edited',
},
{
name: 'Names',
value: 'names',
description: 'Returns the display name of each field',
},
{
name: 'Operations',
value: 'operations',
description: 'Returns all possible operations for the issue.',
},
{
name: 'Rendered Fields',
value: 'renderedFields',
description: ' Returns field values rendered in HTML format.',
},
{
name: 'Schema',
value: 'schema',
description: 'Returns the schema describing a field type.',
},
{
name: 'Transitions',
value: 'transitions',
description: ' Returns all possible transitions for the issue.',
},
{
name: 'Versioned Representations',
value: 'versionedRepresentations',
description: `JSON array containing each version of a field's value`,
},
],
description: `Use expand to include additional information about issues in the response`,
},
{
displayName: 'Fields',
@ -537,55 +576,6 @@ export const issueFields = [
*navigable Returns navigable fields.<br/>
Any issue field, prefixed with a minus to exclude.<br/>`,
},
{
displayName: 'Expand',
name: 'expand',
type: 'options',
default: '',
options: [
{
name: 'Rendered Fields',
valie: 'renderedFields',
description: ' Returns field values rendered in HTML format.',
},
{
name: 'Names',
valie: 'names',
description: 'Returns the display name of each field',
},
{
name: 'Schema',
valie: 'schema',
description: 'Returns the schema describing a field type.',
},
{
name: 'Transitions',
valie: 'transitions',
description: ' Returns all possible transitions for the issue.',
},
{
name: 'Operations',
valie: 'operations',
description: 'Returns all possible operations for the issue.',
},
{
name: 'Editmeta',
valie: 'editmeta',
description: 'Returns information about how each field can be edited',
},
{
name: 'Changelog',
valie: 'changelog',
description: 'Returns a list of recent updates to an issue, sorted by date, starting from the most recent.',
},
{
name: 'Versioned Representations',
valie: 'versionedRepresentations',
description: `JSON array containing each version of a field's value`,
},
],
description: `Use expand to include additional information about issues in the response`,
},
{
displayName: 'Fields By Key',
name: 'fieldsByKey',
@ -596,6 +586,16 @@ export const issueFields = [
This parameter is useful where fields have been added by a connect app and a field's key<br/>
may differ from its ID.`,
},
{
displayName: ' JQL',
name: 'jql',
type: 'string',
default: '',
typeOptions: {
alwaysOpenEditWindow: true,
},
description: 'A JQL expression.',
},
],
},
/* -------------------------------------------------------------------------- */