From 2a5f1bd30cd51c5c28c3c530dadf759d661f0040 Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Mon, 12 Apr 2021 12:23:50 +0200 Subject: [PATCH] Added add route --- config/routes.yaml | 7 +++ public/js/site.js | 4 +- src/Controller/JobController.php | 5 ++ templates/addjob.html.twig | 79 ------------------------------ templates/base.html.twig | 10 ++-- templates/flashes.html.twig | 4 +- templates/job/add.html.twig | 49 ++++++++++++++++++ templates/job/index.html.twig | 13 ++--- templates/security/login.html.twig | 15 +++--- webcron.old/addjob.php | 2 +- 10 files changed, 86 insertions(+), 102 deletions(-) delete mode 100644 templates/addjob.html.twig create mode 100644 templates/job/add.html.twig diff --git a/config/routes.yaml b/config/routes.yaml index 16a9f79..1b65b8b 100644 --- a/config/routes.yaml +++ b/config/routes.yaml @@ -28,3 +28,10 @@ job_view: path: '/job/{id}' defaults: _controller: JeroenED\Webcron\Controller\JobController::viewAction + requirements: + id: \d+ + +job_add: + path: '/job/add' + defaults: + _controller: JeroenED\Webcron\Controller\JobController::addAction diff --git a/public/js/site.js b/public/js/site.js index a2ff37e..ba2f615 100644 --- a/public/js/site.js +++ b/public/js/site.js @@ -2,8 +2,8 @@ $(document).ready(function() { $("body").on("click", "#patternDropdown li", function() { if(this.value != "custom") { $("input#delay").val($(this).data("val")); } }); - $('#nextrunselector').datetimepicker( { format: 'DD/MM/YYYY HH:mm:ss' } ); - $('#lastrunselector').datetimepicker( { format: 'DD/MM/YYYY HH:mm:ss' } ); + $('#nextrunselector').datetimepicker({format: 'L LTS'}); + $('#lastrunselector').datetimepicker({format: 'L LTS'}); $("body").on("click", ".runcron", function() { $("#ajax_loader").show(); diff --git a/src/Controller/JobController.php b/src/Controller/JobController.php index a886121..913f437 100644 --- a/src/Controller/JobController.php +++ b/src/Controller/JobController.php @@ -24,4 +24,9 @@ class JobController extends Controller { return new Response('Not implemented yet', Response::HTTP_TOO_EARLY); } + + public function addAction() + { + return $this->render('job/add.html.twig'); + } } \ No newline at end of file diff --git a/templates/addjob.html.twig b/templates/addjob.html.twig deleted file mode 100644 index 7ab325b..0000000 --- a/templates/addjob.html.twig +++ /dev/null @@ -1,79 +0,0 @@ -{% extends "base.html.twig" %} -{% block title %}Add job{% endblock %} -{% block content %} -
- {% if not error == "" %} -
- × - Error! {{ error }} -
- {% endif %} - - {% if not message == "" %} -
- × - {{ message }} -
- {% endif %} - -
- - -
-
- - -

-
- -
- - -
- -
- -
- - -
-
-
- -
- - - - -
-
-
- -
- - - - - -  Eternal - -
-
-
- - -
- -
- -{% endblock %} \ No newline at end of file diff --git a/templates/base.html.twig b/templates/base.html.twig index caddd22..79fa1e4 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -5,12 +5,16 @@ Webcron management :: {% block title %}{% endblock %} - + + {% block extrastyles %}{% endblock %} - + + + {% block extrascripts %}{% endblock %} + @@ -26,7 +30,7 @@
diff --git a/templates/flashes.html.twig b/templates/flashes.html.twig index 3af10e3..b6982df 100644 --- a/templates/flashes.html.twig +++ b/templates/flashes.html.twig @@ -2,7 +2,9 @@ {% for flash in flashes %} {% endfor %} {% endif %} \ No newline at end of file diff --git a/templates/job/add.html.twig b/templates/job/add.html.twig new file mode 100644 index 0000000..49ad2f2 --- /dev/null +++ b/templates/job/add.html.twig @@ -0,0 +1,49 @@ +{% extends "base.html.twig" %} +{% block title %}Add job{% endblock %} +{% block content %} +

Add a cronjob

+
+ +
+ + +
+
+ + +
+ +
+ + +
+ +
+ + +
+
+ + +
+
+ + +
+
+ + +
+ +
+ +{% endblock %} + +{% block extrastyles %} + +{% endblock %} + +{% block extrascripts %} + + +{% endblock %} \ No newline at end of file diff --git a/templates/job/index.html.twig b/templates/job/index.html.twig index eec1d14..ab3fcf7 100644 --- a/templates/job/index.html.twig +++ b/templates/job/index.html.twig @@ -2,13 +2,8 @@ {% block title %}Overview{% endblock %} {% block content %}

Overview of your cronjobs

- {% if not message == "" %} -
- × - {{ message }} -
- {% endif %} - + +
@@ -16,7 +11,7 @@ -{% for job in jobs %} + {% for job in jobs %} @@ -29,7 +24,7 @@ -{% endfor %} + {% endfor %}
Name HostNext run
{{ job.name }} {{ job.data.host }}