diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7a931dea..8a7b3e5b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,11 +4,12 @@
### New features
TBD
### Bug fixes
-TBD
+- Fix Schedules Traceback Bug ([Merge Request |](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/419) [Commit |](https://gitlab.com/crafty-controller/crafty-4/-/commit/f69d79b7023d6c26fccb5caeae9e47b40ebe5af2) [Commit](https://gitlab.com/crafty-controller/crafty-4/-/commit/ad318296dc93beb5533fcd13066440df9f9e799a))
### Tweaks
- credits-v2| Translator status ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/421))
+- Use Names in Schedules ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/419))
### Lang
-TBD
+- Make Schedules panel translatable ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/419))
## --- [4.0.8] - 2022/08/05
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 cd9590d0..40d11904 100644
--- a/app/classes/web/panel_handler.py
+++ b/app/classes/web/panel_handler.py
@@ -901,6 +901,7 @@ class PanelHandler(BaseHandler):
page_data["new_schedule"] = True
page_data["schedule"] = {}
page_data["schedule"]["children"] = []
+ page_data["schedule"]["name"] = ""
page_data["schedule"]["server_id"] = server_id
page_data["schedule"]["schedule_id"] = ""
page_data["schedule"]["action"] = ""
@@ -968,6 +969,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 +1562,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 +1627,7 @@ class PanelHandler(BaseHandler):
if interval_type == "days":
job_data = {
+ "name": name,
"server_id": server_id,
"action": action,
"interval_type": interval_type,
@@ -1635,6 +1642,7 @@ class PanelHandler(BaseHandler):
}
elif difficulty == "reaction":
job_data = {
+ "name": name,
"server_id": server_id,
"action": action,
"interval_type": interval_type,
@@ -1650,6 +1658,7 @@ class PanelHandler(BaseHandler):
}
elif difficulty == "advanced":
job_data = {
+ "name": name,
"server_id": server_id,
"action": action,
"interval_type": "",
@@ -1665,6 +1674,7 @@ class PanelHandler(BaseHandler):
}
else:
job_data = {
+ "name": name,
"server_id": server_id,
"action": action,
"interval_type": interval_type,
@@ -1714,6 +1724,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 +1788,7 @@ class PanelHandler(BaseHandler):
if interval_type == "days":
job_data = {
+ "name": name,
"server_id": server_id,
"action": action,
"interval_type": interval_type,
@@ -1791,6 +1803,7 @@ class PanelHandler(BaseHandler):
}
elif difficulty == "advanced":
job_data = {
+ "name": name,
"server_id": server_id,
"action": action,
"interval_type": "",
@@ -1806,6 +1819,7 @@ class PanelHandler(BaseHandler):
}
elif difficulty == "reaction":
job_data = {
+ "name": name,
"server_id": server_id,
"action": action,
"interval_type": interval_type,
@@ -1821,6 +1835,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 ae4e54e3..34057466 100644
--- a/app/frontend/templates/panel/server_schedule_edit.html
+++ b/app/frontend/templates/panel/server_schedule_edit.html
@@ -9,14 +9,15 @@
ID | -Action | -Command | -Interval | -Next Run | -Enabled | -Edit | +{{ translate('serverSchedules', 'name', data['lang']) }} + | +{{ translate('serverSchedules', 'action', data['lang']) + }} | +{{ translate('serverSchedules', 'command', + data['lang']) }} | +{{ translate('serverSchedules', 'interval', + data['lang']) }} | +{{ translate('serverSchedules', 'nextRun', + data['lang']) }} | +{{ translate('serverSchedules', 'enabled', + data['lang']) }} | +{{ translate('serverSchedules', 'edit', data['lang']) + }} |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
- {{schedule.schedule_id}} +{{schedule.name}} |
{{schedule.action}} @@ -82,10 +91,11 @@ |
{% if schedule.interval != '' %}
- Every +{{ translate('serverSchedules', 'every', data['lang']) }} {{schedule.interval}} {{schedule.interval_type}} {% elif schedule.interval_type == 'reaction' %} -{{schedule.interval_type}} {{schedule.interval_type}} Cron String: {{schedule.cron_string}} @@ -120,9 +130,12 @@ style="table-layout:fixed;">Action |
- Command |
- Enabled |
+ {{ translate('serverSchedules', 'action', data['lang'])
+ }} |
+ {{ translate('serverSchedules', 'command',
+ data['lang']) }} |
+ {{ translate('serverSchedules', 'enabled',
+ data['lang']) }} |
| {% if schedule.enabled %} - Yes + {{ translate('serverSchedules', 'yes', data['lang']) }} {% else %} - No + {{ translate('serverSchedules', 'no', data['lang']) }} {% end %} | @@ -152,7 +165,8 @@