improve routing error message display, handle when routingstart is triggered twice

Signed-off-by: Julien Veyssier <eneiluj@posteo.net>
This commit is contained in:
Julien Veyssier 2019-04-29 12:53:09 +02:00
Родитель 68b3ae7f70
Коммит 1e53b8d447
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4141FEE162030638
1 изменённых файлов: 16 добавлений и 2 удалений

Просмотреть файл

@ -662,7 +662,16 @@
},
onRoutingError: function(e) {
OC.Notification.showTemporary(t('maps', 'Routing error: ') + e.error.target.responseText);
var msg = e.error.target.responseText
try {
var json = $.parseJSON(e.error.target.responseText);
if (json.message) {
msg = json.message;
}
}
catch (e) {
}
OC.Notification.showTemporary(t('maps', 'Routing error:') + ' ' + msg);
routingController.onRoutingEnd();
},
@ -674,6 +683,12 @@
onRoutingEnd: function(e) {
$('#navigation-routing').removeClass('icon-loading-small');
$('.leaflet-routing-reverse-waypoints').removeClass('icon-loading-small');
// TODO understand why routingstart is sometimes triggered after routesfound
// just in case routingstart is triggered again (weird):
setTimeout(function() {
$('#navigation-routing').removeClass('icon-loading-small');
$('.leaflet-routing-reverse-waypoints').removeClass('icon-loading-small');
}, 5000);
},
// this has been tested with graphhopper
@ -1167,7 +1182,6 @@
else if (results.length === 1) {
var result = results[0];
mapController.displaySearchResult([result]);
routingController.setRouteTo(L.latLng(result.lat, result.lon));
}
else {
var newData = [];