Files
iTop/datamodels/2.x/itop-core-update/view/SelectUpdateFile.ready.js.twig
Pierre Goiffon 8fcd454445 N°4919 New 'Launch setup" in Application Upgrade (#244)
Admin will now be able to re-launch the iTop setup directly from the administration console in the Administration / Application Upgrade screen.
Before the only way to launch setup on an existing iTop instance was to change permissions on the configuration file.

This button will be enabled depending on the isDevEnv (if true it will be displayed) and `setup.launch_button.enabled` new configuration parameter (not present by default ; if set to false will always hide the button, if set to true will always display it, if not set will display button depending on isDevEnv only).

Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
2022-04-19 14:36:15 +02:00

107 lines
3.2 KiB
Twig

{# @copyright Copyright (C) 2010-2021 Combodo SARL #}
{# @license http://opensource.org/licenses/AGPL-3.0 #}
var iDiskFreeSpace = {{ iDiskFreeSpace }};
$.ajax({
method: "POST",
url: "{{ sAjaxURL|raw }}",
data: {
"operation": "CanUpdateCore"
},
dataType: "json",
success: function (data) {
var oRequirements = $("#header-requirements");
var oCanCoreUpdate = $("#can-core-update");
oCanCoreUpdate.html(data.sMessage);
if(data.sMessageDetails){
$("#header-requirements-details").removeClass("ibo-is-hidden");
$('#can-core-update-details').html(data.sMessageDetails);
$("#toggle-requirements-details").click( function() { $("#can-core-update-details").toggle(); } );
}
oRequirements.removeClass("ibo-is-information");
if (data.bStatus) {
oRequirements.addClass("ibo-is-success");
$("#check-update").prop("disabled", false);
$("#file").prop("disabled", false);
$("#file-container").removeClass("ibo-is-hidden");
$("#check-in-progress").addClass("ibo-is-hidden");
} else {
$("#check-update").prop("disabled", true);
$("#file").prop("disabled", true);
$('#form-update-outer').slideUp(600);
oRequirements.addClass("ibo-is-failure");
}
}
});
var oGetItopDiskSpace = $.ajax({
method: "POST",
url: "{{ sAjaxURL|raw }}",
data: {
"operation": "GetItopDiskSpace"
},
dataType: "json",
success: function(data)
{
var oRequirement = $("#itop-disk-space");
oRequirement.html(data.sItopDiskSpace);
}
});
var oGetDBDiskSpace = $.ajax({
method: "POST",
url: "{{ sAjaxURL|raw }}",
data: {
"operation": "GetDBDiskSpace"
},
dataType: "json",
success: function(data)
{
var oRequirement = $("#db-disk-space");
oRequirement.html(data.sDBDiskSpace);
}
});
$.when(oGetItopDiskSpace, oGetDBDiskSpace).then(
function(data1, data2)
{
var iItopDiskSpace = data1[0].iItopDiskSpace;
var iDBDiskSpace = data2[0].iDBDiskSpace;
if ((2 * (iItopDiskSpace + iDBDiskSpace)) > iDiskFreeSpace)
{
$("#dobackup-warning").removeClass("ibo-is-hidden");
}
}
);
$("#file").on("change", function(e) {
var selectedFile = $('#file').get(0).files[0];
var errorMsg = $("#header-file-size");
var submitButton = $("#check-update");
if (selectedFile)
{
if (selectedFile.size > {{ iFileUploadMaxSize }})
{
errorMsg.removeClass("ibo-is-hidden");
submitButton.prop("disabled", true);
return;
}
}
errorMsg.addClass("ibo-is-hidden");
submitButton.prop("disabled", false);
});
$("#check-update").on("click", function(e) {
$("#submit-wait").removeClass("ibo-is-hidden");
$(this).prop("disabled", true);
$(".ajax-spin").removeClass("fa-sync-alt").removeClass("fa-spin").addClass("fa-times");
$(this).parents('form').submit();
e.preventDefault();
e.stopPropagation();
return false;
});
$("#launch-setup-form").on("submit", function () {
return window.confirm("{{ 'iTopUpdate:UI:SetupLaunchConfirm'|dict_s }}");
});