mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
Added active filters to snmp console
This commit is contained in:
parent
6e8ef54bec
commit
e6efe5825b
@ -279,4 +279,111 @@ function snmp_update_translation($oid, $new_oid, $description, $post_process) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Print the event filter tag cloud (enterprise feature)
|
||||||
|
* @param $filter_resume: Array with the active filters
|
||||||
|
* @param $filter_refs: Array of all arrays to humanize some tags
|
||||||
|
*/
|
||||||
|
function print_snmp_tags_active_filters ($filter_resume = array()) {
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
$tags_set = array();
|
||||||
|
|
||||||
|
// Alert
|
||||||
|
if (isset($filter_resume['filter_fired'])) {
|
||||||
|
array_push ($tags_set, array(
|
||||||
|
'title' => __('Alert'),
|
||||||
|
'value' => $filter_resume['filter_fired']
|
||||||
|
));
|
||||||
|
}
|
||||||
|
// Severity
|
||||||
|
if (isset($filter_resume['filter_severity'])) {
|
||||||
|
array_push ($tags_set, array(
|
||||||
|
'title' => __('Severity'),
|
||||||
|
'value' => $filter_resume['filter_severity']
|
||||||
|
));
|
||||||
|
}
|
||||||
|
// Pagination
|
||||||
|
if ($filter_resume['pagination'] == "") {
|
||||||
|
$filter_resume['pagination'] = $config["block_size"];
|
||||||
|
}
|
||||||
|
array_push ($tags_set, array(
|
||||||
|
'title' => __('Pagination'),
|
||||||
|
'value' => $filter_resume['pagination']
|
||||||
|
));
|
||||||
|
// Free search
|
||||||
|
if (isset($filter_resume['free_search_string']) && $filter_resume['free_search_string'] != "") {
|
||||||
|
array_push ($tags_set, array(
|
||||||
|
'title' => __('Search'),
|
||||||
|
'value' => $filter_resume['free_search_string']
|
||||||
|
));
|
||||||
|
}
|
||||||
|
// Status
|
||||||
|
if (isset($filter_resume['filter_status']) && $filter_resume['filter_status'] != "") {
|
||||||
|
array_push ($tags_set, array(
|
||||||
|
'title' => __('Status'),
|
||||||
|
'value' => $filter_resume['filter_status']
|
||||||
|
));
|
||||||
|
}
|
||||||
|
// Group by
|
||||||
|
if (isset($filter_resume['group_by'])) {
|
||||||
|
if ($filter_resume['group_by'] == 0) {
|
||||||
|
array_push ($tags_set, array(
|
||||||
|
'title' => __('Group by Enterprise String / IP'),
|
||||||
|
'value' => __('No')
|
||||||
|
));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
array_push ($tags_set, array(
|
||||||
|
'title' => __('Group by Enterprise String / IP'),
|
||||||
|
'value' => __('Yes')
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Date from
|
||||||
|
if (isset($filter_resume['date_from_trap']) && $filter_resume['date_from_trap'] != "") {
|
||||||
|
if (isset($filter_resume['time_from_trap']) && $filter_resume['time_from_trap'] != "") {
|
||||||
|
array_push ($tags_set, array(
|
||||||
|
'title' => __('From'),
|
||||||
|
'value' => $filter_resume['date_from_trap'] . " " . $filter_resume['time_from_trap']
|
||||||
|
));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
array_push ($tags_set, array(
|
||||||
|
'title' => __('From'),
|
||||||
|
'value' => $filter_resume['date_from_trap']
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Date to
|
||||||
|
if (isset($filter_resume['date_to_trap']) && $filter_resume['date_to_trap'] != "") {
|
||||||
|
if (isset($filter_resume['time_to_trap']) && $filter_resume['time_to_trap'] != "") {
|
||||||
|
array_push ($tags_set, array(
|
||||||
|
'title' => __('To'),
|
||||||
|
'value' => $filter_resume['date_to_trap'] . " " . $filter_resume['time_to_trap']
|
||||||
|
));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
array_push ($tags_set, array(
|
||||||
|
'title' => __('To'),
|
||||||
|
'value' => $filter_resume['date_to_trap']
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Trap type
|
||||||
|
if (isset($filter_resume['trap_type'])) {
|
||||||
|
array_push ($tags_set, array(
|
||||||
|
'title' => __('Trap type'),
|
||||||
|
'value' => $filter_resume['trap_type']
|
||||||
|
));
|
||||||
|
}
|
||||||
|
$title = '';
|
||||||
|
if(!$config['pure']){
|
||||||
|
$title = isset($filter_resume['title'])
|
||||||
|
? __('Active filter') . " (" . $filter_resume['title'] . ")"
|
||||||
|
: __('Active filters');
|
||||||
|
}
|
||||||
|
if (sizeof($filter_resume) > 0) ui_print_tags_view($title, $tags_set);
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -518,15 +518,22 @@ $filter .= html_print_submit_button(__('Update'), 'search', false, 'class="sub u
|
|||||||
$filter .= '</div>';
|
$filter .= '</div>';
|
||||||
$filter .= '</form>';
|
$filter .= '</form>';
|
||||||
|
|
||||||
|
$filter_resume = array();
|
||||||
|
$filter_resume['filter_fired'] = $alerted[$filter_fired];
|
||||||
|
$filter_resume['filter_severity'] = $severities[$filter_severity];
|
||||||
|
$filter_resume['pagination'] = $paginations[$pagination];
|
||||||
|
$filter_resume['free_search_string'] = $free_search_string;
|
||||||
|
$filter_resume['filter_status'] = $status_array[$filter_status];
|
||||||
|
$filter_resume['group_by'] = $group_by;
|
||||||
|
$filter_resume['date_from_trap'] = $date_from_trap;
|
||||||
|
$filter_resume['time_from_trap'] = $time_from_trap;
|
||||||
|
$filter_resume['date_to_trap'] = $date_to_trap;
|
||||||
|
$filter_resume['time_to_trap'] = $time_to_trap;
|
||||||
|
$filter_resume['trap_type'] = $trap_types[$trap_type];
|
||||||
|
|
||||||
$traps = db_get_all_rows_sql($sql);
|
$traps = db_get_all_rows_sql($sql);
|
||||||
$trapcount = (int) db_get_value_sql($sql_count);
|
$trapcount = (int) db_get_value_sql($sql_count);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// No traps
|
// No traps
|
||||||
if (empty ($traps)) {
|
if (empty ($traps)) {
|
||||||
// Header
|
// Header
|
||||||
@ -546,6 +553,9 @@ if (empty ($traps)) {
|
|||||||
|
|
||||||
if(!empty ($traps2)){
|
if(!empty ($traps2)){
|
||||||
ui_toggle($filter, __('Toggle filter(s)'));
|
ui_toggle($filter, __('Toggle filter(s)'));
|
||||||
|
|
||||||
|
print_snmp_tags_active_filters($filter_resume);
|
||||||
|
|
||||||
ui_print_info_message ( array('no_close'=>true, 'message'=> __('There are no SNMP traps in database that contains this filter') ) );
|
ui_print_info_message ( array('no_close'=>true, 'message'=> __('There are no SNMP traps in database that contains this filter') ) );
|
||||||
} else {
|
} else {
|
||||||
ui_print_info_message ( array('no_close'=>true, 'message'=> __('There are no SNMP traps in database') ) );
|
ui_print_info_message ( array('no_close'=>true, 'message'=> __('There are no SNMP traps in database') ) );
|
||||||
@ -651,6 +661,8 @@ if (empty ($traps)) {
|
|||||||
ui_toggle($filter, __('Toggle filter(s)'));
|
ui_toggle($filter, __('Toggle filter(s)'));
|
||||||
unset ($table);
|
unset ($table);
|
||||||
|
|
||||||
|
print_snmp_tags_active_filters($filter_resume);
|
||||||
|
|
||||||
if (($config['dbtype'] == 'oracle') && ($traps !== false)) {
|
if (($config['dbtype'] == 'oracle') && ($traps !== false)) {
|
||||||
for ($i = 0; $i < count($traps); $i++) {
|
for ($i = 0; $i < count($traps); $i++) {
|
||||||
unset($traps[$i]['rnum']);
|
unset($traps[$i]['rnum']);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user