Commit 27097d873d723e60973bb2f55903f94b0fbe5fb8

Authored by Goutte
1 parent 92abc15b

Change the error message displayed to the user.

Showing 2 changed files with 8 additions and 2 deletions   Show diff stats
web/static/js/swapp.js
... ... @@ -162,6 +162,7 @@
162 162 console.info("Loading CSV data of " + target.name + "…");
163 163 targetButton = $(".targets-filters .target." + target.slug);
164 164 targetButton.addClass('loading');
  165 + targetButton.removeClass('failed');
165 166 return this$.loadData(target.slug, started_at, stopped_at).then(function(data){
166 167 console.info("Loaded CSV data of " + target.name + ".", data);
167 168 this$.createTimeSeries(target, data);
... ... @@ -174,7 +175,8 @@
174 175 }
175 176 }, function(error){
176 177 console.error("Failed loading CSV data of " + target.name + ".", error);
177   - alert("There was an error with the CSV of " + target.name + ".\nPlease try another interval.\n\n" + error);
  178 + alert("There was an error with " + target.name + ".\nPlease retry.");
  179 + targetButton.addClass('failed');
178 180 targetButton.removeClass('loading');
179 181 return this$.hideLoader();
180 182 });
... ...
web/static/js/swapp.ls
... ... @@ -166,6 +166,7 @@ https://gitlab.irap.omp.eu/CDPP/SPACEWEATHERONLINE
166 166 console.info "Loading CSV data of #{target.name}…"
167 167 targetButton = $(".targets-filters .target.#{target.slug}")
168 168 targetButton.addClass('loading')
  169 + targetButton.removeClass('failed')
169 170 @loadData(target.slug, started_at, stopped_at).then(
170 171 (data) ~>
171 172 console.info "Loaded CSV data of #{target.name}.", data
... ... @@ -175,8 +176,11 @@ https://gitlab.irap.omp.eu/CDPP/SPACEWEATHERONLINE
175 176 if target.active then @hideLoader() else @disableTarget(target.slug)
176 177 ,
177 178 (error) ~>
  179 + # Sometimes, AMDA's API returns garbage, so the CSV sometime fails
  180 + # But when we re-generate it a second time, usually it's okay.
178 181 console.error("Failed loading CSV data of #{target.name}.", error)
179   - alert("There was an error with the CSV of #{target.name}.\nPlease try another interval.\n\n#{error}")
  182 + alert("There was an error with #{target.name}.\nPlease retry.")
  183 + targetButton.addClass('failed')
180 184 targetButton.removeClass('loading')
181 185 @hideLoader()
182 186 )
... ...