Skip to content

ATC online list #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions public/map.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
body {
margin: 0;
padding: 0;
font-family: Helvetica Neue,Arial,Helvetica,sans-serif;
}

#map {
Expand All @@ -25,10 +26,33 @@
/* line-height: 1.4; */
white-space: pre-line;
}

#mgl-map-overlay {
position: absolute;
top: 0;
left: 0;
z-index: 1;
background-color: #fff;
padding: 8px;
margin-top: 8px;
text-align: center;

li, ul {
list-style-type: none;
padding: 0;
margin: 0;
font-size: 14px;
}
}
</style>
</head>
<body>
<script src='https://unpkg.com/@turf/turf@6/turf.min.js'></script>
<div id='mgl-map-overlay' style="border-radius: 1em; margin-bottom: 1em; margin-left: 1em; box-shadow: 1em; width:200px;">
<div id="atc-online">
<strong>ATC Online</strong>
</div>
</div>
<div id='map'></div>
<!-- <nav id="listing-group" class="listing-group">
<input type="checkbox" id="declutter" checked="checked">
Expand Down
25 changes: 25 additions & 0 deletions public/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,31 @@ if (mobile) {
//map.addControl(new mapboxgl.NavigationControl());
}

async function getATCOnline() {
try {
var response = await fetch(`${window.location.protocol}//${window.location.hostname}:${window.location.port}/v1/atc/online`);
var json = await response.json();
return json;
} catch (err) {
console.log(err);
}
}
// Render ATC online
getATCOnline().then(data => {
console.log('ATC online' + data);

const ul = document.createElement('ul');

data.features.forEach(controlPosition => {
const li = document.createElement('li');
li.innerHTML = controlPosition.properties.Callsign;
ul.appendChild(li);
});

const container = document.getElementById('atc-online');
container.appendChild(ul);
});


async function getATCSectors() {
try {
Expand Down