Allow the user to search for a job.
From: Jeremy Orlow <jorlow@google.com>
Signed-off-by: Martin Bligh <mbligh@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@1065 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/tko/frontend.py b/tko/frontend.py
index dc440bf..0f85607 100755
--- a/tko/frontend.py
+++ b/tko/frontend.py
@@ -18,6 +18,8 @@
'machine_group': ['machine_group', 'machine_idx', 'machine_idx'],
'hostname': ['hostname', 'machine_idx', 'machine_idx'],
'label': ['label', 'job_idx', 'job_idx'],
+ 'tag': ['tag', 'job_idx', 'job_idx'],
+ 'job': ['job_idx', 'job_idx', 'job_idx'],
'user': ['username', 'job_idx', 'job_idx'],
'test': ['test', 'test', 'test'],
'status': ['word', 'status_idx', 'status'],
@@ -26,6 +28,8 @@
'machine_group': 'machines',
'hostname': 'machines',
'label': 'jobs',
+ 'tag': 'jobs',
+ 'job': 'jobs',
'user': 'jobs',
'test': 'tests',
'status': 'status',
@@ -42,7 +46,10 @@
where = " %s is not null " % lookup_field
else:
sql += "%s " % idx_field
- where = " %s = %s " % (lookup_field, value)
+ if field == 'tag':
+ where = " %s LIKE %s " % (lookup_field, value)
+ else:
+ where = " %s = %s " % (lookup_field, value)
match = db.select(sql, tablename, where)
# returns the value and its field name
diff --git a/tko/index.html b/tko/index.html
index ca5b94b..1d4d579 100644
--- a/tko/index.html
+++ b/tko/index.html
@@ -58,6 +58,7 @@
<ul>
<li>user='johnmacdonald' & test='burnin'</li>
<li>hostname='bdpk1' & user='yinghan'</li>
+<li>tag='134-lesliele%%' to search for job '134-lesliele'</li>
</ul>
</p>
</td>