Fix panel config buttons

This commit is contained in:
= 2025-01-18 19:15:43 -05:00
parent ffaaf9ec18
commit 0d0e14b5e0

View File

@ -431,83 +431,85 @@
}); });
} }
} }
}
)
});
if (webSocket) {
webSocket.on('move_status', function (message) {
if (message === "done") {
$("#submit-list").removeClass("loading");
$("#submit-list").html("");
$("#submit-status").html('<i class="fa fa-check"></i>');
} else {
$("#submit-status").html('<i class="fa fa-spinner fa-spin"></i>');
$("#submit-list").html(message);
$("#submit-list").addClass("loading");
}
}); });
if (webSocket) { }
webSocket.on('move_status', function (message) {
if (message === "done") { $("#server-path").submit(async function (e) {
$("#submit-list").removeClass("loading"); const token = getCookie("_xsrf")
$("#submit-list").html(""); e.preventDefault();
$("#submit-status").html('<i class="fa fa-check"></i>');
} else { $("#submit-status").html('<i class="fa fa-spinner fa-spin"></i>');
$("#submit-status").html('<i class="fa fa-spinner fa-spin"></i>');
$("#submit-list").html(message); let path = $("#global_server_path").val();
$("#submit-list").addClass("loading"); let res = await fetch(`/api/v2/crafty/config/servers_dir`, {
} method: 'PATCH',
headers: {
'X-XSRFToken': token
},
body: JSON.stringify({ "new_dir": path }),
});
let responseData = await res.json();
if (responseData.status === "ok") {
return
} else {
bootbox.alert({
title: responseData.error,
message: responseData.error_data
}); });
} }
});
$("#server-path").submit(async function (e) { $(document).ready(function () {
const token = getCookie("_xsrf") $('[data-toggle="popover"]').popover();
e.preventDefault(); if ($(window).width() < 1000) {
$('.too_small').popover("show");
$('.too_small2').popover("show");
}
$("#submit-status").html('<i class="fa fa-spinner fa-spin"></i>'); });
$(window).ready(function () {
let path = $("#global_server_path").val(); $('body').click(function () {
let res = await fetch(`/api/v2/crafty/config/servers_dir`, { $('.too_small').popover("hide");
method: 'PATCH', $('.too_small2').popover("hide");
headers: {
'X-XSRFToken': token
},
body: JSON.stringify({ "new_dir": path }),
});
let responseData = await res.json();
if (responseData.status === "ok") {
return
} else {
bootbox.alert({
title: responseData.error,
message: responseData.error_data
});
}
});
$(document).ready(function () {
$('[data-toggle="popover"]').popover();
if ($(window).width() < 1000) {
$('.too_small').popover("show");
$('.too_small2').popover("show");
}
});
$(window).ready(function () {
$('body').click(function () {
$('.too_small').popover("hide");
$('.too_small2').popover("hide");
});
});
$(window).resize(function () {
// This will execute whenever the window is resized
if ($(window).width() < 1000) {
$('.too_small').popover("show");
}
else {
$('.too_small').popover("hide");
} // New width
if ($(window).width() < 1000) {
$('.too_small2').popover("show");
}
else {
$('.too_small2').popover("hide");
} // New width
});
$('#file').change(function () {
console.log("File changed");
if ($('#file').val()) {
$('#upload-button').prop("disabled", false);
console.log("File changed good");
}
}); });
});
$(window).resize(function () {
// This will execute whenever the window is resized
if ($(window).width() < 1000) {
$('.too_small').popover("show");
}
else {
$('.too_small').popover("hide");
} // New width
if ($(window).width() < 1000) {
$('.too_small2').popover("show");
}
else {
$('.too_small2').popover("hide");
} // New width
});
$('#file').change(function () {
console.log("File changed");
if ($('#file').val()) {
$('#upload-button').prop("disabled", false);
console.log("File changed good");
}
});
</script> </script>
{% end %} {% end %}