aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--server/index.py16
-rw-r--r--server/templates/index.html26
2 files changed, 28 insertions, 14 deletions
diff --git a/server/index.py b/server/index.py
index e6a63f5..2204bd3 100644
--- a/server/index.py
+++ b/server/index.py
@@ -1,8 +1,22 @@
+from web import form
from config import render, db
+search_form = form.Form(
+ form.Textbox('cat', value = 'any', description = 'Category'),
+ form.Textbox('pkg', value = 'any', description = 'Package'),
+ form.Textbox('ver', value = 'any', description = 'Version'),
+ form.Textbox('repo', value = 'any', description = 'Repository'),
+ form.Textbox('min_hosts', value = 'any', description = 'Minimum hosts'),
+ form.Textbox('max_hosts', value = 'any', description = 'Maximum hosts'),
+ form.Button('Search', type = 'submit')
+ )
+
class Index(object):
def GET(self):
hosts = db.select('HOSTS', what='COUNT(UUID) as COUNT')
count = hosts[0]['COUNT']
- return render.index(count)
+
+ form = search_form()
+
+ return render.index(count, form)
diff --git a/server/templates/index.html b/server/templates/index.html
index e601b26..24f7ea7 100644
--- a/server/templates/index.html
+++ b/server/templates/index.html
@@ -1,4 +1,4 @@
-$def with (count)
+$def with (count, form)
$var title: Gentoostats
Welcome to the gentoostats webapp <br/>
@@ -7,18 +7,18 @@ Number of hosts: $count<br/>
<h2>Statistics</h2>
<ul>
- <li>Arch statistics: <a href="/gentoostats/arch">/arch</a></li>
- <li>Portage feature statistics: <a href="/gentoostats/feature">/feature</a></li>
- <li>Keyword statistics: <a href="/gentoostats/keyword">/keyword</a></li>
- <li>Language statistics: <a href="/gentoostats/lang">/lang</a></li>
- <li>Mirror statistics: <a href="/gentoostats/mirror">/mirror</a></li>
- <li>Package statistics: <a href="/gentoostats/package">/package</a></li>
- <li>Profile statistics: <a href="/gentoostats/profile">/profile</a></li>
- <li>Repository statistics: <a href="/gentoostats/repo">/repo</a></li>
- <li>Useflag statistics: <a href="/gentoostats/use">/use</a></li>
+ <li>Arch statistics: <a href="arch">/arch</a></li>
+ <li>Portage feature statistics: <a href="feature">/feature</a></li>
+ <li>Keyword statistics: <a href="keyword">/keyword</a></li>
+ <li>Language statistics: <a href="lang">/lang</a></li>
+ <li>Mirror statistics: <a href="mirror">/mirror</a></li>
+ <li>Package statistics: <a href="package">/package</a></li>
+ <li>Profile statistics: <a href="profile">/profile</a></li>
+ <li>Repository statistics: <a href="repo">/repo</a></li>
+ <li>Useflag statistics: <a href="use">/use</a></li>
</ul>
<h2>Package search</h2>
-<ul>
- <li><a href="/gentoostats/search">/search</a></li>
-</ul>
+<form method="GET" action="/gentoostats/search">
+ $:form.render()
+</form>