mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34:06 -08:00
⚡ small improvements
This commit is contained in:
parent
b395ac0686
commit
75b829f8ae
|
@ -570,6 +570,18 @@ export class ClickUp implements INodeType {
|
|||
name,
|
||||
type,
|
||||
};
|
||||
if (type === 'number' || type === 'currency') {
|
||||
if (!additionalFields.unit) {
|
||||
throw new Error('Unit field must be set');
|
||||
}
|
||||
}
|
||||
if (type === 'number' || type === 'percentaje'
|
||||
|| type === 'automatic' || type === 'currency' ) {
|
||||
if (additionalFields.stepsStart === undefined
|
||||
|| !additionalFields.stepsEnd === undefined) {
|
||||
throw new Error('Steps start and steps end fields must be set');
|
||||
}
|
||||
}
|
||||
if (additionalFields.unit) {
|
||||
body.unit = additionalFields.unit as string;
|
||||
}
|
||||
|
@ -873,33 +885,28 @@ export class ClickUp implements INodeType {
|
|||
if (resource === 'taskDependency') {
|
||||
if (operation === 'create') {
|
||||
const taskId = this.getNodeParameter('task', i) as string;
|
||||
const dependsOn = this.getNodeParameter('dependsOn', i) as string;
|
||||
const dependencyOf = this.getNodeParameter('dependencyOf', i) as string;
|
||||
if (dependencyOf !== '' && dependsOn !== '' ) {
|
||||
throw new Error('Both can not be passed in the same request.');
|
||||
}
|
||||
const dependecyIs = this.getNodeParameter('is', i) as string;
|
||||
const theTaskId = this.getNodeParameter('theTaskId', i) as string;
|
||||
const body: IDataObject = {};
|
||||
if (dependsOn) {
|
||||
body.depends_on = dependsOn;
|
||||
if (dependecyIs === 'waitingOn') {
|
||||
body.depends_on = theTaskId;
|
||||
}
|
||||
if (dependencyOf) {
|
||||
body.dependency_of = dependencyOf;
|
||||
if (dependecyIs === 'blocking') {
|
||||
body.dependency_of = theTaskId;
|
||||
}
|
||||
responseData = await clickupApiRequest.call(this, 'POST', `/task/${taskId}/dependency`, body);
|
||||
responseData = { success: true };
|
||||
}
|
||||
if (operation === 'delete') {
|
||||
const taskId = this.getNodeParameter('task', i) as string;
|
||||
const dependsOn = this.getNodeParameter('dependsOn', i) as string;
|
||||
const dependencyOf = this.getNodeParameter('dependencyOf', i) as string;
|
||||
if (dependencyOf !== '' && dependsOn !== '' ) {
|
||||
throw new Error('Both can not be passed in the same request.');
|
||||
const dependecyIs = this.getNodeParameter('is', i) as string;
|
||||
const theTaskId = this.getNodeParameter('theTaskId', i) as string;
|
||||
|
||||
if (dependecyIs === 'waitingOn') {
|
||||
qs.depends_on = theTaskId;
|
||||
}
|
||||
if (dependsOn) {
|
||||
qs.depends_on = dependsOn;
|
||||
}
|
||||
if (dependencyOf) {
|
||||
qs.dependency_of = dependencyOf;
|
||||
if (dependecyIs === 'blocking') {
|
||||
qs.dependency_of = theTaskId;
|
||||
}
|
||||
responseData = await clickupApiRequest.call(this, 'DELETE', `/task/${taskId}/dependency`, {}, qs);
|
||||
responseData = { success: true };
|
||||
|
|
|
@ -151,7 +151,7 @@ export const goalKeyResultFields = [
|
|||
minValue: 0,
|
||||
},
|
||||
default: 0,
|
||||
description: 'Required for Percentage, Automatic (when Task IDs or List IDs are filled), Number and Currency',
|
||||
description: 'Required for Percentage, Automatic, Number and Currency',
|
||||
},
|
||||
{
|
||||
displayName: 'Steps End',
|
||||
|
@ -161,7 +161,7 @@ export const goalKeyResultFields = [
|
|||
minValue: 0,
|
||||
},
|
||||
default: 0,
|
||||
description: 'Required for Percentage, Automatic (when Task IDs or List IDs are filled), Number and Currency',
|
||||
description: 'Required for Percentage, Automatic, Number and Currency',
|
||||
},
|
||||
{
|
||||
displayName: 'Task IDs',
|
||||
|
@ -257,7 +257,7 @@ export const goalKeyResultFields = [
|
|||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
default: 0,
|
||||
default: 1,
|
||||
},
|
||||
{
|
||||
displayName: 'Steps End',
|
||||
|
|
|
@ -54,10 +54,22 @@ export const taskDependencyFields = [
|
|||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Depends On',
|
||||
name: 'dependsOn',
|
||||
type: 'string',
|
||||
displayName: 'Is',
|
||||
name: 'is',
|
||||
type: 'options',
|
||||
default: '',
|
||||
options: [
|
||||
{
|
||||
name: 'Bloking',
|
||||
value: 'blocking',
|
||||
description: `Tasks that can't start until the task above is completed`,
|
||||
},
|
||||
{
|
||||
name: 'Waiting On',
|
||||
value: 'waitingOn',
|
||||
description: `Tasks that must be completed before the task above`,
|
||||
},
|
||||
],
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
|
@ -68,12 +80,13 @@ export const taskDependencyFields = [
|
|||
],
|
||||
},
|
||||
},
|
||||
description: 'Dependency type between the two tasks',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Dependency Of',
|
||||
name: 'dependencyOf',
|
||||
displayName: 'The Task ID',
|
||||
name: 'theTaskId',
|
||||
type: 'string',
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
|
@ -84,6 +97,7 @@ export const taskDependencyFields = [
|
|||
],
|
||||
},
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* taskDependency:delete */
|
||||
|
@ -106,10 +120,22 @@ export const taskDependencyFields = [
|
|||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Depends On',
|
||||
name: 'dependsOn',
|
||||
type: 'string',
|
||||
displayName: 'Is',
|
||||
name: 'is',
|
||||
type: 'options',
|
||||
default: '',
|
||||
options: [
|
||||
{
|
||||
name: 'Bloking',
|
||||
value: 'blocking',
|
||||
description: `Tasks that can't start until the task above is completed`,
|
||||
},
|
||||
{
|
||||
name: 'Waiting On',
|
||||
value: 'waitingOn',
|
||||
description: `Tasks that must be completed before the task above`,
|
||||
},
|
||||
],
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
|
@ -120,12 +146,13 @@ export const taskDependencyFields = [
|
|||
],
|
||||
},
|
||||
},
|
||||
description: 'Dependency type between the two tasks',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Dependency Of',
|
||||
name: 'dependencyOf',
|
||||
displayName: 'The Task ID',
|
||||
name: 'theTaskId',
|
||||
type: 'string',
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
|
@ -136,5 +163,6 @@ export const taskDependencyFields = [
|
|||
],
|
||||
},
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
] as INodeProperties[];
|
||||
|
|
Loading…
Reference in a new issue