Add latest TLE to UI if possible
Fixes #264. [v2:- Added docstrings] Signed-off-by: Fabian P. Schmidt <kerel@mailbox.org>merge-requests/329/head
parent
2967e608c3
commit
4278c6caa0
|
@ -144,6 +144,28 @@ class Satellite(models.Model):
|
||||||
decoder_count = Telemetry.objects.filter(satellite=self.id).exclude(decoder='').count()
|
decoder_count = Telemetry.objects.filter(satellite=self.id).exclude(decoder='').count()
|
||||||
return decoder_count
|
return decoder_count
|
||||||
|
|
||||||
|
@property
|
||||||
|
def tle_redistributable(self):
|
||||||
|
"""Returns True if re-distribution of the TLE is allowed, False otherwise
|
||||||
|
|
||||||
|
:returns: True if re-distribution of the TLE is allowed, False otherwise
|
||||||
|
"""
|
||||||
|
return self.tle_source in settings.TLE_SOURCES_REDISTRIBUTABLE
|
||||||
|
|
||||||
|
@property
|
||||||
|
def latest_tle(self):
|
||||||
|
"""Returns the latest TLE for this Satellite
|
||||||
|
|
||||||
|
:returns: dict with the latest TLE, it's source and whether redistribution is allowed
|
||||||
|
"""
|
||||||
|
return {
|
||||||
|
'source': self.tle_source,
|
||||||
|
'norad_cat_id': self.norad_cat_id,
|
||||||
|
'tle1': self.tle1,
|
||||||
|
'tle2': self.tle2,
|
||||||
|
'redistributable': self.tle_redistributable
|
||||||
|
}
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return '{0} - {1}'.format(self.norad_cat_id, self.name)
|
return '{0} - {1}'.format(self.norad_cat_id, self.name)
|
||||||
|
|
||||||
|
|
|
@ -296,6 +296,9 @@ DATA_FETCH_DAYS = config('DATA_FETCH_DAYS', default=10, cast=int)
|
||||||
MAPBOX_GEOCODE_URL = 'https://api.tiles.mapbox.com/v4/geocode/mapbox.places/'
|
MAPBOX_GEOCODE_URL = 'https://api.tiles.mapbox.com/v4/geocode/mapbox.places/'
|
||||||
MAPBOX_TOKEN = config('MAPBOX_TOKEN', default='')
|
MAPBOX_TOKEN = config('MAPBOX_TOKEN', default='')
|
||||||
|
|
||||||
|
# TLEs
|
||||||
|
TLE_SOURCES_REDISTRIBUTABLE = config('TLE_SOURCES_REDISTRIBUTABLE', default='manual', cast=Csv())
|
||||||
|
|
||||||
# Influx DB for decoded data_id
|
# Influx DB for decoded data_id
|
||||||
USE_INFLUX = config('USE_INFLUX', default=False, cast=bool)
|
USE_INFLUX = config('USE_INFLUX', default=False, cast=bool)
|
||||||
INFLUX_HOST = config('INFLUX_HOST', default='localhost')
|
INFLUX_HOST = config('INFLUX_HOST', default='localhost')
|
||||||
|
|
|
@ -241,6 +241,10 @@ a.satellite-item:hover {
|
||||||
margin: 20px 0;
|
margin: 20px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.panel-tle {
|
||||||
|
margin: 20px 0;
|
||||||
|
}
|
||||||
|
|
||||||
.panel-first {
|
.panel-first {
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
}
|
}
|
||||||
|
@ -281,6 +285,10 @@ a.satellite-item:hover {
|
||||||
font-size: .8em;
|
font-size: .8em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tle-element {
|
||||||
|
margin: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
.info {
|
.info {
|
||||||
margin-top: 30px;
|
margin-top: 30px;
|
||||||
margin-bottom: 30px;
|
margin-bottom: 30px;
|
||||||
|
|
|
@ -50,8 +50,8 @@
|
||||||
{% if satellite.status != 're-entered' %}
|
{% if satellite.status != 're-entered' %}
|
||||||
<div id="map"
|
<div id="map"
|
||||||
data-name="{{ satellite.name }}"
|
data-name="{{ satellite.name }}"
|
||||||
data-tle1="{{ satellite.tle1 }}"
|
data-tle1="{{ satellite.latest_tle.tle1 }}"
|
||||||
data-tle2="{{ satellite.tle2 }}"
|
data-tle2="{{ satellite.latest_tle.tle2 }}"
|
||||||
data-mapboxtoken="{{ mapbox_token }}"></div>
|
data-mapboxtoken="{{ mapbox_token }}"></div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
@ -513,6 +513,63 @@
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
<!-- Orbital Elements Section -->
|
||||||
|
{% if satellite.latest_tle.redistributable %}
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12 satellite-panels">
|
||||||
|
<div class="panel panel-default panel-satellite">
|
||||||
|
<div class="panel-heading">
|
||||||
|
<div class="satellite-title">
|
||||||
|
Orbital Elements
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row panel-body">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="panel panel-primary panel-tle">
|
||||||
|
<div class="panel-heading">
|
||||||
|
<h3 class="panel-title">
|
||||||
|
<span class="tle-title">Latest TLE</span>
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
<div class="row panel-body">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="row tle-element">
|
||||||
|
<div class="col-md-2">
|
||||||
|
<span class="label label-default">NORAD ID</span>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-10">
|
||||||
|
{{ satellite.latest_tle.norad_cat_id }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row tle-element">
|
||||||
|
<div class="col-md-2">
|
||||||
|
<span class="label label-default">TLE source</span>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-10">
|
||||||
|
{{ satellite.latest_tle.source }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row tle-element">
|
||||||
|
<div class="col-md-2">
|
||||||
|
<span class="label label-default">TLE</span>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<pre>{{ satellite.latest_tle.tle1 }}<br>{{ satellite.latest_tle.tle2 }}</pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<!-- Telemetry Frames Section -->
|
<!-- Telemetry Frames Section -->
|
||||||
<!-- This is a hacky way of getting around slow db queries. See #237 -->
|
<!-- This is a hacky way of getting around slow db queries. See #237 -->
|
||||||
|
|
Loading…
Reference in New Issue