mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Add translations to schedules page
This commit is contained in:
parent
ad318296dc
commit
e0377d4b2f
@ -9,14 +9,15 @@
|
||||
|
||||
<div class="content-wrapper">
|
||||
|
||||
<!-- Page Title Header Starts-->
|
||||
<!-- Page Title Header Starts-->
|
||||
<div class="row page-title-header">
|
||||
<div class="col-12">
|
||||
<div class="page-header">
|
||||
<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>
|
||||
{{ 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>
|
||||
@ -24,159 +25,206 @@
|
||||
</div>
|
||||
<!-- Page Title Header Ends-->
|
||||
|
||||
{% include "parts/details_stats.html" %}
|
||||
{% include "parts/details_stats.html" %}
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-sm-12 grid-margin">
|
||||
<div class="card">
|
||||
<div class="card-body pt-0">
|
||||
{% include "parts/server_controls_list.html" %}
|
||||
{% include "parts/server_controls_list.html" %}
|
||||
|
||||
<div class="row">
|
||||
<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 %}
|
||||
<form class="forms-sample" method="post" action="/panel/edit_schedule?id={{ data['server_stats']['server_id']['server_id'] }}&sch_id={{ data['schedule']['schedule_id'] }}">
|
||||
<div class="row">
|
||||
<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 %}
|
||||
<form class="forms-sample" method="post"
|
||||
action="/panel/edit_schedule?id={{ data['server_stats']['server_id']['server_id'] }}&sch_id={{ data['schedule']['schedule_id'] }}">
|
||||
{% end %}
|
||||
{% raw xsrf_form_html() %}
|
||||
<input type="hidden" name="id" value="{{ data['server_stats']['server_id']['server_id'] }}">
|
||||
<input type="hidden" name="subpage" value="config">
|
||||
{% raw xsrf_form_html() %}
|
||||
<input type="hidden" name="id" value="{{ data['server_stats']['server_id']['server_id'] }}">
|
||||
<input type="hidden" name="subpage" value="config">
|
||||
|
||||
<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">{{ 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">{{ 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">{{ 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">{{ 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">{{ 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">{{ 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 class="form-group">
|
||||
<label for="difficulty">{{ translate('serverScheduleConfig', 'select' , data['lang']) }}<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">{{ 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 id="ifAdvanced" style="display: none;">
|
||||
<div class="form-group">
|
||||
<label for="server_name">{{ translate('serverSchedules', 'action' , data['lang']) }}<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">{{ 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">{{ 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">{{ 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="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="* * * * *">
|
||||
<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 id="ifReaction" style="display: none;">
|
||||
<div class="form-group">
|
||||
<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">{{ 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'] }}">
|
||||
</div>
|
||||
<div id="ifYes" style="display: none;">
|
||||
<div class="form-group">
|
||||
<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">{{ 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">{{ 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">{{ 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'] %}
|
||||
{% if schedule.interval != '' %}
|
||||
<option id="{{schedule.schedule_id}}" value="{{schedule.schedule_id}}">ID: {{schedule.schedule_id}} | {{schedule.command}} | {{schedule.interval}} {{ schedule.interval_type}}</option>
|
||||
<option id="{{schedule.schedule_id}}" value="{{schedule.schedule_id}}">ID:
|
||||
{{schedule.schedule_id}} | {{schedule.command}} | {{schedule.interval}} {{
|
||||
schedule.interval_type}}</option>
|
||||
{% else %}
|
||||
<option id="{{schedule.schedule_id}}" value="{{schedule.schedule_id}}">ID: {{schedule.schedule_id}} {{schedule.command}} {{schedule.cron_string}}</option>
|
||||
<option id="{{schedule.schedule_id}}" value="{{schedule.schedule_id}}">ID:
|
||||
{{schedule.schedule_id}} {{schedule.command}} {{schedule.cron_string}}</option>
|
||||
{% end %}
|
||||
{% end %}
|
||||
{% end %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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">{{ translate('serverScheduleConfig', 'enabled' , data['lang']) }}
|
||||
</label>
|
||||
<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">{{ 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">{{ translate('serverScheduleConfig', 'one-time' , 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">{{
|
||||
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=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>{{ 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>
|
||||
{% end %}
|
||||
</ul>
|
||||
</div>
|
||||
</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=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>{{ 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>
|
||||
{% end %}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<!-- content-wrapper ends -->
|
||||
|
||||
{% end %}
|
||||
|
||||
|
||||
</div>
|
||||
<!-- content-wrapper ends -->
|
||||
|
||||
{% end %}
|
||||
|
||||
{% block js %}
|
||||
<script>
|
||||
{% 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;
|
||||
var r = document.cookie.match("\\b" + name + "=([^;]*)\\b");
|
||||
return r ? r[1] : undefined;
|
||||
}
|
||||
|
||||
$( document ).ready(function() {
|
||||
console.log( "ready!" );
|
||||
$(document).ready(function () {
|
||||
console.log("ready!");
|
||||
|
||||
});
|
||||
|
||||
function yesnoCheck() {
|
||||
if (document.getElementById('action').value == "command") {
|
||||
document.getElementById("ifYes").style.display = "block";
|
||||
document.getElementById("command_input").required = true;
|
||||
document.getElementById("ifYes").style.display = "block";
|
||||
document.getElementById("command_input").required = true;
|
||||
} else {
|
||||
document.getElementById("ifYes").style.display = "none";
|
||||
document.getElementById("command_input").required = false;
|
||||
document.getElementById("ifYes").style.display = "none";
|
||||
document.getElementById("command_input").required = false;
|
||||
}
|
||||
}
|
||||
function basicAdvanced() {
|
||||
if (document.getElementById('difficulty').value == "advanced") {
|
||||
}
|
||||
function basicAdvanced() {
|
||||
if (document.getElementById('difficulty').value == "advanced") {
|
||||
document.getElementById("ifAdvanced").style.display = "block";
|
||||
document.getElementById("ifReaction").style.display = "none";
|
||||
document.getElementById("ifBasic").style.display = "none";
|
||||
@ -184,16 +232,16 @@
|
||||
document.getElementById("parent").required = false;
|
||||
document.getElementById("interval").required = false;
|
||||
document.getElementById("time").required = false;
|
||||
} else if(document.getElementById('difficulty').value == "reaction"){
|
||||
document.getElementById("ifReaction").style.display = "block";
|
||||
document.getElementById("ifBasic").style.display = "none";
|
||||
document.getElementById("ifAdvanced").style.display = "none";
|
||||
document.getElementById("delay").required = true;
|
||||
document.getElementById("parent").required = true;
|
||||
document.getElementById("interval").required = false;
|
||||
document.getElementById("time").required = false;
|
||||
}
|
||||
else {
|
||||
} else if (document.getElementById('difficulty').value == "reaction") {
|
||||
document.getElementById("ifReaction").style.display = "block";
|
||||
document.getElementById("ifBasic").style.display = "none";
|
||||
document.getElementById("ifAdvanced").style.display = "none";
|
||||
document.getElementById("delay").required = true;
|
||||
document.getElementById("parent").required = true;
|
||||
document.getElementById("interval").required = false;
|
||||
document.getElementById("time").required = false;
|
||||
}
|
||||
else {
|
||||
document.getElementById("ifAdvanced").style.display = "none";
|
||||
document.getElementById("ifReaction").style.display = "none";
|
||||
document.getElementById("ifBasic").style.display = "block";
|
||||
@ -201,67 +249,67 @@
|
||||
document.getElementById("parent").required = false;
|
||||
document.getElementById("interval").required = true;
|
||||
document.getElementById("time").required = true;
|
||||
}
|
||||
}
|
||||
function ifDays() {
|
||||
if (document.getElementById('interval_type').value == "days") {
|
||||
document.getElementById("ifDays").style.display = "block";
|
||||
document.getElementById("time").required = true;
|
||||
} else {
|
||||
document.getElementById("ifDays").style.display = "none";
|
||||
document.getElementById("time").required = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
function ifDays() {
|
||||
if (document.getElementById('interval_type').value == "days") {
|
||||
document.getElementById("ifDays").style.display = "block";
|
||||
document.getElementById("time").required = true;
|
||||
} else {
|
||||
document.getElementById("ifDays").style.display = "none";
|
||||
document.getElementById("time").required = false;
|
||||
}
|
||||
}
|
||||
|
||||
function del_task(sch_id, id){
|
||||
var token = getCookie("_xsrf")
|
||||
function del_task(sch_id, id) {
|
||||
var token = getCookie("_xsrf")
|
||||
|
||||
$.ajax({
|
||||
type: "DELETE",
|
||||
headers: {'X-XSRFToken': token},
|
||||
url: '/ajax/del_task?server_id='+id+'&schedule_id='+sch_id,
|
||||
data: {
|
||||
schedule_id: sch_id,
|
||||
id: id
|
||||
},
|
||||
success: function(data) {
|
||||
location.reload();
|
||||
},
|
||||
});
|
||||
}
|
||||
function startup(){
|
||||
try{
|
||||
document.getElementById("{{ data['schedule']['interval_type'] }}").setAttribute('selected', true);
|
||||
}catch{
|
||||
console.log("no element named")
|
||||
}
|
||||
try{
|
||||
document.getElementById("{{ data['schedule']['difficulty'] }}").setAttribute('selected', true);
|
||||
}catch{
|
||||
console.log("no element named")
|
||||
}
|
||||
try{
|
||||
document.getElementById("{{ data['schedule']['action'] }}").setAttribute('selected', true);
|
||||
$.ajax({
|
||||
type: "DELETE",
|
||||
headers: { 'X-XSRFToken': token },
|
||||
url: '/ajax/del_task?server_id=' + id + '&schedule_id=' + sch_id,
|
||||
data: {
|
||||
schedule_id: sch_id,
|
||||
id: id
|
||||
},
|
||||
success: function (data) {
|
||||
location.reload();
|
||||
},
|
||||
});
|
||||
}
|
||||
function startup() {
|
||||
try {
|
||||
document.getElementById("{{ data['schedule']['interval_type'] }}").setAttribute('selected', true);
|
||||
} catch {
|
||||
console.log("no element named")
|
||||
}
|
||||
try {
|
||||
document.getElementById("{{ data['schedule']['difficulty'] }}").setAttribute('selected', true);
|
||||
} catch {
|
||||
console.log("no element named")
|
||||
}
|
||||
try {
|
||||
document.getElementById("{{ data['schedule']['action'] }}").setAttribute('selected', true);
|
||||
|
||||
}catch{
|
||||
console.log("no element named")
|
||||
}
|
||||
ifDays();
|
||||
yesnoCheck();
|
||||
basicAdvanced();
|
||||
if("{{ data['schedule']['enabled'] }}" == 'True'){
|
||||
document.getElementById('enabled').checked = true;
|
||||
}else{
|
||||
document.getElementById('enabled').checked = false;
|
||||
}
|
||||
if("{{ data['schedule']['one_time'] }}" == 'True'){
|
||||
document.getElementById('one_time').checked = true;
|
||||
}else{
|
||||
document.getElementById('one_time').checked = false;
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
console.log("no element named")
|
||||
}
|
||||
ifDays();
|
||||
yesnoCheck();
|
||||
basicAdvanced();
|
||||
if ("{{ data['schedule']['enabled'] }}" == 'True') {
|
||||
document.getElementById('enabled').checked = true;
|
||||
} else {
|
||||
document.getElementById('enabled').checked = false;
|
||||
}
|
||||
if ("{{ data['schedule']['one_time'] }}" == 'True') {
|
||||
document.getElementById('one_time').checked = true;
|
||||
} else {
|
||||
document.getElementById('one_time').checked = false;
|
||||
}
|
||||
}
|
||||
|
||||
window.onload(startup())
|
||||
</script>
|
||||
window.onload(startup())
|
||||
</script>
|
||||
|
||||
{% end %}
|
||||
{% end %}
|
@ -44,7 +44,8 @@
|
||||
<div class="col-md-12 col-sm-12" style="overflow-x:auto;">
|
||||
<div class="card">
|
||||
<div class="card-header header-sm d-flex justify-content-between align-items-center">
|
||||
<h4 class="card-title"><i class="fas fa-calendar"></i> Scheduled Tasks</h4>
|
||||
<h4 class="card-title"><i class="fas fa-calendar"></i> {{ translate('serverSchedules',
|
||||
'scheduledTasks', data['lang']) }} </h4>
|
||||
{% if data['user_data']['hints'] %}
|
||||
<span class="too_small" title="{{ translate('serverSchedules', 'cannotSee', data['lang']) }}" ,
|
||||
data-content="{{ translate('serverSchedules', 'cannotSeeOnMobile', data['lang']) }}" ,
|
||||
@ -52,20 +53,28 @@
|
||||
{% end %}
|
||||
<div><button
|
||||
onclick="location.href=`/panel/add_schedule?id={{ data['server_stats']['server_id']['server_id'] }}`"
|
||||
class="btn btn-info">Create New Schedule <i class="fas fa-pencil-alt"></i></button></div>
|
||||
class="btn btn-info">{{ translate('serverSchedules', 'create', data['lang']) }}<i
|
||||
class="fas fa-pencil-alt"></i></button></div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table class="table table-hover d-none d-lg-block responsive-table" id="schedule_table" width="100%"
|
||||
style="table-layout:fixed;">
|
||||
<thead>
|
||||
<tr class="rounded">
|
||||
<th style="width: 2%; min-width: 10px;">ID</th>
|
||||
<th style="width: 23%; min-width: 50px;">Action</th>
|
||||
<th style="width: 40%; min-width: 50px;">Command</th>
|
||||
<th style="width: 10%; min-width: 50px;">Interval</th>
|
||||
<th style="width: 10%; min-width: 50px;">Next Run</th>
|
||||
<th style="width: 10%; min-width: 50px;">Enabled</th>
|
||||
<th style="width: 10%; min-width: 50px;">Edit</th>
|
||||
<th style="width: 2%; min-width: 10px;">{{ translate('serverSchedules', 'name', data['lang']) }}
|
||||
</th>
|
||||
<th style="width: 23%; min-width: 50px;">{{ translate('serverSchedules', 'action', data['lang'])
|
||||
}}</th>
|
||||
<th style="width: 40%; min-width: 50px;">{{ translate('serverSchedules', 'command',
|
||||
data['lang']) }}</th>
|
||||
<th style="width: 10%; min-width: 50px;">{{ translate('serverSchedules', 'interval',
|
||||
data['lang']) }}</th>
|
||||
<th style="width: 10%; min-width: 50px;">{{ translate('serverSchedules', 'nextRun',
|
||||
data['lang']) }}</th>
|
||||
<th style="width: 10%; min-width: 50px;">{{ translate('serverSchedules', 'enabled',
|
||||
data['lang']) }}</th>
|
||||
<th style="width: 10%; min-width: 50px;">{{ translate('serverSchedules', 'edit', data['lang'])
|
||||
}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -82,7 +91,7 @@
|
||||
</td>
|
||||
<td id="{{schedule.interval}}" class="action">
|
||||
{% if schedule.interval != '' %}
|
||||
<p>Every</p>
|
||||
<p>{{ translate('serverSchedules', 'every', data['lang']) }}</p>
|
||||
<p>{{schedule.interval}} {{schedule.interval_type}}</p>
|
||||
{% elif schedule.interval_type == 'reaction' %}
|
||||
<p>{{schedule.interval_type}}<br><br>child of ID: {{ schedule.parent }}</p>
|
||||
@ -120,9 +129,12 @@
|
||||
style="table-layout:fixed;">
|
||||
<thead>
|
||||
<tr class="rounded">
|
||||
<th style="width: 25%; min-width: 50px;">Action</th>
|
||||
<th style="max-width: 40%; min-width: 50px;">Command</th>
|
||||
<th style="width: 10%; min-width: 50px;">Enabled</th>
|
||||
<th style="width: 25%; min-width: 50px;">{{ translate('serverSchedules', 'action', data['lang'])
|
||||
}}</th>
|
||||
<th style="max-width: 40%; min-width: 50px;">{{ translate('serverSchedules', 'command',
|
||||
data['lang']) }}</th>
|
||||
<th style="width: 10%; min-width: 50px;">{{ translate('serverSchedules', 'enabled',
|
||||
data['lang']) }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -137,11 +149,11 @@
|
||||
<td id="{{schedule.enabled}}" class="action">
|
||||
{% if schedule.enabled %}
|
||||
<span class="text-success">
|
||||
<i class="fas fa-check-square"></i> Yes
|
||||
<i class="fas fa-check-square"></i> {{ translate('serverSchedules', 'yes', data['lang']) }}
|
||||
</span>
|
||||
{% else %}
|
||||
<span class="text-danger">
|
||||
<i class="far fa-times-square"></i> No
|
||||
<i class="far fa-times-square"></i> {{ translate('serverSchedules', 'no', data['lang']) }}
|
||||
</span>
|
||||
{% end %}
|
||||
</td>
|
||||
@ -152,7 +164,8 @@
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="exampleModalLabel">Task Details</h5>
|
||||
<h5 class="modal-title" id="exampleModalLabel">{{ translate('serverSchedules', 'details',
|
||||
data['lang']) }}</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
@ -160,36 +173,39 @@
|
||||
<div class="modal-body">
|
||||
<ul style="list-style: none;">
|
||||
<li id="{{schedule.schedule_id}}" class="id" style="border-top: .1em solid gray;">
|
||||
<h4>ID</h4>
|
||||
<h4>{{ translate('serverSchedules', 'name', data['lang']) }}</h4>
|
||||
<p>{{schedule.schedule_id}}</p>
|
||||
</li>
|
||||
<li id="{{schedule.action}}" class="action" style="border-top: .1em solid gray;">
|
||||
<h4>Action</h4>
|
||||
<h4>{{ translate('serverSchedules', 'action', data['lang']) }}</h4>
|
||||
<p>{{schedule.action}}</p>
|
||||
</li>
|
||||
<li id="{{schedule.command}}" class="action" style="border-top: .1em solid gray;">
|
||||
<h4>Command</h4>
|
||||
<h4>{{ translate('serverSchedules', 'command', data['lang']) }}</h4>
|
||||
<p>{{schedule.command}}</p>
|
||||
</li>
|
||||
<li id="{{schedule.interval}}" class="action" style="border-top: .1em solid gray;">
|
||||
{% if schedule.interval != '' %}
|
||||
<h4>Interval</h4>
|
||||
<p>Every {{schedule.interval}} {{schedule.interval_type}}</p>
|
||||
<h4>{{ translate('serverSchedules', 'interval', data['lang']) }}</h4>
|
||||
<p>{{ translate('serverSchedules', 'every', data['lang']) }} {{schedule.interval}}
|
||||
{{schedule.interval_type}}</p>
|
||||
{% elif schedule.interval_type == 'reaction' %}
|
||||
<h4>Interval</h4>
|
||||
<p>{{schedule.interval_type}}<br><br>child of ID: {{ schedule.parent }}</p>
|
||||
<h4>{{ translate('serverSchedules', 'interval', data['lang']) }}</h4>
|
||||
<p>{{schedule.interval_type}}<br><br>{{ translate('serverSchedules', 'child',
|
||||
data['lang']) }}: {{ schedule.parent }}</p>
|
||||
{% else %}
|
||||
<h4>Interval</h4>
|
||||
<p>Cron String: {{schedule.cron_string}}</p>
|
||||
<h4>{{ translate('serverSchedules', 'interval', data['lang']) }}</h4>
|
||||
<p>{{ translate('serverSchedules', 'cron', data['lang']) }}: {{schedule.cron_string}}
|
||||
</p>
|
||||
{% end %}
|
||||
</li>
|
||||
<li id="{{schedule.start_time}}" class="action" style="border-top: .1em solid gray;">
|
||||
<h4>Next Run</h4>
|
||||
<h4>{{ translate('serverSchedules', 'nextRun', data['lang']) }}</h4>
|
||||
<p>{{schedule.next_run}}</p>
|
||||
</li>
|
||||
<li id="{{schedule.enabled}}" class="action"
|
||||
style="border-top: .1em solid gray; border-bottom: .1em solid gray">
|
||||
<h4>Enabled</h4>
|
||||
<h4>{{ translate('serverSchedules', 'enabled', data['lang']) }}</h4>
|
||||
<input type="checkbox" class="schedule-enabled-toggle"
|
||||
data-schedule-id="{{schedule.schedule_id}}"
|
||||
data-schedule-enabled="{{ 'true' if schedule.enabled else 'false' }}">
|
||||
@ -200,12 +216,15 @@
|
||||
<button
|
||||
onclick="window.location.href='/panel/edit_schedule?id={{ data['server_stats']['server_id']['server_id'] }}&sch_id={{schedule.schedule_id}}'"
|
||||
class="btn btn-info">
|
||||
<i class="fas fa-pencil-alt"></i> Edit
|
||||
<i class="fas fa-pencil-alt"></i> {{ translate('serverSchedules', 'edit', data['lang'])
|
||||
}}
|
||||
</button>
|
||||
<button data-sch={{ schedule.schedule_id }} class="btn btn-danger del_button">
|
||||
<i class="fas fa-trash" aria-hidden="true"></i> Delete
|
||||
<i class="fas fa-trash" aria-hidden="true"></i> {{ translate('serverSchedules',
|
||||
'delete', data['lang']) }}
|
||||
</button>
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">{{
|
||||
translate('serverSchedules', 'close', data['lang']) }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -392,6 +392,7 @@
|
||||
},
|
||||
"serverScheduleConfig": {
|
||||
"backup": "Backup Server",
|
||||
"select": "Basic / Cron / Chain Reaction Select",
|
||||
"basic": "Basic",
|
||||
"children": "Linked Child Tasks: ",
|
||||
"command": "Command",
|
||||
@ -418,7 +419,24 @@
|
||||
"time-explain": "What time do you want your schedule to execute?"
|
||||
},
|
||||
"serverSchedules": {
|
||||
"scheduledTasks": "Scheduled Tasks",
|
||||
"create": "Create New Schedule",
|
||||
"name": "Name",
|
||||
"action": "Action",
|
||||
"command": "Command",
|
||||
"interval": "Interval",
|
||||
"nextRun": "Next Run",
|
||||
"enabled": "Enabled",
|
||||
"edit": "Edit",
|
||||
"every": "Every",
|
||||
"yes": "Yes",
|
||||
"no": "No",
|
||||
"cron": "Crong String",
|
||||
"details": "Schedule Details",
|
||||
"child": "Child of schedule named: ",
|
||||
"areYouSure": "Delete Scheduled Task?",
|
||||
"close": "Close",
|
||||
"delete": "Delete",
|
||||
"cancel": "Cancel",
|
||||
"cannotSee": "Not seeing everything?",
|
||||
"cannotSeeOnMobile": "Try clicking on a scheduled task for full details.",
|
||||
|
Loading…
Reference in New Issue
Block a user