QSO Panel: CAT Timeout Warning Message #310

This adds a warning that Cloudlogs not received any recent data from CAT Interface this timeout is defined in the cloudlog.php configuration file

$config['cat_timeout_interval'] = 1800;

The default has been changed to 30mins.
pull/500/head
Peter Goodhall 2020-05-12 22:51:56 +01:00
rodzic 468419245a
commit 5e6e65301c
4 zmienionych plików z 34 dodań i 9 usunięć

Wyświetl plik

@ -55,11 +55,10 @@ $config['map_gridsquares'] = FALSE;
| The external CAT applications can obviously stop working for various reasons
| this interval is used for displaying a warning on the QSO Panel
|
| Default is: 300 seconds (5 minutes)
| Default is: 1800 seconds (30 minutes)
|
*/
$config['cat_timeout_interval'] = 300;
$config['cat_timeout_interval'] = 1800;
/*
|--------------------------------------------------------------------------

Wyświetl plik

@ -60,7 +60,7 @@
}
}
function json($id)
{
@ -75,6 +75,7 @@
foreach ($query->result() as $row)
{
if($row->sat_name != "") {
$uplink_freq = $row->uplink_freq;
$downlink_freq = $row->downlink_freq;
@ -118,13 +119,20 @@
$sat_mode = "";
}
// Calculate how old the data is in minutes
$datetime1 = new DateTime(); // Today's Date/Time
$datetime2 = new DateTime($row->newtime);
$interval = $datetime1->diff($datetime2);
$updated_at = $interval->format('%i');
// Return Json data
echo json_encode(array(
"uplink_freq" => $uplink_freq,
"downlink_freq" => $downlink_freq,
"mode" => $mode,
"satmode" => $sat_mode,
"satname" => $sat_name,
"updated_minutes_ago" => $updated_at,
), JSON_PRETTY_PRINT);
}
}
@ -175,4 +183,5 @@
}
}
?>

Wyświetl plik

@ -92,11 +92,9 @@
function radio_status($id) {
$this->db->select('*');
$this->db->where('id', $id);
$query = $this->db->get('cat');
return $query;
return $this->db->query('SELECT *, CONVERT_TZ(`timestamp`, @@session.time_zone, \'+00:00\' ) as newtime FROM `cat` WHERE 1');
}

Wyświetl plik

@ -879,6 +879,20 @@ $(document).on('keypress',function(e) {
}
$("#sat_name").val(data.satname);
$("#sat_mode").val(data.satmode);
// Display CAT Timeout warnng based on the figure given in the config file
var minutes = Math.floor(<?php echo $this->config->item('cat_timeout_interval'); ?> / 60);
if(data.updated_minutes_ago > minutes) {
if($('.radio_timeout_error').length == 0) {
$('.qso_panel').prepend('<div class="alert alert-danger radio_timeout_error" role="alert">Radio Connection Error: ' + $('select.radios option:selected').text() + ' data is ' + data.updated_minutes_ago + ' minutes old.</div>');
} else {
$('.radio_timeout_error').text('Radio Connection Error: ' + $('select.radios option:selected').text() + ' data is ' + data.updated_minutes_ago + ' minutes old.');
}
} else {
$(".radio_timeout_error" ).remove();
}
});
}
};
@ -898,6 +912,11 @@ $(document).on('keypress',function(e) {
$("#frequency_rx").val("");
$("#selectPropagation").val($("#selectPropagation option:first").val());
}
if ($(".radios option:selected").text() == "None") {
$(".radio_timeout_error" ).remove();
}
});
<?php } ?>