show archives in archives
This commit is contained in:
parent
601871c699
commit
f635493c95
3 changed files with 54 additions and 26 deletions
|
|
@ -148,9 +148,14 @@
|
|||
#end if
|
||||
</td>
|
||||
</tr>
|
||||
#if $show_components
|
||||
#if $show_rpm_components
|
||||
<tr>
|
||||
<th colspan="2"><a href="rpmlist?imageID=$archive.id&type=image" title="Components that are part of this archive">Components</a></th>
|
||||
<th colspan="2"><a href="rpmlist?imageID=$archive.id&type=image" title="RPM components that are part of this archive">RPM components</a></th>
|
||||
</tr>
|
||||
#end if
|
||||
#if $show_archive_components
|
||||
<tr>
|
||||
<th colspan="2"><a href="archivelist?imageID=$archive.id&type=image" title="Archive components that are part of this archive">Archive components</a></th>
|
||||
</tr>
|
||||
#end if
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,19 @@
|
|||
#from kojiweb import util
|
||||
|
||||
#include "includes/header.chtml"
|
||||
#
|
||||
#def getID()
|
||||
#if $type == 'image'
|
||||
imageID=$image.id #slurp
|
||||
#else
|
||||
buildrootID=$buildroot.id #slurp
|
||||
#end if
|
||||
#end def
|
||||
|
||||
#if $type == 'component'
|
||||
<h4>Component Archives of buildroot <a href="buildrootinfo?buildrootID=$buildroot.id">$util.brLabel($buildroot)</a></h4>
|
||||
#elif $type == 'image'
|
||||
<h4>Archives installed in <a href="archiveinfo?archiveID=$image.id">$image.filename</a></h4>
|
||||
#else
|
||||
<h4>Archives built in buildroot <a href="buildrootinfo?buildrootID=$buildroot.id">$util.brLabel($buildroot)</a></h4>
|
||||
#end if
|
||||
|
|
@ -14,7 +24,7 @@
|
|||
#if $len($archivePages) > 1
|
||||
<form class="pageJump">
|
||||
Page:
|
||||
<select onchange="javascript: window.location = 'archivelist?buildrootID=$buildroot.id&start=' + this.value * $archiveRange + '$util.passthrough($self, 'order', 'type')';">
|
||||
<select onchange="javascript: window.location = 'archivelist?$getID()&start=' + this.value * $archiveRange + '$util.passthrough($self, 'order', 'type')';">
|
||||
#for $pageNum in $archivePages
|
||||
<option value="$pageNum"#if $pageNum == $archiveCurrentPage then ' selected' else ''#>#echo $pageNum + 1#</option>
|
||||
#end for
|
||||
|
|
@ -22,21 +32,21 @@
|
|||
</form>
|
||||
#end if
|
||||
#if $archiveStart > 0
|
||||
<a href="archivelist?buildrootID=$buildroot.id&start=#echo $archiveStart - $archiveRange #$util.passthrough($self, 'order', 'type')"><<<</a>
|
||||
<a href="archivelist?$getID()&start=#echo $archiveStart - $archiveRange #$util.passthrough($self, 'order', 'type')"><<<</a>
|
||||
#end if
|
||||
#if $totalArchives != 0
|
||||
<strong>Archives #echo $archiveStart + 1 # through #echo $archiveStart + $archiveCount # of $totalArchives</strong>
|
||||
#end if
|
||||
#if $archiveStart + $archiveCount < $totalArchives
|
||||
<a href="archivelist?buildrootID=$buildroot.id&start=#echo $archiveStart + $archiveRange#$util.passthrough($self, 'order', 'type')">>>></a>
|
||||
<a href="archivelist?$getID()&start=#echo $archiveStart + $archiveRange#$util.passthrough($self, 'order', 'type')">>>></a>
|
||||
#end if
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="list-header">
|
||||
<th><a href="archivelist?buildrootID=$buildroot.id&order=$util.toggleOrder($self, 'filename')$util.passthrough($self, 'type')">Filename</a> $util.sortImage($self, 'filename')</th>
|
||||
<th><a href="archivelist?buildrootID=$buildroot.id&order=$util.toggleOrder($self, 'type_name')$util.passthrough($self, 'type')">Type</a> $util.sortImage($self, 'type_name')</th>
|
||||
<th><a href="archivelist?$getID()&order=$util.toggleOrder($self, 'filename')$util.passthrough($self, 'type')">Filename</a> $util.sortImage($self, 'filename')</th>
|
||||
<th><a href="archivelist?$getID()&order=$util.toggleOrder($self, 'type_name')$util.passthrough($self, 'type')">Type</a> $util.sortImage($self, 'type_name')</th>
|
||||
#if $type == 'component'
|
||||
<th><a href="archivelist?buildrootID=$buildroot.id&order=$util.toggleOrder($self, 'project')$util.passthrough($self, 'type')">Build Dependency?</a> $util.sortImage($self, 'project')</th>
|
||||
<th><a href="archivelist?$getID()&order=$util.toggleOrder($self, 'project')$util.passthrough($self, 'type')">Build Dependency?</a> $util.sortImage($self, 'project')</th>
|
||||
#end if
|
||||
</tr>
|
||||
#if $len($archives) > 0
|
||||
|
|
@ -60,7 +70,7 @@
|
|||
#if $len($archivePages) > 1
|
||||
<form class="pageJump">
|
||||
Page:
|
||||
<select onchange="javascript: window.location = 'archivelist?buildrootID=$buildroot.id&start=' + this.value * $archiveRange + '$util.passthrough($self, 'order', 'type')';">
|
||||
<select onchange="javascript: window.location = 'archivelist?$getID()&start=' + this.value * $archiveRange + '$util.passthrough($self, 'order', 'type')';">
|
||||
#for $pageNum in $archivePages
|
||||
<option value="$pageNum"#if $pageNum == $archiveCurrentPage then ' selected' else ''#>#echo $pageNum + 1#</option>
|
||||
#end for
|
||||
|
|
@ -68,13 +78,13 @@
|
|||
</form>
|
||||
#end if
|
||||
#if $archiveStart > 0
|
||||
<a href="archivelist?buildrootID=$buildroot.id&start=#echo $archiveStart - $archiveRange #$util.passthrough($self, 'order', 'type')"><<<</a>
|
||||
<a href="archivelist?$getID()&start=#echo $archiveStart - $archiveRange #$util.passthrough($self, 'order', 'type')"><<<</a>
|
||||
#end if
|
||||
#if $totalArchives != 0
|
||||
<strong>Archives #echo $archiveStart + 1 # through #echo $archiveStart + $archiveCount # of $totalArchives</strong>
|
||||
#end if
|
||||
#if $archiveStart + $archiveCount < $totalArchives
|
||||
<a href="archivelist?buildrootID=$buildroot.id&start=#echo $archiveStart + $archiveRange#$util.passthrough($self, 'order', 'type')">>>></a>
|
||||
<a href="archivelist?$getID()&start=#echo $archiveStart + $archiveRange#$util.passthrough($self, 'order', 'type')">>>></a>
|
||||
#end if
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -1432,8 +1432,8 @@ def archiveinfo(environ, archiveID, fileOrder='name', fileStart=None, buildrootO
|
|||
values['wininfo'] = wininfo
|
||||
values['builtInRoot'] = builtInRoot
|
||||
values['buildroots'] = buildroots
|
||||
values['show_components'] = archive.get('rootid', False) or \
|
||||
server.listRPMs(imageID=archive['id'], queryOpts={'limit':1})
|
||||
values['show_rpm_components'] = archive.get('rootid', False)
|
||||
values['show_archive_components'] = server.listArchives(imageID=archive['id'], queryOpts={'limit':1})
|
||||
|
||||
return _genHTML(environ, 'archiveinfo.chtml')
|
||||
|
||||
|
|
@ -1723,27 +1723,40 @@ def rpmlist(environ, type, buildrootID=None, imageID=None, start=None, order='nv
|
|||
|
||||
return _genHTML(environ, 'rpmlist.chtml')
|
||||
|
||||
def archivelist(environ, buildrootID, type, start=None, order='filename'):
|
||||
def archivelist(environ, type, buildrootID=None, imageID=None, start=None, order='filename'):
|
||||
values = _initValues(environ, 'Archive List', 'hosts')
|
||||
server = _getServer(environ)
|
||||
|
||||
buildrootID = int(buildrootID)
|
||||
buildroot = server.getBuildroot(buildrootID)
|
||||
if buildroot == None:
|
||||
raise koji.GenericError('unknown buildroot ID: %i' % buildrootID)
|
||||
if buildrootID is not None:
|
||||
buildrootID = int(buildrootID)
|
||||
buildroot = server.getBuildroot(buildrootID)
|
||||
values['buildroot'] = buildroot
|
||||
|
||||
if type == 'component':
|
||||
kojiweb.util.paginateMethod(server, values, 'listArchives', kw={'componentBuildrootID': buildroot['id']},
|
||||
start=start, dataName='archives', prefix='archive', order=order)
|
||||
elif type == 'built':
|
||||
kojiweb.util.paginateMethod(server, values, 'listArchives', kw={'buildrootID': buildroot['id']},
|
||||
if buildroot == None:
|
||||
raise koji.GenericError('unknown buildroot ID: %i' % buildrootID)
|
||||
|
||||
if type == 'component':
|
||||
kojiweb.util.paginateMethod(server, values, 'listArchives', kw={'componentBuildrootID': buildroot['id']},
|
||||
start=start, dataName='archives', prefix='archive', order=order)
|
||||
elif type == 'built':
|
||||
kojiweb.util.paginateMethod(server, values, 'listArchives', kw={'buildrootID': buildroot['id']},
|
||||
start=start, dataName='archives', prefix='archive', order=order)
|
||||
else:
|
||||
raise koji.GenericError('unrecognized type of archivelist')
|
||||
elif imageID is not None:
|
||||
imageID = int(imageID)
|
||||
values['image'] = server.getArchive(imageID)
|
||||
# If/When future image types are supported, add elifs here if needed.
|
||||
if type == 'image':
|
||||
kojiweb.util.paginateMethod(server, values, 'listArchives', kw={'imageID': imageID},
|
||||
start=start, dataName='archives', prefix='archive', order=order)
|
||||
else:
|
||||
raise koji.GenericError('unrecognized type of archivelist')
|
||||
else:
|
||||
raise koji.GenericError('invalid type: %s' % type)
|
||||
# It is an error if neither buildrootID and imageID are defined.
|
||||
raise koji.GenericError('Both buildrootID and imageID are None')
|
||||
|
||||
values['buildroot'] = buildroot
|
||||
values['type'] = type
|
||||
|
||||
values['order'] = order
|
||||
|
||||
return _genHTML(environ, 'archivelist.chtml')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue