From e56a3c108e0809aafe3c501b8a365823aa00950e Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Wed, 26 May 2021 13:34:19 +0200 Subject: [PATCH] NEW FEATURE: Eternal jobs --- assets/job/add.js | 7 +++++++ src/Repository/Job.php | 2 +- templates/job/add.html.twig | 10 +++++++++- templates/job/edit.html.twig | 10 +++++++++- 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/assets/job/add.js b/assets/job/add.js index 2ab9707..7ba0b92 100644 --- a/assets/job/add.js +++ b/assets/job/add.js @@ -8,6 +8,7 @@ $(function() { initContainerType(); initVarInputs(); initIntervalPattern(); + initEternalCheckbox(); bsCustomFileInput.init() }); @@ -103,6 +104,12 @@ function initVarInputs() }) } +function initEternalCheckbox() { + $('.lastrun-eternal').on('click', function() { + $('#lastrunselector').prop('disabled', $(this).prop('checked')); + $('#lastrunselector').prop('value', ''); + }) +} function initIntervalPattern() { diff --git a/src/Repository/Job.php b/src/Repository/Job.php index 667817a..95b19c0 100644 --- a/src/Repository/Job.php +++ b/src/Repository/Job.php @@ -150,7 +150,7 @@ class Job public function prepareJob(array $values): array { - if(empty($values['lastrun'])) { + if(empty($values['lastrun']) || (isset($values['lastrun-eternal']) && $values['lastrun-eternal'] == 'true')) { $values['lastrun'] = NULL; } else { $values['lastrun'] = DateTime::createFromFormat('d/m/Y H:i:s',$values['lastrun'])->getTimestamp(); diff --git a/templates/job/add.html.twig b/templates/job/add.html.twig index f5007b0..8d3af0e 100644 --- a/templates/job/add.html.twig +++ b/templates/job/add.html.twig @@ -33,7 +33,15 @@
- +
+
+
+ +
+ Eternal +
+ +

Job details

diff --git a/templates/job/edit.html.twig b/templates/job/edit.html.twig index 5661ef8..7709691 100644 --- a/templates/job/edit.html.twig +++ b/templates/job/edit.html.twig @@ -33,7 +33,15 @@
- +
+
+
+ +
+ Eternal +
+ +

Job details