improve map
This commit is contained in:
parent
2269b57b5c
commit
716acefb1e
@ -678,7 +678,7 @@ class HBSYSTEM(DatagramProtocol):
|
|||||||
|
|
||||||
self.send_peer(_peer_id, b''.join([RPTACK, _peer_id]))
|
self.send_peer(_peer_id, b''.join([RPTACK, _peer_id]))
|
||||||
logger.info('(%s) Peer %s (%s) has sent repeater configuration', self._system, _this_peer['CALLSIGN'], _this_peer['RADIO_ID'])
|
logger.info('(%s) Peer %s (%s) has sent repeater configuration', self._system, _this_peer['CALLSIGN'], _this_peer['RADIO_ID'])
|
||||||
self.send_peer_loc(_peer_id, _this_peer['CALLSIGN'], _this_peer['LATITUDE'], _this_peer['LONGITUDE'], _this_peer['URL'], _this_peer['DESCRIPTION'], _this_peer['LOCATION'], _this_peer['SOFTWARE_ID'])
|
self.send_peer_loc(_peer_id, _this_peer['CALLSIGN'], _this_peer['LATITUDE'], _this_peer['LONGITUDE'], _this_peer['URL'], _this_peer['DESCRIPTION'], _this_peer['LOCATION'], str(_this_peer['PACKAGE_ID']) + ' - ' + str(_this_peer['SOFTWARE_ID']))
|
||||||
else:
|
else:
|
||||||
self.transport.write(b''.join([MSTNAK, _peer_id]), _sockaddr)
|
self.transport.write(b''.join([MSTNAK, _peer_id]), _sockaddr)
|
||||||
logger.warning('(%s) Peer info from Radio ID that has not logged in: %s', self._system, int_id(_peer_id))
|
logger.warning('(%s) Peer info from Radio ID that has not logged in: %s', self._system, int_id(_peer_id))
|
||||||
|
74
web/app.py
74
web/app.py
@ -699,24 +699,63 @@ def create_app():
|
|||||||
@app.route('/map')
|
@app.route('/map')
|
||||||
@login_required
|
@login_required
|
||||||
def map_page():
|
def map_page():
|
||||||
|
print(peer_locations)
|
||||||
f_map = folium.Map(location=center_map, zoom_start=map_zoom)
|
f_map = folium.Map(location=center_map, zoom_start=map_zoom)
|
||||||
## folium.Marker([45.372, -121.6972], popup="hello", icon=folium.Icon(color="red", icon="record"), tooltip='hi').add_to(f_map)
|
|
||||||
for l in peer_locations.items():
|
for l in peer_locations.items():
|
||||||
|
## folium.Marker([float(l[1][1]), float(l[1][2])], popup='''
|
||||||
|
##<div class="panel panel-default">
|
||||||
|
## <div class="panel-heading" style="text-align: center;"><h4>''' + l[1][0] + '''</h4></div>
|
||||||
|
## <div class="panel-body">
|
||||||
|
## ''' + l[1][5] + '''
|
||||||
|
## <hr />
|
||||||
|
## ''' + l[1][1] + ''', ''' + l[1][2] + '''
|
||||||
|
## <hr />
|
||||||
|
## ''' + l[1][3] + '''
|
||||||
|
## <hr />
|
||||||
|
## ''' + l[1][4] + '''
|
||||||
|
## <hr />
|
||||||
|
## ''' + l[1][6] + '''
|
||||||
|
## </div>
|
||||||
|
##</div>
|
||||||
|
## ''', icon=folium.Icon(color="red", icon="record"), tooltip='<strong>' + l[1][0] + '</strong>').add_to(f_map)
|
||||||
|
|
||||||
folium.Marker([float(l[1][1]), float(l[1][2])], popup='''
|
folium.Marker([float(l[1][1]), float(l[1][2])], popup='''
|
||||||
<div class="panel panel-default">
|
<table border="1">
|
||||||
<div class="panel-heading" style="text-align: center;"><h4>''' + l[1][0] + '''</h4></div>
|
<tbody>
|
||||||
<div class="panel-body">
|
<tr>
|
||||||
''' + l[1][5] + '''
|
<td> <strong><h4>''' + l[1][0] + '''</strong></h4> </td>
|
||||||
<hr />
|
</tr>
|
||||||
''' + l[1][1] + ''', ''' + l[1][2] + '''
|
</tbody>
|
||||||
<hr />
|
</table>
|
||||||
''' + l[1][3] + '''
|
<table border="1">
|
||||||
<hr />
|
<tbody>
|
||||||
''' + l[1][4] + '''
|
<tr>
|
||||||
<hr />
|
<td style="width: 64.4667px;"><strong>DMR ID:</strong></td>
|
||||||
''' + l[1][6] + '''
|
<td> ''' + str(l[0]) + ''' </td>
|
||||||
</div>
|
</tr>
|
||||||
</div>
|
<tr>
|
||||||
|
<td style="width: 64.4667px;"><strong>Location:</strong></td>
|
||||||
|
<td> ''' + l[1][5] + ''' </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="width: 64.4667px;"><strong>Lat, Lon:</strong></td>
|
||||||
|
<td> ''' + l[1][1] + ''', ''' + l[1][2] + ''' </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="width: 64.4667px;"><strong>Description:</strong></td>
|
||||||
|
<td> ''' + l[1][4] + ''' </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="width: 64.4667px;"><p><strong>URL:</strong></p>
|
||||||
|
</td>
|
||||||
|
<td><a href="''' + l[1][3] + '''"> ''' + l[1][3] + ''' </a></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="width: 64.4667px;"><strong>Device:</strong></td>
|
||||||
|
<td> ''' + l[1][6] + ''' </td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
''', icon=folium.Icon(color="red", icon="record"), tooltip='<strong>' + l[1][0] + '</strong>').add_to(f_map)
|
''', icon=folium.Icon(color="red", icon="record"), tooltip='<strong>' + l[1][0] + '</strong>').add_to(f_map)
|
||||||
content = f_map._repr_html_()
|
content = f_map._repr_html_()
|
||||||
|
|
||||||
@ -766,13 +805,13 @@ def create_app():
|
|||||||
svr_content = ''
|
svr_content = ''
|
||||||
for i in sl:
|
for i in sl:
|
||||||
try:
|
try:
|
||||||
if time.time() - ping_list[i.name] < 30:
|
if time.time() - ping_list[i.name] < 20:
|
||||||
svr_status = '''<div class="alert alert-success">
|
svr_status = '''<div class="alert alert-success">
|
||||||
<strong>Online</strong>
|
<strong>Online</strong>
|
||||||
</div> '''
|
</div> '''
|
||||||
elif time.time() - ping_list[i.name] <= 300:
|
elif time.time() - ping_list[i.name] <= 300:
|
||||||
svr_status = '''<div class="alert alert-warning">
|
svr_status = '''<div class="alert alert-warning">
|
||||||
<strong>No pings. ( < 5 min.)</strong>
|
<strong>Unknown <br /> (No pings, less than 5 min.)</strong>
|
||||||
</div> '''
|
</div> '''
|
||||||
elif time.time() - ping_list[i.name] > 300:
|
elif time.time() - ping_list[i.name] > 300:
|
||||||
svr_status = '''<div class="alert alert-danger">
|
svr_status = '''<div class="alert alert-danger">
|
||||||
@ -5575,7 +5614,6 @@ TG #: <strong> ''' + str(tg_d.tg) + '''</strong>
|
|||||||
try:
|
try:
|
||||||
if hblink_req['ping']:
|
if hblink_req['ping']:
|
||||||
ping_list[hblink_req['ping']] = time.time()
|
ping_list[hblink_req['ping']] = time.time()
|
||||||
print(peer_locations)
|
|
||||||
response = ''
|
response = ''
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
@ -1,17 +1,15 @@
|
|||||||
{% extends 'flask_user/_public_base.html' %}
|
{% extends 'flask_user/_public_base.html' %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
|
<p> </p>
|
||||||
<div class="row container-fluid" style="width: 800px;">
|
<div class="well">Map of connected peers.
|
||||||
<div class="col-sm-12">
|
</div>
|
||||||
|
<div class="row container-fluid" >
|
||||||
|
<div class="col-xs-12">
|
||||||
{{markup_content}}
|
{{markup_content}}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<p> </p>
|
<p> </p>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user