Skip to content

Commit

Permalink
feat(ui): add export timeout error notice markup
Browse files Browse the repository at this point in the history
Added extra markup to display a timeout error notice when the print service doesn't respond quickly. Just need to catch the error.

Signed-off-by: Aleksuei Riabtsev <aleksuei.riabtsev@ec.gc.ca>
  • Loading branch information
AleksueiR committed Jul 6, 2015
1 parent 5052936 commit 10a7686
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
4 changes: 4 additions & 0 deletions site/includes/mapexport.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
<h3>{{t "mapExport.error.generalTitle"}}</h3>
<p>{{t "mapExport.error.generalMessage"}}</p>
</section>
<section class="map-export-notice notice-timeout alert alert-danger">
<h3>{{t "mapExport.error.generalTitle"}}</h3>
<p>{{t "mapExport.error.timeoutMessage"}}</p>
</section>
<section class="map-export-notice notice-ie alert alert-warning">
<h3>{{t "mapExport.ie.generalTitle"}}</h3>
<p>{{t "mapExport.ie.generalMessage"}}</p>
Expand Down
10 changes: 5 additions & 5 deletions src/js/RAMP/Modules/imageExport.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ define([
mapExportNoticeContainer,
mapExportNotice,
mapExportNoticeIE,
mapExportNoticeTimeout,
downloadButton,

mapExportCloseButton,
Expand Down Expand Up @@ -158,7 +159,7 @@ define([
}
});
}

// wait for the image to fully load
mapExportImg.on("load", function (event) {

Expand Down Expand Up @@ -212,10 +213,8 @@ define([
},
function (error) {
// show error notice
tl
.set(mapExportSpinner, { display: "none" })
.set(mapExportNotice, { display: "block" })
;
mapExportSpinner.css({ display: "none" });
mapExportNotice.css({ display: "block" });

console.log(error);
}
Expand All @@ -241,6 +240,7 @@ define([
mapExportNoticeContainer = mapExportStretcher.find(".map-export-notice-container");
mapExportNotice = mapExportStretcher.find(".map-export-notice.notice-error");
mapExportNoticeIE = mapExportStretcher.find(".map-export-notice.notice-ie");
mapExportNoticeTimeout = mapExportStretcher.find(".map-export-notice.notice-timeout");
downloadButton = $(".map-export-controls .download-buttons > .btn");

downloadDropdown = $(".map-export-controls .download-buttons .download-dropdown");
Expand Down
5 changes: 3 additions & 2 deletions src/locales/en-CA/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -563,10 +563,11 @@
"downloadPNGdesc": "Download as PNG",
"error": {
"generalMessage": "Image cannot be generated. Please try again later.",
"generalTitle": "Error"
"generalTitle": "Error",
"timeoutMessage": "The print service did not respond in a timely fashion. Please try again later."
},
"ie": {
"generalMessage": "You have IE9... no CORS image manipulations for you.",
"generalMessage": "Exporting file-based user-added layers is unsupported in versions of Internet Explorer 10 or lower. Please upgrade your browser, or use an alternative.",
"generalTitle": "Warning"
},
"includeLegend": "Include Legend",
Expand Down
5 changes: 3 additions & 2 deletions src/locales/fr-CA/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -563,10 +563,11 @@
"downloadPNGdesc": "Télécharger en PNG",
"error": {
"generalMessage": "L’image ne peut être générée. Veuillez essayer de nouveau plus tard.",
"generalTitle": "Erreur"
"generalTitle": "Erreur",
"timeoutMessage": "[fr] The print service did not respond in a timely fashion. Please try again later."
},
"ie": {
"generalMessage": "[fr] You have IE9...",
"generalMessage": "[fr] Exporting file-based user-added layers is unsupported in versions of Internet Explorer 10 or lower. Please upgrade your browser, or use an alternative.",
"generalTitle": "[fr] Warning"
},
"includeLegend": "Ajouter la légende",
Expand Down

0 comments on commit 10a7686

Please sign in to comment.