cookutils rev 1071
lighttpd/index.cgi: rework this one more time; show parts immediately (this is fast), then request and update only webstat part
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Wed Jun 06 15:31:35 2018 +0300 (2018-06-06) |
parents | 96814879ba1b |
children | 23700c523fdb |
files | lighttpd/index.cgi |
line diff
1.1 --- a/lighttpd/index.cgi Wed Jun 06 13:39:19 2018 +0300 1.2 +++ b/lighttpd/index.cgi Wed Jun 06 15:31:35 2018 +0300 1.3 @@ -876,20 +876,7 @@ 1.4 # Generate part of the main page 1.5 1.6 part() { 1.7 - if [ -z "$nojs" ]; then 1.8 - case $1 in 1.9 - webstat) 1.10 - echo -n "<div id='$1'>" 1.11 - # Show previous webstat, it will be updated seamless then 1.12 - nojs=1; part webstat noupdate; unset nojs 1.13 - echo "</div><script>getPart('$1')</script>" 1.14 - ;; 1.15 - *) 1.16 - echo "<div id='$1'></div><script>getPart('$1')</script>" 1.17 - ;; 1.18 - esac 1.19 - return 1.20 - fi 1.21 + echo -n "<div id='$1'>" 1.22 1.23 case $1 in 1.24 summary) 1.25 @@ -916,7 +903,7 @@ 1.26 ;; 1.27 webstat) 1.28 # Do we need to update the statistics? 1.29 - if [ -z "$2" -a "$activity" -nt "$webstat" ]; then update_webstat; fi 1.30 + if [ -n "$nojs" -a "$activity" -nt "$webstat" ]; then update_webstat; fi 1.31 . $webstat 1.32 1.33 pct=0; [ "$rtotal" -gt 0 ] && pct=$(( ($rcooked * 100) / $rtotal )) 1.34 @@ -931,6 +918,7 @@ 1.35 <tr><td>Packages</td><td>$ptotal</td><td>$pcooked</td><td>$punbuilt</td><td>$pblocked</td><td>$pbroken</td></tr> 1.36 </tbody></table> 1.37 EOT 1.38 + if [ -z "$nojs" ]; then echo "<script>getPart('$1')</script>"; fi 1.39 ;; 1.40 activity) 1.41 tac $activity | head -n12 | sed 's|cooker.cgi?pkg=||; 1.42 @@ -993,6 +981,7 @@ 1.43 fi 1.44 ;; 1.45 esac 1.46 + echo "</div>" 1.47 } 1.48 1.49 1.50 @@ -1128,6 +1117,7 @@ 1.51 </form> 1.52 EOT 1.53 1.54 + unset nojs 1.55 part summary 1.56 part webstat 1.57