mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Merge branch 'bugfix/zip-server-creation' into 'dev'
Fix Zip Root Dir Selection See merge request crafty-controller/crafty-4!764
This commit is contained in:
commit
2e9b7525be
@ -3,7 +3,7 @@
|
|||||||
### New features
|
### New features
|
||||||
TBD
|
TBD
|
||||||
### Bug fixes
|
### Bug fixes
|
||||||
TBD
|
- Fix zip imports so the root dir selection is functional ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/764))
|
||||||
### Tweaks
|
### Tweaks
|
||||||
- Add info note to default creds file ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/760))
|
- Add info note to default creds file ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/760))
|
||||||
### Lang
|
### Lang
|
||||||
|
@ -41,7 +41,7 @@ async function getTreeView(path, unzip = false, upload = false) {
|
|||||||
let responseData = await res.json();
|
let responseData = await res.json();
|
||||||
if (responseData.status === "ok") {
|
if (responseData.status === "ok") {
|
||||||
console.log(responseData);
|
console.log(responseData);
|
||||||
process_tree_response(responseData);
|
process_tree_response(responseData, unzip);
|
||||||
let x = document.querySelector('.bootbox');
|
let x = document.querySelector('.bootbox');
|
||||||
if (x) {
|
if (x) {
|
||||||
x.remove()
|
x.remove()
|
||||||
@ -61,7 +61,7 @@ async function getTreeView(path, unzip = false, upload = false) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function process_tree_response(response) {
|
function process_tree_response(response, unzip) {
|
||||||
const styles = window.getComputedStyle(document.getElementById("lower_half"));
|
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 this value is still hidden we know the user is executing a zip import and not an upload
|
||||||
if (styles.visibility === "hidden") {
|
if (styles.visibility === "hidden") {
|
||||||
@ -70,7 +70,9 @@ function process_tree_response(response) {
|
|||||||
document.getElementById('upload_submit').disabled = false;
|
document.getElementById('upload_submit').disabled = false;
|
||||||
}
|
}
|
||||||
let path = response.data.root_path.path;
|
let path = response.data.root_path.path;
|
||||||
$(".root-input").val(response.data.root_path.path);
|
if (unzip) {
|
||||||
|
$(".root-input").val(response.data.root_path.path);
|
||||||
|
}
|
||||||
let text = `<ul class="tree-nested d-block" id="${path}ul">`;
|
let text = `<ul class="tree-nested d-block" id="${path}ul">`;
|
||||||
Object.entries(response.data).forEach(([key, value]) => {
|
Object.entries(response.data).forEach(([key, value]) => {
|
||||||
if (key === "root_path" || key === "db_stats") {
|
if (key === "root_path" || key === "db_stats") {
|
||||||
@ -83,7 +85,7 @@ function process_tree_response(response) {
|
|||||||
if (value.dir) {
|
if (value.dir) {
|
||||||
text += `<li class="tree-item" id="${dpath}li" data-path="${dpath}">
|
text += `<li class="tree-item" id="${dpath}li" data-path="${dpath}">
|
||||||
<div id="${dpath}" data-path="${dpath}" data-name="${filename}" class="tree-caret tree-ctx-item tree-folder">
|
<div id="${dpath}" data-path="${dpath}" data-name="${filename}" class="tree-caret tree-ctx-item tree-folder">
|
||||||
<input type="radio" name="root_path" value="${dpath}">
|
<input type="radio" class="root-input" name="root_path" value="${dpath}">
|
||||||
<span id="${dpath}span" class="files-tree-title" data-path="${dpath}" data-name="${filename}" onclick="getDirView(event)">
|
<span id="${dpath}span" class="files-tree-title" data-path="${dpath}" data-name="${filename}" onclick="getDirView(event)">
|
||||||
<i style="color: var(--info);" class="far fa-folder"></i>
|
<i style="color: var(--info);" class="far fa-folder"></i>
|
||||||
<i style="color: var(--info);" class="far fa-folder-open"></i>
|
<i style="color: var(--info);" class="far fa-folder-open"></i>
|
||||||
|
@ -246,11 +246,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="visibility: hidden;">
|
|
||||||
<div class="form-group">
|
|
||||||
<input type="text" class="form-control" id="zip_root_path" name="zip_root_path">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="modal fade" id="dir_select" tabindex="-1" role="dialog" aria-labelledby="dir_select"
|
<div class="modal fade" id="dir_select" tabindex="-1" role="dialog" aria-labelledby="dir_select"
|
||||||
aria-hidden="true">
|
aria-hidden="true">
|
||||||
<div class="modal-dialog" role="document">
|
<div class="modal-dialog" role="document">
|
||||||
@ -378,11 +373,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="visibility: hidden;">
|
|
||||||
<div class="form-group">
|
|
||||||
<input type="text" class="form-control" id="zip_root_path" name="zip_root_path">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="modal fade" id="dir_upload_select" tabindex="-1" role="dialog" aria-labelledby="dir_select"
|
<div class="modal fade" id="dir_upload_select" tabindex="-1" role="dialog" aria-labelledby="dir_select"
|
||||||
aria-hidden="true">
|
aria-hidden="true">
|
||||||
<div class="modal-dialog" role="document">
|
<div class="modal-dialog" role="document">
|
||||||
@ -591,7 +581,7 @@
|
|||||||
message: '<p class="text-center mb-0"><i class="fa fa-spin fa-cog"></i> Please wait while we gather your files...</p>',
|
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
|
closeButton: false
|
||||||
});
|
});
|
||||||
setTimeout(function(){
|
setTimeout(function () {
|
||||||
getDirView();
|
getDirView();
|
||||||
}, 2000);
|
}, 2000);
|
||||||
} else {
|
} else {
|
||||||
@ -640,7 +630,7 @@
|
|||||||
message: '<p class="text-center mb-0"><i class="fa fa-spin fa-cog"></i> Please wait while we gather your files...</p>',
|
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
|
closeButton: false
|
||||||
});
|
});
|
||||||
setTimeout(function(){
|
setTimeout(function () {
|
||||||
getDirView();
|
getDirView();
|
||||||
}, 2000);
|
}, 2000);
|
||||||
} else {
|
} else {
|
||||||
@ -796,7 +786,13 @@
|
|||||||
wait_msg(true);
|
wait_msg(true);
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
let jarForm = document.getElementById("import-zip");
|
let jarForm = document.getElementById("import-zip");
|
||||||
|
var checkedRadio = $('.root-input:checked');
|
||||||
|
let zip_root_path = ""
|
||||||
|
if (checkedRadio.length > 0) {
|
||||||
|
// Get the value of the checked radio button
|
||||||
|
var checkedValue = checkedRadio.val();
|
||||||
|
zip_root_path = checkedValue; // Return the checked value if needed
|
||||||
|
}
|
||||||
let formData = new FormData(jarForm);
|
let formData = new FormData(jarForm);
|
||||||
//Create an object from the form data entries
|
//Create an object from the form data entries
|
||||||
let formDataObject = Object.fromEntries(formData.entries());
|
let formDataObject = Object.fromEntries(formData.entries());
|
||||||
@ -813,7 +809,7 @@
|
|||||||
"minecraft_bedrock_create_data": {
|
"minecraft_bedrock_create_data": {
|
||||||
"create_type": "import_server",
|
"create_type": "import_server",
|
||||||
"import_server_create_data": {
|
"import_server_create_data": {
|
||||||
"existing_server_path": formDataObject.root_path,
|
"existing_server_path": zip_root_path,
|
||||||
"executable": formDataObject.server_jar,
|
"executable": formDataObject.server_jar,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -834,6 +830,13 @@
|
|||||||
//Create an object from the form data entries
|
//Create an object from the form data entries
|
||||||
let formDataObject = Object.fromEntries(formData.entries());
|
let formDataObject = Object.fromEntries(formData.entries());
|
||||||
console.log(formDataObject);
|
console.log(formDataObject);
|
||||||
|
var checkedRadio = $('.root-input:checked');
|
||||||
|
let zip_root_path = ""
|
||||||
|
if (checkedRadio.length > 0) {
|
||||||
|
// Get the value of the checked radio button
|
||||||
|
var checkedValue = checkedRadio.val();
|
||||||
|
zip_root_path = checkedValue; // Return the checked value if needed
|
||||||
|
}
|
||||||
let send_data = {
|
let send_data = {
|
||||||
"name": formDataObject.name,
|
"name": formDataObject.name,
|
||||||
"roles": calcRoles(),
|
"roles": calcRoles(),
|
||||||
@ -846,7 +849,7 @@
|
|||||||
"minecraft_bedrock_create_data": {
|
"minecraft_bedrock_create_data": {
|
||||||
"create_type": "import_server",
|
"create_type": "import_server",
|
||||||
"import_server_create_data": {
|
"import_server_create_data": {
|
||||||
"existing_server_path": formDataObject.root_path,
|
"existing_server_path": zip_root_path,
|
||||||
"executable": formDataObject.server_jar,
|
"executable": formDataObject.server_jar,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -437,11 +437,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-12" style="visibility: hidden;" hidden>
|
|
||||||
<div class="form-group">
|
|
||||||
<input type="text" class="form-control" id="zip_root_path" name="zip_root_path">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="modal fade" id="dir_select" tabindex="-1" role="dialog" aria-labelledby="dir_select"
|
<div class="modal fade" id="dir_select" tabindex="-1" role="dialog" aria-labelledby="dir_select"
|
||||||
aria-hidden="true">
|
aria-hidden="true">
|
||||||
<div class="modal-dialog" role="document">
|
<div class="modal-dialog" role="document">
|
||||||
@ -588,11 +583,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="visibility: hidden;">
|
|
||||||
<div class="form-group">
|
|
||||||
<input type="text" class="form-control" id="zip_root_path" name="zip_root_path">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="modal fade" id="dir_upload_select" tabindex="-1" role="dialog" aria-labelledby="dir_select"
|
<div class="modal fade" id="dir_upload_select" tabindex="-1" role="dialog" aria-labelledby="dir_select"
|
||||||
aria-hidden="true">
|
aria-hidden="true">
|
||||||
<div class="modal-dialog" role="document">
|
<div class="modal-dialog" role="document">
|
||||||
@ -1035,6 +1025,13 @@
|
|||||||
//Create an object from the form data entries
|
//Create an object from the form data entries
|
||||||
let formDataObject = Object.fromEntries(formData.entries());
|
let formDataObject = Object.fromEntries(formData.entries());
|
||||||
console.log(formDataObject);
|
console.log(formDataObject);
|
||||||
|
var checkedRadio = $('.root-input:checked');
|
||||||
|
let zip_root_path = ""
|
||||||
|
if (checkedRadio.length > 0) {
|
||||||
|
// Get the value of the checked radio button
|
||||||
|
var checkedValue = checkedRadio.val();
|
||||||
|
zip_root_path = checkedValue; // Return the checked value if needed
|
||||||
|
}
|
||||||
let send_data = {
|
let send_data = {
|
||||||
"name": formDataObject.name,
|
"name": formDataObject.name,
|
||||||
"roles": calcRoles(),
|
"roles": calcRoles(),
|
||||||
@ -1047,7 +1044,7 @@
|
|||||||
"minecraft_java_create_data": {
|
"minecraft_java_create_data": {
|
||||||
"create_type": "import_server",
|
"create_type": "import_server",
|
||||||
"import_server_create_data": {
|
"import_server_create_data": {
|
||||||
"existing_server_path": formDataObject.root_path,
|
"existing_server_path": zip_root_path,
|
||||||
"jarfile": formDataObject.server_jar,
|
"jarfile": formDataObject.server_jar,
|
||||||
"mem_min": formDataObject.mem_min,
|
"mem_min": formDataObject.mem_min,
|
||||||
"mem_max": formDataObject.mem_max,
|
"mem_max": formDataObject.mem_max,
|
||||||
@ -1071,6 +1068,13 @@
|
|||||||
//Create an object from the form data entries
|
//Create an object from the form data entries
|
||||||
let formDataObject = Object.fromEntries(formData.entries());
|
let formDataObject = Object.fromEntries(formData.entries());
|
||||||
console.log(formDataObject);
|
console.log(formDataObject);
|
||||||
|
var checkedRadio = $('.root-input:checked');
|
||||||
|
let zip_root_path = ""
|
||||||
|
if (checkedRadio.length > 0) {
|
||||||
|
// Get the value of the checked radio button
|
||||||
|
var checkedValue = checkedRadio.val();
|
||||||
|
zip_root_path = checkedValue; // Return the checked value if needed
|
||||||
|
}
|
||||||
let send_data = {
|
let send_data = {
|
||||||
"name": formDataObject.name,
|
"name": formDataObject.name,
|
||||||
"roles": calcRoles(),
|
"roles": calcRoles(),
|
||||||
@ -1083,7 +1087,7 @@
|
|||||||
"minecraft_java_create_data": {
|
"minecraft_java_create_data": {
|
||||||
"create_type": "import_server",
|
"create_type": "import_server",
|
||||||
"import_server_create_data": {
|
"import_server_create_data": {
|
||||||
"existing_server_path": formDataObject.root_path,
|
"existing_server_path": zip_root_path,
|
||||||
"jarfile": formDataObject.server_jar,
|
"jarfile": formDataObject.server_jar,
|
||||||
"mem_min": formDataObject.mem_min,
|
"mem_min": formDataObject.mem_min,
|
||||||
"mem_max": formDataObject.mem_max,
|
"mem_max": formDataObject.mem_max,
|
||||||
|
Loading…
Reference in New Issue
Block a user