mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
681 lines
23 KiB
HTML
681 lines
23 KiB
HTML
{% extends ../base.html %}
|
|
|
|
{% block title %}Crafty Controller - {{ translate('serverWizard', 'newServer', data['lang']) }}{% end %}
|
|
|
|
{% block content %}
|
|
<link rel="stylesheet"
|
|
href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.13.10/css/bootstrap-select.min.css">
|
|
|
|
<div class="content-wrapper">
|
|
<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="/server/step1" role="tab" aria-selected="false">
|
|
<i class="fas fa-file-signature"></i>Minecraft-Java</a>
|
|
</li>
|
|
<li class="nav-item term-nav-item">
|
|
<a class="nav-link" href="/server/bedrock_step1" role="tab" aria-selected="false">
|
|
<i class="fas fa-file-signature"></i>Minecraft-Bedrock</a>
|
|
</li>
|
|
<li class="nav-item term-nav-item">
|
|
<a class="nav-link active" href="/server/steam_cmd_step1" role="tab" aria-selected="false">
|
|
<i class="fas fa-file-signature"></i><span class="steam">Steam-CMD </span></a>
|
|
</li>
|
|
</ul>
|
|
<div class="d-none" id="overlay" onclick="hide(event)"></div>
|
|
<div class="row">
|
|
{% if data['online'] %}
|
|
<div class="col-sm-6 grid-margin stretch-card">
|
|
<div class="card">
|
|
<div class="card-body parent">
|
|
<h4 class="ribbon">BETA</h4>
|
|
|
|
<h4>{{ translate('serverWizard', 'newServer', data['lang']) }}</h4>
|
|
<br />
|
|
<p class="card-description">
|
|
<form method="post" class="server-wizard" onSubmit="wait_msg()">
|
|
{% raw xsrf_form_html() %}
|
|
<div class="row">
|
|
<div class="col-sm-12">
|
|
<div class="form-group">
|
|
<label for="server_jar">{{ translate('serverWizard', 'serverType', data['lang'])
|
|
}}</label></br>
|
|
<select style="width: 80%" required class="selectpicker form-control form-control-lg select-css"
|
|
id="steam_server" data-live-search="true" name="steam_server">
|
|
<option value="None">None</option>
|
|
{% for s in data['servers'] %}
|
|
{% if data["windows"] and s["windows"] %}
|
|
<option value="{{ s['appid'] }}">{{ s["name"].capitalize() }}</option>
|
|
{% elif not data["windows"] and s["linux"] %}
|
|
<option value="{{ s['appid'] }}">{{ s["name"].capitalize() }}</option>
|
|
{% end %}
|
|
{% end %}
|
|
</select>
|
|
{% if data['super_user'] %}
|
|
<i onclick="refreshCache()" style="float: left;" id="refresh-cache"
|
|
class="refresh-class fas fa-sync"></i>
|
|
{% end %}
|
|
</div>
|
|
</div>
|
|
<div class="col-sm-12">
|
|
<div class="form-group">
|
|
<label for="server_name">{{ translate('serverWizard', 'serverName', data['lang']) }}</label>
|
|
<input type="text" class="form-control" id="server_name" name="server_name"
|
|
placeholder="{{ translate('serverWizard', 'myNewServer', data['lang']) }}" required>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
<br />
|
|
<h4 class="card-title">{{ translate('serverWizard', 'quickSettings', data['lang']) }} <small
|
|
style="text-transform: none;"> - {{ translate('serverWizard', 'quickSettingsDescription',
|
|
data['lang']) }}</small></h4>
|
|
<hr>
|
|
<script>
|
|
function searchBar() {
|
|
var input, filter, select, options, a, i, txtValue;
|
|
input = document.getElementById("search_bar");
|
|
filter = input.value.toUpperCase();
|
|
select = document.getElementById("steam_server");
|
|
options = select.getElementsByTagName("option");
|
|
for (i = 0; i < options.length; i++) {
|
|
txtValue = options[i].innerText;
|
|
if (txtValue.toUpperCase().indexOf(filter) > -1) {
|
|
options[i].style.display = "";
|
|
} else {
|
|
options[i].style.display = "none";
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
<div class="row">
|
|
<div class="col-sm-12">
|
|
<div class="form-group">
|
|
<div id="accordion-1">
|
|
<div class="card">
|
|
<div class="card-header p-2" id="Role-1">
|
|
<p class="mb-0 p-0" data-toggle="collapse" data-target="#collapseRole-1" aria-expanded="true"
|
|
aria-controls="collapseRole-1">
|
|
<i class="fas fa-chevron-down"></i> {{ translate('serverWizard', 'addRole', data['lang']) }}
|
|
<small style="text-transform: none;"> - {{ translate('serverWizard', 'autoCreate',
|
|
data['lang']) }}</small>
|
|
</p>
|
|
</div>
|
|
<div id="collapseRole-1" class="collapse" aria-labelledby="Role-1" data-parent="">
|
|
<div class="card-body scroll">
|
|
<div class="form-group">
|
|
{% for r in data['roles'] %}
|
|
<span class="d-block menu-option"><label><input name="{{ r['role_id'] }}"
|
|
type="checkbox">
|
|
{{ r['role_name'].capitalize() }}</label></span>
|
|
{% end %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
<button type="submit" class="btn btn-primary mr-2">{{ translate('serverWizard', 'buildServer',
|
|
data['lang']) }}</button>
|
|
<button type="reset" class="btn btn-danger mr-2">{{ translate('serverWizard', 'resetForm', data['lang'])
|
|
}}</button>
|
|
|
|
</form>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
{% end %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<style>
|
|
.ribbon {
|
|
margin: -10px;
|
|
padding: 0;
|
|
background: rebeccapurple;
|
|
color: white;
|
|
padding: 1em 0;
|
|
position: absolute;
|
|
top: 0;
|
|
right: 0;
|
|
transform: translateX(30%) translateY(0%) rotate(45deg);
|
|
transform-origin: top left;
|
|
}
|
|
|
|
.parent {
|
|
overflow: hidden;
|
|
/* required */
|
|
position: relative;
|
|
/* required for demo*/
|
|
}
|
|
|
|
.ribbon:before,
|
|
.ribbon:after {
|
|
content: '';
|
|
position: absolute;
|
|
top: 0;
|
|
margin: 0 -1px;
|
|
/* tweak */
|
|
width: 100%;
|
|
height: 100%;
|
|
background: rebeccapurple;
|
|
}
|
|
|
|
.ribbon:before {
|
|
right: 100%;
|
|
}
|
|
|
|
.ribbon:after {
|
|
left: 100%;
|
|
}
|
|
|
|
.steam::after {
|
|
content: 'BETA';
|
|
font-size: 10px;
|
|
vertical-align: top;
|
|
}
|
|
|
|
.refresh-class:hover {
|
|
cursor: grab;
|
|
}
|
|
|
|
.scroll {
|
|
max-height: 12em;
|
|
overflow-y: auto;
|
|
}
|
|
|
|
.menu-btn {
|
|
font-size: 0.9em;
|
|
padding: 2px 10px;
|
|
}
|
|
|
|
.menu {
|
|
padding-top: 10px;
|
|
z-index: 200;
|
|
margin-top: 4px;
|
|
position: absolute;
|
|
background-color: var(--card-banner-bg);
|
|
}
|
|
|
|
.menu-option {
|
|
padding: 6px 20px 6px;
|
|
color: white;
|
|
}
|
|
|
|
#overlay {
|
|
position: absolute;
|
|
top: 0px;
|
|
left: 0px;
|
|
width: 100%;
|
|
height: 100%;
|
|
z-index: 100;
|
|
}
|
|
</style>
|
|
<style>
|
|
/* Remove default bullets */
|
|
.tree-view,
|
|
.tree-nested {
|
|
list-style-type: none;
|
|
margin: 0;
|
|
padding: 0;
|
|
margin-left: 10px;
|
|
}
|
|
|
|
/* Style the items */
|
|
.tree-item,
|
|
.files-tree-title {
|
|
cursor: pointer;
|
|
user-select: none;
|
|
/* Prevent text selection */
|
|
}
|
|
|
|
/* Create the caret/arrow with a unicode, and style it */
|
|
.tree-caret .fa-folder {
|
|
display: inline-block;
|
|
}
|
|
|
|
.tree-caret .fa-folder-open {
|
|
display: none;
|
|
}
|
|
|
|
/* Rotate the caret/arrow icon when clicked on (using JavaScript) */
|
|
.tree-caret-down .fa-folder {
|
|
display: none;
|
|
}
|
|
|
|
.tree-caret-down .fa-folder-open {
|
|
display: inline-block;
|
|
}
|
|
|
|
/* Hide the nested list */
|
|
.tree-nested {
|
|
display: none;
|
|
}
|
|
|
|
#op_logo {
|
|
position: relative;
|
|
top: 50%;
|
|
transform: translateY(-50%);
|
|
}
|
|
</style>
|
|
<style>
|
|
.scroll {
|
|
max - height: 12em;
|
|
overflow - y: auto;
|
|
}
|
|
|
|
.menu - btn {
|
|
font - size: 0.9em;
|
|
padding: 2px 10px;
|
|
}
|
|
|
|
.menu {
|
|
padding - top: 10px;
|
|
z - index: 200;
|
|
margin - top: 4px;
|
|
position: absolute;
|
|
background - color: #2a2c44;
|
|
}
|
|
|
|
.menu - option {
|
|
padding: 6px 20px 6px;
|
|
color: white;
|
|
}
|
|
|
|
#overlay {
|
|
position: absolute;
|
|
top: 0px;
|
|
left: 0px;
|
|
width: 100 %;
|
|
height: 100 %;
|
|
z - index: 100;
|
|
}
|
|
</style>
|
|
<style>
|
|
/* Remove default bullets */
|
|
.tree-view,
|
|
.tree-nested {
|
|
list - style - type: none;
|
|
margin: 0;
|
|
padding: 0;
|
|
margin-left: 10px;
|
|
}
|
|
|
|
/* Style the items */
|
|
.tree-item,
|
|
.files-tree-title {
|
|
cursor: pointer;
|
|
user-select: none;
|
|
/* Prevent text selection */
|
|
}
|
|
|
|
/* Create the caret/arrow with a unicode, and style it */
|
|
.tree-caret .fa-folder {
|
|
display: inline-block;
|
|
}
|
|
|
|
.tree-caret .fa-folder-open {
|
|
display: none;
|
|
}
|
|
|
|
/* Rotate the caret/arrow icon when clicked on (using JavaScript) */
|
|
.tree-caret-down .fa-folder {
|
|
display: none;
|
|
}
|
|
|
|
.tree-caret-down .fa-folder-open {
|
|
display: inline-block;
|
|
}
|
|
|
|
/* Hide the nested list */
|
|
.tree-nested {
|
|
display: none;
|
|
}
|
|
|
|
#op_logo {
|
|
position: relative;
|
|
top: 50%;
|
|
transform: translateY(-50%);
|
|
}
|
|
</style>
|
|
</style>
|
|
|
|
{% end %}
|
|
|
|
{% block js%}
|
|
<script>
|
|
document.getElementById("root_files_button").addEventListener("click", function () {
|
|
if (document.forms["zip"]["server_path"].value != "") {
|
|
if (document.getElementById('root_files_button').classList.contains('clicked')) {
|
|
document.getElementById('main-tree-div').innerHTML = '<input type="radio" id="main-tree-input" name="root_path" value="" checked><span id="main-tree" class="files-tree-title tree-caret-down root-dir" data-path=""><i class="far fa-folder"></i><i class="far fa-folder-open"></i>{{ translate("serverFiles", "files", data["lang"]) }}</span></input>'
|
|
} else {
|
|
document.getElementById('root_files_button').classList.add('clicked')
|
|
}
|
|
path = document.forms["zip"]["server_path"].value;
|
|
console.log(document.forms["zip"]["server_path"].value)
|
|
var token = getCookie("_xsrf");
|
|
var dialog = bootbox.dialog({
|
|
message: '<p class="text-center mb-0"><i class="fa fa-spin fa-cog"></i> Please wait while we gather your files...</p>',
|
|
closeButton: false
|
|
});
|
|
$.ajax({
|
|
type: "POST",
|
|
headers: { 'X-XSRFToken': token },
|
|
url: '/ajax/unzip_server?id=-1&path=' + encodeURIComponent(path),
|
|
});
|
|
} else {
|
|
bootbox.alert("You must input a path before selecting this button");
|
|
}
|
|
</script>
|
|
|
|
{% end %}
|
|
|
|
{% block js %}
|
|
<script>
|
|
var upload = false;
|
|
var file;
|
|
function sendFile() {
|
|
file = $("#file")[0].files[0]
|
|
document.getElementById("upload_input").innerHTML = '<div class="progress"><div id="upload-progress-bar" class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 100%"> <i class="fa-solid fa-spinner"></i></div></div>'
|
|
let xmlHttpRequest = new XMLHttpRequest();
|
|
let token = getCookie("_xsrf")
|
|
let fileName = file.name
|
|
let target = '/upload'
|
|
let mimeType = file.type
|
|
let size = file.size
|
|
let type = 'server_import'
|
|
|
|
xmlHttpRequest.upload.addEventListener('progress', function (e) {
|
|
|
|
if (e.loaded <= size) {
|
|
var percent = Math.round(e.loaded / size * 100);
|
|
$(`#upload-progress-bar`).css('width', percent + '%');
|
|
$(`#upload-progress-bar`).html(percent + '%');
|
|
}
|
|
});
|
|
|
|
xmlHttpRequest.open('POST', target, true);
|
|
xmlHttpRequest.setRequestHeader('X-Content-Type', mimeType);
|
|
xmlHttpRequest.setRequestHeader('X-XSRFToken', token);
|
|
xmlHttpRequest.setRequestHeader('X-Content-Length', size);
|
|
xmlHttpRequest.setRequestHeader('X-Content-Disposition', 'attachment; filename="' + fileName + '"');
|
|
xmlHttpRequest.setRequestHeader('X-Content-Upload-Type', type);
|
|
xmlHttpRequest.setRequestHeader('X-FileName', fileName);
|
|
xmlHttpRequest.addEventListener('load', (event) => {
|
|
if (event.target.responseText == 'success') {
|
|
console.log('Upload for file', file.name, 'was successful!')
|
|
document.getElementById("upload_input").innerHTML = '<div class="card-header header-sm d-flex justify-content-between align-items-center"><span id="file-uploaded" style="color: gray;">' + fileName + '</span> 🔒</div>';
|
|
document.getElementById("lower_half").style.visibility = "visible";
|
|
}
|
|
else {
|
|
let response_text = JSON.parse(event.target.responseText);
|
|
var x = document.querySelector('.bootbox');
|
|
console.log(JSON.parse(event.target.responseText).info)
|
|
bootbox.alert({
|
|
message: JSON.parse(event.target.responseText).info,
|
|
callback: function () {
|
|
window.location.reload();
|
|
}
|
|
});
|
|
doUpload = false;
|
|
}
|
|
}, false);
|
|
xmlHttpRequest.addEventListener('error', (e) => {
|
|
console.error('Error while uploading file', file.name + '.', 'Event:', e)
|
|
}, false);
|
|
xmlHttpRequest.send(file);
|
|
}
|
|
|
|
|
|
document.getElementById("root_files_button").addEventListener("click", function () {
|
|
if (document.forms["zip"]["server_path"].value != "") {
|
|
if (document.getElementById('root_files_button').classList.contains('clicked')) {
|
|
document.getElementById('main-tree-div').innerHTML = '<input type="radio" id="main-tree-input" name="root_path" value="" checked><span id="main-tree" class="files-tree-title tree-caret-down root-dir" data-path=""><i class="far fa-folder"></i><i class="far fa-folder-open"></i>{{ translate("serverFiles", "files", data["lang"]) }}</span></input>'
|
|
} else {
|
|
document.getElementById('root_files_button').classList.add('clicked')
|
|
}
|
|
path = document.forms["zip"]["server_path"].value;
|
|
console.log(document.forms["zip"]["server_path"].value)
|
|
var token = getCookie("_xsrf");
|
|
var dialog = bootbox.dialog({
|
|
message: '<p class="text-center mb-0"><i class="fa fa-spin fa-cog"></i> Please wait while we gather your files...</p>',
|
|
closeButton: false
|
|
});
|
|
$.ajax({
|
|
type: "POST",
|
|
headers: { 'X-XSRFToken': token },
|
|
url: '/ajax/unzip_server?id=-1&path=' + encodeURIComponent(path),
|
|
});
|
|
} else {
|
|
bootbox.alert("You must input a path before selecting this button");
|
|
}
|
|
});
|
|
|
|
document.getElementById("root_upload_button").addEventListener("click", function () {
|
|
if (file) {
|
|
upload = true;
|
|
if (document.getElementById('root_upload_button').classList.contains('clicked')) {
|
|
document.getElementById('main-tree-div-upload').innerHTML = '<input type="radio" id="main-tree-input-upload" name="root_path" value="" checked><span id="main-tree-upload" class="files-tree-title tree-caret-down root-dir" data-path=""><i class="far fa-folder"></i><i class="far fa-folder-open"></i>{{ translate("serverFiles", "files", data["lang"]) }}</span></input>'
|
|
} else {
|
|
document.getElementById('root_upload_button').classList.add('clicked')
|
|
}
|
|
var token = getCookie("_xsrf");
|
|
var dialog = bootbox.dialog({
|
|
message: '<p class="text-center mb-0"><i class="fa fa-spin fa-cog"></i> Please wait while we gather your files...</p>',
|
|
closeButton: false
|
|
});
|
|
$.ajax({
|
|
type: "POST",
|
|
headers: { 'X-XSRFToken': token },
|
|
url: '/ajax/unzip_server?id=-1&file=' + encodeURIComponent(file.name),
|
|
});
|
|
} else {
|
|
bootbox.alert("You must input a path before selecting this button");
|
|
}
|
|
});
|
|
</script>
|
|
|
|
<script>
|
|
$(".tree-reset").on("click", function () {
|
|
location.href = "/server/step1";
|
|
});
|
|
function dropDown(event) {
|
|
event.target.parentElement.children[1].classList.remove("d-none");
|
|
document.getElementById("overlay").classList.remove("d-none");
|
|
}
|
|
|
|
function hide(event) {
|
|
var items = document.getElementsByClassName('menu');
|
|
items.forEach(item => {
|
|
item.classList.add("d-none");
|
|
})
|
|
|
|
document.getElementById("overlay").classList.add("d-none");
|
|
}
|
|
|
|
$(document).ready(function () {
|
|
console.log('ready');
|
|
var forms = $('form.server-wizard');
|
|
forms.each(function (i, formEl) {
|
|
var form = $(formEl);
|
|
var min = form.find('[name=min_memory]');
|
|
var max = form.find('[name=max_memory]');
|
|
console.log(form, min, max)
|
|
min.change(function () {
|
|
check_sizes(max, min, 'min');
|
|
});
|
|
max.change(function () {
|
|
check_sizes(max, min, 'max');
|
|
});
|
|
});
|
|
});
|
|
|
|
function wait_msg(importing) {
|
|
bootbox.alert({
|
|
title: importing ? '{% raw translate("serverWizard", "importing", data["lang"]) %}' : '{% raw translate("serverWizard", "downloading", data["lang"]) %}',
|
|
message: '<i class="fas fa-cloud-download"></i> {% raw translate("serverWizard", "bePatient", data["lang"]) %}',
|
|
});
|
|
}
|
|
|
|
function show_file_tree() {
|
|
if (upload) {
|
|
$("#dir_upload_select").modal();
|
|
} else {
|
|
$("#dir_select").modal();
|
|
}
|
|
}
|
|
|
|
function check_sizes(a, b, changed) {
|
|
max_mem = parseFloat(a.val());
|
|
min_mem = parseFloat(b.val());
|
|
if (max_mem < min_mem && changed === 'min') {
|
|
a.val(min_mem)
|
|
}
|
|
if (max_mem < min_mem && changed === 'max') {
|
|
b.val(max_mem)
|
|
}
|
|
}
|
|
|
|
function getTreeView(path) {
|
|
const styles = window.getComputedStyle(document.getElementById("lower_half"));
|
|
//If this value is still hidden we know the user is executing a zip import and not an upload
|
|
if (styles.visibility === "hidden") {
|
|
document.getElementById('zip_submit').disabled = false;
|
|
} else {
|
|
document.getElementById('upload_submit').disabled = false;
|
|
}
|
|
path = path
|
|
|
|
$.ajax({
|
|
type: "GET",
|
|
url: '/ajax/get_zip_tree?id=-1&path=' + path,
|
|
dataType: 'text',
|
|
success: function (data) {
|
|
console.log("got response:");
|
|
console.log(data);
|
|
|
|
dataArr = data.split('\n');
|
|
serverDir = dataArr.shift(); // Remove & return first element (server directory)
|
|
text = dataArr.join('\n');
|
|
if (styles.visibility === "hidden") {
|
|
try {
|
|
document.getElementById('main-tree-div').innerHTML += text;
|
|
document.getElementById('main-tree').parentElement.classList.add("clicked");
|
|
} catch {
|
|
document.getElementById('files-tree').innerHTML = text;
|
|
}
|
|
} else {
|
|
try {
|
|
document.getElementById('main-tree-div-upload').innerHTML += text;
|
|
document.getElementById('main-tree-upload').parentElement.classList.add("clicked");
|
|
} catch {
|
|
document.getElementById('files-tree').innerHTML = text;
|
|
}
|
|
}
|
|
|
|
document.getElementsByClassName('files-tree-title')[0].setAttribute('data-path', serverDir);
|
|
document.getElementsByClassName('files-tree-title')[0].setAttribute('data-name', 'Files');
|
|
|
|
},
|
|
});
|
|
}
|
|
|
|
function getToggleMain(event) {
|
|
path = event.target.parentElement.getAttribute('data-path');
|
|
document.getElementById("files-tree").classList.toggle("d-block");
|
|
document.getElementById(path + "span").classList.toggle("tree-caret-down");
|
|
document.getElementById(path + "span").classList.toggle("tree-caret");
|
|
}
|
|
|
|
|
|
function getDirView(event) {
|
|
path = event.target.parentElement.getAttribute('data-path');
|
|
|
|
if (document.getElementById(path).classList.contains('clicked')) {
|
|
|
|
var toggler = document.getElementById(path + "span");
|
|
|
|
if (toggler.classList.contains('files-tree-title')) {
|
|
document.getElementById(path + "ul").classList.toggle("d-block");
|
|
document.getElementById(path + "span").classList.toggle("tree-caret-down");
|
|
}
|
|
return;
|
|
} else {
|
|
$.ajax({
|
|
type: "GET",
|
|
url: '/ajax/get_zip_dir?id=-1&path=' + path,
|
|
dataType: 'text',
|
|
success: function (data) {
|
|
console.log("got response:");
|
|
|
|
dataArr = data.split('\n');
|
|
serverDir = dataArr.shift(); // Remove & return first element (server directory)
|
|
text = dataArr.join('\n');
|
|
|
|
try {
|
|
document.getElementById(path + "span").classList.add('tree-caret-down');
|
|
document.getElementById(path).innerHTML += text;
|
|
document.getElementById(path).classList.add("clicked");
|
|
} catch {
|
|
console.log("Bad")
|
|
}
|
|
|
|
var toggler = document.getElementById(path);
|
|
|
|
if (toggler.classList.contains('files-tree-title')) {
|
|
document.getElementById(path + "span").addEventListener("click", function caretListener() {
|
|
document.getElementById(path + "ul").classList.toggle("d-block");
|
|
document.getElementById(path + "span").classList.toggle("tree-caret-down");
|
|
});
|
|
}
|
|
},
|
|
});
|
|
}
|
|
}
|
|
if (webSocket) {
|
|
webSocket.on('send_temp_path', function (data) {
|
|
setTimeout(function () {
|
|
var x = document.querySelector('.bootbox');
|
|
if (x) {
|
|
x.remove()
|
|
}
|
|
var x = document.querySelector('.modal-backdrop');
|
|
if (x) {
|
|
x.remove()
|
|
}
|
|
document.getElementById('main-tree-input').setAttribute('value', data.path)
|
|
document.getElementById('main-tree-input-upload').setAttribute('value', data.path)
|
|
getTreeView(data.path);
|
|
show_file_tree();
|
|
|
|
$("#root_files_button").attr("disabled", "disabled");
|
|
$("#root_upload_button").attr("disabled", "disabled");
|
|
|
|
}, 5000);
|
|
});
|
|
}
|
|
|
|
function refreshCache() {
|
|
var token = getCookie("_xsrf")
|
|
document.getElementById("refresh-cache").classList.add("fa-spin")
|
|
$.ajax({
|
|
type: "POST",
|
|
headers: { 'X-XSRFToken': token },
|
|
url: '/ajax/jar_cache',
|
|
success: function () {
|
|
document.getElementById("refresh-cache").classList.remove("fa-sync");
|
|
document.getElementById("refresh-cache").classList.remove("fa-spin");
|
|
document.getElementById("refresh-cache").classList.add("fa-check");
|
|
|
|
setTimeout(function () {
|
|
location.reload();
|
|
}, 2000);
|
|
},
|
|
});
|
|
}
|
|
|
|
</script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.13.10/js/bootstrap-select.min.js"></script>
|
|
{% end %} |