From 45b02644997bb0e6e2fd6d547f294fa554f30d70 Mon Sep 17 00:00:00 2001 From: Andrew Date: Tue, 4 Jul 2023 12:10:59 -0400 Subject: [PATCH 1/2] Fix enabling schedules from schedule list --- .../routes/api/servers/server/tasks/index.py | 27 ++++++++++--------- .../api/servers/server/tasks/task/index.py | 27 ++++++++++--------- 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/app/classes/web/routes/api/servers/server/tasks/index.py b/app/classes/web/routes/api/servers/server/tasks/index.py index 72f8def4..8e98bbbe 100644 --- a/app/classes/web/routes/api/servers/server/tasks/index.py +++ b/app/classes/web/routes/api/servers/server/tasks/index.py @@ -92,20 +92,21 @@ class ApiServersServerTasksIndexHandler(BaseApiHandler): data["start_time"] = "00:00" # validate cron string - if data["cron_string"] != "" and not croniter.is_valid(data["cron_string"]): - return self.finish_json( - 405, - { - "status": "error", - "error": self.helper.translation.translate( - "error", - "cronFormat", - self.controller.users.get_user_lang_by_id( - auth_data[4]["user_id"] + if "cron_string" in data: + if data["cron_string"] != "" and not croniter.is_valid(data["cron_string"]): + return self.finish_json( + 405, + { + "status": "error", + "error": self.helper.translation.translate( + "error", + "cronFormat", + self.controller.users.get_user_lang_by_id( + auth_data[4]["user_id"] + ), ), - ), - }, - ) + }, + ) if "parent" not in data: data["parent"] = None task_id = self.tasks_manager.schedule_job(data) diff --git a/app/classes/web/routes/api/servers/server/tasks/task/index.py b/app/classes/web/routes/api/servers/server/tasks/task/index.py index 1db5ccf1..742312a6 100644 --- a/app/classes/web/routes/api/servers/server/tasks/task/index.py +++ b/app/classes/web/routes/api/servers/server/tasks/task/index.py @@ -136,20 +136,21 @@ class ApiServersServerTasksTaskIndexHandler(BaseApiHandler): data["parent"] = None data["server_id"] = server_id - if data["cron_string"] != "" and not croniter.is_valid(data["cron_string"]): - return self.finish_json( - 405, - { - "status": "error", - "error": self.helper.translation.translate( - "error", - "cronFormat", - self.controller.users.get_user_lang_by_id( - auth_data[4]["user_id"] + if "cron_string" in data: + if data["cron_string"] != "" and not croniter.is_valid(data["cron_string"]): + return self.finish_json( + 405, + { + "status": "error", + "error": self.helper.translation.translate( + "error", + "cronFormat", + self.controller.users.get_user_lang_by_id( + auth_data[4]["user_id"] + ), ), - ), - }, - ) + }, + ) self.tasks_manager.update_job(task_id, data) self.controller.management.add_to_audit_log( From 748db1866ac1a9f13c8ccfc89bae6320db830fbe Mon Sep 17 00:00:00 2001 From: Zedifus Date: Tue, 18 Jul 2023 20:57:30 +0100 Subject: [PATCH 2/2] Update changelog !606 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b79b960..98292835 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ TBD - Include tzdata in Docker image ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/604)) - Fix text/formatting issue on server config page ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/602)) - Bump required version of PyYAML to 6.0.1 ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/609)) +- Fix enable/disable schedule toggles on schedule list ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/606)) ### Tweaks - Add public status link to login ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/608)) ### Lang