mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-19 19:11:13 +00:00
✨ Feature/clickup timetrackingv2 (#1010)
* Add clickup time tracking v2 - fixed one typo - extended getAssignees with task related API call - added all V2 API calls for time tracking - marked old API calls as deprecated * ⚡ Improvements to #1000 * ⚡ Small improvements * ⚡ Small fix Co-authored-by: Andreas Sawatzki <asawatzki@evomation.de>
This commit is contained in:
@@ -63,9 +63,14 @@ import {
|
|||||||
} from './TaskDependencyDescription';
|
} from './TaskDependencyDescription';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
timeTrackingFields,
|
timeEntryFields,
|
||||||
timeTrackingOperations,
|
timeEntryOperations,
|
||||||
} from './TimeTrackingDescription';
|
} from './TimeEntryDescription';
|
||||||
|
|
||||||
|
import {
|
||||||
|
timeEntryTagFields,
|
||||||
|
timeEntryTagOperations,
|
||||||
|
} from './TimeEntryTagDescription';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
listFields,
|
listFields,
|
||||||
@@ -80,6 +85,8 @@ import {
|
|||||||
IList,
|
IList,
|
||||||
} from './ListInterface';
|
} from './ListInterface';
|
||||||
|
|
||||||
|
import * as moment from 'moment-timezone';
|
||||||
|
|
||||||
export class ClickUp implements INodeType {
|
export class ClickUp implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
displayName: 'ClickUp',
|
displayName: 'ClickUp',
|
||||||
@@ -182,8 +189,12 @@ export class ClickUp implements INodeType {
|
|||||||
value: 'taskDependency',
|
value: 'taskDependency',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Time Traking',
|
name: 'Time Entry',
|
||||||
value: 'timeTracking',
|
value: 'timeEntry',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Time Entry Tag',
|
||||||
|
value: 'timeEntryTag',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
default: 'task',
|
default: 'task',
|
||||||
@@ -216,9 +227,13 @@ export class ClickUp implements INodeType {
|
|||||||
// TASK DEPENDENCY
|
// TASK DEPENDENCY
|
||||||
...taskDependencyOperations,
|
...taskDependencyOperations,
|
||||||
...taskDependencyFields,
|
...taskDependencyFields,
|
||||||
// TIME TRACKING
|
// TIME ENTRY
|
||||||
...timeTrackingOperations,
|
...timeEntryOperations,
|
||||||
...timeTrackingFields,
|
...timeEntryFields,
|
||||||
|
...taskDependencyFields,
|
||||||
|
// TIME ENTRY TAG
|
||||||
|
...timeEntryTagOperations,
|
||||||
|
...timeEntryTagFields,
|
||||||
// LIST
|
// LIST
|
||||||
...listOperations,
|
...listOperations,
|
||||||
...listFields,
|
...listFields,
|
||||||
@@ -310,8 +325,19 @@ export class ClickUp implements INodeType {
|
|||||||
// select them easily
|
// select them easily
|
||||||
async getAssignees(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
async getAssignees(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||||
const listId = this.getCurrentNodeParameter('list') as string;
|
const listId = this.getCurrentNodeParameter('list') as string;
|
||||||
|
const taskId = this.getCurrentNodeParameter('task') as string;
|
||||||
const returnData: INodePropertyOptions[] = [];
|
const returnData: INodePropertyOptions[] = [];
|
||||||
const { members } = await clickupApiRequest.call(this, 'GET', `/list/${listId}/member`);
|
let url: string;
|
||||||
|
if (listId) {
|
||||||
|
url = `/list/${listId}/member`;
|
||||||
|
}
|
||||||
|
else if (taskId) {
|
||||||
|
url = `/task/${taskId}/member`;
|
||||||
|
} else {
|
||||||
|
return returnData;
|
||||||
|
}
|
||||||
|
|
||||||
|
const { members } = await clickupApiRequest.call(this, 'GET', url);
|
||||||
for (const member of members) {
|
for (const member of members) {
|
||||||
const memberName = member.username;
|
const memberName = member.username;
|
||||||
const menberId = member.id;
|
const menberId = member.id;
|
||||||
@@ -329,6 +355,7 @@ export class ClickUp implements INodeType {
|
|||||||
const returnData: INodePropertyOptions[] = [];
|
const returnData: INodePropertyOptions[] = [];
|
||||||
const { tags } = await clickupApiRequest.call(this, 'GET', `/space/${spaceId}/tag`);
|
const { tags } = await clickupApiRequest.call(this, 'GET', `/space/${spaceId}/tag`);
|
||||||
for (const tag of tags) {
|
for (const tag of tags) {
|
||||||
|
console.log(tag);
|
||||||
const tagName = tag.name;
|
const tagName = tag.name;
|
||||||
const tagId = tag.name;
|
const tagId = tag.name;
|
||||||
returnData.push({
|
returnData.push({
|
||||||
@@ -340,6 +367,22 @@ export class ClickUp implements INodeType {
|
|||||||
},
|
},
|
||||||
// Get all the available tags to display them to user so that he can
|
// Get all the available tags to display them to user so that he can
|
||||||
// select them easily
|
// select them easily
|
||||||
|
async getTimeEntryTags(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||||
|
const teamId = this.getCurrentNodeParameter('team') as string;
|
||||||
|
const returnData: INodePropertyOptions[] = [];
|
||||||
|
const { data: tags } = await clickupApiRequest.call(this, 'GET', `/team/${teamId}/time_entries/tags`);
|
||||||
|
for (const tag of tags) {
|
||||||
|
const tagName = tag.name;
|
||||||
|
const tagId = JSON.stringify(tag);
|
||||||
|
returnData.push({
|
||||||
|
name: tagName,
|
||||||
|
value: tagId,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return returnData;
|
||||||
|
},
|
||||||
|
// Get all the available tags to display them to user so that he can
|
||||||
|
// select them easily
|
||||||
async getStatuses(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
async getStatuses(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||||
const listId = this.getCurrentNodeParameter('list') as string;
|
const listId = this.getCurrentNodeParameter('list') as string;
|
||||||
const returnData: INodePropertyOptions[] = [];
|
const returnData: INodePropertyOptions[] = [];
|
||||||
@@ -371,6 +414,24 @@ export class ClickUp implements INodeType {
|
|||||||
}
|
}
|
||||||
return returnData;
|
return returnData;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Get all the available lists to display them to user so that he can
|
||||||
|
// select them easily
|
||||||
|
async getTasks(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||||
|
const listId = this.getCurrentNodeParameter('list') as string;
|
||||||
|
const archived = this.getCurrentNodeParameter('archived') as string;
|
||||||
|
const returnData: INodePropertyOptions[] = [];
|
||||||
|
const { tasks } = await clickupApiRequest.call(this, 'GET', `/list/${listId}/task?archived=${archived}`);
|
||||||
|
for (const task of tasks) {
|
||||||
|
const taskName = task.name;
|
||||||
|
const taskId = task.id;
|
||||||
|
returnData.push({
|
||||||
|
name: taskName,
|
||||||
|
value: taskId,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return returnData;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -983,52 +1044,152 @@ export class ClickUp implements INodeType {
|
|||||||
responseData = { success: true };
|
responseData = { success: true };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (resource === 'timeTracking') {
|
if (resource === 'timeEntry') {
|
||||||
if (operation === 'log') {
|
if (operation === 'update') {
|
||||||
const taskId = this.getNodeParameter('task', i) as string;
|
const teamId = this.getNodeParameter('team', i) as string;
|
||||||
const type = this.getNodeParameter('type', i) as string;
|
const timeEntryId = this.getNodeParameter('timeEntry', i) as string;
|
||||||
|
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject;
|
||||||
|
const timezone = this.getTimezone();
|
||||||
const body: IDataObject = {};
|
const body: IDataObject = {};
|
||||||
if (type === 'fromTo') {
|
Object.assign(body, updateFields);
|
||||||
const from = new Date(this.getNodeParameter('from', i) as string).getTime();
|
|
||||||
const to = new Date(this.getNodeParameter('to', i) as string).getTime();
|
if (body.start) {
|
||||||
body.from = from;
|
body.start = moment.tz(body.start, timezone).valueOf();
|
||||||
body.to = to;
|
|
||||||
} else {
|
|
||||||
const minutes = this.getNodeParameter('minutes', i) as number;
|
|
||||||
body.time = minutes * 60000;
|
|
||||||
}
|
}
|
||||||
responseData = await clickupApiRequest.call(this, 'POST', `/task/${taskId}/time`, body);
|
|
||||||
|
if (body.duration) {
|
||||||
|
body.duration = body.duration as number * 60000;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (body.task) {
|
||||||
|
body.tid = body.task;
|
||||||
|
body.custom_task_ids = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
responseData = await clickupApiRequest.call(this, 'PUT', `/team/${teamId}/time_entries/${timeEntryId}`, body);
|
||||||
|
responseData = responseData.data;
|
||||||
|
}
|
||||||
|
if (operation === 'getAll') {
|
||||||
|
const teamId = this.getNodeParameter('team', i) as string;
|
||||||
|
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||||
|
const filters = this.getNodeParameter('filters', i) as IDataObject;
|
||||||
|
const timezone = this.getTimezone();
|
||||||
|
Object.assign(qs, filters);
|
||||||
|
|
||||||
|
if (filters.start_date) {
|
||||||
|
qs.start_date = moment.tz(qs.start_date, timezone).valueOf();
|
||||||
|
}
|
||||||
|
if (filters.end_date) {
|
||||||
|
qs.end_date = moment.tz(qs.end_date, timezone).valueOf();
|
||||||
|
}
|
||||||
|
responseData = await clickupApiRequest.call(this, 'GET', `/team/${teamId}/time_entries`, {}, qs);
|
||||||
|
|
||||||
|
responseData = responseData.data;
|
||||||
|
|
||||||
|
if (returnAll === false) {
|
||||||
|
const limit = this.getNodeParameter('limit', i) as number;
|
||||||
|
responseData = responseData.splice(0, limit);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if (operation === 'get') {
|
||||||
|
const teamId = this.getNodeParameter('team', i) as string;
|
||||||
|
const running = this.getNodeParameter('running', i) as boolean;
|
||||||
|
|
||||||
|
let endpoint = `/team/${teamId}/time_entries/current`;
|
||||||
|
|
||||||
|
if (running === false) {
|
||||||
|
const timeEntryId = this.getNodeParameter('timeEntry', i) as string;
|
||||||
|
endpoint = `/team/${teamId}/time_entries/${timeEntryId}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
responseData = await clickupApiRequest.call(this, 'GET', endpoint);
|
||||||
|
responseData = responseData.data;
|
||||||
|
}
|
||||||
|
if (operation === 'create') {
|
||||||
|
const teamId = this.getNodeParameter('team', i) as string;
|
||||||
|
const taskId = this.getNodeParameter('task', i) as string;
|
||||||
|
const start = this.getNodeParameter('start', i) as string;
|
||||||
|
const duration = this.getNodeParameter('duration', i) as number;
|
||||||
|
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||||
|
const timezone = this.getTimezone();
|
||||||
|
const body: IDataObject = {
|
||||||
|
start: moment.tz(start, timezone).valueOf(),
|
||||||
|
duration: duration * 60000,
|
||||||
|
tid: taskId,
|
||||||
|
};
|
||||||
|
Object.assign(body, additionalFields);
|
||||||
|
|
||||||
|
if (body.tags) {
|
||||||
|
body.tags = (body.tags as string[]).map((tag) => (JSON.parse(tag)));
|
||||||
|
}
|
||||||
|
|
||||||
|
responseData = await clickupApiRequest.call(this, 'POST', `/team/${teamId}/time_entries`, body);
|
||||||
|
responseData = responseData.data;
|
||||||
|
}
|
||||||
|
if (operation === 'start') {
|
||||||
|
const teamId = this.getNodeParameter('team', i) as string;
|
||||||
|
const taskId = this.getNodeParameter('task', i) as string;
|
||||||
|
const body: IDataObject = {};
|
||||||
|
body.tid = taskId;
|
||||||
|
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||||
|
Object.assign(body, additionalFields);
|
||||||
|
responseData = await clickupApiRequest.call(this, 'POST', `/team/${teamId}/time_entries/start`, body);
|
||||||
|
responseData = responseData.data;
|
||||||
|
}
|
||||||
|
if (operation === 'stop') {
|
||||||
|
const teamId = this.getNodeParameter('team', i) as string;
|
||||||
|
responseData = await clickupApiRequest.call(this, 'POST', `/team/${teamId}/time_entries/stop`);
|
||||||
|
responseData = responseData.data;
|
||||||
}
|
}
|
||||||
if (operation === 'delete') {
|
if (operation === 'delete') {
|
||||||
const taskId = this.getNodeParameter('task', i) as string;
|
const teamId = this.getNodeParameter('team', i) as string;
|
||||||
const intervalId = this.getNodeParameter('interval', i) as string;
|
const timeEntryId = this.getNodeParameter('timeEntry', i) as string;
|
||||||
responseData = await clickupApiRequest.call(this, 'DELETE', `/task/${taskId}/time/${intervalId}`);
|
responseData = await clickupApiRequest.call(this, 'DELETE', `/team/${teamId}/time_entries/${timeEntryId}`);
|
||||||
|
responseData = responseData.data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (resource === 'timeEntryTag') {
|
||||||
|
if (operation === 'add') {
|
||||||
|
const teamId = this.getNodeParameter('team', i) as string;
|
||||||
|
const timeEntryIds = this.getNodeParameter('timeEntryIds', i) as string;
|
||||||
|
const tagsUi = this.getNodeParameter('tagsUi', i) as IDataObject;
|
||||||
|
const body: IDataObject = {};
|
||||||
|
body.time_entry_ids = timeEntryIds.split(',');
|
||||||
|
if (tagsUi) {
|
||||||
|
const tags = (tagsUi as IDataObject).tagsValues as IDataObject[];
|
||||||
|
if (tags === undefined) {
|
||||||
|
throw new Error('At least one tag must be set');
|
||||||
|
}
|
||||||
|
body.tags = tags;
|
||||||
|
}
|
||||||
|
responseData = await clickupApiRequest.call(this, 'POST', `/team/${teamId}/time_entries/tags`, body);
|
||||||
responseData = { success: true };
|
responseData = { success: true };
|
||||||
}
|
}
|
||||||
if (operation === 'getAll') {
|
if (operation === 'getAll') {
|
||||||
const taskId = this.getNodeParameter('task', i) as string;
|
const teamId = this.getNodeParameter('team', i) as string;
|
||||||
qs.limit = this.getNodeParameter('limit', i) as number;
|
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||||
responseData = await clickupApiRequest.call(this, 'GET', `/task/${taskId}/time`, {}, qs);
|
responseData = await clickupApiRequest.call(this, 'GET', `/team/${teamId}/time_entries/tags`);
|
||||||
|
|
||||||
responseData = responseData.data;
|
responseData = responseData.data;
|
||||||
responseData = responseData.splice(0, qs.limit);
|
|
||||||
|
if (returnAll === false) {
|
||||||
|
const limit = this.getNodeParameter('limit', i) as number;
|
||||||
|
responseData = responseData.splice(0, limit);
|
||||||
}
|
}
|
||||||
if (operation === 'update') {
|
|
||||||
const taskId = this.getNodeParameter('task', i) as string;
|
}
|
||||||
const intervalId = this.getNodeParameter('interval', i) as string;
|
if (operation === 'remove') {
|
||||||
const type = this.getNodeParameter('type', i) as string;
|
const teamId = this.getNodeParameter('team', i) as string;
|
||||||
|
const timeEntryIds = this.getNodeParameter('timeEntryIds', i) as string;
|
||||||
|
const tagNames = this.getNodeParameter('tagNames', i) as string[];
|
||||||
const body: IDataObject = {};
|
const body: IDataObject = {};
|
||||||
if (type === 'fromTo') {
|
body.time_entry_ids = timeEntryIds.split(',');
|
||||||
const from = new Date(this.getNodeParameter('from', i) as string).getTime();
|
body.tags = tagNames.map((tag) => ( JSON.parse(tag).name ));
|
||||||
const to = new Date(this.getNodeParameter('to', i) as string).getTime();
|
responseData = await clickupApiRequest.call(this, 'DELETE', `/team/${teamId}/time_entries/tags`, body);
|
||||||
body.from = from;
|
|
||||||
body.to = to;
|
|
||||||
} else {
|
|
||||||
const minutes = this.getNodeParameter('minutes', i) as number;
|
|
||||||
body.time = minutes * 60000;
|
|
||||||
}
|
|
||||||
responseData = await clickupApiRequest.call(this, 'PUT', `/task/${taskId}/time/${intervalId}`, body);
|
|
||||||
responseData = { success: true };
|
responseData = { success: true };
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (resource === 'list') {
|
if (resource === 'list') {
|
||||||
if (operation === 'create') {
|
if (operation === 'create') {
|
||||||
|
|||||||
862
packages/nodes-base/nodes/ClickUp/TimeEntryDescription.ts
Normal file
862
packages/nodes-base/nodes/ClickUp/TimeEntryDescription.ts
Normal file
@@ -0,0 +1,862 @@
|
|||||||
|
import {
|
||||||
|
INodeProperties,
|
||||||
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
|
export const timeEntryOperations = [
|
||||||
|
{
|
||||||
|
displayName: 'Operation',
|
||||||
|
name: 'operation',
|
||||||
|
type: 'options',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'timeEntry',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: 'Create',
|
||||||
|
value: 'create',
|
||||||
|
description: 'Create a time entry',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Delete',
|
||||||
|
value: 'delete',
|
||||||
|
description:'Delete a time entry',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Get',
|
||||||
|
value: 'get',
|
||||||
|
description:'Get a time entry',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Get All',
|
||||||
|
value: 'getAll',
|
||||||
|
description: 'Get all time entries',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Start',
|
||||||
|
value: 'start',
|
||||||
|
description:'Start a time entry',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Stop',
|
||||||
|
value: 'stop',
|
||||||
|
description:'Stop the current running timer',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Update',
|
||||||
|
value: 'update',
|
||||||
|
description:'Update a time Entry',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
default: 'create',
|
||||||
|
description: 'The operation to perform.',
|
||||||
|
},
|
||||||
|
] as INodeProperties[];
|
||||||
|
|
||||||
|
export const timeEntryFields = [
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
/* timeEntry:getAll */
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
{
|
||||||
|
displayName: 'Team ID',
|
||||||
|
name: 'team',
|
||||||
|
type: 'options',
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'timeEntry',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'getAll',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getTeams',
|
||||||
|
},
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Return All',
|
||||||
|
name: 'returnAll',
|
||||||
|
type: 'boolean',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'timeEntry',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'getAll',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
default: false,
|
||||||
|
description: 'If all results should be returned or only up to a given limit.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Limit',
|
||||||
|
name: 'limit',
|
||||||
|
type: 'number',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'timeEntry',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'getAll',
|
||||||
|
],
|
||||||
|
returnAll: [
|
||||||
|
false,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
typeOptions: {
|
||||||
|
minValue: 1,
|
||||||
|
maxValue: 10,
|
||||||
|
},
|
||||||
|
default: 5,
|
||||||
|
description: 'How many results to return.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Filters',
|
||||||
|
name: 'filters',
|
||||||
|
type: 'collection',
|
||||||
|
placeholder: 'Add Field',
|
||||||
|
default: {},
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'timeEntry',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'getAll',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
displayName: 'End Date',
|
||||||
|
name: 'end_date',
|
||||||
|
type: 'dateTime',
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Start Date',
|
||||||
|
name: 'start_date',
|
||||||
|
type: 'dateTime',
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
/* timeEntry:get */
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
{
|
||||||
|
displayName: 'Team ID',
|
||||||
|
name: 'team',
|
||||||
|
type: 'options',
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'timeEntry',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'get',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getTeams',
|
||||||
|
},
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Running',
|
||||||
|
name: 'running',
|
||||||
|
type: 'boolean',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'timeEntry',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'get',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
default: false,
|
||||||
|
description: 'When set to true it will return just the current running time entry',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Time Entry ID',
|
||||||
|
name: 'timeEntry',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'timeEntry',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'get',
|
||||||
|
],
|
||||||
|
running: [
|
||||||
|
false,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
/* timeEntry:create */
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
{
|
||||||
|
displayName: 'Team ID',
|
||||||
|
name: 'team',
|
||||||
|
type: 'options',
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'timeEntry',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'create',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getTeams',
|
||||||
|
},
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Space ID',
|
||||||
|
name: 'space',
|
||||||
|
type: 'options',
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'timeEntry',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'create',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getSpaces',
|
||||||
|
loadOptionsDependsOn: [
|
||||||
|
'team',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Folderless List',
|
||||||
|
name: 'folderless',
|
||||||
|
type: 'boolean',
|
||||||
|
default: false,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'timeEntry',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'create',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Folder ID',
|
||||||
|
name: 'folder',
|
||||||
|
type: 'options',
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'timeEntry',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'create',
|
||||||
|
],
|
||||||
|
folderless: [
|
||||||
|
false,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getFolders',
|
||||||
|
loadOptionsDependsOn: [
|
||||||
|
'space',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'List ID',
|
||||||
|
name: 'list',
|
||||||
|
type: 'options',
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'timeEntry',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'create',
|
||||||
|
],
|
||||||
|
folderless: [
|
||||||
|
true,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getFolderlessLists',
|
||||||
|
loadOptionsDependsOn: [
|
||||||
|
'space',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'List ID',
|
||||||
|
name: 'list',
|
||||||
|
type: 'options',
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'timeEntry',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'create',
|
||||||
|
],
|
||||||
|
folderless: [
|
||||||
|
false,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getLists',
|
||||||
|
loadOptionsDependsOn: [
|
||||||
|
'folder',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Start',
|
||||||
|
name: 'start',
|
||||||
|
type: 'dateTime',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'timeEntry',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'create',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: true,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Duration (minutes)',
|
||||||
|
name: 'duration',
|
||||||
|
type: 'number',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'timeEntry',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'create',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
default: 0,
|
||||||
|
required: true,
|
||||||
|
description: 'Duration in minutes',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Task ID',
|
||||||
|
name: 'task',
|
||||||
|
type: 'options',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'timeEntry',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'create',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getTasks',
|
||||||
|
loadOptionsDependsOn: [
|
||||||
|
'list',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Additional Fields',
|
||||||
|
name: 'additionalFields',
|
||||||
|
type: 'collection',
|
||||||
|
placeholder: 'Add Field',
|
||||||
|
default: {},
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'timeEntry',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'create',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
displayName: 'Assignee IDs',
|
||||||
|
name: 'assignee',
|
||||||
|
type: 'options',
|
||||||
|
loadOptionsDependsOn: [
|
||||||
|
'list',
|
||||||
|
],
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getAssignees',
|
||||||
|
},
|
||||||
|
default: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Billable',
|
||||||
|
name: 'billable',
|
||||||
|
type: 'boolean',
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Description',
|
||||||
|
name: 'description',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
description: 'Description of the time entry'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Tags IDs',
|
||||||
|
name: 'tags',
|
||||||
|
type: 'multiOptions',
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsDependsOn: [
|
||||||
|
'team',
|
||||||
|
],
|
||||||
|
loadOptionsMethod: 'getTimeEntryTags'
|
||||||
|
},
|
||||||
|
default: [],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
/* timeEntry:start */
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
{
|
||||||
|
displayName: 'Team ID',
|
||||||
|
name: 'team',
|
||||||
|
type: 'options',
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'timeEntry',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'start',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getTeams',
|
||||||
|
},
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Task ID',
|
||||||
|
name: 'task',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'timeEntry',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'start',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Additional Fields',
|
||||||
|
name: 'additionalFields',
|
||||||
|
type: 'collection',
|
||||||
|
placeholder: 'Add Field',
|
||||||
|
default: {},
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'timeEntry',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'start',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
displayName: 'Billable',
|
||||||
|
name: 'billable',
|
||||||
|
type: 'boolean',
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Description',
|
||||||
|
name: 'description',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
description: 'Description of the time entry'
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
/* timeEntry:stop */
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
{
|
||||||
|
displayName: 'Team ID',
|
||||||
|
name: 'team',
|
||||||
|
type: 'options',
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'timeEntry',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'stop',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getTeams',
|
||||||
|
},
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
/* timeEntry:delete */
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
{
|
||||||
|
displayName: 'Team ID',
|
||||||
|
name: 'team',
|
||||||
|
type: 'options',
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'timeEntry',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'delete',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getTeams',
|
||||||
|
},
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Time Entry ID',
|
||||||
|
name: 'timeEntry',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'timeEntry',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'delete',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
/* timeEntry:update */
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
{
|
||||||
|
displayName: 'Team ID',
|
||||||
|
name: 'team',
|
||||||
|
type: 'options',
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'timeEntry',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'update',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getTeams',
|
||||||
|
},
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Space ID',
|
||||||
|
name: 'space',
|
||||||
|
type: 'options',
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'timeEntry',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'update',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getSpaces',
|
||||||
|
loadOptionsDependsOn: [
|
||||||
|
'team',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Folderless List',
|
||||||
|
name: 'folderless',
|
||||||
|
type: 'boolean',
|
||||||
|
default: false,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'timeEntry',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'update',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Folder ID',
|
||||||
|
name: 'folder',
|
||||||
|
type: 'options',
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'timeEntry',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'update',
|
||||||
|
],
|
||||||
|
folderless: [
|
||||||
|
false,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getFolders',
|
||||||
|
loadOptionsDependsOn: [
|
||||||
|
'space',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'List ID',
|
||||||
|
name: 'list',
|
||||||
|
type: 'options',
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'timeEntry',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'update',
|
||||||
|
],
|
||||||
|
folderless: [
|
||||||
|
true,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getFolderlessLists',
|
||||||
|
loadOptionsDependsOn: [
|
||||||
|
'space',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'List ID',
|
||||||
|
name: 'list',
|
||||||
|
type: 'options',
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'timeEntry',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'update',
|
||||||
|
],
|
||||||
|
folderless: [
|
||||||
|
false,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getLists',
|
||||||
|
loadOptionsDependsOn: [
|
||||||
|
'folder',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Archived',
|
||||||
|
name: 'archived',
|
||||||
|
type: 'boolean',
|
||||||
|
default: false,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'timeEntry',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'update',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Time Entry ID',
|
||||||
|
name: 'timeEntry',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'timeEntry',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'update',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Update Fields',
|
||||||
|
name: 'updateFields',
|
||||||
|
type: 'collection',
|
||||||
|
placeholder: 'Add Field',
|
||||||
|
default: {},
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'timeEntry',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'update',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
displayName: 'Assignee IDs',
|
||||||
|
name: 'assignee',
|
||||||
|
type: 'options',
|
||||||
|
loadOptionsDependsOn: [
|
||||||
|
'list',
|
||||||
|
],
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getAssignees',
|
||||||
|
},
|
||||||
|
default: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Billable',
|
||||||
|
name: 'billable',
|
||||||
|
type: 'boolean',
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Description',
|
||||||
|
name: 'description',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
description: 'Description of the time entry'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Duration (minutes)',
|
||||||
|
name: 'duration',
|
||||||
|
type: 'number',
|
||||||
|
default: 0,
|
||||||
|
description: 'Duration in minutes',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Start',
|
||||||
|
name: 'start',
|
||||||
|
type: 'dateTime',
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Tags IDs',
|
||||||
|
name: 'tags',
|
||||||
|
type: 'multiOptions',
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsDependsOn: [
|
||||||
|
'spaceId',
|
||||||
|
],
|
||||||
|
loadOptionsMethod: 'getTags'
|
||||||
|
},
|
||||||
|
default: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Task ID',
|
||||||
|
name: 'task',
|
||||||
|
type: 'options',
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getTasks',
|
||||||
|
loadOptionsDependsOn: [
|
||||||
|
'archived',
|
||||||
|
'list',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
] as INodeProperties[];
|
||||||
254
packages/nodes-base/nodes/ClickUp/TimeEntryTagDescription.ts
Normal file
254
packages/nodes-base/nodes/ClickUp/TimeEntryTagDescription.ts
Normal file
@@ -0,0 +1,254 @@
|
|||||||
|
import {
|
||||||
|
INodeProperties,
|
||||||
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
|
export const timeEntryTagOperations = [
|
||||||
|
{
|
||||||
|
displayName: 'Operation',
|
||||||
|
name: 'operation',
|
||||||
|
type: 'options',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'timeEntryTag',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: 'Add',
|
||||||
|
value: 'add',
|
||||||
|
description: 'Add tag to time entry',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Get All',
|
||||||
|
value: 'getAll',
|
||||||
|
description: 'Get all time entry tags',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Remove',
|
||||||
|
value: 'remove',
|
||||||
|
description:'Remove tag from time entry',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
default: 'add',
|
||||||
|
description: 'The operation to perform.',
|
||||||
|
},
|
||||||
|
] as INodeProperties[];
|
||||||
|
|
||||||
|
export const timeEntryTagFields = [
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
/* timeEntryTag:getAll */
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
{
|
||||||
|
displayName: 'Team ID',
|
||||||
|
name: 'team',
|
||||||
|
type: 'options',
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'timeEntryTag',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'getAll',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getTeams',
|
||||||
|
},
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Return All',
|
||||||
|
name: 'returnAll',
|
||||||
|
type: 'boolean',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'timeEntryTag',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'getAll',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
default: false,
|
||||||
|
description: 'If all results should be returned or only up to a given limit.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Limit',
|
||||||
|
name: 'limit',
|
||||||
|
type: 'number',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'timeEntryTag',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'getAll',
|
||||||
|
],
|
||||||
|
returnAll: [
|
||||||
|
false,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
typeOptions: {
|
||||||
|
minValue: 1,
|
||||||
|
maxValue: 10,
|
||||||
|
},
|
||||||
|
default: 5,
|
||||||
|
description: 'How many results to return.',
|
||||||
|
},
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
/* timeEntryTag:add */
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
{
|
||||||
|
displayName: 'Team ID',
|
||||||
|
name: 'team',
|
||||||
|
type: 'options',
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'timeEntryTag',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'add',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getTeams',
|
||||||
|
},
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Time Entry IDs',
|
||||||
|
name: 'timeEntryIds',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'timeEntryTag',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'add',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Tags',
|
||||||
|
name: 'tagsUi',
|
||||||
|
type: 'fixedCollection',
|
||||||
|
placeholder: 'Add Tag',
|
||||||
|
typeOptions: {
|
||||||
|
multipleValues: true,
|
||||||
|
},
|
||||||
|
default: {},
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'timeEntryTag',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'add',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
displayName: 'Tag',
|
||||||
|
name: 'tagsValues',
|
||||||
|
values: [
|
||||||
|
{
|
||||||
|
displayName: 'Name',
|
||||||
|
name: 'name',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Background Color',
|
||||||
|
name: 'tag_bg',
|
||||||
|
type: 'color',
|
||||||
|
default: '#ff0000',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Foreground Color',
|
||||||
|
name: 'tag_fg',
|
||||||
|
type: 'color',
|
||||||
|
default: '#ff0000',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
/* timeEntryTag:remove */
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
{
|
||||||
|
displayName: 'Team ID',
|
||||||
|
name: 'team',
|
||||||
|
type: 'options',
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'timeEntryTag',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'remove',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getTeams',
|
||||||
|
},
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Time Entry IDs',
|
||||||
|
name: 'timeEntryIds',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'timeEntryTag',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'remove',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Tag Names',
|
||||||
|
name: 'tagNames',
|
||||||
|
type: 'multiOptions',
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getTimeEntryTags',
|
||||||
|
loadOptionsDependsOn: [
|
||||||
|
'teamId',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
default: [],
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'timeEntryTag',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'remove',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
] as INodeProperties[];
|
||||||
@@ -1,359 +0,0 @@
|
|||||||
import {
|
|
||||||
INodeProperties,
|
|
||||||
} from 'n8n-workflow';
|
|
||||||
|
|
||||||
export const timeTrackingOperations = [
|
|
||||||
{
|
|
||||||
displayName: 'Operation',
|
|
||||||
name: 'operation',
|
|
||||||
type: 'options',
|
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'timeTracking',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
options: [
|
|
||||||
{
|
|
||||||
name: 'Log',
|
|
||||||
value: 'log',
|
|
||||||
description: 'Log time on task',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Delete',
|
|
||||||
value: 'delete',
|
|
||||||
description: 'Delete a logged time',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Get All',
|
|
||||||
value: 'getAll',
|
|
||||||
description: 'Get all logging times on task',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Update',
|
|
||||||
value: 'update',
|
|
||||||
description: 'Update a logged time',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
default: 'log',
|
|
||||||
description: 'The operation to perform.',
|
|
||||||
},
|
|
||||||
] as INodeProperties[];
|
|
||||||
|
|
||||||
export const timeTrackingFields = [
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
|
||||||
/* timeTracking:log */
|
|
||||||
/* -------------------------------------------------------------------------- */
|
|
||||||
{
|
|
||||||
displayName: 'Task ID',
|
|
||||||
name: 'task',
|
|
||||||
type: 'string',
|
|
||||||
default: '',
|
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'timeTracking',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'log',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
displayName: 'Type',
|
|
||||||
name: 'type',
|
|
||||||
type: 'options',
|
|
||||||
default: '',
|
|
||||||
options: [
|
|
||||||
{
|
|
||||||
name: 'Duration',
|
|
||||||
value: 'duration',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'From/To',
|
|
||||||
value: 'fromTo',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'timeTracking',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'log',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
displayName: 'Minutes',
|
|
||||||
name: 'minutes',
|
|
||||||
type: 'number',
|
|
||||||
typeOptions: {
|
|
||||||
minValue: 0,
|
|
||||||
},
|
|
||||||
default: 0,
|
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'timeTracking',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'log',
|
|
||||||
],
|
|
||||||
type: [
|
|
||||||
'duration',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
displayName: 'From',
|
|
||||||
name: 'from',
|
|
||||||
type: 'dateTime',
|
|
||||||
default: '',
|
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'timeTracking',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'log',
|
|
||||||
],
|
|
||||||
type: [
|
|
||||||
'fromTo',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
displayName: 'To',
|
|
||||||
name: 'to',
|
|
||||||
type: 'dateTime',
|
|
||||||
default: '',
|
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'timeTracking',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'log',
|
|
||||||
],
|
|
||||||
type: [
|
|
||||||
'fromTo',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
/* -------------------------------------------------------------------------- */
|
|
||||||
/* timeTracking:delete */
|
|
||||||
/* -------------------------------------------------------------------------- */
|
|
||||||
{
|
|
||||||
displayName: 'Task ID',
|
|
||||||
name: 'task',
|
|
||||||
type: 'string',
|
|
||||||
default: '',
|
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'timeTracking',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'delete',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
displayName: 'Interval ID',
|
|
||||||
name: 'interval',
|
|
||||||
type: 'string',
|
|
||||||
default: '',
|
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'timeTracking',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'delete',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
/* -------------------------------------------------------------------------- */
|
|
||||||
/* timeTracking:getAll */
|
|
||||||
/* -------------------------------------------------------------------------- */
|
|
||||||
{
|
|
||||||
displayName: 'Task ID',
|
|
||||||
name: 'task',
|
|
||||||
type: 'string',
|
|
||||||
default: '',
|
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'timeTracking',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'getAll',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
displayName: 'Limit',
|
|
||||||
name: 'limit',
|
|
||||||
type: 'number',
|
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'timeTracking',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'getAll',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
typeOptions: {
|
|
||||||
minValue: 1,
|
|
||||||
maxValue: 100,
|
|
||||||
},
|
|
||||||
default: 50,
|
|
||||||
description: 'How many results to return.',
|
|
||||||
},
|
|
||||||
/* -------------------------------------------------------------------------- */
|
|
||||||
/* timeTracking:update */
|
|
||||||
/* -------------------------------------------------------------------------- */
|
|
||||||
{
|
|
||||||
displayName: 'Task ID',
|
|
||||||
name: 'task',
|
|
||||||
type: 'string',
|
|
||||||
default: '',
|
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'timeTracking',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'update',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
displayName: 'Interval ID',
|
|
||||||
name: 'interval',
|
|
||||||
type: 'string',
|
|
||||||
default: '',
|
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'timeTracking',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'update',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
displayName: 'Type',
|
|
||||||
name: 'type',
|
|
||||||
type: 'options',
|
|
||||||
default: '',
|
|
||||||
options: [
|
|
||||||
{
|
|
||||||
name: 'Duration',
|
|
||||||
value: 'duration',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'From/To',
|
|
||||||
value: 'fromTo',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'timeTracking',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'update',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
displayName: 'Minutes',
|
|
||||||
name: 'minutes',
|
|
||||||
type: 'number',
|
|
||||||
typeOptions: {
|
|
||||||
minValue: 0,
|
|
||||||
},
|
|
||||||
default: 0,
|
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'timeTracking',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'update',
|
|
||||||
],
|
|
||||||
type: [
|
|
||||||
'duration',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
displayName: 'From',
|
|
||||||
name: 'from',
|
|
||||||
type: 'dateTime',
|
|
||||||
default: '',
|
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'timeTracking',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'update',
|
|
||||||
],
|
|
||||||
type: [
|
|
||||||
'fromTo',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
displayName: 'To',
|
|
||||||
name: 'to',
|
|
||||||
type: 'dateTime',
|
|
||||||
default: '',
|
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'timeTracking',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'update',
|
|
||||||
],
|
|
||||||
type: [
|
|
||||||
'fromTo',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
] as INodeProperties[];
|
|
||||||
Reference in New Issue
Block a user