1
0
Fork 0

Add warning when old TLE is shown

Closes https://gitlab.com/librespacefoundation/satnogs/satnogs-db/-/issues/557

Signed-off-by: George Sfoungaris <sfou@libre.space>
spacecruft
George Sfoungaris 2022-10-05 11:22:28 +03:00
parent f847b783f6
commit 24aa35d904
4 changed files with 20 additions and 3 deletions

View File

@ -149,6 +149,7 @@ def satellite(request, norad=None, sat_id=None):
latest_tle = None
latest_tle_set = None
latest_tle_warning = None
if hasattr(satellite_obj, 'latest_tle_set'):
latest_tle_set = satellite_obj.latest_tle_set
@ -157,6 +158,8 @@ def satellite(request, norad=None, sat_id=None):
latest_tle = latest_tle_set.latest
else:
latest_tle = latest_tle_set.latest_distributable
if latest_tle_set.latest != latest_tle_set.latest_distributable:
latest_tle_warning = "There is at least one newer non-redestributable TLE set."
transmitter_suggestions = TransmitterSuggestion.objects.filter(satellite=satellite_obj)
for suggestion in transmitter_suggestions:
@ -194,7 +197,8 @@ def satellite(request, norad=None, sat_id=None):
'mapbox_token': settings.MAPBOX_TOKEN,
'recent_observers': recent_observers,
'badge_telemetry_count': millify(satellite_obj.telemetry_data_count),
'showmap': showmap
'showmap': showmap,
"latest_tle_warning": latest_tle_warning
}
)

View File

@ -733,3 +733,7 @@ a.skip-main:focus, a.skip-main:active {
margin-top: auto;
margin-bottom: auto;
}
.latest-tle-warning {
text-align: center;
}

View File

@ -21,7 +21,7 @@ $(document).ready(function() {
});
// Transitional from inline alerts to Toasts
$('.alert').each(function() {
$('.alert:not(.non-toasted)').each(function() {
var alerticon = 'fas fa-question';
var alerttitle = 'Unknown';
var alertclass = 'alert-info';

View File

@ -574,8 +574,17 @@
<div class="card-header card-satnogs-header">
Orbital Elements
</div>
<div class="card-body text-sm">
<div class="font-weight-bolder pb-2 px-2">Latest Two-Line Element (TLE)</div>
{% if latest_tle_warning %}
<div class="alert alert-warning alert-dismissible latest-tle-warning non-toasted" role="alert">
<strong>Warning:</strong> {{ latest_tle_warning }}
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
{% endif %}
<div class="font-weight-bolder pb-2 px-2">Latest Two-Line Element (TLE)</div>
<dl class="row mb-0">
<dt class="col-sm-2">TLE Source</dt>
<dd class="col-sm-10">