mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
231 lines
14 KiB
HTML
231 lines
14 KiB
HTML
{% extends ../base.html %}
|
|
|
|
{% block meta %}
|
|
<!-- <meta http-equiv="refresh" content="60">-->
|
|
{% end %}
|
|
|
|
{% block title %}Crafty Controller - {{ translate('serverDetails', 'serverDetails') }}{% 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['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">
|
|
<ul class="nav nav-tabs col-md-12 tab-simple-styled " role="tablist">
|
|
<li class="nav-item term-nav-item">
|
|
<a class="nav-link" href="/panel/server_detail?id={{ data['server_stats']['server_id']['server_id'] }}&subpage=term" role="tab" aria-selected="false">
|
|
<i class="fas fa-file-signature"></i>{{ translate('serverDetails', 'terminal') }}</a>
|
|
</li>
|
|
<li class="nav-item term-nav-item">
|
|
<a class="nav-link" href="/panel/server_detail?id={{ data['server_stats']['server_id']['server_id'] }}&subpage=logs" role="tab" aria-selected="false">
|
|
<i class="fas fa-file-signature"></i>{{ translate('serverDetails', 'logs') }}</a>
|
|
</li>
|
|
<li class="nav-item term-nav-item">
|
|
<a class="nav-link" href="/panel/server_detail?id={{ data['server_stats']['server_id']['server_id'] }}&subpage=tasks" role="tab" aria-selected="false">
|
|
<i class="fas fa-clock"></i>{{ translate('serverDetails', 'schedule') }}</a>
|
|
</li>
|
|
<li class="nav-item term-nav-item">
|
|
<a class="nav-link" href="/panel/server_detail?id={{ data['server_stats']['server_id']['server_id'] }}&subpage=backup" role="tab" aria-selected="false">
|
|
<i class="fas fa-save"></i>{{ translate('serverDetails', 'backup') }}</a>
|
|
</li>
|
|
<li class="nav-item term-nav-item">
|
|
<a class="nav-link" href="/panel/server_detail?id={{ data['server_stats']['server_id']['server_id'] }}&subpage=files" role="tab" aria-selected="false">
|
|
<i class="fas fa-folder-tree"></i>{{ translate('serverDetails', 'files') }}</a>
|
|
</li>
|
|
<li class="nav-item term-nav-item">
|
|
<a class="nav-link active" href="/panel/server_detail?id={{ data['server_stats']['server_id']['server_id'] }}&subpage=config" role="tab" aria-selected="true">
|
|
<i class="fas fa-cogs"></i>{{ translate('serverDetails', 'config') }}</a>
|
|
</li>
|
|
<li class="nav-item term-nav-item">
|
|
<a class="nav-link" href="/panel/server_detail?id={{ data['server_stats']['server_id']['server_id'] }}&subpage=admin_controls" role="tab" aria-selected="true">
|
|
<i class="fas fa-users"></i>{{ translate('serverDetails', 'playerControls') }}</a>
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<div class="row">
|
|
<div class="col-md-6 col-sm-12">
|
|
<form class="forms-sample" method="post" action="/panel/server_detail">
|
|
{% 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="server_name">{{ translate('serverConfig', 'serverName') }} <small class="text-muted ml-1"> - {{ translate('serverConfig', 'serverNameDesc') }}</small> </label>
|
|
<input type="text" class="form-control" name="server_name" id="server_name" value="{{ data['server_stats']['server_id']['server_name'] }}" placeholder="{{ translate('serverConfig', 'serverName') }}" >
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="server_path">{{ translate('serverConfig', 'serverPath') }} <small class="text-muted ml-1"> - {{ translate('serverConfig', 'serverPathDesc') }}</small> </label>
|
|
<input type="text" class="form-control" name="server_path" id="server_path" value="{{ data['server_stats']['server_id']['path'] }}" placeholder="{{ translate('serverConfig', 'serverPath') }}" >
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="log_path">{{ translate('serverConfig', 'serverLogLocation') }} <small class="text-muted ml-1"> - {{ translate('serverConfig', 'serverLogLocationDesc') }}</small> </label>
|
|
<input type="text" class="form-control" name="log_path" id="log_path" value="{{ data['server_stats']['server_id']['log_path'] }}" placeholder="{{ translate('serverConfig', 'serverLogLocation') }}" >
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="executable">{{ translate('serverConfig', 'serverExecutable') }} <small class="text-muted ml-1"> - {{ translate('serverConfig', 'serverExecutableDesc') }}</small> </label>
|
|
<input type="text" class="form-control" name="executable" id="executable" value="{{ data['server_stats']['server_id']['executable'] }}" placeholder="{{ translate('serverConfig', 'serverExecutable') }}" >
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="execution_command">{{ translate('serverConfig', 'serverExecutionCommand') }} <small class="text-muted ml-1"> - {{ translate('serverConfig', 'serverExecutionCommandDesc') }}</small> </label>
|
|
<input type="text" class="form-control" name="execution_command" id="execution_command" value="{{ data['server_stats']['server_id']['execution_command'] }}" placeholder="{{ translate('serverConfig', 'serverExecutionCommand') }}" >
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="stop_command">{{ translate('serverConfig', 'serverStopCommand') }} <small class="text-muted ml-1"> - {{ translate('serverConfig', 'serverStopCommandDesc') }}</small> </label>
|
|
<input type="text" class="form-control" name="stop_command" id="stop_command" value="{{ data['server_stats']['server_id']['stop_command'] }}" placeholder="{{ translate('serverConfig', 'serverStopCommand') }}" >
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="auto_start_delay">{{ translate('serverConfig', 'serverAutostartDelay') }} <small class="text-muted ml-1"> - {{ translate('serverConfig', 'serverAutostartDelayDesc') }}</small> </label>
|
|
<input type="number" class="form-control" name="auto_start_delay" id="auto_start_delay" value="{{ data['server_stats']['server_id']['auto_start_delay'] }}" step="1" max="999" min="10" >
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="executable_update_url">{{ translate('serverConfig', 'exeUpdateURL') }} <small class="text-muted ml-1"> - {{ translate('serverConfig', 'exeUpdateURLDesc') }}</small> </label>
|
|
<input type="text" class="form-control" name="executable_update_url" id="executable_update_url" value="{{ data['server_stats']['server_id']['executable_update_url'] }}" placeholder="{{ translate('serverConfig', 'exeUpdateURL') }}" >
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="server_ip">{{ translate('serverConfig', 'serverPort') }} <small class="text-muted ml-1"> - {{ translate('serverConfig', 'serverPortDesc') }}</small> </label>
|
|
<input type="text" class="form-control" name="server_ip" id="server_ip" value="{{ data['server_stats']['server_id']['server_ip'] }}">
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="server_port">{{ translate('serverConfig', 'serverIP') }} <small class="text-muted ml-1"> - {{ translate('serverConfig', 'serverIPDesc') }}</small> </label>
|
|
<input type="number" class="form-control" name="server_port" id="server_port" value="{{ data['server_stats']['server_id']['server_port'] }}" step="1" max="65566" min="1" >
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="logs_delete_after">{{ translate('serverConfig', 'removeOldLogsAfter') }} <small class="text-muted ml-1"> - {{ translate('serverConfig', 'removeOldLogsAfterDesc') }}</small> </label>
|
|
<input type="number" class="form-control" name="logs_delete_after" id="logs_delete_after" value="{{ data['server_stats']['server_id']['logs_delete_after'] }}" step="1" max="365" min="0" >
|
|
</div>
|
|
|
|
<div class="form-check-flat">
|
|
<label for="auto_start" class="form-check-label ml-4 mb-4">
|
|
{% if data['server_stats']['server_id']['auto_start'] %}
|
|
<input type="checkbox" class="form-check-input" id="auto_start" name="auto_start" checked="" value="1">{{ translate('serverConfig', 'serverAutoStart') }}
|
|
{% else %}
|
|
<input type="checkbox" class="form-check-input" id="auto_start" name="auto_start" value="1">{{ translate('serverConfig', 'serverAutoStart') }}
|
|
{% end %}
|
|
</label>
|
|
|
|
<label for="crash_detection" class="form-check-label ml-4 mb-4">
|
|
{% if data['server_stats']['server_id']['crash_detection'] %}
|
|
<input type="checkbox" class="form-check-input" id="crash_detection" name="crash_detection" checked="" value="1">{{ translate('serverConfig', 'serverCrashDetection') }}
|
|
{% else %}
|
|
<input type="checkbox" class="form-check-input" id="crash_detection" name="crash_detection" value="1" >{{ translate('serverConfig', 'serverCrashDetection') }}
|
|
{% end %}
|
|
</label>
|
|
|
|
</div>
|
|
|
|
<button type="submit" class="btn btn-success mr-2">{{ translate('serverConfig', 'save') }}</button>
|
|
<button type="reset" class="btn btn-light">{{ translate('serverConfig', 'cancel') }}</button>
|
|
</form>
|
|
</div>
|
|
|
|
<div class="col-md-6 col-sm-12">
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<h4 class="card-title">{{ translate('serverConfigHelp', 'title') }}</h4>
|
|
<p class="card-description"> {{ translate('serverConfigHelp', 'desc') }}</p>
|
|
<blockquote class="blockquote">
|
|
<p class="mb-0">
|
|
{% raw translate('serverConfigHelp', 'perms') %}
|
|
</p>
|
|
</blockquote>
|
|
</div>
|
|
</div>
|
|
<div class="text-center">
|
|
{% if data['server_stats']['running'] %}
|
|
<button onclick="send_command(server_id, 'update_executable');" id="update_executable" style="max-width: 7rem;" class="btn btn-warning m-1 flex-grow-1 disabled">{{ translate('serverConfig', 'update') }}</button>
|
|
<a class="btn btn-sm btn-danger disabled">{{ translate('serverConfig', 'deleteServer') }}</a><br />
|
|
<small>{{ translate('serverConfig', 'stopBeforeDeleting') }}</small>
|
|
{% else %}
|
|
<button onclick="send_command(server_id, 'update_executable');" id="update_executable" style="max-width: 7rem;" class="btn btn-warning m-1 flex-grow-1">{{ translate('serverConfig', 'update') }}</button>
|
|
<a href="/panel/remove_server?id={{ data['server_stats']['server_id']['server_id'] }}" class="btn btn-sm btn-danger">{{ translate('serverConfig', 'deleteServer') }}</a>
|
|
{% end %}
|
|
|
|
</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!" );
|
|
|
|
});
|
|
|
|
let server_id = '{{ data['server_stats']['server_id']['server_id'] }}';
|
|
|
|
function send_command (server_id, command){
|
|
<!-- this getCookie function is in base.html-->
|
|
var token = getCookie("_xsrf");
|
|
|
|
$.ajax({
|
|
type: "POST",
|
|
headers: {'X-XSRFToken': token},
|
|
url: '/server/command?command=' + command + '&id=' + server_id,
|
|
success: function(data){
|
|
console.log("got response:");
|
|
console.log(data);
|
|
setTimeout(function(){ location.reload(); }, 10000);
|
|
|
|
}
|
|
});bootbox.alert({
|
|
backdrop: true,
|
|
title: '{% raw translate("serverConfig", "sendingRequest") %}',
|
|
message: '<div align="center"><i class="fas fa-spin fa-spinner"></i> {% raw translate("serverConfig", "bePatientUpdate") %} </div>'
|
|
});
|
|
}
|
|
|
|
</script>
|
|
|
|
{% end %} |