From 637524471554f4691c0cb543f7991d0722041dce Mon Sep 17 00:00:00 2001 From: Mike McLean Date: Feb 14 2017 15:58:37 +0000 Subject: Merge #281 `web.conf options for specifying which methods will appear in filter` --- diff --git a/www/conf/web.conf b/www/conf/web.conf index 4069258..2ec0959 100644 --- a/www/conf/web.conf +++ b/www/conf/web.conf @@ -1,6 +1,6 @@ [web] SiteName = koji -#KojiTheme = mytheme +# KojiTheme = mytheme # Key urls KojiHubURL = http://hub.example.com/kojihub @@ -32,4 +32,13 @@ LiteralFooter = True # This can be a space-delimited list of the numeric IDs of users that you want # to hide from tasks listed on the front page. You might want to, for instance, # hide the activity of an account used for continuous integration. -#HiddenUsers = 5372 1234 +# HiddenUsers = 5372 1234 + +# Task types visible in pulldown menu on tasks page. +# Tasks = +# runroot plugin provided via main package could be listed as: +# Tasks = runroot +# Tasks that can exist without a parent +# ToplevelTasks = +# Tasks that can have children +# ParentTasks = diff --git a/www/kojiweb/index.py b/www/kojiweb/index.py index c529abf..6c449a6 100644 --- a/www/kojiweb/index.py +++ b/www/kojiweb/index.py @@ -416,7 +416,6 @@ def notificationdelete(environ, notificationID): _redirect(environ, 'index') - # All Tasks _TASKS = ['build', 'buildSRPMFromSCM', @@ -441,7 +440,6 @@ _TASKS = ['build', 'createAppliance', 'image', 'createImage', - 'runroot', 'livemedia', 'createLiveMedia'] # Tasks that can exist without a parent @@ -467,15 +465,15 @@ def tasks(environ, owner=None, state='active', view='tree', method='all', hostID values['users'] = server.listUsers(queryOpts={'order': 'name'}) - if method in _TASKS: + if method in _TASKS + environ['koji.options']['Tasks']: opts['method'] = method else: method = 'all' values['method'] = method - values['alltasks'] = _TASKS + values['alltasks'] = _TASKS + environ['koji.options']['Tasks'] treeEnabled = True - if hostID or (method not in ['all'] + _PARENT_TASKS): + if hostID or (method not in ['all'] + _PARENT_TASKS + environ['koji.options']['ParentTasks']): # force flat view if we're filtering by a hostID or a task that never has children if view == 'tree': view = 'flat' @@ -484,7 +482,7 @@ def tasks(environ, owner=None, state='active', view='tree', method='all', hostID values['treeEnabled'] = treeEnabled toplevelEnabled = True - if method not in ['all'] + _TOPLEVEL_TASKS: + if method not in ['all'] + _TOPLEVEL_TASKS + environ['koji.options']['ToplevelTasks']: # force flat view if we're viewing a task that is never a top-level task if view == 'toplevel': view = 'flat' diff --git a/www/kojiweb/wsgi_publisher.py b/www/kojiweb/wsgi_publisher.py index f250afd..6fd7f04 100644 --- a/www/kojiweb/wsgi_publisher.py +++ b/www/kojiweb/wsgi_publisher.py @@ -93,6 +93,10 @@ class Dispatcher(object): ['LogLevel', 'string', 'WARNING'], ['LogFormat', 'string', '%(msecs)d [%(levelname)s] m=%(method)s u=%(user_name)s p=%(process)s r=%(remoteaddr)s %(name)s: %(message)s'], + ['Tasks', 'list', []], + ['ToplevelTasks', 'list', []], + ['ParentTasks', 'list', []], + ['RLIMIT_AS', 'string', None], ['RLIMIT_CORE', 'string', None], ['RLIMIT_CPU', 'string', None], @@ -153,6 +157,8 @@ class Dispatcher(object): opts[name] = config.getint(*key) elif dtype == 'boolean': opts[name] = config.getboolean(*key) + elif dtype == 'list': + opts[name] = [x.strip() for x in config.get(*key).split(',')] else: opts[name] = config.get(*key) else: