[PATCH 19 of 20] hgweb: show message when an error occured during ajax loading

Alexander Plavin alexander at plav.in
Fri Aug 9 13:57:44 CDT 2013


# HG changeset patch
# User Alexander Plavin <alexander at plav.in>
# Date 1376071527 -14400
#      Fri Aug 09 22:05:27 2013 +0400
# Node ID e9201431f36ecd514a6be403c96b49dd02572082
# Parent  bfe92dd16d91ab859180beee692ead44fcde6001
hgweb: show message when an error occured during ajax loading

Add redish background color for this to the paper theme.

diff -r bfe92dd16d91 -r e9201431f36e mercurial/templates/static/mercurial.js
--- a/mercurial/templates/static/mercurial.js	Fri Aug 09 22:04:39 2013 +0400
+++ b/mercurial/templates/static/mercurial.js	Fri Aug 09 22:05:27 2013 +0400
@@ -385,6 +385,7 @@
                 format(urlFormat, {hash: lastHash, params: 'ajax=1'}),
                 'GET',
                 function onstart() {
+                    removeByClassName('scroll-loading-error');
                     container.lastElementChild.classList.add('scroll-separator');
 
                     var message = {
@@ -403,6 +404,11 @@
                     process_dates();
                 },
                 function onerror(errorText) {
+                    var message = {
+                        class: 'scroll-loading-error',
+                        text: 'Error: ' + errorText
+                    };
+                    appendHTML(container, format(messageFormat, message));
                 },
                 function oncomplete() {
                     removeByClassName('scroll-loading');
diff -r bfe92dd16d91 -r e9201431f36e mercurial/templates/static/style-paper.css
--- a/mercurial/templates/static/style-paper.css	Fri Aug 09 22:04:39 2013 +0400
+++ b/mercurial/templates/static/style-paper.css	Fri Aug 09 22:05:27 2013 +0400
@@ -403,6 +403,10 @@
   from { background-color: #A0CEFF; } to {  }
 }
 
+.scroll-loading-error {
+    background-color: #FFCCCC !important;
+}
+
 .scroll-separator {
     border-bottom: 1px solid #444 !important;
 }


More information about the Mercurial-devel mailing list