mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 04:04:06 -08:00
⚡ Minor improvements to ClickUp-Node
This commit is contained in:
parent
15c0eae56d
commit
edd2d39fb1
|
@ -79,13 +79,13 @@ import {
|
|||
|
||||
import {
|
||||
ITask,
|
||||
} from './TaskInterface';
|
||||
} from './TaskInterface';
|
||||
|
||||
import {
|
||||
import {
|
||||
IList,
|
||||
} from './ListInterface';
|
||||
} from './ListInterface';
|
||||
|
||||
import * as moment from 'moment-timezone';
|
||||
import * as moment from 'moment-timezone';
|
||||
|
||||
export class ClickUp implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
|
@ -688,9 +688,9 @@ export class ClickUp implements INodeType {
|
|||
}
|
||||
}
|
||||
if (type === 'number' || type === 'percentaje'
|
||||
|| type === 'automatic' || type === 'currency' ) {
|
||||
if (additionalFields.stepsStart === undefined
|
||||
|| !additionalFields.stepsEnd === undefined) {
|
||||
|| type === 'automatic' || type === 'currency') {
|
||||
if (additionalFields.stepsStart === undefined
|
||||
|| !additionalFields.stepsEnd === undefined) {
|
||||
throw new Error('Steps start and steps end fields must be set');
|
||||
}
|
||||
}
|
||||
|
@ -805,7 +805,7 @@ export class ClickUp implements INodeType {
|
|||
const name = this.getNodeParameter('name', i) as string;
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||
const body: ITask = {
|
||||
name,
|
||||
name,
|
||||
};
|
||||
if (additionalFields.customFieldsJson) {
|
||||
const customFields = validateJSON(additionalFields.customFieldsJson as string);
|
||||
|
@ -1115,7 +1115,7 @@ export class ClickUp implements INodeType {
|
|||
const timezone = this.getTimezone();
|
||||
const body: IDataObject = {
|
||||
start: moment.tz(start, timezone).valueOf(),
|
||||
duration: duration * 60000,
|
||||
duration: duration * 60000,
|
||||
tid: taskId,
|
||||
};
|
||||
Object.assign(body, additionalFields);
|
||||
|
@ -1140,7 +1140,12 @@ export class ClickUp implements INodeType {
|
|||
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 (responseData.data) {
|
||||
responseData = responseData.data;
|
||||
} else {
|
||||
throw new Error('There seems to be nothing to stop.');
|
||||
}
|
||||
}
|
||||
if (operation === 'delete') {
|
||||
const teamId = this.getNodeParameter('team', i) as string;
|
||||
|
@ -1185,7 +1190,7 @@ export class ClickUp implements INodeType {
|
|||
const tagNames = this.getNodeParameter('tagNames', i) as string[];
|
||||
const body: IDataObject = {};
|
||||
body.time_entry_ids = timeEntryIds.split(',');
|
||||
body.tags = tagNames.map((tag) => ( JSON.parse(tag).name ));
|
||||
body.tags = tagNames.map((tag) => (JSON.parse(tag).name));
|
||||
responseData = await clickupApiRequest.call(this, 'DELETE', `/team/${teamId}/time_entries/tags`, body);
|
||||
responseData = { success: true };
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import {
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export const timeEntryOperations = [
|
||||
{
|
||||
|
@ -23,12 +23,12 @@ export const timeEntryOperations = [
|
|||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description:'Delete a time entry',
|
||||
description: 'Delete a time entry',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description:'Get a time entry',
|
||||
description: 'Get a time entry',
|
||||
},
|
||||
{
|
||||
name: 'Get All',
|
||||
|
@ -38,17 +38,17 @@ export const timeEntryOperations = [
|
|||
{
|
||||
name: 'Start',
|
||||
value: 'start',
|
||||
description:'Start a time entry',
|
||||
description: 'Start a time entry',
|
||||
},
|
||||
{
|
||||
name: 'Stop',
|
||||
value: 'stop',
|
||||
description:'Stop the current running timer',
|
||||
description: 'Stop the current running timer',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
description:'Update a time Entry',
|
||||
description: 'Update a time Entry',
|
||||
},
|
||||
],
|
||||
default: 'create',
|
||||
|
@ -58,9 +58,9 @@ export const timeEntryOperations = [
|
|||
|
||||
export const timeEntryFields = [
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* timeEntry:getAll */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* timeEntry:getAll */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Team ID',
|
||||
name: 'team',
|
||||
|
@ -153,9 +153,10 @@ export const timeEntryFields = [
|
|||
},
|
||||
],
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* timeEntry:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* timeEntry:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Team ID',
|
||||
name: 'team',
|
||||
|
@ -213,9 +214,10 @@ export const timeEntryFields = [
|
|||
},
|
||||
required: true,
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* timeEntry:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* timeEntry:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Team ID',
|
||||
name: 'team',
|
||||
|
@ -467,9 +469,10 @@ export const timeEntryFields = [
|
|||
},
|
||||
],
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* timeEntry:start */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* timeEntry:start */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Team ID',
|
||||
name: 'team',
|
||||
|
@ -539,9 +542,10 @@ export const timeEntryFields = [
|
|||
},
|
||||
],
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* timeEntry:stop */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* timeEntry:stop */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Team ID',
|
||||
name: 'team',
|
||||
|
@ -562,9 +566,10 @@ export const timeEntryFields = [
|
|||
},
|
||||
required: true,
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* timeEntry:delete */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* timeEntry:delete */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Team ID',
|
||||
name: 'team',
|
||||
|
@ -602,9 +607,10 @@ export const timeEntryFields = [
|
|||
},
|
||||
required: true,
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* timeEntry:update */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* timeEntry:update */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Team ID',
|
||||
name: 'team',
|
||||
|
|
Loading…
Reference in a new issue