mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Merge branch 'pretzel-fixes' of https://gitlab.com/crafty-controller/crafty-commander into pretzel-fixes
This commit is contained in:
commit
59ddff16e3
@ -356,7 +356,7 @@ class PanelHandler(BaseHandler):
|
||||
if server_id is None:
|
||||
return
|
||||
|
||||
valid_subpages = ['term', 'logs', 'backup', 'config', 'files', 'admin_controls', 'tasks']
|
||||
valid_subpages = ['term', 'logs', 'backup', 'config', 'files', 'admin_controls', 'schedules']
|
||||
|
||||
if subpage not in valid_subpages:
|
||||
logger.debug('not a valid subpage')
|
||||
@ -401,10 +401,10 @@ class PanelHandler(BaseHandler):
|
||||
return
|
||||
|
||||
|
||||
if subpage == 'tasks':
|
||||
if subpage == 'schedules':
|
||||
if not page_data['permissions']['Schedule'] in page_data['user_permissions']:
|
||||
if not superuser:
|
||||
self.redirect("/panel/error?error=Unauthorized access To Scheduled Tasks")
|
||||
self.redirect("/panel/error?error=Unauthorized access To Schedules")
|
||||
return
|
||||
page_data['schedules'] = management_helper.get_schedules_by_server(server_id)
|
||||
|
||||
@ -585,7 +585,7 @@ class PanelHandler(BaseHandler):
|
||||
server_id = self.get_argument('id', None)
|
||||
page_data['schedules'] = management_helper.get_schedules_by_server(server_id)
|
||||
page_data['get_players'] = lambda: self.controller.stats.get_server_players(server_id)
|
||||
page_data['active_link'] = 'tasks'
|
||||
page_data['active_link'] = 'schedules'
|
||||
page_data['permissions'] = {
|
||||
'Commands': Enum_Permissions_Server.Commands,
|
||||
'Terminal': Enum_Permissions_Server.Terminal,
|
||||
@ -599,6 +599,7 @@ class PanelHandler(BaseHandler):
|
||||
page_data['user_permissions'] = self.controller.server_perms.get_user_id_permissions_list(exec_user["user_id"], server_id)
|
||||
page_data['server_data'] = self.controller.servers.get_server_data_by_id(server_id)
|
||||
page_data['server_stats'] = self.controller.servers.get_server_stats_by_id(server_id)
|
||||
page_data['server_stats']['server_type'] = self.controller.servers.get_server_type_by_id(server_id)
|
||||
page_data['new_schedule'] = True
|
||||
page_data['schedule'] = {}
|
||||
page_data['schedule']['children'] = []
|
||||
@ -617,7 +618,7 @@ class PanelHandler(BaseHandler):
|
||||
|
||||
if not Enum_Permissions_Server.Schedule in page_data['user_permissions']:
|
||||
if not superuser:
|
||||
self.redirect("/panel/error?error=Unauthorized access To Scheduled Tasks")
|
||||
self.redirect("/panel/error?error=Unauthorized access To Schedules")
|
||||
return
|
||||
|
||||
template = "panel/server_schedule_edit.html"
|
||||
@ -628,7 +629,7 @@ class PanelHandler(BaseHandler):
|
||||
sch_id = self.get_argument('sch_id', None)
|
||||
schedule = self.controller.management.get_scheduled_task_model(sch_id)
|
||||
page_data['get_players'] = lambda: self.controller.stats.get_server_players(server_id)
|
||||
page_data['active_link'] = 'tasks'
|
||||
page_data['active_link'] = 'schedules'
|
||||
page_data['permissions'] = {
|
||||
'Commands': Enum_Permissions_Server.Commands,
|
||||
'Terminal': Enum_Permissions_Server.Terminal,
|
||||
@ -642,6 +643,7 @@ class PanelHandler(BaseHandler):
|
||||
page_data['user_permissions'] = self.controller.server_perms.get_user_id_permissions_list(exec_user["user_id"], server_id)
|
||||
page_data['server_data'] = self.controller.servers.get_server_data_by_id(server_id)
|
||||
page_data['server_stats'] = self.controller.servers.get_server_stats_by_id(server_id)
|
||||
page_data['server_stats']['server_type'] = self.controller.servers.get_server_type_by_id(server_id)
|
||||
page_data['new_schedule'] = False
|
||||
page_data['schedule'] = {}
|
||||
page_data['schedule']['server_id'] = server_id
|
||||
@ -673,7 +675,7 @@ class PanelHandler(BaseHandler):
|
||||
|
||||
if not Enum_Permissions_Server.Schedule in page_data['user_permissions']:
|
||||
if not superuser:
|
||||
self.redirect("/panel/error?error=Unauthorized access To Scheduled Tasks")
|
||||
self.redirect("/panel/error?error=Unauthorized access To Schedules")
|
||||
return
|
||||
|
||||
template = "panel/server_schedule_edit.html"
|
||||
@ -1205,7 +1207,7 @@ class PanelHandler(BaseHandler):
|
||||
server_id,
|
||||
self.get_remote_ip())
|
||||
self.tasks_manager.reload_schedule_from_db()
|
||||
self.redirect(f"/panel/server_detail?id={server_id}&subpage=tasks")
|
||||
self.redirect(f"/panel/server_detail?id={server_id}&subpage=schedules")
|
||||
|
||||
|
||||
if page == "edit_schedule":
|
||||
@ -1353,7 +1355,7 @@ class PanelHandler(BaseHandler):
|
||||
server_id,
|
||||
self.get_remote_ip())
|
||||
self.tasks_manager.reload_schedule_from_db()
|
||||
self.redirect(f"/panel/server_detail?id={server_id}&subpage=tasks")
|
||||
self.redirect(f"/panel/server_detail?id={server_id}&subpage=schedules")
|
||||
|
||||
|
||||
elif page == "edit_user":
|
||||
|
@ -124,9 +124,9 @@
|
||||
<tbody>
|
||||
{% for server in data['servers'] %}
|
||||
<tr id="{{server['server_data']['server_id']}}" draggable="true" ondragstart="start()" ondragover="dragover()" ondragend="dragend()">
|
||||
<td>
|
||||
<td draggable="false">
|
||||
<i class="fas fa-server"></i>
|
||||
<a href="/panel/server_detail?id={{server['server_data']['server_id']}}">
|
||||
<a draggable="false" href="/panel/server_detail?id={{server['server_data']['server_id']}}">
|
||||
{{ server['server_data']['server_name'] }}
|
||||
</a>
|
||||
</td>
|
||||
|
@ -14,7 +14,7 @@
|
||||
{% end %}
|
||||
{% if data['permissions']['Schedule'] in data['user_permissions'] %}
|
||||
<li class="nav-item term-nav-item">
|
||||
<a class="nav-link {% if data['active_link'] == 'tasks' %}active{% end %}" href="/panel/server_detail?id={{ data['server_stats']['server_id']['server_id'] }}&subpage=tasks" role="tab" aria-selected="false">
|
||||
<a class="nav-link {% if data['active_link'] == 'schedules' %}active{% end %}" href="/panel/server_detail?id={{ data['server_stats']['server_id']['server_id'] }}&subpage=schedules" role="tab" aria-selected="false">
|
||||
<i class="fas fa-clock"></i>{{ translate('serverDetails', 'schedule', data['lang']) }}</a>
|
||||
</li>
|
||||
{% end %}
|
||||
|
@ -47,59 +47,59 @@
|
||||
<div class="form-group">
|
||||
<label for="difficulty">Basic / Cron / Chain-Reaction Select<small class="text-muted ml-1"></small> </label><br>
|
||||
<select id="difficulty" name="difficulty" onchange="basicAdvanced(this);" class="form-control form-control-lg select-css" value="{{ data['schedule']['difficulty'] }}">
|
||||
<option id="basic" value="basic">Basic</option>
|
||||
<option id="advanced" value="advanced">Advanced</option>
|
||||
<option id="reaction" value="reaction">Chain-Reaction</option>
|
||||
<option id="basic" value="basic">{{ translate('serverScheduleConfig', 'basic' , data['lang']) }}</option>
|
||||
<option id="advanced" value="advanced">{{ translate('serverScheduleConfig', 'cron' , data['lang']) }}</option>
|
||||
<option id="reaction" value="reaction">{{ translate('serverScheduleConfig', 'reaction' , data['lang']) }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="server_name">Action<small class="text-muted ml-1"></small> </label><br>
|
||||
<select id="action" name="action" onchange="yesnoCheck(this);" class="form-control form-control-lg select-css" value="{{ data['schedule']['action'] }}">
|
||||
<option id="start" value="start">Start Server</option>
|
||||
<option id="restart" value="restart">Restart Server</option>
|
||||
<option id="stop" value="stop">Shutdown Server</option>
|
||||
<option id="backup" value="backup">Backup Server</option>
|
||||
<option id="command" value="command">Custom Command</option>
|
||||
<option id="start" value="start">{{ translate('serverScheduleConfig', 'start' , data['lang']) }}</option>
|
||||
<option id="restart" value="restart">{{ translate('serverScheduleConfig', 'restart' , data['lang']) }}</option>
|
||||
<option id="stop" value="stop">{{ translate('serverScheduleConfig', 'stop' , data['lang']) }}</option>
|
||||
<option id="backup" value="backup">{{ translate('serverScheduleConfig', 'backup' , data['lang']) }}</option>
|
||||
<option id="command" value="command">{{ translate('serverScheduleConfig', 'custom' , data['lang']) }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div id="ifBasic">
|
||||
<div class="form-group">
|
||||
<label for="server_path">Interval <small class="text-muted ml-1"> - How often you want this task to execute</small> </label>
|
||||
<label for="server_path">{{ translate('serverScheduleConfig', 'interval' , data['lang']) }} <small class="text-muted ml-1"> - {{ translate('serverScheduleConfig', 'interval-explain' , data['lang']) }}</small> </label>
|
||||
<input type="number" class="form-control" name="interval" id="interval" value="{{ data['schedule']['interval'] }}" placeholder="Interval" required>
|
||||
<br>
|
||||
<br>
|
||||
<select id="interval_type" onchange="ifDays(this);" name="interval_type" class="form-control form-control-lg select-css" value="{{ data['schedule']['interval_type'] }}">
|
||||
<option id = "days" value="days">Days</option>
|
||||
<option id = "hours" value="hours">Hours</option>
|
||||
<option id = "minutes" value="minutes">Minutes</option>
|
||||
<option id = "days" value="days">{{ translate('serverScheduleConfig', 'days' , data['lang']) }}</option>
|
||||
<option id = "hours" value="hours">{{ translate('serverScheduleConfig', 'hours' , data['lang']) }}</option>
|
||||
<option id = "minutes" value="minutes">{{ translate('serverScheduleConfig', 'minutes' , data['lang']) }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div id="ifDays" style="display: block;">
|
||||
<div class="form-group">
|
||||
<label for="time">Time <small class="text-muted ml-1"> - What time do you want your task to execute?</small> </label>
|
||||
<label for="time">{{ translate('serverScheduleConfig', 'time' , data['lang']) }} <small class="text-muted ml-1"> - {{ translate('serverScheduleConfig', 'time-explain' , data['lang']) }}</small> </label>
|
||||
<input type="time" class="form-control" name="time" id="time" value="{{ data['schedule']['time'] }}" placeholder="Time" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="ifYes" style="display: none;">
|
||||
<div class="form-group">
|
||||
<label for="command">Command <small class="text-muted ml-1"> - What command do you want us to execute? Do not include the '/'</small> </label>
|
||||
<label for="command">{{ translate('serverScheduleConfig', 'command' , data['lang']) }} <small class="text-muted ml-1"> - {{ translate('serverScheduleConfig', 'command-explain' , data['lang']) }}</small> </label>
|
||||
<input type="input" class="form-control" name="command" id="command_input" value="{{ data['schedule']['command'] }}" placeholder="Command" required>
|
||||
</div>
|
||||
</div>
|
||||
<div id="ifAdvanced" style="display: none;">
|
||||
<div class="form-group">
|
||||
<label for="cron">Cron <small class="text-muted ml-1"> - Input your cron string</small> </label>
|
||||
<label for="cron">{{ translate('serverScheduleConfig', 'cron' , data['lang']) }} <small class="text-muted ml-1"> - {{ translate('serverScheduleConfig', 'cron-explain' , data['lang']) }}</small> </label>
|
||||
<input type="input" class="form-control" name="cron" id="cron" value="{{ data['schedule']['cron_string'] }}" placeholder="* * * * *">
|
||||
</div>
|
||||
</div>
|
||||
<div id="ifReaction" style="display: none;">
|
||||
<div class="form-group">
|
||||
<label for="delay">Delay Offset <small class="text-muted ml-1"> - How long should we wait to fire this after firing the first task? (Seconds)</small> </label>
|
||||
<label for="delay">{{ translate('serverScheduleConfig', 'offset' , data['lang']) }} <small class="text-muted ml-1"> - {{ translate('serverScheduleConfig', 'offset-explain' , data['lang']) }}</small> </label>
|
||||
<input type="number" class="form-control" name="delay" id="delay" value="0">
|
||||
<br>
|
||||
<br>
|
||||
<label for="parent">Parent Task <small class="text-muted ml-1"> - Which task should trigger this one?</small> </label>
|
||||
<label for="parent">{{ translate('serverScheduleConfig', 'parent' , data['lang']) }} <small class="text-muted ml-1"> - {{ translate('serverScheduleConfig', 'parent-explain' , data['lang']) }}</small> </label>
|
||||
<select id="parent" name="parent" class="form-control form-control-lg select-css" value="{{ data['schedule']['action'] }}">
|
||||
{% for schedule in data['schedules'] %}
|
||||
{% if schedule.schedule_id != data['schedule']['schedule_id'] %}
|
||||
@ -116,22 +116,22 @@
|
||||
|
||||
<div class="form-check-flat">
|
||||
<label for="enabled" class="form-check-label ml-4 mb-4">
|
||||
<input type="checkbox" class="form-check-input" id="enabled" name="enabled" checked="" value="1">Enabled
|
||||
<input type="checkbox" class="form-check-input" id="enabled" name="enabled" checked="" value="1">{{ translate('serverScheduleConfig', 'enabled' , data['lang']) }}
|
||||
</label>
|
||||
|
||||
</div>
|
||||
<div class="form-check-flat">
|
||||
<label for="one_time" class="form-check-label ml-4 mb-4">
|
||||
<input type="checkbox" class="form-check-input" id="one_time" name="one_time" value="1">Delete After Execution
|
||||
<input type="checkbox" class="form-check-input" id="one_time" name="one_time" value="1">{{ translate('serverScheduleConfig', 'one-time' , data['lang']) }}
|
||||
</label>
|
||||
|
||||
</div>
|
||||
<button type="submit" class="btn btn-success mr-2"><i class="fas fa-save"></i> {{ translate('serverConfig', 'save', data['lang']) }}</button>
|
||||
<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>
|
||||
<button type="reset" onclick="location.href=`/panel/server_detail?id={{ data['server_stats']['server_id']['server_id'] }}&subpage=schedules`" 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>
|
||||
<h4>{{ translate('serverScheduleConfig', 'children' , data['lang']) }}</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>
|
||||
|
@ -62,7 +62,7 @@
|
||||
|
||||
<div class="col-sm-12">
|
||||
<div class="form-group">
|
||||
<label for="port2">{{ translate('serverWizard', 'serverPort', data['lang']) }} <small> - {{ translate('serverWizard', 'defaultPort', data['lang']) }}</small></label>
|
||||
<label for="port2">{{ translate('serverWizard', 'serverPort', data['lang']) }} <small></small></label>
|
||||
<input type="number" class="form-control" id="port2" name="port" value="19132" step="1" min="1" required>
|
||||
</div>
|
||||
</div>
|
||||
@ -153,7 +153,7 @@
|
||||
|
||||
<div class="col-sm-12">
|
||||
<div class="form-group">
|
||||
<label for="port3">{{ translate('serverWizard', 'serverPort', data['lang']) }} <small> - {{ translate('serverWizard', 'defaultPort', data['lang']) }}</small></label>
|
||||
<label for="port3">{{ translate('serverWizard', 'serverPort', data['lang']) }} <small></small></label>
|
||||
<input type="number" class="form-control" id="port3" name="port" value="19132" step="1" min="1" required>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -178,6 +178,34 @@
|
||||
"cannotSee": "Not seeing everything?",
|
||||
"cannotSeeOnMobile": "Try clicking on a scheduled task for full details."
|
||||
},
|
||||
"serverScheduleConfig":{
|
||||
"basic": "Basic",
|
||||
"cron": "Cron",
|
||||
"reaction": "Reaction",
|
||||
"start": "Start Server",
|
||||
"restart": "Restart Server",
|
||||
"stop": "Shutdown Server",
|
||||
"backup": "Backup Server",
|
||||
"custom": "Custom Command",
|
||||
"interval": "Interval",
|
||||
"interval-explain": "How often do you want this schedule executed?",
|
||||
"days": "Days",
|
||||
"hours": "Hours",
|
||||
"minutes": "Minutes",
|
||||
"time": "Time",
|
||||
"time-explain": "What time do you want your schedule to execute?",
|
||||
"command": "Command",
|
||||
"command-explain": "What command do you want us to execute? Do not include the '/'",
|
||||
"cron-explain": "Enter your cron string",
|
||||
"offset": "Delay Offset",
|
||||
"offset-explain": "How long should we wait to fire this after firing the first task? (Seconds)",
|
||||
"parent": "Select a parent schedule",
|
||||
"parent-explain": "Which schedule should trigger this one?",
|
||||
"enabled": "Enabled",
|
||||
"one-time": "Delete after execution",
|
||||
"children": "Linked Child Tasks: "
|
||||
|
||||
},
|
||||
"notify":{
|
||||
"supportLogs": "Support Logs",
|
||||
"activityLog": "Activity Logs",
|
||||
|
Loading…
Reference in New Issue
Block a user