mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-14 13:00:33 +03:00
⚡ Small improvements on Jira-Node
This commit is contained in:
parent
9fbf6b4307
commit
201dd95c90
@ -24,6 +24,7 @@ export class JiraSoftwareCloudApi implements ICredentialType {
|
|||||||
name: 'domain',
|
name: 'domain',
|
||||||
type: 'string' as NodePropertyTypes,
|
type: 'string' as NodePropertyTypes,
|
||||||
default: '',
|
default: '',
|
||||||
|
placeholder: 'https://example.atlassian.net',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ export class JiraSoftwareServerApi implements ICredentialType {
|
|||||||
name: 'domain',
|
name: 'domain',
|
||||||
type: 'string' as NodePropertyTypes,
|
type: 'string' as NodePropertyTypes,
|
||||||
default: '',
|
default: '',
|
||||||
|
placeholder: 'https://example.com',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,9 @@ import { OptionsWithUri } from 'request';
|
|||||||
|
|
||||||
import {
|
import {
|
||||||
IExecuteFunctions,
|
IExecuteFunctions,
|
||||||
|
IExecuteSingleFunctions,
|
||||||
IHookFunctions,
|
IHookFunctions,
|
||||||
ILoadOptionsFunctions,
|
ILoadOptionsFunctions,
|
||||||
IExecuteSingleFunctions,
|
|
||||||
BINARY_ENCODING
|
|
||||||
} from 'n8n-core';
|
} from 'n8n-core';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@ -16,21 +15,22 @@ export async function jiraSoftwareCloudApiRequest(this: IHookFunctions | IExecut
|
|||||||
let data; let domain;
|
let data; let domain;
|
||||||
const jiraCloudCredentials = this.getCredentials('jiraSoftwareCloudApi');
|
const jiraCloudCredentials = this.getCredentials('jiraSoftwareCloudApi');
|
||||||
const jiraServerCredentials = this.getCredentials('jiraSoftwareServerApi');
|
const jiraServerCredentials = this.getCredentials('jiraSoftwareServerApi');
|
||||||
if (jiraCloudCredentials === undefined
|
if (jiraCloudCredentials === undefined && jiraServerCredentials === undefined) {
|
||||||
&& jiraServerCredentials === undefined) {
|
|
||||||
throw new Error('No credentials got returned!');
|
throw new Error('No credentials got returned!');
|
||||||
}
|
}
|
||||||
if (jiraCloudCredentials !== undefined) {
|
if (jiraCloudCredentials !== undefined) {
|
||||||
domain = jiraCloudCredentials!.domain;
|
domain = jiraCloudCredentials!.domain;
|
||||||
data = Buffer.from(`${jiraCloudCredentials!.email}:${jiraCloudCredentials!.apiToken}`).toString(BINARY_ENCODING);
|
data = Buffer.from(`${jiraCloudCredentials!.email}:${jiraCloudCredentials!.apiToken}`).toString('base64');
|
||||||
} else {
|
} else {
|
||||||
domain = jiraServerCredentials!.domain;
|
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 = {
|
const options: OptionsWithUri = {
|
||||||
headers: headerWithAuthentication,
|
headers: {
|
||||||
|
Authorization: `Basic ${data}`,
|
||||||
|
Accept: 'application/json',
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
method,
|
method,
|
||||||
qs: query,
|
qs: query,
|
||||||
uri: uri || `${domain}/rest/api/2${endpoint}`,
|
uri: uri || `${domain}/rest/api/2${endpoint}`,
|
||||||
|
@ -518,14 +518,53 @@ export const issueFields = [
|
|||||||
default: {},
|
default: {},
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
displayName: ' JQL',
|
displayName: 'Expand',
|
||||||
name: 'jql',
|
name: 'expand',
|
||||||
type: 'string',
|
type: 'options',
|
||||||
default: '',
|
default: '',
|
||||||
typeOptions: {
|
options: [
|
||||||
alwaysOpenEditWindow: true,
|
{
|
||||||
|
name: 'Changelog',
|
||||||
|
value: 'changelog',
|
||||||
|
description: 'Returns a list of recent updates to an issue, sorted by date, starting from the most recent.',
|
||||||
},
|
},
|
||||||
description: 'A JQL expression.',
|
{
|
||||||
|
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',
|
displayName: 'Fields',
|
||||||
@ -537,55 +576,6 @@ export const issueFields = [
|
|||||||
*navigable Returns navigable fields.<br/>
|
*navigable Returns navigable fields.<br/>
|
||||||
Any issue field, prefixed with a minus to exclude.<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',
|
displayName: 'Fields By Key',
|
||||||
name: 'fieldsByKey',
|
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/>
|
This parameter is useful where fields have been added by a connect app and a field's key<br/>
|
||||||
may differ from its ID.`,
|
may differ from its ID.`,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
displayName: ' JQL',
|
||||||
|
name: 'jql',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
typeOptions: {
|
||||||
|
alwaysOpenEditWindow: true,
|
||||||
|
},
|
||||||
|
description: 'A JQL expression.',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
Loading…
Reference in New Issue
Block a user