Merge branch 'ent-5830-SNMP-Browser-Network-components-OID-info-and-Create-agent-modules' into 'develop'

Ent 5830 snmp browser network components oid info and create agent modules

See merge request artica/pandorafms!3249
This commit is contained in:
Daniel Rodriguez 2020-06-24 12:46:49 +02:00
commit 3c5a893c71
3 changed files with 65 additions and 14 deletions

View File

@ -113,6 +113,17 @@ if (is_ajax()) {
$output .= '</div>';
$output .= '</div>';
// Dialog no agent selected.
$output .= '<div id="dialog_no_agents_selected" style="display:none" title="'.__('SNMP modules').'">';
$output .= '<div>';
$output .= "<div style='width:25%; float:left'><img style='padding-left:20px; padding-top:20px;' src='images/icono_error_mr.png'></div>";
$output .= "<div style='width:75%; float:left;'><h3><strong style='font-family:Verdana; font-size:13pt;'>ERROR</strong></h3>";
$output .= "<p style='font-family:Verdana; font-size:12pt;margin-bottom: 0px'>".__('Module must be applied to an agent or a policy').'</p>';
$output .= "<p id='error_text' style='font-family:Verdana; font-size:12pt;'></p>";
$output .= '</div>';
$output .= '</div>';
$output .= '</div>';
echo $output;
}
@ -159,6 +170,11 @@ if (is_ajax()) {
$id_target = explode(',', $id_items[0]);
}
if (empty($id_items[0])) {
echo json_encode([0 => -1]);
exit;
}
$snmp_extradata = get_parameter('snmp_extradata', '');
if (!is_array($snmp_extradata)) {

View File

@ -625,6 +625,20 @@ function snmp_browser_create_modules(module_target, return_post = true) {
);
$("input[name=create_modules_" + module_target + "]").addClass("sub spinn");
$("#dialog_error").on("dialogclose", function(event) {
$("input[name=create_modules_" + module_target + "]").removeClass(
"sub spinn"
);
$("input[name=create_modules_" + module_target + "]").addClass("sub add");
});
$("#dialog_success").on("dialogclose", function(event) {
$("input[name=create_modules_" + module_target + "]").removeClass(
"sub spinn"
);
$("input[name=create_modules_" + module_target + "]").addClass("sub add");
});
$.ajax({
method: "post",
url: "ajax.php",

View File

@ -241,20 +241,41 @@ function snmp_show_result_message(data) {
if (dato.length !== 0) {
$("#error_text").text("");
dato.forEach(function (valor, indice, array) {
$("#error_text").append("<br/>" + valor);
});
$("#dialog_error").dialog({
resizable: true,
draggable: true,
modal: true,
height: 300,
width: 500,
overlay: {
opacity: 0.5,
background: "black"
}
});
if (dato[0] === -1) {
$("#dialog_no_agents_selected").dialog({
resizable: true,
draggable: true,
modal: true,
height: 300,
width: 500,
close: function(e, ui) {
$("input[name=create_modules_network_component]").removeClass("sub spinn");
$("input[name=create_modules_network_component]").addClass("sub add");
},
overlay: {
opacity: 0.5,
background: "black"
}
});
} else {
$("#error_text").text("");
dato.forEach(function (valor, indice, array) {
$("#error_text").append("<br/>" + valor);
});
$("#dialog_error").dialog({
resizable: true,
draggable: true,
modal: true,
height: 300,
width: 500,
overlay: {
opacity: 0.5,
background: "black"
}
});
}
} else {
$("#dialog_success").dialog({
resizable: true,