diff --git a/app/classes/controllers/management_controller.py b/app/classes/controllers/management_controller.py index b0b1f10a..547a8ebd 100644 --- a/app/classes/controllers/management_controller.py +++ b/app/classes/controllers/management_controller.py @@ -76,7 +76,7 @@ class ManagementController: interval_type, start_time, command, - comment=None, + name, enabled=True, ): return HelpersManagement.create_scheduled_task( @@ -86,7 +86,7 @@ class ManagementController: interval_type, start_time, command, - comment, + name, enabled, ) diff --git a/app/classes/models/management.py b/app/classes/models/management.py index c3eed588..67d1ff9c 100644 --- a/app/classes/models/management.py +++ b/app/classes/models/management.py @@ -110,7 +110,7 @@ class Schedules(BaseModel): interval_type = CharField() start_time = CharField(null=True) command = CharField(null=True) - comment = CharField() + name = CharField() one_time = BooleanField(default=False) cron_string = CharField(default="") parent = IntegerField(null=True) @@ -265,7 +265,7 @@ class HelpersManagement: interval_type, start_time, command, - comment=None, + name, enabled=True, one_time=False, cron_string="* * * * *", @@ -281,7 +281,7 @@ class HelpersManagement: Schedules.interval_type: interval_type, Schedules.start_time: start_time, Schedules.command: command, - Schedules.comment: comment, + Schedules.name: name, Schedules.one_time: one_time, Schedules.cron_string: cron_string, Schedules.parent: parent, diff --git a/app/classes/shared/tasks.py b/app/classes/shared/tasks.py index 260ceaa8..7055d1cb 100644 --- a/app/classes/shared/tasks.py +++ b/app/classes/shared/tasks.py @@ -303,7 +303,7 @@ class TasksManager: job_data["interval_type"], job_data["start_time"], job_data["command"], - "None", + job_data["name"], job_data["enabled"], job_data["one_time"], job_data["cron_string"], @@ -318,6 +318,7 @@ class TasksManager: # Check to see if it's enabled and is not a chain reaction. if job_data["enabled"] and job_data["interval_type"] != "reaction": + new_job = "error" if job_data["cron_string"] != "": try: new_job = self.scheduler.add_job( @@ -447,6 +448,7 @@ class TasksManager: ) if job_data["enabled"] and job_data["interval"] != "reaction": + new_job = "error" if job_data["cron_string"] != "": try: new_job = self.scheduler.add_job( diff --git a/app/classes/web/panel_handler.py b/app/classes/web/panel_handler.py index b5a07eb3..d70f98c0 100644 --- a/app/classes/web/panel_handler.py +++ b/app/classes/web/panel_handler.py @@ -968,6 +968,10 @@ class PanelHandler(BaseHandler): page_data["schedule"]["server_id"] = server_id page_data["schedule"]["schedule_id"] = schedule.schedule_id page_data["schedule"]["action"] = schedule.action + if schedule.name: + page_data["schedule"]["name"] = schedule.name + else: + page_data["schedule"]["name"] = "" page_data["schedule"][ "children" ] = self.controller.management.get_child_schedules(sch_id) @@ -1557,6 +1561,7 @@ class PanelHandler(BaseHandler): difficulty = bleach.clean(self.get_argument("difficulty", None)) server_obj = self.controller.servers.get_server_obj(server_id) enabled = bleach.clean(self.get_argument("enabled", "0")) + name = bleach.clean(self.get_argument("name", "")) if difficulty == "basic": action = bleach.clean(self.get_argument("action", None)) interval = bleach.clean(self.get_argument("interval", None)) @@ -1621,6 +1626,7 @@ class PanelHandler(BaseHandler): if interval_type == "days": job_data = { + "name": name, "server_id": server_id, "action": action, "interval_type": interval_type, @@ -1635,6 +1641,7 @@ class PanelHandler(BaseHandler): } elif difficulty == "reaction": job_data = { + "name": name, "server_id": server_id, "action": action, "interval_type": interval_type, @@ -1650,6 +1657,7 @@ class PanelHandler(BaseHandler): } elif difficulty == "advanced": job_data = { + "name": name, "server_id": server_id, "action": action, "interval_type": "", @@ -1665,6 +1673,7 @@ class PanelHandler(BaseHandler): } else: job_data = { + "name": name, "server_id": server_id, "action": action, "interval_type": interval_type, @@ -1714,6 +1723,7 @@ class PanelHandler(BaseHandler): difficulty = bleach.clean(self.get_argument("difficulty", None)) server_obj = self.controller.servers.get_server_obj(server_id) enabled = bleach.clean(self.get_argument("enabled", "0")) + name = bleach.clean(self.get_argument("name", "")) if difficulty == "basic": action = bleach.clean(self.get_argument("action", None)) interval = bleach.clean(self.get_argument("interval", None)) @@ -1777,6 +1787,7 @@ class PanelHandler(BaseHandler): if interval_type == "days": job_data = { + "name": name, "server_id": server_id, "action": action, "interval_type": interval_type, @@ -1791,6 +1802,7 @@ class PanelHandler(BaseHandler): } elif difficulty == "advanced": job_data = { + "name": name, "server_id": server_id, "action": action, "interval_type": "", @@ -1806,6 +1818,7 @@ class PanelHandler(BaseHandler): } elif difficulty == "reaction": job_data = { + "name": name, "server_id": server_id, "action": action, "interval_type": interval_type, @@ -1821,6 +1834,7 @@ class PanelHandler(BaseHandler): } else: job_data = { + "name": name, "server_id": server_id, "action": action, "interval_type": interval_type, diff --git a/app/frontend/templates/panel/server_schedule_edit.html b/app/frontend/templates/panel/server_schedule_edit.html index a084d53a..34057466 100644 --- a/app/frontend/templates/panel/server_schedule_edit.html +++ b/app/frontend/templates/panel/server_schedule_edit.html @@ -47,6 +47,12 @@ +
{{schedule.schedule_id}}
+{{schedule.name}}
{{schedule.action}}
@@ -94,7 +94,8 @@{{ translate('serverSchedules', 'every', data['lang']) }}
{{schedule.interval}} {{schedule.interval_type}}
{% elif schedule.interval_type == 'reaction' %} -{{schedule.interval_type}}
child of ID: {{ schedule.parent }}
{{schedule.interval_type}}
{{ translate('serverSchedules', 'child', data['lang'])}}:
+ {{ schedule.parent }}
Cron String:
{{schedule.cron_string}}
@@ -201,7 +202,11 @@{{schedule.next_run}}
+ {% else %} +zzzzzzz
+ {% end %}