Add features to child tasks

This commit is contained in:
Andrew 2022-02-25 19:53:38 -05:00
parent 31cb2793fd
commit 45ae49e84e
3 changed files with 21 additions and 4 deletions

View File

@ -80,6 +80,10 @@ class Management_Controller:
def get_scheduled_task_model(schedule_id):
return management_helper.get_scheduled_task_model(schedule_id)
@staticmethod
def get_child_schedules(sch_id):
return management_helper.get_child_schedules(sch_id)
@staticmethod
def get_schedules_by_server(server_id):
return management_helper.get_schedules_by_server(server_id)

View File

@ -622,6 +622,7 @@ class PanelHandler(BaseHandler):
page_data['schedule']['server_id'] = server_id
page_data['schedule']['schedule_id'] = schedule.schedule_id
page_data['schedule']['action'] = schedule.action
page_data['schedule']['children'] = self.controller.management.get_child_schedules(sch_id)
# We check here to see if the command is any of the default ones.
# We do not want a user changing to a custom command and seeing our command there.
if schedule.action != 'start' or schedule.action != 'stop' or schedule.action != 'restart' or schedule.action != 'backup':
@ -1152,7 +1153,9 @@ class PanelHandler(BaseHandler):
"command": command,
"cron_string": cron_string,
"enabled": enabled,
"one_time": one_time
"one_time": one_time,
"parent": None,
"delay": 0
}
else:
job_data = {
@ -1165,7 +1168,9 @@ class PanelHandler(BaseHandler):
#We'll base every interval off of a midnight start time.
"start_time": '00:00',
"one_time": one_time,
"cron_string": ''
"cron_string": '',
'parent': None,
'delay': 0
}
self.tasks_manager.schedule_job(job_data)

View File

@ -24,7 +24,7 @@
</div>
<!-- Page Title Header Ends-->
{% include "parts/details_stats.html %}
{% include "parts/details_stats.html" %}
<div class="row">
@ -34,7 +34,7 @@
{% include "parts/server_controls_list.html %}
<div class="row">
<div class="col-md-12 col-sm-12">
<div class="col-md-8 col-sm-8">
{% if data['new_schedule'] == True %}
<form class="forms-sample" method="post" action="/panel/new_schedule?id={{ data['server_stats']['server_id']['server_id'] }}">
{% else %}
@ -130,6 +130,14 @@
<button type="reset" onclick="location.href=`/panel/server_detail?id={{ data['server_stats']['server_id']['server_id'] }}&subpage=tasks`" class="btn btn-light"><i class="fas fa-times"></i> {{ translate('serverConfig', 'cancel', data['lang']) }}</button>
</form>
</div>
<div class="col-sm-4 grid-margin">
<h4>Linked Child Tasks</h4>
<ul>
{% for schedule in data['schedule']['children'] %}
<li style="overflow: auto;"><a href="/panel/edit_schedule?id={{schedule.server_id}}&sch_id={{schedule.schedule_id}}">{{schedule.schedule_id}} | {{schedule.command}}</a></li>
{% end %}
</ul>
</div>
</div>
</div>