tazbug rev 116

Rename pkgs plugin and improve dashboard
author Christophe Lincoln <pankso@slitaz.org>
date Sat Feb 11 15:19:38 2017 +0100 (2017-02-11)
parents b9aaee394e0c
children 73dde38a42cf
files web/plugins/dashboard/dashboard.cgi web/plugins/packages/packages.cgi web/plugins/packages/packages.conf web/plugins/pkgs/pkgs.cgi web/plugins/pkgs/pkgs.conf web/style.css
line diff
     1.1 --- a/web/plugins/dashboard/dashboard.cgi	Sat Feb 11 09:56:12 2017 +0000
     1.2 +++ b/web/plugins/dashboard/dashboard.cgi	Sat Feb 11 15:19:38 2017 +0100
     1.3 @@ -25,7 +25,8 @@
     1.4  	if check_auth && ! admin_user; then
     1.5  		ADMIN_TOOLS=""
     1.6  	fi
     1.7 -	cat << EOT
     1.8 +	if check_auth; then
     1.9 +		cat << EOT
    1.10  <h2>Dashboard</h2>
    1.11  
    1.12  <div id="tools">
    1.13 @@ -33,31 +34,52 @@
    1.14  </div>
    1.15  
    1.16  <pre>
    1.17 -Users     : $users
    1.18 -Bugs      : $bugs
    1.19 -Bugsize   : $bugsize
    1.20 +Bugs count       : $bugs
    1.21 +Database size    : $bugsize
    1.22 +User accounts    : $users
    1.23 +Server uptime    :$(uptime | cut -d "," -f 1-2)
    1.24  </pre>
    1.25 +
    1.26 +<h3>Admin users</h3>
    1.27  EOT
    1.28 -		# List all plugins
    1.29 -		cat << EOT
    1.30 +		
    1.31 +		# Get the list of administrators
    1.32 +		fgrep -l "ADMIN_USER=" $PEOPLE/*/account.conf | while read file;
    1.33 +		do
    1.34 +			. ${file}
    1.35 +			echo "<a href='?user=$USER'>$USER</a>"
    1.36 +			unset NAME USER
    1.37 +		done
    1.38 +		
    1.39 +		# Only for admins
    1.40 +		if check_auth && admin_user; then
    1.41 +			# List all plugins
    1.42 +			cat << EOT
    1.43  <h3>$(gettext "Plugins")</h3>
    1.44  <pre>
    1.45 +	<table>
    1.46 +		<thead>
    1.47 +			<td>$(gettext "Name")</td>
    1.48 +			<td>$(gettext "Description")</td>
    1.49 +			<td>$(gettext "Action")</td>
    1.50 +		</thead>
    1.51  EOT
    1.52 -	for p in $(ls -1 $plugins)
    1.53 -	do
    1.54 -		. $plugins/$p/$p.conf
    1.55 -		echo "<a href='?$p'>$PLUGIN</a> - $SHORT_DESC"
    1.56 -	done
    1.57 -	echo '</pre>'
    1.58 -	
    1.59 -	# Get the list of administrators
    1.60 -	echo "<h3>Admin users</h3>"
    1.61 -	for u in $(ls $PEOPLE)
    1.62 -	do
    1.63 -		user=${u}
    1.64 -		if admin_user; then
    1.65 -			echo "<a href='?user=$u'>$u</a>"
    1.66 +			for p in $(ls -1 $plugins)
    1.67 +			do
    1.68 +				. $plugins/$p/$p.conf
    1.69 +				cat << EOT
    1.70 +		<tr>
    1.71 +			<td><a href='?$p'>$PLUGIN</a></td>
    1.72 +			<td>$SHORT_DESC</td>
    1.73 +			<td>TODO</td>
    1.74 +		</tr>
    1.75 +EOT
    1.76 +			done
    1.77 +			echo "	</table>"
    1.78 +			echo "</pre>"
    1.79  		fi
    1.80 -	done
    1.81 +	else
    1.82 +		gettext "You must be logged in to view the dashboard"
    1.83 +	fi
    1.84  	html_footer && exit 0
    1.85  fi
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/web/plugins/packages/packages.cgi	Sat Feb 11 15:19:38 2017 +0100
     2.3 @@ -0,0 +1,43 @@
     2.4 +#!/bin/sh
     2.5 +#
     2.6 +# TazBug Plugin - Buggy packages plugins
     2.7 +#
     2.8 +
     2.9 +if [ "$(GET packages)" ] || [ "$(GET pkg)" ]; then
    2.10 +	d="Skel"
    2.11 +	header
    2.12 +	html_header
    2.13 +	user_box
    2.14 +	if [ "$(GET pkg)" ]; then
    2.15 +		pkg=$(GET pkg)
    2.16 +		echo "<h2>Bugs for: $pkg</h2>"
    2.17 +		echo "<pre>"
    2.18 +		for bug in $(fgrep -l "OPEN" $bugdir/*/bug.conf)
    2.19 +		do
    2.20 +			. ${bug}
    2.21 +			if echo "$PKGS" | fgrep -q "$pkg"; then
    2.22 +				dir=$(dirname $bug)
    2.23 +				id=$(basename $dir)
    2.24 +				echo "ID: $id <a href='$script?id=$id'>$BUG</a> \
    2.25 +<span class='date'>$DATE</span>"
    2.26 +			fi
    2.27 +		done
    2.28 +		echo "</pre>"
    2.29 +	else
    2.30 +		# List all pkgs affected by a bug
    2.31 +		echo "<h2>Buggy packages</h2>"
    2.32 +		echo "<pre>"
    2.33 +		for bug in $(fgrep -l "OPEN" $bugdir/*/bug.conf)
    2.34 +		do
    2.35 +			. ${bug}
    2.36 +			pkgs="$pkgs $PKGS"
    2.37 +			unset PKGS
    2.38 +		done
    2.39 +		for pkg in $pkgs; do
    2.40 +			echo "<a href='?pkg=$pkg'>$pkg</a> "
    2.41 +		done
    2.42 +		echo "</pre>"
    2.43 +	fi
    2.44 +	html_footer
    2.45 +	exit 0
    2.46 +fi
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/web/plugins/packages/packages.conf	Sat Feb 11 15:19:38 2017 +0100
     3.3 @@ -0,0 +1,13 @@
     3.4 +# TinyCM/TazBug Plugin configuration
     3.5 +
     3.6 +PLUGIN="Buggy packages"
     3.7 +SHORT_DESC="List buggy packages or all bugs related to a package"
     3.8 +MAINTAINER="devel@slitaz.org"
     3.9 +
    3.10 +# All users
    3.11 +BUGS_TOOLS="${BUGS_TOOLS} <a href='?packages'>Buggy packages</a>"
    3.12 +
    3.13 +# Authenticated users
    3.14 +PLUGINS_TOOLS="${PLUGINS_TOOLS}"
    3.15 +
    3.16 +# Configurable variables used in plugin.cgi
     4.1 --- a/web/plugins/pkgs/pkgs.cgi	Sat Feb 11 09:56:12 2017 +0000
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,43 +0,0 @@
     4.4 -#!/bin/sh
     4.5 -#
     4.6 -# TazBug Plugin - Buggy packages plugins
     4.7 -#
     4.8 -
     4.9 -if [ "$(GET packages)" ] || [ "$(GET pkg)" ]; then
    4.10 -	d="Skel"
    4.11 -	header
    4.12 -	html_header
    4.13 -	user_box
    4.14 -	if [ "$(GET pkg)" ]; then
    4.15 -		pkg=$(GET pkg)
    4.16 -		echo "<h2>Bugs for: $pkg</h2>"
    4.17 -		echo "<pre>"
    4.18 -		for bug in $(fgrep -l "OPEN" $bugdir/*/bug.conf)
    4.19 -		do
    4.20 -			. ${bug}
    4.21 -			if echo "$PKGS" | fgrep -q "$pkg"; then
    4.22 -				dir=$(dirname $bug)
    4.23 -				id=$(basename $dir)
    4.24 -				echo "ID: $id <a href='$script?id=$id'>$BUG</a> \
    4.25 -<span class='date'>$DATE</span>"
    4.26 -			fi
    4.27 -		done
    4.28 -		echo "</pre>"
    4.29 -	else
    4.30 -		# List all pkgs affected by a bug
    4.31 -		echo "<h2>Buggy packages</h2>"
    4.32 -		echo "<pre>"
    4.33 -		for bug in $(fgrep -l "OPEN" $bugdir/*/bug.conf)
    4.34 -		do
    4.35 -			. ${bug}
    4.36 -			pkgs="$pkgs $PKGS"
    4.37 -			unset PKGS
    4.38 -		done
    4.39 -		for pkg in $pkgs; do
    4.40 -			echo "<a href='?pkg=$pkg'>$pkg</a> "
    4.41 -		done
    4.42 -		echo "</pre>"
    4.43 -	fi
    4.44 -	html_footer
    4.45 -	exit 0
    4.46 -fi
     5.1 --- a/web/plugins/pkgs/pkgs.conf	Sat Feb 11 09:56:12 2017 +0000
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,13 +0,0 @@
     5.4 -# TinyCM/TazBug Plugin configuration
     5.5 -
     5.6 -PLUGIN="Buggy packages"
     5.7 -SHORT_DESC="List buggy packages or all bugs related to a package"
     5.8 -MAINTAINER="devel@slitaz.org"
     5.9 -
    5.10 -# All users
    5.11 -BUGS_TOOLS="${BUGS_TOOLS} <a href='?packages'>Buggy packages</a>"
    5.12 -
    5.13 -# Authenticated users
    5.14 -PLUGINS_TOOLS="${PLUGINS_TOOLS}"
    5.15 -
    5.16 -# Configurable variables used in plugin.cgi
     6.1 --- a/web/style.css	Sat Feb 11 09:56:12 2017 +0000
     6.2 +++ b/web/style.css	Sat Feb 11 15:19:38 2017 +0100
     6.3 @@ -12,7 +12,8 @@
     6.4  	overflow: auto;
     6.5  	font-size: 98%;
     6.6  }
     6.7 -textarea { width: 100%; }
     6.8 +textarea, table { width: 100%; }
     6.9 +thead { font-weight: bold; }
    6.10  
    6.11  /* Header */
    6.12