From 27097d873d723e60973bb2f55903f94b0fbe5fb8 Mon Sep 17 00:00:00 2001 From: Goutte Date: Fri, 28 Jul 2017 21:01:00 +0200 Subject: [PATCH] Change the error message displayed to the user. --- web/static/js/swapp.js | 4 +++- web/static/js/swapp.ls | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/web/static/js/swapp.js b/web/static/js/swapp.js index f028358..7ad2ac0 100644 --- a/web/static/js/swapp.js +++ b/web/static/js/swapp.js @@ -162,6 +162,7 @@ console.info("Loading CSV data of " + target.name + "…"); targetButton = $(".targets-filters .target." + target.slug); targetButton.addClass('loading'); + targetButton.removeClass('failed'); return this$.loadData(target.slug, started_at, stopped_at).then(function(data){ console.info("Loaded CSV data of " + target.name + ".", data); this$.createTimeSeries(target, data); @@ -174,7 +175,8 @@ } }, function(error){ console.error("Failed loading CSV data of " + target.name + ".", error); - alert("There was an error with the CSV of " + target.name + ".\nPlease try another interval.\n\n" + error); + alert("There was an error with " + target.name + ".\nPlease retry."); + targetButton.addClass('failed'); targetButton.removeClass('loading'); return this$.hideLoader(); }); diff --git a/web/static/js/swapp.ls b/web/static/js/swapp.ls index 5474cdb..bd7a611 100644 --- a/web/static/js/swapp.ls +++ b/web/static/js/swapp.ls @@ -166,6 +166,7 @@ https://gitlab.irap.omp.eu/CDPP/SPACEWEATHERONLINE console.info "Loading CSV data of #{target.name}…" targetButton = $(".targets-filters .target.#{target.slug}") targetButton.addClass('loading') + targetButton.removeClass('failed') @loadData(target.slug, started_at, stopped_at).then( (data) ~> console.info "Loaded CSV data of #{target.name}.", data @@ -175,8 +176,11 @@ https://gitlab.irap.omp.eu/CDPP/SPACEWEATHERONLINE if target.active then @hideLoader() else @disableTarget(target.slug) , (error) ~> + # Sometimes, AMDA's API returns garbage, so the CSV sometime fails + # But when we re-generate it a second time, usually it's okay. console.error("Failed loading CSV data of #{target.name}.", error) - alert("There was an error with the CSV of #{target.name}.\nPlease try another interval.\n\n#{error}") + alert("There was an error with #{target.name}.\nPlease retry.") + targetButton.addClass('failed') targetButton.removeClass('loading') @hideLoader() ) -- libgit2 0.21.2