Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/pull/5561'
Browse files Browse the repository at this point in the history
  • Loading branch information
tomhughes committed Jan 27, 2025
2 parents c7adb87 + 558e05c commit 7c47cde
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions app/assets/javascripts/index/layers/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,16 @@ OSM.initializeDataLayer = function (map) {
.click(add)));
}

function displayLoadError(message) {
function displayLoadError(message, close) {
$("#browse_status").html(
$("<div class='p-3'>").append(
$("<h2 class='flex-grow-1 text-break'>")
.text(I18n.t("browse.start_rjs.load_data")),
$("<div class='d-flex'>").append(
$("<h2 class='flex-grow-1 text-break'>")
.text(I18n.t("browse.start_rjs.load_data")),
$("<div>").append(
$("<button type='button' class='btn-close'>")
.attr("aria-label", I18n.t("javascripts.close"))
.click(close))),
$("<div>").append(
$("<div class='d-flex'>").append(
$("<p class='alert alert-warning'>")
Expand Down Expand Up @@ -128,12 +133,16 @@ OSM.initializeDataLayer = function (map) {
dataLoader = null;
if (textStatus === "abort") { return; }

function closeError() {
$("#browse_status").empty();
}

if (XMLHttpRequest.status === 400 && XMLHttpRequest.responseText) {
displayLoadError(XMLHttpRequest.responseText);
displayLoadError(XMLHttpRequest.responseText, closeError);
} else if (XMLHttpRequest.statusText) {
displayLoadError(XMLHttpRequest.statusText);
displayLoadError(XMLHttpRequest.statusText, closeError);
} else {
displayLoadError(String(XMLHttpRequest.status));
displayLoadError(String(XMLHttpRequest.status), closeError);
}
}
});
Expand Down

0 comments on commit 7c47cde

Please sign in to comment.