From 22973e9f1299098ab674431139a52a3cb7ad6e41 Mon Sep 17 00:00:00 2001 From: enriquecd Date: Wed, 26 Oct 2016 18:39:41 +0200 Subject: [PATCH] New function pandora ux, let open pics from base64 image modules #90 --- pandora_console/include/ajax/module.php | 16 +++++---- .../include/javascript/tree/TreeController.js | 28 ++++++++++++++-- .../operation/agentes/status_monitor.php | 33 +++++++++++++++++-- 3 files changed, 64 insertions(+), 13 deletions(-) diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php index 969ec1177d..636334017d 100755 --- a/pandora_console/include/ajax/module.php +++ b/pandora_console/include/ajax/module.php @@ -177,7 +177,7 @@ if ($get_module_detail) { "Data" => array( "data", "modules_format_data", - "align" => "left", + "align" => "center", "width" => "230px"), ); @@ -185,14 +185,14 @@ if ($get_module_detail) { $columns["Time"] = array( "utimestamp", "modules_format_time", - "align" => "left", + "align" => "center", "width" => "50px"); } else { $columns["Timestamp"] = array( "utimestamp", "modules_format_timestamp", - "align" => "left", + "align" => "center", "width" => "50px"); } @@ -249,7 +249,7 @@ if ($get_module_detail) { foreach ($columns as $col => $attr) { if ($attr[1] != "modules_format_data") { - $data[] = $attr[1] ($row[$attr[0]]); + $data[] = date('d F Y - h:i:s A', $row['utimestamp']); } elseif (($config['command_snapshot']) && (preg_match ("/[\n]+/i", $row[$attr[0]]))) { @@ -303,7 +303,7 @@ if ($get_module_detail) { $data[] = 'No data'; } else { - $data[] = io_safe_input($row[$attr[0]]); + $data[] = ""; } } } @@ -990,8 +990,10 @@ if ($list_modules) { base64_encode($module["nombre"]))) . "&" . "refresh=" . SECONDS_10MINUTES . "&" . "draw_events=$draw_events', 'day_".$win_handle."')"; - + +if(!is_snapshot_data($module['datos'])){ $data[8] .= '' . html_print_image("images/chart_curve.png", true, array("border" => '0', "alt" => "")) . '   '; + } $server_name = ''; $data[8] .= "". html_print_image ("images/binary.png", true, array ("border" => "0", "alt" => "")) . ""; } - + if ($module['estado'] == 3) { $data[9] = ''; } diff --git a/pandora_console/include/javascript/tree/TreeController.js b/pandora_console/include/javascript/tree/TreeController.js index ef4b10bd1f..05ca835239 100644 --- a/pandora_console/include/javascript/tree/TreeController.js +++ b/pandora_console/include/javascript/tree/TreeController.js @@ -393,19 +393,41 @@ var TreeController = { if (typeof element.showGraphs != 'undefined' && element.showGraphs != 0) { // Graph pop-up if (typeof element.moduleGraph != 'undefined') { + + if(element.statusImageHTML.indexOf('data:image')!=-1){ var $graphImage = $(' '); + +'images/photo.png" /> '); + } + else{ + + var $graphImage = $(' '); + } + $graphImage .addClass('module-graph') .click(function (e) { e.preventDefault(); - + if(element.statusImageHTML.indexOf('data:image')!=-1){ try { - winopeng(element.moduleGraph.url, element.moduleGraph.handle); + winopeng('operation/agentes/snapshot_view.php?id='+element.id+'&refr=&label='+element.name); } catch (error) { // console.log(error); } + } + else{ + + try { + + winopeng(element.moduleGraph.url, element.moduleGraph.handle); + } + catch (error) { + // console.log(error); + } + + + } }); $content.append($graphImage); diff --git a/pandora_console/operation/agentes/status_monitor.php b/pandora_console/operation/agentes/status_monitor.php index 66a8824c40..e307753156 100644 --- a/pandora_console/operation/agentes/status_monitor.php +++ b/pandora_console/operation/agentes/status_monitor.php @@ -1245,8 +1245,12 @@ if (!empty($result)) { $link = 'winopeng(\''.$url.'?'.$graph_params_str.'\',\''.$win_handle.'\')'; - $data[7] = '' . html_print_image('images/chart_curve.png', true, array('border' => '0', 'alt' => '')) . ''; + $data[7] = ''; + if(!is_snapshot_data($row['datos'])){ + + $data[7] = '' . html_print_image('images/chart_curve.png', true, array('border' => '0', 'alt' => '')) . ''; + } $data[7] .= '' . html_print_image('images/default_list.png', true, array('border' => '0', 'alt' => '', 'title' => __('Snapshot view'))) . '   '; + }else{ + $salida = '' . + html_print_image('images/photo.png', true, + array('border' => '0', + 'alt' => '', + 'title' => __('Snapshot view'))) . '   '; + } } else { @@ -1468,11 +1479,27 @@ $('#moduletype').click(function(){ period = ; } } + + var server_name = ''; + var extra_parameters = ''; + if ($('input[name=selection_mode]:checked').val()) { + + period = $('#period').val(); + + var selection_mode = $('input[name=selection_mode]:checked').val(); + var date_from = $('#text-date_from').val(); + var time_from = $('#text-time_from').val(); + var date_to = $('#text-date_to').val(); + var time_to = $('#text-time_to').val(); + + extra_parameters = '&selection_mode=' + selection_mode + '&date_from=' + date_from + '&date_to=' + date_to + '&time_from=' + time_from + '&time_to=' + time_to; + + } title = ; $.ajax({ type: "POST", url: "", - data: "page=include/ajax/module&get_module_detail=1&server_name="+server_name+"&id_agent="+id_agent+"&id_module=" + module_id+"&offset="+offset+"&period="+period, + data: "page=include/ajax/module&get_module_detail=1&server_name="+server_name+"&id_agent="+id_agent+"&id_module=" + module_id+"&offset="+offset+"&period="+period + extra_parameters, dataType: "html", success: function(data) { $("#monitor_details_window").hide ()