Merge branch 'ent-10281-descuadre-vista-snmp-console' into 'develop'

Ent 10281 descuadre vista snmp console

See merge request artica/pandorafms!5526
This commit is contained in:
daniel 2023-03-09 18:59:36 +00:00
commit 312efeaa1e
1 changed files with 144 additions and 113 deletions

View File

@ -947,14 +947,26 @@ class SnmpConsole extends HTML
).'</a> ';
}
$tmp->action .= '<a href="javascript: toggleVisibleExtendedInfo('.$tmp->id_trap.','.$count.');">'.html_print_image(
$tmp->action .= '<a id="eye_'.$tmp->id_trap.'" data-show="show"
href="javascript: toggleVisibleExtendedInfo('.$tmp->id_trap.','.$count.');">'.html_print_image(
'images/see-details@svg.svg',
true,
[
'id' => 'img_'.$tmp->id_trap,
'alt' => __('Show more'),
'title' => __('Show more'),
'class' => 'invert_filter main_menu_icon',
]
).' '.html_print_image(
'images/disable.svg',
true,
[
'id' => 'img_hide_'.$tmp->id_trap,
'alt' => __('Hide details'),
'title' => __('Hide details'),
'class' => 'invert_filter main_menu_icon',
'style' => 'display:none',
]
).'</a>';
if ($config['enterprise_installed']) {
@ -1380,6 +1392,16 @@ class SnmpConsole extends HTML
* Show more information
*/
function toggleVisibleExtendedInfo(id, position) {
// Show all "Show more"
$('[id^=img_]').each(function() {
$(this).show();
});
// Hide all "Hide details"
$('[id^=img_hide_]').each(function() {
$(this).hide();
});
var status = $('#eye_'+id).attr('data-show');
if(status == "show"){
$('tr[id^=show_]').remove()
$.ajax({
method: 'get',
@ -1442,21 +1464,21 @@ class SnmpConsole extends HTML
}
let labelType = '<td align="left" valign="top"><b><?php echo __('Type:'); ?></td>';
let variableType = `<td align="left">${desc_trap_type}</td>`;
let variableType = `<td align="left" colspan="8">${desc_trap_type}</td>`;
tr.after(`<tr id="show_" role="row">${labelType}${variableType}</tr>`);
// Description.
if (trap['description']) {
let labelDesc = '<td align="left" valign="top"><b><?php echo __('Description:'); ?></td>';
let variableDesc = `<td align="left">${trap['description']}</td>`;
let variableDesc = `<td align="left" colspan="8">${trap['description']}</td>`;
tr.after(`<tr id="show_" role="row">${labelDesc}${variableDesc}</tr>`);
}
// Enterprise String.
let labelOid = '<td align="left" valign="top"><b><?php echo __('Enterprise String:'); ?></td>';
let variableOId = `<td align="left">${trap['oid']}</td>`;
let variableOId = `<td align="left" colspan="8">${trap['oid']}</td>`;
tr.after(`<tr id="show_" role="row">${labelOid}${variableOId}</tr>`);
@ -1476,7 +1498,7 @@ class SnmpConsole extends HTML
const string = '<a href="'+new_url+'"><?php echo __('See more details'); ?></a>';
variableBindings = `<td align="left">${string}</td>`;
variableBindings = `<td align="left" colspan="8">${string}</td>`;
} else {
labelBindings = '<td align="left" valign="top" width="15%"><b><?php echo __('Variable bindings:'); ?></b></td>';
const binding_vars = trap['oid_custom'].split("\t");
@ -1484,7 +1506,7 @@ class SnmpConsole extends HTML
binding_vars.forEach(function(oid) {
string += oid+'<br/>';
});
variableBindings = `<td align="left">${string}</td>`;
variableBindings = `<td align="left" colspan="8">${string}</td>`;
}
tr.after(`<tr id="show_" role="row">${labelBindings}${variableBindings}</tr>`);
@ -1493,6 +1515,15 @@ class SnmpConsole extends HTML
console.error(e);
}
});
$('#eye_'+id).attr('data-show', 'hide');
$('#img_'+id).hide();
$('#img_hide_'+id).show();
} else{
$('tr[id^=show_]').remove();
$('#eye_'+id).attr('data-show', 'show');
$('#img_'+id).show();
$('#img_hide_'+id).hide();
}
}
$(document).ready(function() {