Fix issues

This commit is contained in:
Jose Gonzalez 2021-03-04 11:33:21 +01:00
parent e727f7c276
commit 6ee5b9c3e9
2 changed files with 39 additions and 61 deletions

View File

@ -417,35 +417,6 @@ echo '</form>';
canSubmit = val;
$submitButton.prop('disabled', !val);
}
var showSpinner = function () {
var $loadingSpinner = $pluginsSelect.siblings('img#loading_spinner');
if ($loadingSpinner.length > 0) {
// Display inline instead using the show function
// cause its absolute positioning.
$loadingSpinner.css('display', 'inline');
return;
}
$loadingSpinner = $('<img />');
$loadingSpinner
.prop('id', 'loading_spinner')
.css('padding-left', '5px')
.css('position', 'absolute')
.css('top', $pluginsSelect.position().top + 'px')
.prop('src', "<?php echo $config['homeurl'].'/'; ?>images/spinner.gif");
$pluginsSelect.parent().append($loadingSpinner);
}
var hideSpinner = function () {
var $loadingSpinner = $pluginsSelect.siblings('img#loading_spinner');
if ($loadingSpinner.length > 0)
$loadingSpinner.hide();
}
var clearModulePluginMacrosValues = function () {
$('input.plugin-macro')
@ -876,6 +847,7 @@ echo '</form>';
}
var errorHandler = function (error) {
hideSpinner();
console.log("<?php echo __('Error'); ?>: " + error.message);
// alert("<?php echo __('Error'); ?>: " + err.message);
@ -939,7 +911,10 @@ echo '</form>';
$agentModulesRow.show();
}
else {
alert("<?php echo __('There are no modules using this plugin'); ?>");
var contents = {};
contents.html = '<?php echo __('There are no modules using this plugin'); ?>';
contents.title = '<?php echo __('Massive operations'); ?>';
showMassiveModal(contents);
// Abort the another call
if (typeof pluginXHR !== 'undefined') {

View File

@ -4,37 +4,7 @@ function massiveOperationValidation(contents, totalCount, limit, thisForm) {
// If the amount of changes exceed the limit, the operation stops.
if (totalCount > limit) {
// Set the content.
$("#massive_modal")
.empty()
.html(contents.html);
// Set the title.
$("#massive_modal").prop("title", contents.title);
// Build the dialog for show the mesage.
$("#massive_modal").dialog({
resizable: true,
draggable: true,
modal: true,
width: 800,
buttons: [
{
text: "OK",
click: function() {
hideSpinner();
$(this).dialog("close");
return false;
}
}
],
overlay: {
opacity: 0.5,
background: "black"
},
closeOnEscape: false,
open: function(event, ui) {
$(".ui-dialog-titlebar-close").hide();
}
});
showMassiveModal(contents);
return false;
} else {
@ -58,6 +28,39 @@ function massiveOperationValidation(contents, totalCount, limit, thisForm) {
return output;
}
function showMassiveModal(contents) {
$("#massive_modal")
.empty()
.html(contents.html);
// Set the title.
$("#massive_modal").prop("title", contents.title);
// Build the dialog for show the mesage.
$("#massive_modal").dialog({
resizable: true,
draggable: true,
modal: true,
width: 800,
buttons: [
{
text: "OK",
click: function() {
hideSpinner();
$(this).dialog("close");
return false;
}
}
],
overlay: {
opacity: 0.5,
background: "black"
},
closeOnEscape: false,
open: function(event, ui) {
$(".ui-dialog-titlebar-close").hide();
}
});
}
/*
function showMassiveOperationMessage(message) {
$("#massive_modal")