mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-21 02:56:40 -08:00
⚡ Add components parameter to Jira (#2428)
This commit is contained in:
parent
b31820e7a0
commit
c574a0d20d
|
@ -164,6 +164,18 @@ export const issueFields = [
|
|||
default: '',
|
||||
description: 'Description',
|
||||
},
|
||||
{
|
||||
displayName: 'Components',
|
||||
name: 'componentIds',
|
||||
type: 'multiOptions',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getProjectComponents',
|
||||
loadOptionsDependsOn: [
|
||||
'project',
|
||||
],
|
||||
},
|
||||
default: [],
|
||||
},
|
||||
{
|
||||
displayName: 'Custom Fields',
|
||||
name: 'customFieldsUi',
|
||||
|
|
|
@ -12,6 +12,7 @@ export interface IFields {
|
|||
project?: IDataObject;
|
||||
summary?: string;
|
||||
reporter?: IDataObject;
|
||||
components?: IDataObject[];
|
||||
}
|
||||
|
||||
export interface IIssue {
|
||||
|
|
|
@ -427,6 +427,30 @@ export class Jira implements INodeType {
|
|||
}
|
||||
return returnData;
|
||||
},
|
||||
|
||||
// Get all the components to display them to user so that he can
|
||||
// select them easily
|
||||
async getProjectComponents(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
|
||||
const project = this.getCurrentNodeParameter('project');
|
||||
const { values: components } = await jiraSoftwareCloudApiRequest.call(this, `/api/2/project/${project}/component`, 'GET');
|
||||
|
||||
for (const component of components) {
|
||||
returnData.push({
|
||||
name: component.name,
|
||||
value: component.id,
|
||||
});
|
||||
}
|
||||
|
||||
returnData.sort((a, b) => {
|
||||
if (a.name < b.name) { return -1; }
|
||||
if (a.name > b.name) { return 1; }
|
||||
return 0;
|
||||
});
|
||||
|
||||
return returnData;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -492,6 +516,9 @@ export class Jira implements INodeType {
|
|||
if (additionalFields.updateHistory) {
|
||||
qs.updateHistory = additionalFields.updateHistory as boolean;
|
||||
}
|
||||
if (additionalFields.componentIds) {
|
||||
fields.components = (additionalFields.componentIds as string[]).map(id => ({ id }));
|
||||
}
|
||||
if (additionalFields.customFieldsUi) {
|
||||
const customFields = (additionalFields.customFieldsUi as IDataObject).customFieldsValues as IDataObject[];
|
||||
if (customFields) {
|
||||
|
|
Loading…
Reference in a new issue