diff --git a/pandora_console/include/class/SnmpConsole.class.php b/pandora_console/include/class/SnmpConsole.class.php
index 9aae307bc5..4c9bf32d54 100644
--- a/pandora_console/include/class/SnmpConsole.class.php
+++ b/pandora_console/include/class/SnmpConsole.class.php
@@ -917,14 +917,25 @@ class SnmpConsole extends HTML
).' ';
}
- $tmp->action .= ''.html_print_image(
+ $tmp->action .= ''.html_print_image(
'images/eye.png',
true,
[
+ 'id' => 'img_'.$tmp->id_trap,
'alt' => __('Show more'),
'title' => __('Show more'),
'class' => 'invert_filter',
]
+ ).' '.html_print_image(
+ 'images/eye_hide.png',
+ true,
+ [
+ 'id' => 'img_hide_'.$tmp->id_trap,
+ 'alt' => __('Hide details'),
+ 'title' => __('Hide details'),
+ 'class' => 'invert_filter',
+ 'style' => 'display:none',
+ ]
).'';
$tmp->action .= ''.html_print_image('images/edit.png', true, ['alt' => __('SNMP trap editor'), 'title' => __('SNMP trap editor')]).'';
@@ -1337,119 +1348,138 @@ class SnmpConsole extends HTML
* Show more information
*/
function toggleVisibleExtendedInfo(id, position) {
- $('tr[id^=show_]').remove()
- $.ajax({
- method: 'get',
- url: '',
- data: {
- page: 'operation/snmpconsole/snmp_view',
- method: 'showInfo',
- id: id,
- group_by : $('#filter_group_by').val(),
- alert: $('#filter_alert').val(),
- severity: $('#filter_severity').val(),
- search: $('#text-filter_free_search').val(),
- status: $('#filter_status').val(),
- hours_ago: $('#text-filter_hours_ago').val(),
- trap_type: $('#filter_trap_type').val()
- },
- datatype: "json",
- success: function(data) {
- let trap = JSON.parse(data);
- var tr = $('#snmp_console tr').eq(position+1);
-
- // Count.
- if ($('#filter_group_by').val() == 1) {
- let labelCount = '
| ';
- let variableCount = `${trap['count']}${trap['first']}${trap['last']} | `;
-
- tr.after(`${labelCount}${variableCount}
`);
- }
-
- // Type.
- desc_trap_type = "";
- switch (trap['type']) {
- case -1:
- desc_trap_type = "";
- break;
-
- case 0:
- desc_trap_type = "";
- break;
-
- case 1:
- desc_trap_type = "";
- break;
-
- case 2:
- desc_trap_type = "";
- break;
-
- case 3:
- desc_trap_type = "";
- break;
-
- case 4:
- desc_trap_type = "";
- break;
-
- default:
- desc_trap_type = "";
- break;
- }
-
- let labelType = ' | ';
- let variableType = `${desc_trap_type} | `;
-
- tr.after(`${labelType}${variableType}
`);
-
- // Description.
- if (trap['description']) {
- let labelDesc = ' | ';
- let variableDesc = `${trap['description']} | `;
-
- tr.after(`${labelDesc}${variableDesc}
`);
- }
-
- // Enterprise String.
- let labelOid = ' | ';
- let variableOId = `${trap['oid']} | `;
-
- tr.after(`${labelOid}${variableOId}
`);
-
- // Variable bindings.
- let labelBindings = '';
- let variableBindings = '';
- if ($('#filter_group_by').val() == 1) {
- labelBindings = ' | ';
-
- let new_url = 'index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_view';
- new_url += '&filter_severity='+$('#filter_severity').val();
- new_url += '&filter_status='+$('#filter_status').val();
- new_url += '&filter_alert='+$('#filter_alert').val();
- new_url += '&filter_group_by=0&filter_free_search='+$('#text-filter_free_search').val();
- new_url += '&filter_hours_ago='+$('#text-filter_hours_ago').val();
- new_url += '&filter_trap_type='+$('#filter_trap_type').val();
-
- const string = '';
-
- variableBindings = `${string} | `;
- } else {
- labelBindings = ' | ';
- const binding_vars = trap['oid_custom'].split("\t");
- let string = '';
- binding_vars.forEach(function(oid) {
- string += oid+'
';
- });
- variableBindings = `${string} | `;
- }
-
- tr.after(`${labelBindings}${variableBindings}
`);
- },
- error: function(e) {
- console.error(e);
- }
+ // 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',
+ url: '',
+ data: {
+ page: 'operation/snmpconsole/snmp_view',
+ method: 'showInfo',
+ id: id,
+ group_by : $('#filter_group_by').val(),
+ alert: $('#filter_alert').val(),
+ severity: $('#filter_severity').val(),
+ search: $('#text-filter_free_search').val(),
+ status: $('#filter_status').val(),
+ hours_ago: $('#text-filter_hours_ago').val(),
+ trap_type: $('#filter_trap_type').val()
+ },
+ datatype: "json",
+ success: function(data) {
+ let trap = JSON.parse(data);
+ var tr = $('#snmp_console tr').eq(position+1);
+
+ // Count.
+ if ($('#filter_group_by').val() == 1) {
+ let labelCount = ' | ';
+ let variableCount = `${trap['count']}${trap['first']}${trap['last']} | `;
+
+ tr.after(`${labelCount}${variableCount}
`);
+ }
+
+ // Type.
+ desc_trap_type = "";
+ switch (trap['type']) {
+ case -1:
+ desc_trap_type = "";
+ break;
+
+ case 0:
+ desc_trap_type = "";
+ break;
+
+ case 1:
+ desc_trap_type = "";
+ break;
+
+ case 2:
+ desc_trap_type = "";
+ break;
+
+ case 3:
+ desc_trap_type = "";
+ break;
+
+ case 4:
+ desc_trap_type = "";
+ break;
+
+ default:
+ desc_trap_type = "";
+ break;
+ }
+
+ let labelType = ' | ';
+ let variableType = `${desc_trap_type} | `;
+
+ tr.after(`${labelType}${variableType}
`);
+
+ // Description.
+ if (trap['description']) {
+ let labelDesc = ' | ';
+ let variableDesc = `${trap['description']} | `;
+
+ tr.after(`${labelDesc}${variableDesc}
`);
+ }
+
+ // Enterprise String.
+ let labelOid = ' | ';
+ let variableOId = `${trap['oid']} | `;
+
+ tr.after(`${labelOid}${variableOId}
`);
+
+ // Variable bindings.
+ let labelBindings = '';
+ let variableBindings = '';
+ if ($('#filter_group_by').val() == 1) {
+ labelBindings = ' | ';
+
+ let new_url = 'index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_view';
+ new_url += '&filter_severity='+$('#filter_severity').val();
+ new_url += '&filter_status='+$('#filter_status').val();
+ new_url += '&filter_alert='+$('#filter_alert').val();
+ new_url += '&filter_group_by=0&filter_free_search='+$('#text-filter_free_search').val();
+ new_url += '&filter_hours_ago='+$('#text-filter_hours_ago').val();
+ new_url += '&filter_trap_type='+$('#filter_trap_type').val();
+
+ const string = '';
+
+ variableBindings = `${string} | `;
+ } else {
+ labelBindings = ' | ';
+ const binding_vars = trap['oid_custom'].split("\t");
+ let string = '';
+ binding_vars.forEach(function(oid) {
+ string += oid+'
';
+ });
+ variableBindings = `${string} | `;
+ }
+
+ tr.after(`${labelBindings}${variableBindings}
`);
+ },
+ error: function(e) {
+ 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() {