fixed UX historical snapshot viewer

This commit is contained in:
fbsanchez 2018-10-30 16:12:48 +01:00
parent c06bd4207e
commit a58bde2118
2 changed files with 22 additions and 4 deletions

View File

@ -3947,8 +3947,14 @@ function ui_get_snapshot_link($params, $only_params = false) {
"id=" . $params['id_module'] .
"&label=" . rawurlencode(urlencode(io_safe_output($params['module_name']))).
"&id_node=" . $params['id_node'];
if ($params['timestamp'] != 0) $url .= "&timestamp=" . $parms['timestamp'];
if ($params['timestamp'] != 0) $url .= "&refr=" . $parms['interval'];
if ($params['timestamp'] != 0) {
$url .= "&timestamp=" . $params['timestamp'];
}
if ($params['interval'] != 0) {
$url .= "&refr=" . $params['interval'];
}
// Second parameter of js winopeng_var
$win_handle = dechex(crc32('snapshot_' . $params['id_module']));

View File

@ -50,11 +50,23 @@ if ($id_node > 0) {
}
}
$row_module = modules_get_agentmodule($id);
// Retrieve data
$utimestamp = get_parameter("timestamp", '');
if($utimestamp == '') {
// Retrieve last data
$row_state = db_get_row('tagente_estado', 'id_agente_modulo', $id);
$last_timestamp = $row_state['timestamp'];
} else {
// Retrieve target data
$state = db_get_row('tagente_estado', 'id_agente_modulo', $id, array('id_agente'));
$row_state = db_get_row_filter('tagente_datos_string', array('id_agente_modulo' => $id, 'utimestamp' => $utimestamp));
$row_state['id_agente'] = $state['id_agente'];
$last_timestamp = date("Y-m-d H:i:s", $row_state['utimestamp']);
}
// Build the info
$label = get_parameter ("label", io_safe_output($row_module['module_name']));
$last_timestamp = get_parameter("timestamp", $row_state['timestamp']);
$last_data = io_safe_output($row_state["datos"]);
$refresh = (int) get_parameter ("refr", $row_state['current_interval']);