diff --git a/pandora_console/extras/mr/21.sql b/pandora_console/extras/mr/21.sql
new file mode 100644
index 0000000000..e2144016ce
--- /dev/null
+++ b/pandora_console/extras/mr/21.sql
@@ -0,0 +1,5 @@
+START TRANSACTION;
+
+ALTER TABLE tlayout_data ADD COLUMN `show_last_value` tinyint(1) UNSIGNED NULL default '0';
+
+COMMIT;
diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql
index 29c5bb4f8b..ea21ccab03 100644
--- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql
+++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql
@@ -1294,6 +1294,7 @@ ALTER TABLE tlayout_data ADD COLUMN `show_on_top` tinyint(1) NOT NULL default '0
ALTER TABLE tlayout_data ADD COLUMN `clock_animation` varchar(60) NOT NULL default "analogic_1";
ALTER TABLE tlayout_data ADD COLUMN `time_format` varchar(60) NOT NULL default "time";
ALTER TABLE tlayout_data ADD COLUMN `timezone` varchar(60) NOT NULL default "Europe/Madrid";
+ALTER TABLE tlayout_data ADD COLUMN `show_last_value` tinyint(1) UNSIGNED NULL default '0';
-- ---------------------------------------------------------------------
-- Table `tagent_custom_fields`
diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js
index d32b15e1aa..8d92642f52 100755
--- a/pandora_console/godmode/reporting/visual_console_builder.editor.js
+++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js
@@ -870,6 +870,7 @@ function readFields() {
values['time_format'] = $("select[name=time_format]").val();
values['timezone'] = $("select[name=timezone]").val();
values['clock_animation'] = $("select[name=clock_animation]").val();
+ values['show_last_value'] = $("select[name=last_value]").val();
if (is_metaconsole()) {
values['metaconsole'] = 1;
@@ -1380,7 +1381,6 @@ function loadFieldsFromDB(item) {
}
});
-
parameter = Array();
parameter.push ({name: "page",
value: "include/ajax/visual_console_builder.ajax"});
@@ -1459,26 +1459,26 @@ function loadFieldsFromDB(item) {
$("select[name=type_graph]").val(val);
}
- if (key == 'label_position') {
- if($("#hidden-metaconsole").val() == 1){
- $('#labelposup'+" img").attr('src','../../images/label_up.png');
- $('#labelposdown'+" img").attr('src','../../images/label_down.png');
- $('#labelposleft'+" img").attr('src','../../images/label_left.png');
- $('#labelposright'+" img").attr('src','../../images/label_right.png');
- $('.labelpos').attr('sel','no');
- $('#labelpos'+val+" img").attr('src','../../images/label_'+$('#labelpos'+val).attr('id').replace('labelpos','')+'_2.png');
- $('#labelpos'+val).attr('sel','yes');
- }
- else{
- $('#labelposup'+" img").attr('src','images/label_up.png');
- $('#labelposdown'+" img").attr('src','images/label_down.png');
- $('#labelposleft'+" img").attr('src','images/label_left.png');
- $('#labelposright'+" img").attr('src','images/label_right.png');
- $('.labelpos').attr('sel','no');
- $('#labelpos'+val+" img").attr('src','images/label_'+$('#labelpos'+val).attr('id').replace('labelpos','')+'_2.png');
- $('#labelpos'+val).attr('sel','yes');
- }
+ if (key == 'label_position') {
+ if($("#hidden-metaconsole").val() == 1){
+ $('#labelposup'+" img").attr('src','../../images/label_up.png');
+ $('#labelposdown'+" img").attr('src','../../images/label_down.png');
+ $('#labelposleft'+" img").attr('src','../../images/label_left.png');
+ $('#labelposright'+" img").attr('src','../../images/label_right.png');
+ $('.labelpos').attr('sel','no');
+ $('#labelpos'+val+" img").attr('src','../../images/label_'+$('#labelpos'+val).attr('id').replace('labelpos','')+'_2.png');
+ $('#labelpos'+val).attr('sel','yes');
}
+ else{
+ $('#labelposup'+" img").attr('src','images/label_up.png');
+ $('#labelposdown'+" img").attr('src','images/label_down.png');
+ $('#labelposleft'+" img").attr('src','images/label_left.png');
+ $('#labelposright'+" img").attr('src','images/label_right.png');
+ $('.labelpos').attr('sel','no');
+ $('#labelpos'+val+" img").attr('src','images/label_'+$('#labelpos'+val).attr('id').replace('labelpos','')+'_2.png');
+ $('#labelpos'+val).attr('sel','yes');
+ }
+ }
if (key == 'image') {
//Load image preview
@@ -1590,6 +1590,10 @@ function loadFieldsFromDB(item) {
.css('background-color', val);
}
+ if (key == 'show_last_value') {
+ $("select[name=last_value]").val(val);
+ }
+
if (key == 'clock_animation')
$("select[name=clock_animation]").val(val);
if (key == 'time_format')
@@ -1852,6 +1856,9 @@ function hiddenFields(item) {
$("#percentile_bar_row_2").css('display', 'none');
$("#percentile_bar_row_2." + item).css('display', '');
+
+ $("#show_last_value_row").css('display', 'none');
+ $("#show_last_value_row." + item).css('display', '');
$("#percentile_item_row_3").css('display', 'none');
$("#percentile_item_row_3." + item).css('display', '');
diff --git a/pandora_console/include/ajax/visual_console_builder.ajax.php b/pandora_console/include/ajax/visual_console_builder.ajax.php
index 98be4f174b..92a77974e7 100755
--- a/pandora_console/include/ajax/visual_console_builder.ajax.php
+++ b/pandora_console/include/ajax/visual_console_builder.ajax.php
@@ -164,6 +164,8 @@ $clock_animation = get_parameter('clock_animation', 'analogic_1');
$time_format = get_parameter('time_format', 'time');
$timezone = get_parameter('timezone', 'Europe/Madrid');
+$show_last_value = get_parameter('show_last_value', null);
+
switch ($action) {
case 'get_font':
$return = array();
@@ -785,6 +787,9 @@ switch ($action) {
if ($height !== null) {
$values['height'] = $height;
}
+ if ($show_last_value !== null) {
+ $values['show_last_value'] = $show_last_value;
+ }
break;
case 'simple_value':
if ($action == 'update') {
@@ -1281,6 +1286,7 @@ switch ($action) {
$values['image'] = $image;
$values['width'] = $width;
$values['height'] = $height;
+ $values['show_last_value'] = $show_last_value;
break;
case 'group_item':
$values['type'] = GROUP_ITEM;
diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php
index 71cf0e6047..e8cc2cb4c4 100755
--- a/pandora_console/include/functions_visual_map.php
+++ b/pandora_console/include/functions_visual_map.php
@@ -1775,16 +1775,25 @@ function visual_map_print_item($mode = "read", $layoutData,
$value = format_for_graph($value, 2);
}
- if (!empty($unit_text))
- $value .= " " . $unit_text;
-
// Hide value on boolean modules
- if (!modules_is_boolean($layoutData['id_agente_modulo'])) {
- $img_style_title .=
- "
" . __("Last value: ")
- . remove_right_zeros(number_format($value, $config['graph_precision'])).$unit_text;
+ if ($layoutData['show_last_value'] != 2) {
+ if ((!modules_is_boolean($layoutData['id_agente_modulo'])) ||
+ (modules_is_boolean($layoutData['id_agente_modulo']) && $layoutData['show_last_value'] != 0)){
+ if (is_numeric($value)) {
+ $img_style_title .=
+ "
" . __("Last value: ")
+ . remove_right_zeros(number_format($value, $config['graph_precision']));
+ } else {
+ $img_style_title .=
+ "
" . __("Last value: ")
+ . $value;
+ }
+ }
}
+ if (!empty($unit_text))
+ $img_style_title .= " " . $unit_text;
+
if ($layoutData['id_metaconsole'] != 0) {
//Restore db connection
metaconsole_restore_db();
@@ -1792,7 +1801,7 @@ function visual_map_print_item($mode = "read", $layoutData,
}
if(get_parameter('action') == 'edit'){
- $img_style_title = '';
+ $img_style_title = '';
}
}
diff --git a/pandora_console/include/functions_visual_map_editor.php b/pandora_console/include/functions_visual_map_editor.php
index a20a8c5e42..8bc8665a9d 100755
--- a/pandora_console/include/functions_visual_map_editor.php
+++ b/pandora_console/include/functions_visual_map_editor.php
@@ -590,6 +590,15 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {