mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34:06 -08:00
3a9c7acb04
* 👕 Enable rule * ⬆️ Upgrade linter * 📦 Update `package-lock.json` * 👕 Apply rule * ✏️ Fix plurals * ✏️ More typos * ✏️ Final typos
324 lines
7 KiB
TypeScript
324 lines
7 KiB
TypeScript
import { INodeProperties } from 'n8n-workflow';
|
|
|
|
export const taskOperations: INodeProperties[] = [
|
|
{
|
|
displayName: 'Operation',
|
|
name: 'operation',
|
|
type: 'options',
|
|
noDataExpression: true,
|
|
displayOptions: {
|
|
show: {
|
|
resource: ['task'],
|
|
},
|
|
},
|
|
options: [
|
|
{
|
|
name: 'Create',
|
|
value: 'create',
|
|
description: 'Create a task',
|
|
action: 'Create a task',
|
|
},
|
|
{
|
|
name: 'Delete',
|
|
value: 'delete',
|
|
description: 'Delete a task',
|
|
action: 'Delete a task',
|
|
},
|
|
{
|
|
name: 'Get',
|
|
value: 'get',
|
|
description: 'Get a task',
|
|
action: 'Get a task',
|
|
},
|
|
{
|
|
name: 'Get Many',
|
|
value: 'getAll',
|
|
description: 'Get many tasks',
|
|
action: 'Get many tasks',
|
|
},
|
|
{
|
|
name: 'Update',
|
|
value: 'update',
|
|
description: 'Update a task',
|
|
action: 'Update a task',
|
|
},
|
|
],
|
|
default: 'create',
|
|
},
|
|
];
|
|
|
|
export const taskFields: INodeProperties[] = [
|
|
{
|
|
displayName: 'Project Name or ID',
|
|
name: 'projectId',
|
|
type: 'options',
|
|
description:
|
|
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
|
typeOptions: {
|
|
loadOptionsDependsOn: ['workspaceId'],
|
|
loadOptionsMethod: 'loadProjectsForWorkspace',
|
|
},
|
|
displayOptions: {
|
|
show: {
|
|
resource: ['task'],
|
|
},
|
|
},
|
|
required: true,
|
|
default: '',
|
|
},
|
|
/* -------------------------------------------------------------------------- */
|
|
/* task:create */
|
|
/* -------------------------------------------------------------------------- */
|
|
{
|
|
displayName: 'Task Name',
|
|
name: 'name',
|
|
type: 'string',
|
|
required: true,
|
|
default: '',
|
|
description: 'Name of task to create',
|
|
displayOptions: {
|
|
show: {
|
|
resource: ['task'],
|
|
operation: ['create'],
|
|
},
|
|
},
|
|
},
|
|
{
|
|
displayName: 'Additional Fields',
|
|
name: 'additionalFields',
|
|
type: 'collection',
|
|
placeholder: 'Add Field',
|
|
displayOptions: {
|
|
show: {
|
|
operation: ['create'],
|
|
resource: ['task'],
|
|
},
|
|
},
|
|
default: {},
|
|
options: [
|
|
{
|
|
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-multi-options
|
|
displayName: 'Assignee Names or IDs',
|
|
name: 'assigneeIds',
|
|
type: 'multiOptions',
|
|
description:
|
|
'Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
|
default: [],
|
|
typeOptions: {
|
|
loadOptionsMethod: 'loadUsersForWorkspace',
|
|
},
|
|
},
|
|
{
|
|
displayName: 'Estimate',
|
|
name: 'estimate',
|
|
type: 'string',
|
|
default: '',
|
|
placeholder: '2:30',
|
|
description: 'Estimate time the task will take, e.x: 2:30 (2 hours and 30 minutes)',
|
|
},
|
|
],
|
|
},
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
/* task:delete */
|
|
/* -------------------------------------------------------------------------- */
|
|
{
|
|
displayName: 'Task ID',
|
|
name: 'taskId',
|
|
type: 'string',
|
|
required: true,
|
|
default: '',
|
|
displayOptions: {
|
|
show: {
|
|
resource: ['task'],
|
|
operation: ['delete'],
|
|
},
|
|
},
|
|
description: 'ID of task to delete',
|
|
},
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
/* task:get */
|
|
/* -------------------------------------------------------------------------- */
|
|
{
|
|
displayName: 'Task ID',
|
|
name: 'taskId',
|
|
type: 'string',
|
|
required: true,
|
|
default: '',
|
|
displayOptions: {
|
|
show: {
|
|
resource: ['task'],
|
|
operation: ['get'],
|
|
},
|
|
},
|
|
description: 'ID of task to get',
|
|
},
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
/* task:getAll */
|
|
/* -------------------------------------------------------------------------- */
|
|
{
|
|
displayName: 'Return All',
|
|
name: 'returnAll',
|
|
type: 'boolean',
|
|
displayOptions: {
|
|
show: {
|
|
operation: ['getAll'],
|
|
resource: ['task'],
|
|
},
|
|
},
|
|
default: false,
|
|
description: 'Whether to return all results or only up to a given limit',
|
|
},
|
|
{
|
|
displayName: 'Limit',
|
|
name: 'limit',
|
|
type: 'number',
|
|
displayOptions: {
|
|
show: {
|
|
operation: ['getAll'],
|
|
resource: ['task'],
|
|
returnAll: [false],
|
|
},
|
|
},
|
|
typeOptions: {
|
|
minValue: 1,
|
|
maxValue: 500,
|
|
},
|
|
default: 100,
|
|
description: 'Max number of results to return',
|
|
},
|
|
{
|
|
displayName: 'Filters',
|
|
name: 'filters',
|
|
type: 'collection',
|
|
placeholder: 'Add Filter',
|
|
displayOptions: {
|
|
show: {
|
|
operation: ['getAll'],
|
|
resource: ['task'],
|
|
},
|
|
},
|
|
default: {},
|
|
options: [
|
|
{
|
|
displayName: 'Is Active',
|
|
name: 'is-active',
|
|
type: 'boolean',
|
|
default: false,
|
|
},
|
|
{
|
|
displayName: 'Name',
|
|
name: 'name',
|
|
type: 'string',
|
|
default: '',
|
|
description: 'Text to match in the task name',
|
|
},
|
|
{
|
|
displayName: 'Sort Column',
|
|
name: 'sort-column',
|
|
type: 'options',
|
|
options: [
|
|
{
|
|
name: 'Name',
|
|
value: 'NAME',
|
|
},
|
|
],
|
|
default: 'NAME',
|
|
},
|
|
{
|
|
displayName: 'Sort Order',
|
|
name: 'sort-order',
|
|
type: 'options',
|
|
options: [
|
|
{
|
|
name: 'Ascending',
|
|
value: 'ASCENDING',
|
|
},
|
|
{
|
|
name: 'Descending',
|
|
value: 'DESCENDING',
|
|
},
|
|
],
|
|
default: 'ASCENDING',
|
|
},
|
|
],
|
|
},
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
/* task:update */
|
|
/* -------------------------------------------------------------------------- */
|
|
{
|
|
displayName: 'Task ID',
|
|
name: 'taskId',
|
|
type: 'string',
|
|
required: true,
|
|
default: '',
|
|
displayOptions: {
|
|
show: {
|
|
resource: ['task'],
|
|
operation: ['update'],
|
|
},
|
|
},
|
|
description: 'ID of task to update',
|
|
},
|
|
{
|
|
displayName: 'Update Fields',
|
|
name: 'updateFields',
|
|
type: 'collection',
|
|
placeholder: 'Add Field',
|
|
displayOptions: {
|
|
show: {
|
|
operation: ['update'],
|
|
resource: ['task'],
|
|
},
|
|
},
|
|
default: {},
|
|
options: [
|
|
{
|
|
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-multi-options
|
|
displayName: 'Assignee Names or IDs',
|
|
name: 'assigneeIds',
|
|
type: 'multiOptions',
|
|
description:
|
|
'Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
|
default: [],
|
|
typeOptions: {
|
|
loadOptionsMethod: 'loadUsersForWorkspace',
|
|
},
|
|
},
|
|
{
|
|
displayName: 'Estimate',
|
|
name: 'estimate',
|
|
type: 'string',
|
|
default: '',
|
|
placeholder: '2:30',
|
|
description: 'Estimate time the task will take, e.x: 2:30 (2 hours and 30 minutes)',
|
|
},
|
|
{
|
|
displayName: 'Name',
|
|
name: 'name',
|
|
type: 'string',
|
|
default: '',
|
|
},
|
|
{
|
|
displayName: 'Status',
|
|
name: 'status',
|
|
type: 'options',
|
|
options: [
|
|
{
|
|
name: 'Active',
|
|
value: 'ACTIVE',
|
|
},
|
|
{
|
|
name: 'Done',
|
|
value: 'DONE',
|
|
},
|
|
],
|
|
default: 'ACTIVE',
|
|
},
|
|
],
|
|
},
|
|
];
|