diff --git a/hub/kojihub.py b/hub/kojihub.py
index 57fa43d8..ce5af794 100644
--- a/hub/kojihub.py
+++ b/hub/kojihub.py
@@ -7571,6 +7571,7 @@ class RootExports(object):
state[list]: limit to tasks of given state
owner[int]: limit to tasks owned by the user with the given ID
host_id[int]: limit to tasks running on the host with the given ID
+ channel_id[int]: limit to tasks in the specified channel
parent[int]: limit to tasks with the given parent
decode[bool]: whether or not xmlrpc data in the 'request' and 'result'
fields should be decoded; defaults to False
@@ -7612,7 +7613,7 @@ class RootExports(object):
for f in ['arch','state']:
if opts.has_key(f):
conditions.append('%s IN %%(%s)s' % (f, f))
- for f in ['owner', 'host_id', 'parent']:
+ for f in ['owner', 'host_id', 'channel_id', 'parent']:
if opts.has_key(f):
if opts[f] is None:
conditions.append('%s IS NULL' % f)
diff --git a/www/kojiweb/channelinfo.chtml b/www/kojiweb/channelinfo.chtml
index 16def058..31dcdc52 100644
--- a/www/kojiweb/channelinfo.chtml
+++ b/www/kojiweb/channelinfo.chtml
@@ -11,6 +11,9 @@
| Hosts |
diff --git a/www/kojiweb/index.py b/www/kojiweb/index.py
index 361498bf..c14bd357 100644
--- a/www/kojiweb/index.py
+++ b/www/kojiweb/index.py
@@ -372,7 +372,7 @@ _TOPLEVEL_TASKS = ['build', 'buildNotification', 'chainbuild', 'maven', 'newRepo
# Tasks that can have children
_PARENT_TASKS = ['build', 'chainbuild', 'maven', 'newRepo']
-def tasks(req, owner=None, state='active', view='tree', method='all', hostID=None, start=None, order='-id'):
+def tasks(req, owner=None, state='active', view='tree', method='all', hostID=None, channelID=None, start=None, order='-id'):
values = _initValues(req, 'Tasks', 'tasks')
server = _getServer(req)
@@ -444,6 +444,19 @@ def tasks(req, owner=None, state='active', view='tree', method='all', hostID=Non
values['host'] = None
values['hostID'] = None
+ if channelID:
+ try:
+ channelID = int(channelID)
+ except ValueError:
+ pass
+ channel = server.getChannel(channelID, strict=True)
+ opts['channel_id'] = channel['id']
+ values['channel'] = channel
+ values['channelID'] = channel['id']
+ else:
+ values['channel'] = None
+ values['channelID'] = None
+
loggedInUser = req.currentUser
values['loggedInUser'] = loggedInUser
@@ -1506,6 +1519,11 @@ def channelinfo(req, channelID):
values['title'] = channel['name'] + ' | Channel Info'
+ states = [koji.TASK_STATES[s] for s in ('FREE', 'OPEN', 'ASSIGNED')]
+ values['taskCount'] = \
+ server.listTasks(opts={'channel_id': channelID, 'state': states},
+ queryOpts={'countOnly': True})
+
hosts = server.listHosts(channelID=channelID)
hosts.sort(_sortbyname)
diff --git a/www/kojiweb/tasks.chtml b/www/kojiweb/tasks.chtml
index 75837225..ec557382 100644
--- a/www/kojiweb/tasks.chtml
+++ b/www/kojiweb/tasks.chtml
@@ -36,11 +36,11 @@ All
#end if
#end def
-#attr _PASSTHROUGH = ['owner', 'state', 'view', 'method', 'hostID', 'order']
+#attr _PASSTHROUGH = ['owner', 'state', 'view', 'method', 'hostID', 'channelID', 'order']
#include "includes/header.chtml"
- $headerPrefix($state) #if $view == 'toplevel' then 'toplevel' else ''# #if $method != 'all' then $method else ''# Tasks#if $ownerObj then ' owned by %s' % ($ownerObj.id, $ownerObj.name) else ''##if $host then ' on host %s' % ($host.id, $host.name) else ''#
+ $headerPrefix($state) #if $view == 'toplevel' then 'toplevel' else ''# #if $method != 'all' then $method else ''# Tasks#if $ownerObj then ' owned by %s' % ($ownerObj.id, $ownerObj.name) else ''##if $host then ' on host %s' % ($host.id, $host.name) else ''# #if $channel then ' in channel %s' % ($channel.id, $channel.name) else ''#
|