allow selection of only Maven builds on the builds page
This commit is contained in:
parent
97b590b272
commit
22f540e94d
2 changed files with 37 additions and 38 deletions
|
|
@ -1,34 +1,23 @@
|
|||
#import koji
|
||||
#from kojiweb import util
|
||||
|
||||
#def toggleLink($comp, $label, $link)
|
||||
#if $comp
|
||||
<strong>$label</strong>#slurp
|
||||
#else
|
||||
<a href="$link">$label</a>#slurp
|
||||
#end if
|
||||
#end def
|
||||
|
||||
#include "includes/header.chtml"
|
||||
|
||||
<h4>#if $state != None then $util.stateName($state).capitalize() else ''# Builds#if $prefix then ' starting with "%s"' % $prefix else ''##if $user then ' by <a href="userinfo?userID=%i">%s</a>' % ($user.id, $user.name) else ''##if $tag then ' in tag <a href="taginfo?tagID=%i">%s</a>' % ($tag.id, $tag.name) else ''#</h4>
|
||||
<h4>#if $state != None then $util.stateName($state).capitalize() else ''##if $mavenonly then ' Maven' else ''# Builds#if $prefix then ' starting with "%s"' % $prefix else ''##if $user then ' by <a href="userinfo?userID=%i">%s</a>' % ($user.id, $user.name) else ''##if $tag then ' in tag <a href="taginfo?tagID=%i">%s</a>' % ($tag.id, $tag.name) else ''#</h4>
|
||||
|
||||
<table class="data-list">
|
||||
#if $tag
|
||||
<tr>
|
||||
<td colspan="6">
|
||||
#if $inherited
|
||||
<a href="builds?inherited=0$util.passthrough($self, 'userID', 'tagID', 'order', 'prefix', 'state')">Hide inherited builds</a>
|
||||
#else
|
||||
<a href="builds?${util.passthrough($self, 'userID', 'tagID', 'order', 'prefix', 'state')[1:]}">Show inherited builds</a>
|
||||
#end if
|
||||
</td>
|
||||
</tr>
|
||||
#end if
|
||||
<tr>
|
||||
<td colspan="#if $tag then '6' else '5'#">
|
||||
#if $tag
|
||||
<strong>Inherited</strong>:
|
||||
<select name="inherited" class="filterlist" onchange="javascript: window.location = 'builds?inherited=' + this.value + '$util.passthrough($self, 'userID', 'tagID', 'order', 'prefix', 'state', 'mavenonly')';">
|
||||
<option value="1" #if $inherited then 'selected="selected"' else ''#>yes</option>
|
||||
<option value="0" #if not $inherited then 'selected="selected"' else ''#>no</option>
|
||||
</select>
|
||||
<br/>
|
||||
#end if
|
||||
<strong>State</strong>:
|
||||
<select name="state" class="filterlist" onchange="javascript: window.location = 'builds?state=' + this.value + '$util.passthrough($self, 'userID', 'tagID', 'order', 'prefix', 'inherited')';">
|
||||
<select name="state" class="filterlist" onchange="javascript: window.location = 'builds?state=' + this.value + '$util.passthrough($self, 'userID', 'tagID', 'order', 'prefix', 'inherited', 'mavenonly')';">
|
||||
<option value="all">all</option>
|
||||
#for $stateOpt in ['BUILDING', 'COMPLETE', 'FAILED', 'CANCELED']
|
||||
<option value="$koji.BUILD_STATES[$stateOpt]" #if $state == $koji.BUILD_STATES[$stateOpt] then 'selected="selected"' else ''#>$stateOpt.lower()</option>
|
||||
|
|
@ -56,6 +45,12 @@
|
|||
<option value="$userOption.name" #if $userOption.name == ($user and $user.name or None) then 'selected="selected"' else ''#>$userOption.name</option>
|
||||
#end for
|
||||
</select>
|
||||
<br/>
|
||||
<strong>Type</strong>:
|
||||
<select name="mavenonly" class="filterlist" onchange="javascript: window.location='builds?mavenonly=' + this.value + '$util.passthrough($self, 'userID', 'tagID', 'order', 'prefix', 'inherited', 'state')';">
|
||||
<option value="0" #if not $mavenonly then 'selected="selected"' else ''#>all</option>
|
||||
<option value="1" #if $mavenonly then 'selected="selected"' else ''#>Maven</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
@ -64,12 +59,12 @@
|
|||
#if $prefix == $char
|
||||
<strong>$char</strong>
|
||||
#else
|
||||
<a href="builds?prefix=$char$util.passthrough($self, 'userID', 'tagID', 'order', 'inherited', 'state')">$char</a>
|
||||
<a href="builds?prefix=$char$util.passthrough($self, 'userID', 'tagID', 'order', 'inherited', 'state', 'mavenonly')">$char</a>
|
||||
#end if
|
||||
|
|
||||
#end for
|
||||
#if $prefix
|
||||
<a href="builds?${util.passthrough($self, 'userID', 'tagID', 'order', 'inherited', 'state')[1:]}">all</a>
|
||||
<a href="builds?${util.passthrough($self, 'userID', 'tagID', 'order', 'inherited', 'state', 'mavenonly')[1:]}">all</a>
|
||||
#else
|
||||
<strong>all</strong>
|
||||
#end if
|
||||
|
|
@ -80,7 +75,7 @@
|
|||
#if $len($buildPages) > 1
|
||||
<form class="pageJump">
|
||||
Page:
|
||||
<select onchange="javascript: window.location = 'builds?start=' + this.value * $buildRange + '$util.passthrough($self, 'userID', 'tagID', 'order', 'prefix', 'inherited', 'state')';">
|
||||
<select onchange="javascript: window.location = 'builds?start=' + this.value * $buildRange + '$util.passthrough($self, 'userID', 'tagID', 'order', 'prefix', 'inherited', 'state', 'mavenonly')';">
|
||||
#for $pageNum in $buildPages
|
||||
<option value="$pageNum"#if $pageNum == $buildCurrentPage then ' selected' else ''#>#echo $pageNum + 1#</option>
|
||||
#end for
|
||||
|
|
@ -88,25 +83,25 @@
|
|||
</form>
|
||||
#end if
|
||||
#if $buildStart > 0
|
||||
<a href="builds?start=#echo $buildStart - $buildRange #$util.passthrough($self, 'userID', 'tagID', 'order', 'prefix', 'inherited', 'state')"><<<</a>
|
||||
<a href="builds?start=#echo $buildStart - $buildRange #$util.passthrough($self, 'userID', 'tagID', 'order', 'prefix', 'inherited', 'state', 'mavenonly')"><<<</a>
|
||||
#end if
|
||||
#if $totalBuilds != 0
|
||||
<strong>Builds #echo $buildStart + 1 # through #echo $buildStart + $buildCount # of $totalBuilds</strong>
|
||||
#end if
|
||||
#if $buildStart + $buildCount < $totalBuilds
|
||||
<a href="builds?start=#echo $buildStart + $buildRange#$util.passthrough($self, 'userID', 'tagID', 'order', 'prefix', 'inherited', 'state')">>>></a>
|
||||
<a href="builds?start=#echo $buildStart + $buildRange#$util.passthrough($self, 'userID', 'tagID', 'order', 'prefix', 'inherited', 'state', 'mavenonly')">>>></a>
|
||||
#end if
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="list-header">
|
||||
<th><a href="builds?order=$util.toggleOrder($self, 'build_id')$util.passthrough($self, 'userID', 'tagID', 'prefix', 'inherited', 'state')">ID</a> $util.sortImage($self, 'build_id')</th>
|
||||
<th><a href="builds?order=$util.toggleOrder($self, 'nvr')$util.passthrough($self, 'userID', 'tagID', 'prefix', 'inherited', 'state')">NVR</a> $util.sortImage($self, 'nvr')</th>
|
||||
<th><a href="builds?order=$util.toggleOrder($self, 'build_id')$util.passthrough($self, 'userID', 'tagID', 'prefix', 'inherited', 'state', 'mavenonly')">ID</a> $util.sortImage($self, 'build_id')</th>
|
||||
<th><a href="builds?order=$util.toggleOrder($self, 'nvr')$util.passthrough($self, 'userID', 'tagID', 'prefix', 'inherited', 'state', 'mavenonly')">NVR</a> $util.sortImage($self, 'nvr')</th>
|
||||
#if $tag
|
||||
<th><a href="builds?order=$util.toggleOrder($self, 'tag_name')$util.passthrough($self, 'userID', 'tagID', 'prefix', 'inherited', 'state')">Tag</a> $util.sortImage($self, 'tag_name')</th>
|
||||
<th><a href="builds?order=$util.toggleOrder($self, 'tag_name')$util.passthrough($self, 'userID', 'tagID', 'prefix', 'inherited', 'state', 'mavenonly')">Tag</a> $util.sortImage($self, 'tag_name')</th>
|
||||
#end if
|
||||
<th><a href="builds?order=$util.toggleOrder($self, 'owner_name')$util.passthrough($self, 'userID', 'tagID', 'prefix', 'inherited', 'state')">Built by</a> $util.sortImage($self, 'owner_name')</th>
|
||||
<th><a href="builds?order=$util.toggleOrder($self, 'completion_time')$util.passthrough($self, 'userID', 'tagID', 'prefix', 'inherited', 'state')">Finished</a> $util.sortImage($self, 'completion_time')</th>
|
||||
<th><a href="builds?order=$util.toggleOrder($self, 'state')$util.passthrough($self, 'userID', 'tagID', 'prefix', 'inherited', 'state')">State</a> $util.sortImage($self, 'state')</th>
|
||||
<th><a href="builds?order=$util.toggleOrder($self, 'owner_name')$util.passthrough($self, 'userID', 'tagID', 'prefix', 'inherited', 'state', 'mavenonly')">Built by</a> $util.sortImage($self, 'owner_name')</th>
|
||||
<th><a href="builds?order=$util.toggleOrder($self, 'completion_time')$util.passthrough($self, 'userID', 'tagID', 'prefix', 'inherited', 'state', 'mavenonly')">Finished</a> $util.sortImage($self, 'completion_time')</th>
|
||||
<th><a href="builds?order=$util.toggleOrder($self, 'state')$util.passthrough($self, 'userID', 'tagID', 'prefix', 'inherited', 'state', 'mavenonly')">State</a> $util.sortImage($self, 'state')</th>
|
||||
</tr>
|
||||
#if $len($builds) > 0
|
||||
#for $build in $builds
|
||||
|
|
@ -132,7 +127,7 @@
|
|||
#if $len($buildPages) > 1
|
||||
<form class="pageJump">
|
||||
Page:
|
||||
<select onchange="javascript: window.location = 'builds?start=' + this.value * $buildRange + '$util.passthrough($self, 'userID', 'tagID', 'order', 'prefix', 'inherited', 'state')';">
|
||||
<select onchange="javascript: window.location = 'builds?start=' + this.value * $buildRange + '$util.passthrough($self, 'userID', 'tagID', 'order', 'prefix', 'inherited', 'state', 'mavenonly')';">
|
||||
#for $pageNum in $buildPages
|
||||
<option value="$pageNum"#if $pageNum == $buildCurrentPage then ' selected' else ''#>#echo $pageNum + 1#</option>
|
||||
#end for
|
||||
|
|
@ -140,13 +135,13 @@
|
|||
</form>
|
||||
#end if
|
||||
#if $buildStart > 0
|
||||
<a href="builds?start=#echo $buildStart - $buildRange #$util.passthrough($self, 'userID', 'tagID', 'order', 'prefix', 'inherited', 'state')"><<<</a>
|
||||
<a href="builds?start=#echo $buildStart - $buildRange #$util.passthrough($self, 'userID', 'tagID', 'order', 'prefix', 'inherited', 'state', 'mavenonly')"><<<</a>
|
||||
#end if
|
||||
#if $totalBuilds != 0
|
||||
<strong>Builds #echo $buildStart + 1 # through #echo $buildStart + $buildCount # of $totalBuilds</strong>
|
||||
#end if
|
||||
#if $buildStart + $buildCount < $totalBuilds
|
||||
<a href="builds?start=#echo $buildStart + $buildRange#$util.passthrough($self, 'userID', 'tagID', 'order', 'prefix', 'inherited', 'state')">>>></a>
|
||||
<a href="builds?start=#echo $buildStart + $buildRange#$util.passthrough($self, 'userID', 'tagID', 'order', 'prefix', 'inherited', 'state', 'mavenonly')">>>></a>
|
||||
#end if
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -836,7 +836,7 @@ def buildinfo(req, buildID):
|
|||
|
||||
return _genHTML(req, 'buildinfo.chtml')
|
||||
|
||||
def builds(req, userID=None, tagID=None, state=None, order='-completion_time', start=None, prefix=None, inherited='1'):
|
||||
def builds(req, userID=None, tagID=None, state=None, order='-completion_time', start=None, prefix=None, inherited='1', mavenonly='0'):
|
||||
values = _initValues(req, 'Builds', 'builds')
|
||||
server = _getServer(req)
|
||||
|
||||
|
|
@ -874,13 +874,17 @@ def builds(req, userID=None, tagID=None, state=None, order='-completion_time', s
|
|||
values['order'] = order
|
||||
inherited = int(inherited)
|
||||
values['inherited'] = inherited
|
||||
mavenonly = int(mavenonly)
|
||||
values['mavenonly'] = mavenonly
|
||||
|
||||
if tag:
|
||||
# don't need to consider 'state' here, since only completed builds would be tagged
|
||||
builds = kojiweb.util.paginateResults(server, values, 'listTagged', kw={'tag': tag['id'], 'inherit': bool(inherited), 'prefix': prefix},
|
||||
builds = kojiweb.util.paginateResults(server, values, 'listTagged', kw={'tag': tag['id'], 'inherit': bool(inherited), 'prefix': prefix,
|
||||
'maven_only': bool(mavenonly)},
|
||||
start=start, dataName='builds', prefix='build', order=order)
|
||||
else:
|
||||
builds = kojiweb.util.paginateMethod(server, values, 'listBuilds', kw={'userID': (user and user['id'] or None), 'state': state, 'prefix': prefix},
|
||||
builds = kojiweb.util.paginateMethod(server, values, 'listBuilds', kw={'userID': (user and user['id'] or None), 'state': state, 'prefix': prefix,
|
||||
'mavenOnly': bool(mavenonly)},
|
||||
start=start, dataName='builds', prefix='build', order=order)
|
||||
|
||||
values['chars'] = [chr(char) for char in range(48, 58) + range(97, 123)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue