mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34:06 -08:00
Add SpaceID in Create Work Item for Kitemaker
This commit is contained in:
parent
e505eea1bd
commit
902a75bd18
|
@ -119,10 +119,16 @@ export class Kitemaker implements INodeType {
|
||||||
},
|
},
|
||||||
|
|
||||||
async getStatuses(this: ILoadOptionsFunctions) {
|
async getStatuses(this: ILoadOptionsFunctions) {
|
||||||
|
const spaceId = this.getNodeParameter('spaceId', 0) as string;
|
||||||
|
if (!spaceId.length) {
|
||||||
|
throw new Error('Please choose a space to set for the work item to create.');
|
||||||
|
}
|
||||||
|
|
||||||
const responseData = await kitemakerRequest.call(this, { query: getStatuses });
|
const responseData = await kitemakerRequest.call(this, { query: getStatuses });
|
||||||
const { data: { organization: { spaces } } } = responseData;
|
const { data: { organization: { spaces } } } = responseData;
|
||||||
|
const space = spaces.find((e: { [x: string]: string; }) => e.id == spaceId)
|
||||||
|
|
||||||
return createLoadOptions(spaces[0].statuses);
|
return createLoadOptions(space.statuses);
|
||||||
},
|
},
|
||||||
|
|
||||||
async getUsers(this: ILoadOptionsFunctions) {
|
async getUsers(this: ILoadOptionsFunctions) {
|
||||||
|
|
|
@ -59,11 +59,33 @@ export const workItemFields: INodeProperties[] = [
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Space ID',
|
||||||
|
name: 'spaceId',
|
||||||
|
type: 'options',
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getSpaces',
|
||||||
|
},
|
||||||
|
default: [],
|
||||||
|
required: true,
|
||||||
|
description: 'ID of the space to retrieve the work items from.',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'workItem',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'create',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Status ID',
|
displayName: 'Status ID',
|
||||||
name: 'statusId',
|
name: 'statusId',
|
||||||
type: 'options',
|
type: 'options',
|
||||||
typeOptions: {
|
typeOptions: {
|
||||||
|
loadOptionsDependsOn: ['spaceId'],
|
||||||
loadOptionsMethod: 'getStatuses',
|
loadOptionsMethod: 'getStatuses',
|
||||||
},
|
},
|
||||||
default: [],
|
default: [],
|
||||||
|
|
|
@ -84,6 +84,7 @@ export const getStatuses = `
|
||||||
query {
|
query {
|
||||||
organization {
|
organization {
|
||||||
spaces {
|
spaces {
|
||||||
|
id
|
||||||
statuses {
|
statuses {
|
||||||
id
|
id
|
||||||
name
|
name
|
||||||
|
|
Loading…
Reference in a new issue