Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SpaceID in Create Work Item for Kitemaker #2579

Merged
merged 1 commit into from
Dec 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion packages/nodes-base/nodes/Kitemaker/Kitemaker.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,16 @@ export class Kitemaker implements INodeType {
},

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 { data: { organization: { spaces } } } = responseData;
const space = spaces.find((e: { [x: string]: string; }) => e.id == spaceId)
ivov marked this conversation as resolved.
Show resolved Hide resolved

return createLoadOptions(spaces[0].statuses);
return createLoadOptions(space.statuses);
},

async getUsers(this: ILoadOptionsFunctions) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
name: 'statusId',
type: 'options',
typeOptions: {
loadOptionsDependsOn: ['spaceId'],
loadOptionsMethod: 'getStatuses',
},
default: [],
Expand Down
1 change: 1 addition & 0 deletions packages/nodes-base/nodes/Kitemaker/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export const getStatuses = `
query {
organization {
spaces {
id
statuses {
id
name
Expand Down