mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
Add MondayCom option to add updates to an item. Make options alphabetical.
This commit is contained in:
parent
d2e738b5c7
commit
8e86443bdb
|
@ -15,6 +15,11 @@ export const boardItemOperations = [
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
options: [
|
options: [
|
||||||
|
{
|
||||||
|
name: 'Add Update',
|
||||||
|
value: 'addUpdate',
|
||||||
|
description: `Add an update to an item.`,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'Change Column Value',
|
name: 'Change Column Value',
|
||||||
value: 'changeColumnValue',
|
value: 'changeColumnValue',
|
||||||
|
@ -58,6 +63,192 @@ export const boardItemOperations = [
|
||||||
|
|
||||||
export const boardItemFields = [
|
export const boardItemFields = [
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
/* boardItem:addUpdate */
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
{
|
||||||
|
displayName: 'Item ID',
|
||||||
|
name: 'itemId',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
required: true,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'boardItem',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'addUpdate',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
description: `Item's ID`
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Body',
|
||||||
|
name: 'value',
|
||||||
|
type: 'string',
|
||||||
|
required: true,
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'boardItem',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'addUpdate',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
description: 'The update text',
|
||||||
|
},
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
/* boardItem:changeColumnValue */
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
{
|
||||||
|
displayName: 'Board ID',
|
||||||
|
name: 'boardId',
|
||||||
|
type: 'options',
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getBoards',
|
||||||
|
},
|
||||||
|
default: '',
|
||||||
|
required: true,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'boardItem',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'changeColumnValue',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
description: 'The unique identifier of the board.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Item ID',
|
||||||
|
name: 'itemId',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
required: true,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'boardItem',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'changeColumnValue',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
description: `Item's ID`
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Column ID',
|
||||||
|
name: 'columnId',
|
||||||
|
type: 'options',
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getColumns',
|
||||||
|
loadOptionsDependsOn: [
|
||||||
|
'boardId'
|
||||||
|
],
|
||||||
|
},
|
||||||
|
default: '',
|
||||||
|
required: true,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'boardItem',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'changeColumnValue',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
description: `The column's unique identifier.`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Value',
|
||||||
|
name: 'value',
|
||||||
|
type: 'json',
|
||||||
|
required: true,
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'boardItem',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'changeColumnValue',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
description: 'The column value in JSON format.',
|
||||||
|
},
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
/* boardItem:changeMultipleColumnValues */
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
{
|
||||||
|
displayName: 'Board ID',
|
||||||
|
name: 'boardId',
|
||||||
|
type: 'options',
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getBoards',
|
||||||
|
},
|
||||||
|
default: '',
|
||||||
|
required: true,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'boardItem',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'changeMultipleColumnValues',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
description: 'The unique identifier of the board.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Item ID',
|
||||||
|
name: 'itemId',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
required: true,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'boardItem',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'changeMultipleColumnValues',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
description: `Item's ID`
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Column Values',
|
||||||
|
name: 'columnValues',
|
||||||
|
type: 'json',
|
||||||
|
required: true,
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'boardItem',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'changeMultipleColumnValues',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
description: 'The column fields and values in JSON format.',
|
||||||
|
typeOptions: {
|
||||||
|
alwaysOpenEditWindow: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* boardItem:create */
|
/* boardItem:create */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
@ -387,151 +578,4 @@ export const boardItemFields = [
|
||||||
default: 50,
|
default: 50,
|
||||||
description: 'How many results to return.',
|
description: 'How many results to return.',
|
||||||
},
|
},
|
||||||
/* -------------------------------------------------------------------------- */
|
|
||||||
/* boardItem:changeColumnValue */
|
|
||||||
/* -------------------------------------------------------------------------- */
|
|
||||||
{
|
|
||||||
displayName: 'Board ID',
|
|
||||||
name: 'boardId',
|
|
||||||
type: 'options',
|
|
||||||
typeOptions: {
|
|
||||||
loadOptionsMethod: 'getBoards',
|
|
||||||
},
|
|
||||||
default: '',
|
|
||||||
required: true,
|
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'boardItem',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'changeColumnValue',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
description: 'The unique identifier of the board.',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
displayName: 'Item ID',
|
|
||||||
name: 'itemId',
|
|
||||||
type: 'string',
|
|
||||||
default: '',
|
|
||||||
required: true,
|
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'boardItem',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'changeColumnValue',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
description: `Item's ID`
|
|
||||||
},
|
|
||||||
{
|
|
||||||
displayName: 'Column ID',
|
|
||||||
name: 'columnId',
|
|
||||||
type: 'options',
|
|
||||||
typeOptions: {
|
|
||||||
loadOptionsMethod: 'getColumns',
|
|
||||||
loadOptionsDependsOn: [
|
|
||||||
'boardId'
|
|
||||||
],
|
|
||||||
},
|
|
||||||
default: '',
|
|
||||||
required: true,
|
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'boardItem',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'changeColumnValue',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
description: `The column's unique identifier.`,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
displayName: 'Value',
|
|
||||||
name: 'value',
|
|
||||||
type: 'json',
|
|
||||||
required: true,
|
|
||||||
default: '',
|
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'boardItem',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'changeColumnValue',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
description: 'The column value in JSON format.',
|
|
||||||
},
|
|
||||||
/* -------------------------------------------------------------------------- */
|
|
||||||
/* boardItem:changeMultipleColumnValues */
|
|
||||||
/* -------------------------------------------------------------------------- */
|
|
||||||
{
|
|
||||||
displayName: 'Board ID',
|
|
||||||
name: 'boardId',
|
|
||||||
type: 'options',
|
|
||||||
typeOptions: {
|
|
||||||
loadOptionsMethod: 'getBoards',
|
|
||||||
},
|
|
||||||
default: '',
|
|
||||||
required: true,
|
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'boardItem',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'changeMultipleColumnValues',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
description: 'The unique identifier of the board.',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
displayName: 'Item ID',
|
|
||||||
name: 'itemId',
|
|
||||||
type: 'string',
|
|
||||||
default: '',
|
|
||||||
required: true,
|
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'boardItem',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'changeMultipleColumnValues',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
description: `Item's ID`
|
|
||||||
},
|
|
||||||
{
|
|
||||||
displayName: 'Column Values',
|
|
||||||
name: 'columnValues',
|
|
||||||
type: 'json',
|
|
||||||
required: true,
|
|
||||||
default: '',
|
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'boardItem',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'changeMultipleColumnValues',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
description: 'The column fields and values in JSON format.',
|
|
||||||
typeOptions: {
|
|
||||||
alwaysOpenEditWindow: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
] as INodeProperties[];
|
] as INodeProperties[];
|
||||||
|
|
|
@ -455,37 +455,25 @@ export class MondayCom implements INodeType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (resource === 'boardItem') {
|
if (resource === 'boardItem') {
|
||||||
if (operation === 'create') {
|
if (operation === 'addUpdate') {
|
||||||
const boardId = parseInt(this.getNodeParameter('boardId', i) as string, 10);
|
const itemId = parseInt((this.getNodeParameter('itemId', i) as string), 10);
|
||||||
const groupId = this.getNodeParameter('groupId', i) as string;
|
const value = this.getNodeParameter('value', i) as string;
|
||||||
const itemName = this.getNodeParameter('name', i) as string;
|
|
||||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
|
||||||
|
|
||||||
const body: IGraphqlBody = {
|
const body: IGraphqlBody = {
|
||||||
query:
|
query:
|
||||||
`mutation ($boardId: Int!, $groupId: String!, $itemName: String!, $columnValues: JSON) {
|
`mutation ($itemId: Int!, $value: String!) {
|
||||||
create_item (board_id: $boardId, group_id: $groupId, item_name: $itemName, column_values: $columnValues) {
|
create_update (item_id: $itemId, body: $value) {
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}`,
|
}`,
|
||||||
variables: {
|
variables: {
|
||||||
boardId,
|
itemId,
|
||||||
groupId,
|
value,
|
||||||
itemName,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
if (additionalFields.columnValues) {
|
|
||||||
try {
|
|
||||||
JSON.parse(additionalFields.columnValues as string);
|
|
||||||
} catch (e) {
|
|
||||||
throw new Error('Custom Values must be a valid JSON');
|
|
||||||
}
|
|
||||||
body.variables.columnValues = JSON.stringify(JSON.parse(additionalFields.columnValues as string));
|
|
||||||
}
|
|
||||||
|
|
||||||
responseData = await mondayComApiRequest.call(this, body);
|
responseData = await mondayComApiRequest.call(this, body);
|
||||||
responseData = responseData.data.create_item;
|
responseData = responseData.data.create_update;
|
||||||
}
|
}
|
||||||
if (operation === 'changeColumnValue') {
|
if (operation === 'changeColumnValue') {
|
||||||
const boardId = parseInt(this.getNodeParameter('boardId', i) as string, 10);
|
const boardId = parseInt(this.getNodeParameter('boardId', i) as string, 10);
|
||||||
|
@ -545,6 +533,38 @@ export class MondayCom implements INodeType {
|
||||||
responseData = await mondayComApiRequest.call(this, body);
|
responseData = await mondayComApiRequest.call(this, body);
|
||||||
responseData = responseData.data.change_multiple_column_values;
|
responseData = responseData.data.change_multiple_column_values;
|
||||||
}
|
}
|
||||||
|
if (operation === 'create') {
|
||||||
|
const boardId = parseInt(this.getNodeParameter('boardId', i) as string, 10);
|
||||||
|
const groupId = this.getNodeParameter('groupId', i) as string;
|
||||||
|
const itemName = this.getNodeParameter('name', i) as string;
|
||||||
|
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||||
|
|
||||||
|
const body: IGraphqlBody = {
|
||||||
|
query:
|
||||||
|
`mutation ($boardId: Int!, $groupId: String!, $itemName: String!, $columnValues: JSON) {
|
||||||
|
create_item (board_id: $boardId, group_id: $groupId, item_name: $itemName, column_values: $columnValues) {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
}`,
|
||||||
|
variables: {
|
||||||
|
boardId,
|
||||||
|
groupId,
|
||||||
|
itemName,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
if (additionalFields.columnValues) {
|
||||||
|
try {
|
||||||
|
JSON.parse(additionalFields.columnValues as string);
|
||||||
|
} catch (e) {
|
||||||
|
throw new Error('Custom Values must be a valid JSON');
|
||||||
|
}
|
||||||
|
body.variables.columnValues = JSON.stringify(JSON.parse(additionalFields.columnValues as string));
|
||||||
|
}
|
||||||
|
|
||||||
|
responseData = await mondayComApiRequest.call(this, body);
|
||||||
|
responseData = responseData.data.create_item;
|
||||||
|
}
|
||||||
if (operation === 'delete') {
|
if (operation === 'delete') {
|
||||||
const itemId = parseInt((this.getNodeParameter('itemId', i) as string), 10);
|
const itemId = parseInt((this.getNodeParameter('itemId', i) as string), 10);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue