2020-09-01 17:29:39 +00:00
|
|
|
{% extends ../base.html %}
|
|
|
|
|
|
|
|
{% block meta %}
|
|
|
|
<!-- <meta http-equiv="refresh" content="60">-->
|
|
|
|
{% end %}
|
|
|
|
|
|
|
|
{% block title %}Crafty Controller - Server Details{% 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">
|
|
|
|
Server Details - {{ data['server_stats'][0]['server_id']['server_name'] }}
|
2020-09-04 04:02:03 +00:00
|
|
|
<br />
|
|
|
|
<small>UUID: {{ data['server_stats'][0]['server_id']['server_uuid'] }}</small>
|
2020-09-01 17:29:39 +00:00
|
|
|
</h4>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<!-- Page Title Header Ends-->
|
|
|
|
|
2020-09-04 02:49:20 +00:00
|
|
|
{% include "parts/details_stats.html %}
|
2020-09-02 01:30:39 +00:00
|
|
|
|
2020-09-01 17:29:39 +00:00
|
|
|
<div class="row">
|
|
|
|
|
|
|
|
<div class="col-sm-12 grid-margin">
|
|
|
|
<div class="card">
|
|
|
|
<div class="card-body pt-0">
|
|
|
|
|
2020-09-02 01:30:39 +00:00
|
|
|
<ul class="nav nav-tabs col-md-12 tab-simple-styled " role="tablist">
|
2020-09-18 01:09:19 +00:00
|
|
|
<li class="nav-item term-nav-item">
|
2020-09-01 17:29:39 +00:00
|
|
|
<a class="nav-link active" href="/panel/server_detail?id={{ data['server_stats'][0]['server_id']['server_id'] }}&subpage=term" role="tab" aria-selected="true">
|
2020-09-04 02:49:20 +00:00
|
|
|
<i class="fas fa-file-signature"></i>Terminal</a>
|
2020-09-01 17:29:39 +00:00
|
|
|
</li>
|
2020-09-18 01:09:19 +00:00
|
|
|
<li class="nav-item term-nav-item">
|
2020-09-04 02:49:20 +00:00
|
|
|
<a class="nav-link" href="/panel/server_detail?id={{ data['server_stats'][0]['server_id']['server_id'] }}&subpage=logs" role="tab" aria-selected="false">
|
2020-09-01 17:29:39 +00:00
|
|
|
<i class="fas fa-file-signature"></i>Logs</a>
|
|
|
|
</li>
|
2020-09-18 01:09:19 +00:00
|
|
|
<li class="nav-item term-nav-item">
|
2020-09-04 02:49:20 +00:00
|
|
|
<a class="nav-link" href="/panel/server_detail?id={{ data['server_stats'][0]['server_id']['server_id'] }}&subpage=tasks" role="tab" aria-selected="false">
|
2020-09-01 17:29:39 +00:00
|
|
|
<i class="fas fa-clock"></i>Schedule</a>
|
|
|
|
</li>
|
2020-09-18 01:09:19 +00:00
|
|
|
<li class="nav-item term-nav-item">
|
2020-09-04 02:49:20 +00:00
|
|
|
<a class="nav-link" href="/panel/server_detail?id={{ data['server_stats'][0]['server_id']['server_id'] }}&subpage=backup" role="tab" aria-selected="false">
|
2020-09-01 17:29:39 +00:00
|
|
|
<i class="fas fa-save"></i>Backup</a>
|
|
|
|
</li>
|
2020-09-18 01:09:19 +00:00
|
|
|
<li class="nav-item term-nav-item">
|
2020-09-04 02:49:20 +00:00
|
|
|
<a class="nav-link" href="/panel/server_detail?id={{ data['server_stats'][0]['server_id']['server_id'] }}&subpage=files" role="tab" aria-selected="false">
|
2020-09-01 17:29:39 +00:00
|
|
|
<i class="fas fa-folder-tree"></i>Files</a>
|
|
|
|
</li>
|
2020-09-18 01:09:19 +00:00
|
|
|
<li class="nav-item term-nav-item">
|
2020-09-04 02:49:20 +00:00
|
|
|
<a class="nav-link" href="/panel/server_detail?id={{ data['server_stats'][0]['server_id']['server_id'] }}&subpage=config" role="tab" aria-selected="false">
|
2020-09-01 17:29:39 +00:00
|
|
|
<i class="fas fa-cogs"></i>Config</a>
|
|
|
|
</li>
|
2020-09-18 01:09:19 +00:00
|
|
|
<li class="nav-item term-nav-item">
|
2020-09-02 01:30:39 +00:00
|
|
|
<label class="p-0 m-0">
|
|
|
|
<input type="checkbox" name="stop_scroll" id="stop_scroll" />
|
|
|
|
{{ _('Stop Refresh') }}
|
|
|
|
</label>
|
|
|
|
</li>
|
2020-09-01 17:29:39 +00:00
|
|
|
</ul>
|
|
|
|
|
2020-09-02 01:30:39 +00:00
|
|
|
<div class="col-md-12">
|
|
|
|
<div class="input-group">
|
2020-09-14 20:01:38 +00:00
|
|
|
<div id="virt_console" class="" style="width: 100%; font-size: .8em; padding: 5px 10px; border: 1px solid #383e5d; background-color:#2a2c44;height:500px; overflow: scroll;"></div>
|
2020-09-02 01:30:39 +00:00
|
|
|
</div>
|
|
|
|
<br />
|
|
|
|
|
|
|
|
<div class="input-group">
|
|
|
|
<input type="text" class="form-control" id="server_command" name="server_command" placeholder="Enter your server command" autofocus="">
|
|
|
|
<span class="input-group-btn ml-5">
|
2020-09-22 02:01:16 +00:00
|
|
|
<input type="hidden" value="" id="last_command"/>
|
2020-09-02 01:30:39 +00:00
|
|
|
<button id="submit" class="btn btn-sm btn-info" type="button">Send Command</button>
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-09-01 17:29:39 +00:00
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<!-- content-wrapper ends -->
|
|
|
|
|
|
|
|
{% end %}
|
|
|
|
|
|
|
|
{% block js %}
|
|
|
|
<script>
|
2020-09-02 01:30:39 +00:00
|
|
|
function get_server_log(){
|
|
|
|
if( !$("#stop_scroll").is(':checked')){
|
|
|
|
$.ajax({
|
|
|
|
type: 'GET',
|
|
|
|
url: '/ajax/server_log?id={{ data['server_stats'][0]['server_id']['server_id'] }}',
|
|
|
|
dataType: 'text',
|
|
|
|
success: function (data) {
|
|
|
|
console.log('Got Log From Server')
|
|
|
|
$('#virt_console').html(data);
|
|
|
|
scroll();
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//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!" );
|
|
|
|
get_server_log()
|
|
|
|
|
|
|
|
setInterval(function(){
|
|
|
|
get_server_log() // this will run after every 5 seconds
|
|
|
|
}, 1500);
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#server_command').on('keydown', function (e) {
|
|
|
|
if (e.which == 13){
|
|
|
|
$(this).attr("disabled", "disabled"); //Disable textbox to prevent multiple submit
|
|
|
|
send_command_to_server()
|
|
|
|
$(this).removeAttr("disabled"); //Enable the textbox again if needed.
|
|
|
|
$(this).focus();
|
|
|
|
}
|
|
|
|
else if (e.which == 38){
|
|
|
|
last_command = $('#last_command').val()
|
|
|
|
$("#server_command").val(last_command)
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
$("#submit").click(function(e) {
|
|
|
|
e.preventDefault();
|
|
|
|
send_command_to_server();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
function scroll(){
|
|
|
|
var logview = $('#virt_console');
|
|
|
|
if(logview.length)
|
|
|
|
logview.scrollTop(logview[0].scrollHeight - logview.height());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function send_command_to_server(){
|
|
|
|
var server_command = $("#server_command").val()
|
|
|
|
console.log(server_command)
|
|
|
|
$("#last_command").val(server_command)
|
|
|
|
|
|
|
|
var token = getCookie("_xsrf")
|
|
|
|
|
|
|
|
data_to_send = { command :server_command, }
|
|
|
|
|
|
|
|
console.log('sending command: ' + server_command)
|
|
|
|
$.ajax({
|
|
|
|
type: "POST",
|
|
|
|
headers: {'X-XSRFToken': token},
|
|
|
|
url: '/ajax/send_command?id={{ data['server_stats'][0]['server_id']['server_id'] }}',
|
|
|
|
data: data_to_send,
|
|
|
|
success: function(data){
|
|
|
|
console.log("got response:");
|
|
|
|
console.log(data);
|
|
|
|
$("#server_command").val('')
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
2020-09-01 17:29:39 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
{% end %}
|