Jira retrieve all projects (#1140)

Fixes #1138
This commit is contained in:
Ricardo Espinoza 2020-11-10 01:43:39 -05:00 committed by GitHub
parent c6f21804d7
commit ad6155068e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View file

@ -73,7 +73,7 @@ export async function jiraSoftwareCloudApiRequest(this: IHookFunctions | IExecut
}
}
export async function jiraSoftwareCloudApiRequestAllItems(this: IHookFunctions | IExecuteFunctions, propertyName: string, endpoint: string, method: string, body: any = {}, query: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
export async function jiraSoftwareCloudApiRequestAllItems(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, propertyName: string, endpoint: string, method: string, body: any = {}, query: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
const returnData: IDataObject[] = [];

View file

@ -112,12 +112,16 @@ export class Jira implements INodeType {
async getProjects(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
const returnData: INodePropertyOptions[] = [];
const jiraVersion = this.getCurrentNodeParameter('jiraVersion') as string;
let endpoint = '';
let projects;
let endpoint = '/api/2/project/search';
if (jiraVersion === 'server') {
endpoint = '/api/2/project';
projects = await jiraSoftwareCloudApiRequest.call(this, endpoint, 'GET');
} else {
endpoint = '/api/2/project/search';
projects = await jiraSoftwareCloudApiRequestAllItems.call(this, 'values', endpoint, 'GET');
}
let projects = await jiraSoftwareCloudApiRequest.call(this, endpoint, 'GET');
if (projects.values && Array.isArray(projects.values)) {
projects = projects.values;