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