Add dialog box for marking a payload as recovered.

bearings
Mark Jessop 2019-08-04 15:26:10 +09:30
rodzic 4406040db5
commit 5597ecb269
8 zmienionych plików z 165 dodań i 10 usunięć

Wyświetl plik

@ -77,7 +77,7 @@ def fetchUuids(timeout=10):
return
def initListenerCallsign(callsign):
def initListenerCallsign(callsign, antenna=None, radio=None):
doc = {
'type': 'listener_information',
'time_created' : ISOStringNow(),
@ -86,6 +86,12 @@ def initListenerCallsign(callsign):
}
}
if antenna != None:
doc['data']['antenna'] = antenna
if radio != None:
doc['data']['radio'] = radio
resp = postListenerData(doc)
if resp is True:
@ -96,7 +102,7 @@ def initListenerCallsign(callsign):
return False
def uploadListenerPosition(callsign, lat, lon, alt):
def uploadListenerPosition(callsign, lat, lon, alt, chase=True):
""" Upload Listener Position """
doc = {
@ -104,7 +110,7 @@ def uploadListenerPosition(callsign, lat, lon, alt):
'time_created': ISOStringNow(),
'data': {
'callsign': callsign,
'chase': True,
'chase': chase,
'latitude': lat,
'longitude': lon,
'altitude': alt,

Wyświetl plik

@ -26,7 +26,7 @@ from chasemapper.gpsd import GPSDAdaptor
from chasemapper.atmosphere import time_to_landing
from chasemapper.listeners import OziListener, UDPListener, fix_datetime
from chasemapper.predictor import predictor_spawn_download, model_download_running
from chasemapper.habitat import HabitatChaseUploader
from chasemapper.habitat import HabitatChaseUploader, initListenerCallsign, uploadListenerPosition
from chasemapper.logger import ChaseLogger
@ -513,6 +513,26 @@ def clear_car_data(data):
logging.warning("Client requested all chase car data be cleared.")
car_track = GenericTrack()
@socketio.on('mark_recovered', namespace='/chasemapper')
def mark_payload_recovered(data):
""" Mark a payload as recovered, by uploading a station position """
_callsign = data['recovery_title']
_lat = data['last_pos'][0]
_lon = data['last_pos'][1]
_alt = data['last_pos'][2]
_msg = data['message']
_timestamp = "Recovered at " + datetime.utcnow().strftime("%Y-%m-%d %H:%MZ")
try:
initListenerCallsign(_callsign, radio=_msg, antenna=_timestamp)
uploadListenerPosition(_callsign, _lat, _lon, _alt, chase=False)
except Exception as e:
logging.error("Unable to mark %s as recovered - %s" % (data['payload_call'], str(e)))
return
logging.info("Payload %s marked as recovered." % data['payload_call'])
# Incoming telemetry handlers

Wyświetl plik

@ -111,4 +111,22 @@ html, body, #map {
.leaflet-control-container .leaflet-routing-container-hide {
display: none;
}
}
.centerWrapper:before {
content:'';
height: 100%;
display: inline-block;
vertical-align: middle;
}
.center_btn {
background: rgba(0, 0, 0, 0);
right:10px;
display:inline-block;
vertical-align: middle;
float: left;
}
.ui-dialog { z-index: 1000 !important ;}

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 6.8 KiB

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 6.8 KiB

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 6.8 KiB

Wyświetl plik

@ -20,10 +20,96 @@ function toggleSummarySize(){
$("#summary_table").tabulator("redraw", true);
}
// Allow for the telemetry table to be expanded/hidden with a click.
var telemetry_table_hidden = false;
function selectPayloadFollow(){}
// TODO. Allow selection of a specific payload to follow.
function toggleTelemTableHide(){
if(telemetry_table_hidden == false){
$('#telem_table_btn').html("<i class='fa fa-angle-left fa-4x text-center'></i>");
$("#telem_table").hide("slide", { direction: "right" }, "fast" );
telemetry_table_hidden = true;
}else{
$('#telem_table_btn').html("<i class='fa fa-angle-right fa-4x text-center'></i>");
$("#telem_table").show("slide", { direction: "right" }, "fast" );
telemetry_table_hidden = false;
}
}
function markPayloadRecovered(callsign){
// Grab the most recent telemetry, along with a few other parameters.
var _recovery_data = {
my_call: chase_config.habitat_call,
payload_call: callsign,
recovery_title: callsign + " recovered by " + chase_config.habitat_call,
last_pos: balloon_positions[callsign].latest_data.position,
message: ""
};
// Populate fields in the dialog window.
$('#customRecoveryTitle').val(_recovery_data.recovery_title);
$('#recoveryPosition').html(_recovery_data.last_pos[0].toFixed(5) + ", " + _recovery_data.last_pos[1].toFixed(5));
// Pop up a dialog box so the user can enter a custom message if they want.
var divObj = $('#mark-recovered-dialog');
divObj.dialog({
autoOpen: false,
//bgiframe: true,
modal: true,
resizable: false,
height: "auto",
width: 500,
title: "Mark " + callsign + " recovered",
buttons: {
"Submit": function() {
$( this ).dialog( "close" );
_recovery_data.message = $('#customRecoveryMessage').val();
_recovery_data.title = $('#customRecoveryTitle').val();
socket.emit('mark_recovered', _recovery_data);
},
Cancel: function() {
$( this ).dialog( "close" );
}
}
});
divObj.dialog('open');
}
// Dialog box for when a user clicks/taps on a row of the telemetry table.
function telemetryTableDialog(e, row){
callsign = row.row.data.callsign;
if (callsign === "None"){
return;
}
var divObj = $('#telemetry-select-dialog');
divObj.dialog({
autoOpen: false,
//bgiframe: true,
modal: true,
resizable: false,
height: "auto",
width: 400,
title: "Payload: " + callsign,
buttons: {
"Follow": function() {
// Follow the currently selected callsign.
balloon_currently_following = callsign;
$( this ).dialog( "close" );
},
"Mark Recovered": function() {
$( this ).dialog( "close" );
// Pop up another dialog box to enter details for marking the payload as recovered.
markPayloadRecovered(callsign);
},
Cancel: function() {
$( this ).dialog( "close" );
}
}
});
divObj.dialog('open');
}
// Initialise tables
function initTables(){
@ -40,7 +126,10 @@ function initTables(){
{title:"Alt (m)", field:"alt", headerSort:false},
{title:"V_rate (m/s)", field:"vel_v", headerSort:false},
{title:"Aux", field:'aux', headerSort:false}
]
],
rowClick:function(e, row){telemetryTableDialog(e, row);},
rowTap:function(e, row){telemetryTableDialog(e, row);}
});
$("#summary_table").tabulator({

Wyświetl plik

@ -12,6 +12,7 @@
<link href="{{ url_for('static', filename='css/easy-button.css') }}" rel="stylesheet">
<link href="{{ url_for('static', filename='css/tabulator_simple.css') }}" rel="stylesheet">
<link href="{{ url_for('static', filename='css/font-awesome.min.css') }}" rel="stylesheet">
<link href="{{ url_for('static', filename='css/jquery-ui.css') }}" rel="stylesheet">
<link href="{{ url_for('static', filename='css/chasemapper.css') }}" rel="stylesheet">
@ -235,8 +236,8 @@
// Telemetry table - shows all payload telemetry.
L.control.custom({
position: 'bottomright',
content : "<div id='telem_table'></div>",
classes : 'btn-group-vertical btn-group-sm',
content : "<div class='centerWrapper'><div id='telem_table_btn' class='center_btn'><i class='fa fa-angle-right fa-4x text-center'></i></div><div id='telem_table' style='float:right;'></div></div>",
classes : 'btn-group-horizonal btn-group-sm',
id: 'telem_display',
style :
{
@ -247,6 +248,10 @@
})
.addTo(map);
// Allow hiding of the telemetry table. This function is in tables.js
$("#telem_table_btn").click(toggleTelemTableHide);
// Summary display - a 'quick-look' of where the currently tracked payload is and what it's doing.
L.control.custom({
position: 'topcenter',
@ -495,6 +500,23 @@
</head>
<body>
<!-- Dialog boxes. These are activated from the telemetry table - see tables.js -->
<div id="telemetry-select-dialog" title="Payload Selection" style='display:none;'>
Select action:
</div>
<div id="mark-recovered-dialog" title="Mark Payload Recovered" style='display:none;'>
<div class="paramRow">
<b>Last Position:</b> <div style='float:right;' id='recoveryPosition'></div><br/>
</div>
<div class="paramRow">
<b>Title:</b><input type="text" class="paramEntry" size="40" id="customRecoveryTitle"><br/>
</div>
<div class="paramRow">
<b>Message:</b><input type="text" class="paramEntry" size="40" id="customRecoveryMessage"><br/>
</div>
</div>
<div id="sidebar" class="sidebar collapsed">
<!-- Nav tabs -->
<div class="sidebar-tabs">