mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 20:24:05 -08:00
✨ Make it possible to use custom cron-expressions and add
"Every Hour" option to Cron-Node
This commit is contained in:
parent
cc3f2c42d1
commit
60162d5c46
|
@ -53,6 +53,10 @@ export class Cron implements INodeType {
|
|||
name: 'mode',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Every Hour',
|
||||
value: 'everyHour'
|
||||
},
|
||||
{
|
||||
name: 'Every Day',
|
||||
value: 'everyDay'
|
||||
|
@ -65,6 +69,10 @@ export class Cron implements INodeType {
|
|||
name: 'Every Month',
|
||||
value: 'everyMonth'
|
||||
},
|
||||
{
|
||||
name: 'Custom',
|
||||
value: 'custom'
|
||||
},
|
||||
],
|
||||
default: 'everyDay',
|
||||
description: 'How often to trigger.',
|
||||
|
@ -77,6 +85,14 @@ export class Cron implements INodeType {
|
|||
minValue: 0,
|
||||
maxValue: 23,
|
||||
},
|
||||
displayOptions: {
|
||||
hide: {
|
||||
mode: [
|
||||
'custom',
|
||||
'everyHour',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: 14,
|
||||
description: 'The hour of the day to trigger (24h format).',
|
||||
},
|
||||
|
@ -88,6 +104,13 @@ export class Cron implements INodeType {
|
|||
minValue: 0,
|
||||
maxValue: 59,
|
||||
},
|
||||
displayOptions: {
|
||||
hide: {
|
||||
mode: [
|
||||
'custom',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: 0,
|
||||
description: 'The minute of the day to trigger.',
|
||||
},
|
||||
|
@ -153,6 +176,20 @@ export class Cron implements INodeType {
|
|||
default: '1',
|
||||
description: 'The weekday to trigger.',
|
||||
},
|
||||
{
|
||||
displayName: 'Cron Expression',
|
||||
name: 'cronExpression',
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
mode: [
|
||||
'custom',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: '* * * * * *',
|
||||
description: 'Use custom cron expression. Values and ranges as follows:<ul><li>Seconds: 0-59</li><li>Minutes: 0 - 59</li><li>Hours: 0 - 23</li><li>Day of Month: 1 - 31</li><li>Months: 0 - 11 (Jan - Dec)</li><li>Day of Week: 0 - 6 (Sun - Sat)</li></ul>',
|
||||
},
|
||||
]
|
||||
},
|
||||
],
|
||||
|
@ -185,6 +222,11 @@ export class Cron implements INodeType {
|
|||
if (triggerTimes.item !== undefined) {
|
||||
for (const item of triggerTimes.item) {
|
||||
cronTime = [];
|
||||
if (item.mode === 'custom') {
|
||||
cronTimes.push(item.cronExpression as string);
|
||||
continue;
|
||||
}
|
||||
|
||||
for (parameterName of parameterOrder) {
|
||||
if (item[parameterName] !== undefined) {
|
||||
// Value is set so use it
|
||||
|
|
Loading…
Reference in a new issue