Show selected plane information in separate panel

This commit is contained in:
Carlos Salaverria 2016-08-30 15:07:54 -05:00
parent 3588a47058
commit d5bd164169
3 changed files with 104 additions and 90 deletions

View file

@ -51,64 +51,6 @@
<a id="toggle_sidebar_button" class="hide_sidebar" href="#"></a>
<a id="expand_sidebar_button" href="#"></a>
</div>
<div id="sidebar_container">
<div id="splitter" class="ui-resizable-handle ui-resizable-w"></div>
<div id="sidebar_canvas">
<a id="show_map_button" href="#"></a>
<div id="sudo_buttons">
<table style="width: 100%">
<tr>
<td style="width: 150px; text-align: center;">
[ <span class="pointer" onclick="resetMap();">Reset Map</span> ]
</td>
<td style="width: 150px; text-align: center;" class="pointer">
[ <span onclick="selectAllPlanes();">Select All</span> ]
</td>
<td style="width: 150px; text-align: center;" class="pointer">
[ <span onclick="deselectAllPlanes();">Select None</span> ]
</td>
</tr>
</table>
</div> <!-- sudo_buttons -->
<div id="dump1090_infoblock">
<table style="width: 100%">
<tr class="infoblock_heading">
<td>
<b id="infoblock_name">FlightAware dump1090</b>
</td>
<td style="text-align: right">
<a href="https://github.com/flightaware/dump1090" id="dump1090_version" target="_blank"></a>
</td>
</tr>
<tr class="infoblock_body">
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr class="infoblock_body dim">
<td>(no aircraft selected)</td>
<td>&nbsp;</td>
</tr>
<tr class="infoblock_body">
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr class="infoblock_body">
<td>Aircraft (total): <span id="dump1090_total_ac">n/a</span></td>
<td>Messages: <span id="dump1090_message_rate">n/a</span>/sec</td>
</tr>
<tr class="infoblock_body">
<td>(with positions): <span id="dump1090_total_ac_positions">n/a</span></td>
<td>History: <span id="dump1090_total_history">n/a</span> positions</td>
</tr>
</table>
</div> <!-- dump1090_infoblock -->
<div id="selected_infoblock" class="hidden">
<table style="width: 100%">
<tr class="infoblock_heading">
@ -160,6 +102,51 @@
</tr>
</table>
</div> <!-- selected_infoblock -->
<div id="sidebar_container">
<div id="splitter" class="ui-resizable-handle ui-resizable-w"></div>
<div id="sidebar_canvas">
<a id="show_map_button" href="#"></a>
<div id="dump1090_infoblock">
<table style="width: 100%">
<tr class="infoblock_heading">
<td>
<b id="infoblock_name">FlightAware dump1090</b>
</td>
<td style="text-align: right">
<a href="https://github.com/flightaware/dump1090" id="dump1090_version" target="_blank"></a>
</td>
</tr>
<tr class="infoblock_body">
<td>&nbsp;</td>
</tr>
<tr>
<td colspan="3">
<div id="sudo_buttons">
<span class="pointer" onclick="resetMap();">[ Reset Map ]</span>
<span class="pointer" onclick="selectAllPlanes();">[ Select All ]</span>
<span class="pointer" onclick="deselectAllPlanes();">[ Select None ]</span>
</div>
</td>
</tr>
<tr class="infoblock_body">
<td>&nbsp;</td>
</tr>
<tr class="infoblock_body">
<td>Aircraft (total): <span id="dump1090_total_ac">n/a</span></td>
<td>Messages: <span id="dump1090_message_rate">n/a</span>/sec</td>
</tr>
<tr class="infoblock_body">
<td>(with positions): <span id="dump1090_total_ac_positions">n/a</span></td>
<td>History: <span id="dump1090_total_history">n/a</span> positions</td>
</tr>
</table>
</div> <!-- dump1090_infoblock -->
<div id="units_container">
<label for="units_selector">Units:</label>

View file

@ -710,8 +710,6 @@ function refreshSelected() {
selected = Planes[SelectedPlane];
}
if (!selected) {
$('#selected_infoblock').css('display','none');
$('#dump1090_infoblock').css('display','block');
$('#dump1090_version').text(Dump1090Version);
$('#dump1090_total_ac').text(TrackedAircraft);
@ -724,12 +722,12 @@ function refreshSelected() {
$('#dump1090_message_rate').text("n/a");
}
setSelectedInfoBlockVisibility();
if (!selected) {
return;
}
$('#dump1090_infoblock').css('display','none');
$('#selected_infoblock').css('display','block');
$('#selected_flightaware_link').attr('href','//flightaware.com/live/modes/'+selected.icao+'/redirect');
if (selected.flight !== null && selected.flight !== "") {
@ -1114,6 +1112,7 @@ function expandSidebar(e) {
$("#show_map_button").show();
$("#sidebar_container").width("100%");
setColumnVisibility();
setSelectedInfoBlockVisibility();
updateMapSize();
}
@ -1125,6 +1124,7 @@ function showMap() {
$("#show_map_button").hide();
$("#sidebar_container").width("420px");
setColumnVisibility();
setSelectedInfoBlockVisibility();
updateMapSize();
}
@ -1156,6 +1156,18 @@ function setColumnVisibility() {
showColumn(infoTable, "#flightaware_photo_link", !mapIsVisible);
}
function setSelectedInfoBlockVisibility() {
var mapIsVisible = $("#map_container").is(":visible");
var planeSelected = (typeof SelectedPlane !== 'undefined' && SelectedPlane != null && SelectedPlane != "ICAO");
if (planeSelected && mapIsVisible) {
$('#selected_infoblock').show();
}
else {
$('#selected_infoblock').hide();
}
}
function initializeUnitsSelector() {
// Get display unit preferences from local storage
if (!localStorage.getItem('displayUnits')) {

View file

@ -8,6 +8,15 @@ html, body {
height: 100%;
}
#selected_infoblock {
position: absolute;
background: #ffffff;
padding: 20px;
box-shadow: 4px 4px 10px #444444;
left: 20px;
top: 20px;
}
#map_container {
flex: 1 1 auto;
position: relative;
@ -106,7 +115,14 @@ div#loader { z-index: 99; position: absolute; left: 0; top: 0; bottom: 0; right:
#spinny { width: 128px; height: 128px; position: absolute; top: 50%; left: 50%; margin: -64px 0 0 -64px; }
#loader_progress { width: 250px; height: 20px; position: absolute; top: 50%; left: 50%; margin: 128px 0 0 -125px; }
#tableinfo, #sudo_buttons { font-size: x-small; font-family: monospace; }
#tableinfo { font-size: x-small; font-family: monospace; }
#sudo_buttons {
display: flex;
padding: 0 40px 0 40px;
justify-content: space-between;
font-size: small;
}
#units_container,
#altitude_filter_form {
@ -151,4 +167,3 @@ select.error, textarea.error, input.error {
.layer-switcher {
top: 5em !important;
}