crafty-4/app/frontend/templates/panel/server_tasks.html

203 lines
8.9 KiB
HTML
Raw Normal View History

{% extends ../base.html %}
{% block meta %}
<!-- <meta http-equiv="refresh" content="60">-->
{% end %}
2021-11-30 20:46:30 +00:00
{% block title %}Crafty Controller - {{ translate('serverDetails', 'serverDetails', data['lang']) }}{% end %}
{% block content %}
<div class="content-wrapper">
<!-- Page Title Header Starts-->
<div class="row page-title-header">
<div class="col-12">
<div class="page-header">
2021-11-30 20:46:30 +00:00
<h4 class="page-title">
{{ translate('serverDetails', 'serverDetails', data['lang']) }} - {{ data['server_stats']['server_id']['server_name'] }}
<br />
<small>UUID: {{ data['server_stats']['server_id']['server_uuid'] }}</small>
</h4>
</div>
</div>
</div>
<!-- Page Title Header Ends-->
2021-11-30 20:46:30 +00:00
{% include "parts/details_stats.html %}
<div class="row">
<div class="col-sm-12 grid-margin">
<div class="card">
<div class="card-body pt-0">
2021-11-30 20:46:30 +00:00
{% include "parts/server_controls_list.html %}
<div class="row">
2021-11-30 20:46:30 +00:00
<div class="col-md-4 col-sm-12">
<form class="forms-sample" method="post" action="/panel/server_detail">
{% raw xsrf_form_html() %}
2021-11-30 20:46:30 +00:00
<input type="hidden" name="id" value="{{ data['server_stats']['server_id']['server_id'] }}">
<input type="hidden" name="subpage" value="config">
2021-11-30 20:46:30 +00:00
<div class="form-group">
2022-01-09 06:16:09 +00:00
<label for="server_name">Basic / Cron Select<small class="text-muted ml-1"></small> </label><br>
<select id="action" name="action" onchange="basicAdvanced(this);" class="form-control form-control-lg select-css">
<option value="basic">Basic</option>
<option value="advanced">Advanced</option>
2021-11-30 20:46:30 +00:00
</select>
</div>
<div id="ifBasic">
<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">
<option value="start">Start Server</option>
<option value="restart">Restart Server</option>
<option value="shutdown">Shutdown Server</option>
<option value="command">Custon Command</option>
</select>
</div>
<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>
<input type="number" class="form-control" name="server_path" id="server_path" value="{{ data['server_stats']['server_id']['path'] }}" placeholder="Interval" required>
<br>
<br>
<select id="interval_type" name="interval_type" class="form-control form-control-lg select-css">
<option value="days">Days</option>
<option value="hours">Hours</option>
<option value="minutes">Minutes</option>
<option value="weeks">Weeks</option>
</select>
</div>
2021-11-30 20:46:30 +00:00
<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>
<input type="time" class="form-control" name="time" id="time" value="{{ data['server_stats']['server_id']['log_path'] }}" placeholder="Time" required>
2021-11-30 20:46:30 +00:00
</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>
<input type="input" class="form-control" name="command" id="command" value="" placeholder="Command" required>
</div>
</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>
2022-01-09 06:24:04 +00:00
<input type="input" class="form-control" name="cron" id="cron" value="" placeholder="* * * * backup_server" required>
</div>
2021-11-30 20:46:30 +00:00
</div>
<div class="form-check-flat">
<label for="enabled" class="form-check-label ml-4 mb-4">
2021-11-30 20:46:30 +00:00
<input type="checkbox" class="form-check-input" id="enabled" name="enabled" checked="" value="1">Enabled
</label>
2021-11-30 20:46:30 +00:00
</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
</label>
</div>
2021-11-30 20:46:30 +00:00
<button type="submit" class="btn btn-success mr-2"><i class="fas fa-save"></i> {{ translate('serverConfig', 'save', data['lang']) }}</button>
<button type="reset" class="btn btn-light"><i class="fas fa-times"></i> {{ translate('serverConfig', 'cancel', data['lang']) }}</button>
</form>
</div>
2021-11-30 20:46:30 +00:00
<div class="col-md-8 col-sm-12">
<div class="card">
<div class="card-body">
2021-11-30 20:46:30 +00:00
<h4 class="card-title">Scheduled Tasks</h4>
<table class="table table-hover" width="100%">
<tr class="rounded">
<th>Action</th>
<th>Interval</th>
<th>Start Time</th>
<th>Enabled</th>
<th>Edit</th>
</tr>
{% for schedule in data['schedules'] %}
<td id="{{schedule.action}}" class="action">
<p>{{schedule.action}}</p>
</td>
<td id="{{schedule.interval}}" class="action">
<p>Every</p>
<p>{{schedule.interval}} {{schedule.interval_type}}</p>
</td>
<td id="{{schedule.start_time}}" class="action">
<p>{{schedule.start_time}}</p>
</td>
<td id="{{schedule.enabled}}" class="action">
{% if schedule.enabled %}
<span class="text-success">
<i class="fas fa-check-square"></i> Yes
</span>
{% else %}
<span class="text-danger">
<i class="far fa-times-square"></i> No
</span>
</td>
{% end %}
<td id="{{schedule.action}}" class="action">
<a href="/panel/edit_schedule?id={{schedule.schedule_id}}"><i class="fas fa-pencil-alt"></i></a>
</td>
2021-11-30 20:46:30 +00:00
{% end %}
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- content-wrapper ends -->
{% end %}
{% block js %}
<script>
//used to get cookies from browser - this is part of tornados xsrf protection - it's for extra security
function getCookie(name) {
var r = document.cookie.match("\\b" + name + "=([^;]*)\\b");
return r ? r[1] : undefined;
}
$( document ).ready(function() {
console.log( "ready!" );
});
2021-11-30 20:46:30 +00:00
function yesnoCheck(that) {
if (that.value == "command") {
document.getElementById("ifYes").style.display = "block";
} else {
document.getElementById("ifYes").style.display = "none";
}
}
function basicAdvanced(that) {
if (that.value == "advanced") {
document.getElementById("ifAdvanced").style.display = "block";
document.getElementById("ifBasic").style.display = "none";
} else {
document.getElementById("ifAdvanced").style.display = "none";
document.getElementById("ifBasic").style.display = "block";
}
}
</script>
{% end %}