cookutils rev 65
Improve web interface, keep and show more activity and cooknote
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Sat May 07 17:38:17 2011 +0200 (2011-05-07) |
parents | 99b24823dbc7 |
children | af6305b2076b |
files | cooker web/cooker.cgi web/style.css |
line diff
1.1 --- a/cooker Sat May 07 16:33:12 2011 +0200 1.2 +++ b/cooker Sat May 07 17:38:17 2011 +0200 1.3 @@ -56,7 +56,7 @@ 1.4 } 1.5 1.6 # Lograte activity. 1.7 -[ -s "$activity" ] && tail -n 20 $activity > /tmp/tail && \ 1.8 +[ -s "$activity" ] && tail -n 60 $activity > /tmp/tail && \ 1.9 mv -f /tmp/tail $activity 1.10 1.11 # Log activities, we want first letter capitalized.
2.1 --- a/web/cooker.cgi Sat May 07 16:33:12 2011 +0200 2.2 +++ b/web/cooker.cgi Sat May 07 17:38:17 2011 +0200 2.3 @@ -34,7 +34,7 @@ 2.4 -e 's#no$#<span class="span-no">no</span>#g' \ 2.5 -e 's#error$#<span class="span-error">error</span>#g' \ 2.6 -e 's#ERROR:#<span class="span-error">ERROR:</span>#g' \ 2.7 - -e s"#^Executing:\([^']*\).#<span class='span-sky'>\0</span>#"g \ 2.8 + -e s"#^Executing:\([^']*\).#<span class='sh-val'>\0</span>#"g \ 2.9 -e s"#^====\([^']*\).#<span class='span-line'>\0</span>#"g \ 2.10 -e s"#^[a-zA-Z0-9]\([^']*\) :: #<span class='span-sky'>\0</span>#"g \ 2.11 -e s"#ftp://\([^']*\).*#<a href='\0'>\0</a>#"g \ 2.12 @@ -121,23 +121,34 @@ 2.13 else 2.14 echo "<pre>No log: $pkg</pre>" 2.15 fi ;; 2.16 - log=*) 2.17 - log=${QUERY_STRING#log=} 2.18 - file=$LOGS/$log.log 2.19 - echo "<h2>Log for: $log</h2>" 2.20 - if [ -f "$LOGS/$log.log" ]; then 2.21 - if fgrep -q "Summary" $file; then 2.22 + file=*) 2.23 + # Dont allown all files on the system for security reason. 2.24 + file=${QUERY_STRING#file=} 2.25 + case "$file" in 2.26 + activity|cooknotes) 2.27 + echo "<h2>DB: $file</h2>" 2.28 echo '<pre>' 2.29 - grep -A 8 "^Summary" $file | sed /^$/d | \ 2.30 - syntax_highlighter log 2.31 - echo '</pre>' 2.32 - fi 2.33 - echo '<pre>' 2.34 - cat $file | syntax_highlighter log 2.35 - echo '</pre>' 2.36 - else 2.37 - echo "<pre>No log for: $log</pre>" 2.38 - fi ;; 2.39 + tac $CACHE/$file | \ 2.40 + sed s"#^\([^']* : \)#<span class='log-date'>\0</span>#"g 2.41 + echo '</pre>' ;; 2.42 + *.log) 2.43 + file=$LOGS/$file 2.44 + name=$(basename $file) 2.45 + echo "<h2>Log for: ${name%.log}</h2>" 2.46 + if [ -f "$LOGS/$log.log" ]; then 2.47 + if fgrep -q "Summary" $file; then 2.48 + echo '<pre>' 2.49 + grep -A 8 "^Summary" $file | sed /^$/d | \ 2.50 + syntax_highlighter log 2.51 + echo '</pre>' 2.52 + fi 2.53 + echo '<pre>' 2.54 + cat $file | syntax_highlighter log 2.55 + echo '</pre>' 2.56 + else 2.57 + echo "<pre>No log for: $log</pre>" 2.58 + fi ;; 2.59 + esac ;; 2.60 receipt=*) 2.61 pkg=${QUERY_STRING#receipt=} 2.62 echo "<h2>Receipt for: $pkg</h2>" 2.63 @@ -164,23 +175,29 @@ 2.64 Packages in wok : $(ls $WOK | wc -l) 2.65 Wok revision : <a href="http://hg.slitaz.org/wok">$(cd $WOK && hg head --template '{rev}\n')</a> 2.66 Commits to cook : $(cat $commits | wc -l) 2.67 +Current cooklist : $(cat $cooklist | wc -l) 2.68 Broken packages : $(cat $broken | wc -l) 2.69 </pre> 2.70 2.71 <div id="info"> 2.72 - Latest logs: <a href="cooker.cgi?log=cookorder">cookorder</a> 2.73 - <a href="cooker.cgi?log=commits">commits</a> 2.74 + Logs: 2.75 + <a class="button" href="cooker.cgi?file=cookorder.log">cookorder</a> 2.76 + <a class="button" href="cooker.cgi?file=commits.log">commits</a> 2.77 </div> 2.78 2.79 <h2>Activity</h2> 2.80 <pre> 2.81 -$(tac $CACHE/activity | sed s"#^\([^']* : \)#<span class='log-date'>\0</span>#"g) 2.82 +$(tac $CACHE/activity | head -n 12 | \ 2.83 + sed s"#^\([^']* : \)#<span class='log-date'>\0</span>#"g) 2.84 </pre> 2.85 +<a class="button" href="cooker.cgi?file=activity">More activity</a> 2.86 2.87 <h2>Cooknotes</h2> 2.88 <pre> 2.89 -$(cat $cooknotes) 2.90 +$(tac $cooknotes | head -n 12 | \ 2.91 + sed s"#^\([^']* : \)#<span class='log-date'>\0</span>#"g) 2.92 </pre> 2.93 +<a class="button" href="cooker.cgi?file=cooknotes">More notes</a> 2.94 2.95 <h2>Commits</h2> 2.96 <pre>
3.1 --- a/web/style.css Sat May 07 16:33:12 2011 +0200 3.2 +++ b/web/style.css Sat May 07 17:38:17 2011 +0200 3.3 @@ -1,6 +1,6 @@ 3.4 /* CSS style for SliTaz Cooker */ 3.5 3.6 -body { font: 96% sans-serif, vernada, arial; margin: 0; } 3.7 +body { font: 13px sans-serif, vernada, arial; margin: 0; } 3.8 h1 { margin: 0; padding: 8px; color: #fff; font-size: 20px; } 3.9 h1 a { color: #fff; text-decoration: none; } 3.10 h2 { color: #444; } h3 { color: #666; font-size: 140%; } 3.11 @@ -9,8 +9,8 @@ 3.12 background-color: #f8f8f8; 3.13 border: 1px solid #ddd; 3.14 padding: 10px; 3.15 - border-radius: 4px; 3.16 overflow: auto; 3.17 + font-size: 96%; 3.18 } 3.19 3.20 #header { 3.21 @@ -39,3 +39,32 @@ 3.22 .log-date { color: #666; font-size: 95%; } 3.23 .sh-comment { color: #b20000; } 3.24 .sh-val { color: #f35a00; } 3.25 + 3.26 +/* Buttons */ 3.27 + 3.28 +.button { 3.29 + padding: 2px 4px; 3.30 + margin: 0; 3.31 + background-color: #f1f1f1; 3.32 + border: 1px solid #ddd; 3.33 + cursor: pointer; 3.34 + color: #000; 3.35 +} 3.36 + 3.37 +a.button { 3.38 + text-decoration: none; 3.39 + color: #666; 3.40 +} 3.41 + 3.42 +.button:hover { 3.43 + background-color: #ddd; 3.44 + border: 1px solid #999; 3.45 +} 3.46 + 3.47 +/* Round corner */ 3.48 + 3.49 +pre, .button { 3.50 + /*-moz-border-radius: 4px; 3.51 + -webkit-border-radius: 4px; */ 3.52 + border-radius: 4px; 3.53 +}