mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
209 lines
7.2 KiB
HTML
209 lines
7.2 KiB
HTML
{% extends ../base.html %}
|
|
|
|
{% block meta %}
|
|
<!-- <meta http-equiv="refresh" content="60">-->
|
|
{% end %}
|
|
|
|
{% 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">
|
|
<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-->
|
|
|
|
{% 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 %}
|
|
|
|
<div class="row">
|
|
<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="col-md-12 col-sm-12" style="overflow-x:auto;">
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<h4 class="card-title">Scheduled Tasks</h4>
|
|
<table class="table table-hover" width="100%">
|
|
<thead>
|
|
<tr class="rounded">
|
|
<th>Action</th>
|
|
<th>Command</th>
|
|
<th>Interval</th>
|
|
<th>Start Time</th>
|
|
<th>Enabled</th>
|
|
<th>Edit</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for schedule in data['schedules'] %}
|
|
<tr>
|
|
<td id="{{schedule.action}}" class="action">
|
|
<p>{{schedule.action}}</p>
|
|
</td>
|
|
<td id="{{schedule.command}}" class="action">
|
|
<p>{{schedule.command}}</p>
|
|
</td>
|
|
<td id="{{schedule.interval}}" class="action">
|
|
{% if schedule.interval != '' %}
|
|
<p>Every</p>
|
|
<p>{{schedule.interval}} {{schedule.interval_type}}</p>
|
|
{% else %}
|
|
<p>Cron String:</p>
|
|
<p>{{schedule.cron_string}}</p>
|
|
{% end %}
|
|
</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">
|
|
<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>
|
|
</button>
|
|
<br>
|
|
<br>
|
|
<button data-sch={{ schedule.schedule_id }} class="btn btn-danger del_button">
|
|
<i class="fas fa-trash" aria-hidden="true"></i>
|
|
</button>
|
|
</td>
|
|
</tr>
|
|
{% end %}
|
|
</tbody>
|
|
</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!" );
|
|
|
|
});
|
|
|
|
function yesnoCheck(that) {
|
|
if (that.value == "command") {
|
|
document.getElementById("ifYes").style.display = "block";
|
|
document.getElementById("command").required = true;
|
|
} else {
|
|
document.getElementById("ifYes").style.display = "none";
|
|
document.getElementById("command").required = false;
|
|
}
|
|
}
|
|
function basicAdvanced(that) {
|
|
if (that.value == "advanced") {
|
|
document.getElementById("ifAdvanced").style.display = "block";
|
|
document.getElementById("ifBasic").style.display = "none";
|
|
document.getElementById("interval").required = false;
|
|
document.getElementById("time").required = false;
|
|
} else {
|
|
document.getElementById("ifAdvanced").style.display = "none";
|
|
document.getElementById("ifBasic").style.display = "block";
|
|
document.getElementById("interval").required = true;
|
|
document.getElementById("time").required = true;
|
|
}
|
|
}
|
|
function ifDays(that) {
|
|
if (that.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;
|
|
}
|
|
}
|
|
|
|
$( ".del_button" ).click(function() {
|
|
var sch_id = $(this).data('sch');
|
|
var server_id = {{ data['server_stats']['server_id']['server_id'] }};
|
|
|
|
console.log(sch_id)
|
|
|
|
bootbox.confirm({
|
|
title: "{{ translate('serverSchedules', 'areYouSure', data['lang']) }}",
|
|
message: "{{ translate('serverSchedules', 'confirmDelete', data['lang']) }}",
|
|
buttons: {
|
|
cancel: {
|
|
label: '<i class="fas fa-times"></i> {{ translate("serverSchedules", "cancel", data['lang']) }}'
|
|
},
|
|
confirm: {
|
|
label: '<i class="fas fa-check"></i> {{ translate("serverSchedules", "confirm", data['lang']) }}'
|
|
}
|
|
},
|
|
callback: function (result) {
|
|
console.log(result);
|
|
if (result == true) {
|
|
del_task(sch_id, server_id);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
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();
|
|
},
|
|
});
|
|
}
|
|
|
|
</script>
|
|
|
|
{% end %} |