guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]


From: Mathieu Othacehe
Date: Thu, 8 Apr 2021 03:17:54 -0400 (EDT)

branch: master
commit 065dbea5737edaba512803c3de687127891fed39
Author: Mathieu Othacehe <othacehe@gnu.org>
AuthorDate: Thu Apr 8 09:17:20 2021 +0200

    Add a spinner to dashboard page.
    
    * src/cuirass/templates.scm (evaluation-dashboard): Add a spinner.
---
 src/cuirass/templates.scm | 26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/src/cuirass/templates.scm b/src/cuirass/templates.scm
index 8b6d0a1..ad2ae02 100644
--- a/src/cuirass/templates.scm
+++ b/src/cuirass/templates.scm
@@ -1750,10 +1750,25 @@ text-dark d-flex position-absolute w-100"))
                                 systems)))
             (div (@ (class "col-auto"))
                  (button
-                  (@ (type "submit")
-                     (class "btn btn-primary"))
-                  " Go")))
+                  (@ (id "load-btn")
+                     (class "btn btn-primary")
+                     (type "submit")
+                     (disabled))
+                  (span
+                   (@ (class "spinner-border spinner-border-sm")))
+                  (span
+                   " Loading"))))
       (script ,(format #f "
+      function enableLoadButton() {
+          $('#load-btn').removeAttr('disabled');
+          $('#load-btn').children().eq(0).hide();
+          $('#load-btn').children().eq(1).text('Go');
+      }
+      function disableLoadButton() {
+          $('#load-btn').attr('disabled', 'true');
+          $('#load-btn').children().eq(0).show();
+          $('#load-btn').children().eq(1).text(' Loading');
+      }
       function radius(count) {
           if (count < 100)
               return 15;
@@ -1785,6 +1800,7 @@ text-dark d-flex position-absolute w-100"))
           return Math.round(Number(width));
       }
 
+      disableLoadButton();
       d3.json('~a').then(function (data) {
           var width = svgWidth();
           var circle_radius = radius(data.length);
@@ -1799,9 +1815,6 @@ text-dark d-flex position-absolute w-100"))
                         margin_circle_y) +
               circle_radius + 2 * margin_y;
 
-          console.log(width);
-          console.log(height);
-
           var div = d3.select('body').append('div')
                         .attr('class', 'tooltip')
                         .style('opacity', 0);
@@ -1842,4 +1855,5 @@ text-dark d-flex position-absolute w-100"))
                       .style('left', '0px')
                       .style('top', '0px');
               })
+          enableLoadButton();
       });" jobs)))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]