Merge branch 'ent-2997-color-cloud-vc-items' into 'develop'
Error fixes and metaconsole support for the color cloud item of the VC See merge request artica/pandorafms!2082 Former-commit-id: 445dbc16ce84f22ffb1d379c8539b7ec35c9e478
This commit is contained in:
commit
6839559eb5
|
@ -653,9 +653,6 @@ function update_button_palette_callback() {
|
||||||
var image = values['image'] + ".png";
|
var image = values['image'] + ".png";
|
||||||
set_image("image", idItem, image);
|
set_image("image", idItem, image);
|
||||||
break;
|
break;
|
||||||
case "color_cloud":
|
|
||||||
setColorCloud(id_visual_console, idItem);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
if($('input[name=width]').val() == ''){
|
if($('input[name=width]').val() == ''){
|
||||||
alert('Undefined width');
|
alert('Undefined width');
|
||||||
|
@ -2782,7 +2779,7 @@ function setColorCloud (visualConsoleId, dataId, $container) {
|
||||||
$container = $container || $("#" + dataId + ".item.color_cloud");
|
$container = $container || $("#" + dataId + ".item.color_cloud");
|
||||||
if ($container.length === 0) return;
|
if ($container.length === 0) return;
|
||||||
|
|
||||||
var $spinner = $container.find("#image_" + dataId);
|
var $spinner = $container.children("img");
|
||||||
var $svg = $container.children("svg");
|
var $svg = $container.children("svg");
|
||||||
|
|
||||||
if ($svg.length === 0) {
|
if ($svg.length === 0) {
|
||||||
|
@ -3929,10 +3926,11 @@ function updateDB_visual(type, idElement , values, event, top, left) {
|
||||||
case 'color_cloud':
|
case 'color_cloud':
|
||||||
var diameter = values["diameter"];
|
var diameter = values["diameter"];
|
||||||
var $container = $("#" + idElement + ".item.color_cloud");
|
var $container = $("#" + idElement + ".item.color_cloud");
|
||||||
$container
|
if ($container.children("img").length === 0) {
|
||||||
.children("svg")
|
$container.append(
|
||||||
.attr("width", diameter)
|
'<img id="image_' + idElement + '" class="image" src="images/spinner.gif" width="' + diameter + '" height="' + diameter + '" />'
|
||||||
.attr("height", diameter);
|
);
|
||||||
|
}
|
||||||
setColorCloud(id_visual_console, idElement, $container);
|
setColorCloud(id_visual_console, idElement, $container);
|
||||||
break;
|
break;
|
||||||
case 'background':
|
case 'background':
|
||||||
|
@ -5400,7 +5398,10 @@ function getColorRangeTable ($colorRangeCreationTable, values) {
|
||||||
// Change img
|
// Change img
|
||||||
$colorRangeAddImg = $colorRangeAddBtn.children("img");
|
$colorRangeAddImg = $colorRangeAddBtn.children("img");
|
||||||
if ($colorRangeAddImg.length > 0) {
|
if ($colorRangeAddImg.length > 0) {
|
||||||
$colorRangeAddImg.prop("src", "images/delete.png");
|
var src = $("#hidden-metaconsole").val() == 1
|
||||||
|
? "../../images/delete.png"
|
||||||
|
: "images/delete.png";
|
||||||
|
$colorRangeAddImg.prop("src", src);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4071,8 +4071,21 @@ function visual_map_get_color_cloud_element ($data) {
|
||||||
!empty($dynamic_fields["color_ranges"]) &&
|
!empty($dynamic_fields["color_ranges"]) &&
|
||||||
!empty($data["id_agente_modulo"])
|
!empty($data["id_agente_modulo"])
|
||||||
) {
|
) {
|
||||||
// TODO: Metaconsole support.
|
$node_id = null;
|
||||||
$value = modules_get_last_value($data["id_agente_modulo"]);
|
$node_connected = false;
|
||||||
|
// Connect to node
|
||||||
|
if (is_metaconsole() && !empty($data["id_metaconsole"])) {
|
||||||
|
$node_id = (int) $data["id_metaconsole"];
|
||||||
|
if (metaconsole_connect(null, $node_id) === NOERR) $node_connected = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fetch module value
|
||||||
|
$value = (!$node_id || ($node_id && $node_connected))
|
||||||
|
? modules_get_last_value($data["id_agente_modulo"])
|
||||||
|
: false;
|
||||||
|
|
||||||
|
// Restore connection
|
||||||
|
if ($node_connected) metaconsole_restore_db();
|
||||||
|
|
||||||
if ($value !== false) {
|
if ($value !== false) {
|
||||||
/* TODO: It would be ok to give support to string values in the future?
|
/* TODO: It would be ok to give support to string values in the future?
|
||||||
|
|
|
@ -612,10 +612,14 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
||||||
"</td>";
|
"</td>";
|
||||||
|
|
||||||
// Color ranges
|
// Color ranges
|
||||||
|
$color_range_tip = __("TODO");
|
||||||
$form_items["color_cloud_color_ranges_row"] = array();
|
$form_items["color_cloud_color_ranges_row"] = array();
|
||||||
$form_items["color_cloud_color_ranges_row"]["items"] = array("color_cloud");
|
$form_items["color_cloud_color_ranges_row"]["items"] = array("color_cloud");
|
||||||
$form_items["color_cloud_color_ranges_row"]["html"] =
|
$form_items["color_cloud_color_ranges_row"]["html"] =
|
||||||
"<td align=\"left\">" . __("Color ranges") . "</td>" .
|
"<td align=\"left\">" .
|
||||||
|
__("Ranges") .
|
||||||
|
ui_print_help_tip($color_range_tip, true) .
|
||||||
|
"</td>" .
|
||||||
"<td align=\"left\">" .
|
"<td align=\"left\">" .
|
||||||
"<table id=\"new-color-range\" class=\"databox color-range color-range-creation\">" .
|
"<table id=\"new-color-range\" class=\"databox color-range color-range-creation\">" .
|
||||||
"<tr>" .
|
"<tr>" .
|
||||||
|
@ -817,6 +821,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
||||||
var $mapLinkedSelect = $("select#map_linked");
|
var $mapLinkedSelect = $("select#map_linked");
|
||||||
var $linkedMapNodeIDInput = $("input#hidden-linked_map_node_id");
|
var $linkedMapNodeIDInput = $("input#hidden-linked_map_node_id");
|
||||||
var visualMaps = <?php echo json_encode($visual_maps); ?>;
|
var visualMaps = <?php echo json_encode($visual_maps); ?>;
|
||||||
|
if (!(visualMaps instanceof Array)) visualMaps = [];
|
||||||
var nodesById = <?php echo json_encode($meta_servers_by_id); ?>;
|
var nodesById = <?php echo json_encode($meta_servers_by_id); ?>;
|
||||||
|
|
||||||
visualMaps.forEach(function (vMap) {
|
visualMaps.forEach(function (vMap) {
|
||||||
|
|
Loading…
Reference in New Issue