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

login
register
mail settings
Submitter Alexander Plavin
Date Aug. 9, 2013, 6:57 p.m.
Message ID <e9201431f36ecd514a6b.1376074664@debian-alexander.dolgopa>
Download mbox | patch
Permalink /patch/2124/
State Superseded
Commit 54981b8994066c90e6500f4b34e33b30fc455cae
Headers show

Comments

Alexander Plavin - Aug. 9, 2013, 6:57 p.m.
# HG changeset patch
# User Alexander Plavin <alexander@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.

Patch

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;
 }