Skip to content

Commit 8270e17

Browse files
added spinner when fetchin vehicles
1 parent c766f85 commit 8270e17

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,10 @@ <h2>Chase car mode</h2>
281281
<div id="main" style="display: none">
282282
<div class="scrollwrapper">
283283
<div class="portrait">
284-
<div class="row vehicle0"><div class="header empty"><span>No vehicles :(</span></div></div>
284+
<div class="row vehicle0"><div class="header empty"><img style="width:24px;height:24px" src="img/hab-spinner.gif"/></div></div>
285285
</div>
286286
<div class="landscape">
287-
<div class="row vehicle0"><div class="header empty"><span>No vehicles :(</span></div></div>
287+
<div class="row vehicle0"><div class="header empty"><img style="width:24px;height:24px" src="img/hab-spinner.gif"/></div></div>
288288
</div>
289289
</div>
290290
</div>

js/tracker.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,13 @@ function load() {
392392
balloon_index = 0;
393393
stopFollow();
394394

395+
// add loading spinner in the vehicle list
396+
$('#main .empty').parent().remove();
397+
$("#main .portrait,#main .landscape").append(
398+
'<div class="row vehicle'+elm_uuid+'"><div class="header empty">' +
399+
'<img style="width:24px;height:24px" src="img/hab-spinner.gif"/></div></div>'
400+
);
401+
395402
refresh();
396403

397404
return true;
@@ -2391,7 +2398,12 @@ function update(response) {
23912398
!response.positions ||
23922399
!response.positions.position ||
23932400
!response.positions.position.length) {
2401+
2402+
// if no vehicles are found, this will remove the spinner and put a friendly message
2403+
$("#main .empty").html("<span>No vehicles :(</span>");
2404+
23942405
ajax_inprogress = false;
2406+
23952407
return;
23962408
}
23972409

@@ -2455,6 +2467,7 @@ function update(response) {
24552467
setTimeout(function() { ctx.draw(ctx); }, 16);
24562468
},
24572469
end: function(ctx) {
2470+
24582471
// update graph is current vehicles is followed
24592472
if(follow_vehicle !== null && vehicles[follow_vehicle].graph_data_updated) updateGraph(follow_vehicle, false);
24602473

0 commit comments

Comments
 (0)