[Bps-public-commit] rt-extension-rightsdebugger branch, master, updated. 7a09b717fd952f62a76499a84cac8a7dbd366256

Shawn Moore shawn at bestpractical.com
Tue Feb 28 14:49:14 EST 2017


The branch, master has been updated
       via  7a09b717fd952f62a76499a84cac8a7dbd366256 (commit)
       via  143cea43c13b180eb5d09eae347c80e3bf358629 (commit)
       via  bf806c13fc9d6ac486e21ca385d905c7b6ac02f6 (commit)
      from  92d1f043195bbfafe4ba181baf09a2f59e6785d1 (commit)

Summary of changes:
 html/Admin/RightsDebugger/index.html |   1 +
 static/css/rights-debugger.css       |  17 +++++++++++++++++
 static/images/loading.gif            | Bin 0 -> 3208 bytes
 static/js/rights-debugger.js         |  12 ++++++++++--
 4 files changed, 28 insertions(+), 2 deletions(-)
 create mode 100644 static/images/loading.gif

- Log -----------------------------------------------------------------
commit bf806c13fc9d6ac486e21ca385d905c7b6ac02f6
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Tue Feb 28 19:45:29 2017 +0000

    Display loading spinner while waiting for refreshed results

diff --git a/html/Admin/RightsDebugger/index.html b/html/Admin/RightsDebugger/index.html
index 9f028e0..15f95d2 100644
--- a/html/Admin/RightsDebugger/index.html
+++ b/html/Admin/RightsDebugger/index.html
@@ -6,6 +6,7 @@
     <input type="text" name="principal" placeholder="Principal">
     <input type="text" name="object" placeholder="Object">
     <input type="text" name="right" placeholder="Right">
+    <span class="loading"><img src="<%RT->Config->Get('WebPath')%>/static/images/loading.gif" alt="<%loc('Loading')%>" title="<%loc('Loading')%>" /></span>
   </div>
   <div class="results">
   </div>
diff --git a/static/css/rights-debugger.css b/static/css/rights-debugger.css
index 79b4a8c..84171b8 100644
--- a/static/css/rights-debugger.css
+++ b/static/css/rights-debugger.css
@@ -4,6 +4,23 @@
     width: 15em;
 }
 
+#rights-debugger .search .loading {
+    display: none;
+}
+
+#rights-debugger .search .loading img {
+    height: 1em;
+    width: 1em;
+}
+
+#rights-debugger.refreshing .search .loading {
+    display: inline;
+}
+
+#rights-debugger.refreshing .results {
+    opacity: 0.5;
+}
+
 #rights-debugger .results .result .cell {
     padding: 2px;
     vertical-align: top;
diff --git a/static/images/loading.gif b/static/images/loading.gif
new file mode 100644
index 0000000..3288d10
Binary files /dev/null and b/static/images/loading.gif differ
diff --git a/static/js/rights-debugger.js b/static/js/rights-debugger.js
index 4199969..19db9fd 100644
--- a/static/js/rights-debugger.js
+++ b/static/js/rights-debugger.js
@@ -20,7 +20,7 @@ jQuery(function () {
     var display = form.find('.results');
 
     var refreshResults = function () {
-        display.empty();
+        form.addClass('refreshing');
 
         var serialized = form.serializeArray();
         var search = {};
@@ -33,6 +33,7 @@ jQuery(function () {
             data: search,
             timeout: 30000, /* 30 seconds */
             success: function (response) {
+                form.removeClass('refreshing');
                 display.empty(); // just in case of race condition
                 var items = response.results;
                 jQuery.each(items, function (i, item) {

commit 143cea43c13b180eb5d09eae347c80e3bf358629
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Tue Feb 28 19:48:29 2017 +0000

    Disable buttons while result refreshing

diff --git a/static/js/rights-debugger.js b/static/js/rights-debugger.js
index 19db9fd..79b0192 100644
--- a/static/js/rights-debugger.js
+++ b/static/js/rights-debugger.js
@@ -21,6 +21,7 @@ jQuery(function () {
 
     var refreshResults = function () {
         form.addClass('refreshing');
+        form.find('button').addClass('ui-state-disabled').prop('disabled', true);
 
         var serialized = form.serializeArray();
         var search = {};

commit 7a09b717fd952f62a76499a84cac8a7dbd366256
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Tue Feb 28 19:48:41 2017 +0000

    Abort previous requests to avoid getting into an inconsistent state

diff --git a/static/js/rights-debugger.js b/static/js/rights-debugger.js
index 79b0192..77f4991 100644
--- a/static/js/rights-debugger.js
+++ b/static/js/rights-debugger.js
@@ -19,6 +19,8 @@ jQuery(function () {
     var form = jQuery('form#rights-debugger');
     var display = form.find('.results');
 
+    var existingRequest;
+
     var refreshResults = function () {
         form.addClass('refreshing');
         form.find('button').addClass('ui-state-disabled').prop('disabled', true);
@@ -29,7 +31,11 @@ jQuery(function () {
             search[field.name] = field.value;
         });
 
-        jQuery.ajax({
+        if (existingRequest) {
+            existingRequest.abort();
+        }
+
+        existingRequest = jQuery.ajax({
             url: form.attr('action'),
             data: search,
             timeout: 30000, /* 30 seconds */

-----------------------------------------------------------------------


More information about the Bps-public-commit mailing list