mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
fix(Linear Node): Fix issue with Issue States not loading correctly (#5435)
This commit is contained in:
parent
32de081b0c
commit
57a2b9cceb
|
@ -134,11 +134,38 @@ export class Linear implements INodeType {
|
||||||
return returnData;
|
return returnData;
|
||||||
},
|
},
|
||||||
async getStates(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
async getStates(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||||
|
let teamId = this.getNodeParameter('teamId', null) as string;
|
||||||
|
// Handle Updates
|
||||||
|
if (!teamId) {
|
||||||
|
const updateFields = this.getNodeParameter('updateFields', null) as IDataObject;
|
||||||
|
// If not updating the team look up the current team
|
||||||
|
if (!updateFields.teamId) {
|
||||||
|
const issueId = this.getNodeParameter('issueId');
|
||||||
|
const body = {
|
||||||
|
query: query.getIssueTeam(),
|
||||||
|
variables: {
|
||||||
|
issueId,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
const responseData = await linearApiRequest.call(this, body);
|
||||||
|
teamId = responseData?.data?.issue?.team?.id;
|
||||||
|
} else {
|
||||||
|
teamId = updateFields.teamId as string;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const returnData: INodePropertyOptions[] = [];
|
const returnData: INodePropertyOptions[] = [];
|
||||||
const body = {
|
const body = {
|
||||||
query: query.getStates(),
|
query: query.getStates(),
|
||||||
variables: {
|
variables: {
|
||||||
$first: 10,
|
$first: 10,
|
||||||
|
filter: {
|
||||||
|
team: {
|
||||||
|
id: {
|
||||||
|
eq: teamId,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
const states = await linearApiRequestAllItems.call(this, 'data.workflowStates', body);
|
const states = await linearApiRequestAllItems.call(this, 'data.workflowStates', body);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
export const query = {
|
export const query = {
|
||||||
getUsers() {
|
getUsers() {
|
||||||
return `query Users ($first: Int){
|
return `query Users ($first: Int, $after: String){
|
||||||
users (first: $first){
|
users (first: $first, after: $after){
|
||||||
nodes {
|
nodes {
|
||||||
id
|
id
|
||||||
name
|
name
|
||||||
|
@ -26,8 +26,8 @@ export const query = {
|
||||||
}}`;
|
}}`;
|
||||||
},
|
},
|
||||||
getStates() {
|
getStates() {
|
||||||
return `query States ($first: Int){
|
return `query States ($first: Int, $after: String, $filter: WorkflowStateFilter){
|
||||||
workflowStates (first: $first){
|
workflowStates (first: $first, after: $after, filter: $filter){
|
||||||
nodes {
|
nodes {
|
||||||
id
|
id
|
||||||
name
|
name
|
||||||
|
@ -121,6 +121,15 @@ export const query = {
|
||||||
}
|
}
|
||||||
}`;
|
}`;
|
||||||
},
|
},
|
||||||
|
getIssueTeam() {
|
||||||
|
return `query Issue($issueId: String!) {
|
||||||
|
issue(id: $issueId) {
|
||||||
|
team {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}`;
|
||||||
|
},
|
||||||
getIssues() {
|
getIssues() {
|
||||||
return `query Issue ($first: Int, $after: String){
|
return `query Issue ($first: Int, $after: String){
|
||||||
issues (first: $first, after: $after){
|
issues (first: $first, after: $after){
|
||||||
|
|
Loading…
Reference in a new issue