Fixed issue with instructions in events view
This commit is contained in:
parent
0418c86867
commit
4ae14e0888
|
@ -6634,3 +6634,50 @@ function events_get_secondary_groups_left_join($table)
|
|||
return 'LEFT JOIN tmetaconsole_agent_secondary_group tasg
|
||||
ON te.id_agente = tasg.id_tagente AND te.server_id = tasg.id_tmetaconsole_setup';
|
||||
}
|
||||
|
||||
|
||||
function events_get_instructions($event)
|
||||
{
|
||||
if (!is_array($event)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
switch ($event['event_type']) {
|
||||
case 'going_unknown':
|
||||
if ($event['unknown_instructions'] != '') {
|
||||
$value = str_replace("\n", '<br>', io_safe_output($event['unknown_instructions']));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'going_up_warning':
|
||||
case 'going_down_warning':
|
||||
if ($event['warning_instructions'] != '') {
|
||||
$value = str_replace("\n", '<br>', io_safe_output($event['warning_instructions']));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'going_up_critical':
|
||||
case 'going_down_critical':
|
||||
if ($event['critical_instructions'] != '') {
|
||||
$value = str_replace("\n", '<br>', io_safe_output($event['critical_instructions']));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!isset($value)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$output = '<div id="hidden_event_instructions_'.$event['id_evento'].'"';
|
||||
$output .= ' style="display: none; width: 100%; height: 100%; overflow: auto; padding: 10px; font-size: 14px; line-height: 16px; font-family: mono,monospace; text-align: left">';
|
||||
$output .= $value;
|
||||
$output .= '</div>';
|
||||
$output .= '<center>';
|
||||
$output .= '<span id="value_event_'.$event['id_evento'].'" style="white-space: nowrap;">';
|
||||
$output .= '<span id="value_event_text_'.$event['id_evento'].'"></span>';
|
||||
$output .= '<a href="javascript:show_instructions('.$event['id_evento'].')">';
|
||||
$output .= html_print_image('images/default_list.png', true).'</a></span>';
|
||||
$output .= '</center>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
|
|
@ -309,6 +309,8 @@ if (is_ajax()) {
|
|||
|
||||
$tmp->data = format_numeric($tmp->data, 1);
|
||||
|
||||
$tmp->instructions = events_get_instructions($item);
|
||||
|
||||
$tmp->b64 = base64_encode(json_encode($tmp));
|
||||
|
||||
$carry[] = $tmp;
|
||||
|
@ -2371,5 +2373,12 @@ function datetime_picker_callback() {
|
|||
|
||||
datetime_picker_callback();
|
||||
|
||||
function show_instructions(id){
|
||||
title = "<?php echo __('Instructions'); ?>";
|
||||
$('#hidden_event_instructions_' + id).dialog({
|
||||
title: title,
|
||||
width: 600
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue