Fixed module graph problems in visual console. Ticket#2825
This commit is contained in:
parent
7d6f03c3c8
commit
0dd0ae4b4c
|
@ -1221,14 +1221,12 @@ function set_image(type, idElement, image) {
|
|||
|
||||
function setModuleGraph(id_data) {
|
||||
var parameter = Array();
|
||||
|
||||
parameter.push ({name: "page",
|
||||
value: "include/ajax/visual_console_builder.ajax"});
|
||||
|
||||
parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"});
|
||||
parameter.push ({name: "action", value: "get_layout_data"});
|
||||
parameter.push ({name: "id_element", value: id_data});
|
||||
parameter.push ({name: "id_visual_console",
|
||||
value: id_visual_console});
|
||||
|
||||
parameter.push ({name: "id_visual_console", value: id_visual_console});
|
||||
|
||||
jQuery.ajax({
|
||||
url: get_url_ajax(),
|
||||
data: parameter,
|
||||
|
@ -1258,6 +1256,7 @@ function setModuleGraph(id_data) {
|
|||
if (is_metaconsole()) {
|
||||
parameter.push ({name: "id_metaconsole", value: id_metaconsole});
|
||||
}
|
||||
parameter.push ({name: "type", value: 'module_graph'});
|
||||
parameter.push ({name: "height", value: height});
|
||||
parameter.push ({name: "width", value: width});
|
||||
parameter.push ({name: "period", value: period});
|
||||
|
@ -1268,10 +1267,16 @@ function setModuleGraph(id_data) {
|
|||
url: get_url_ajax(),
|
||||
data: parameter,
|
||||
type: "POST",
|
||||
dataType: 'text', //The ajax return the data as text.
|
||||
dataType: 'json', //The ajax return the data as text.
|
||||
success: function (data)
|
||||
{
|
||||
$("#image_" + id_data).attr('src', data);
|
||||
console.log(data);
|
||||
if (data['no_data'] == true) {
|
||||
$('#' + id_data).html(data['url']);
|
||||
}
|
||||
else {
|
||||
$("#image_" + id_data).attr('src', data['url']);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -158,8 +158,8 @@ switch ($action) {
|
|||
}
|
||||
else {
|
||||
$img = grafico_modulo_sparse($id_agent_module,
|
||||
$period, false, $width, $height, '', null, false, 1,
|
||||
false, 0, '', 0, 0, true, true, '', 1, false, '',
|
||||
$period, 0, $width, $height, '', null, false, 1,
|
||||
false, 0, '', 0, 0, true, true, '', 1, false, '',
|
||||
false, false, true, $background_color);
|
||||
}
|
||||
|
||||
|
@ -167,11 +167,22 @@ switch ($action) {
|
|||
if (!empty($id_metaconsole)) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
|
||||
$data_image = array();
|
||||
preg_match("/src=[\'\"](.*)[\'\"]/", $img, $matches);
|
||||
$url = $matches[1];
|
||||
|
||||
echo $url;
|
||||
|
||||
if (empty($url) && ($type == 'module_graph')) {
|
||||
$data_image['url'] = $img;
|
||||
$data_image['no_data'] = true;
|
||||
$data_image['message'] = __('No data to show');
|
||||
}
|
||||
else{
|
||||
$data_image['url'] = $matches[1];
|
||||
$data_image['no_data'] = false;
|
||||
}
|
||||
|
||||
echo json_encode($data_image);
|
||||
break;
|
||||
|
||||
|
||||
|
|
|
@ -733,8 +733,9 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
if ($layoutData['id_metaconsole'] != 0) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
$img = str_replace('>', 'class="image" id="image_' . $id . '" />', $img);
|
||||
|
||||
//$img = str_replace('>', 'class="image" id="image_' . $id . '" />', $img);
|
||||
|
||||
break;
|
||||
case LABEL:
|
||||
$z_index = 4 + 1;
|
||||
|
|
Loading…
Reference in New Issue