move buildroot label display code into util function
This commit is contained in:
parent
d8865cdd51
commit
e50b5e04d7
4 changed files with 13 additions and 16 deletions
|
|
@ -51,7 +51,7 @@
|
|||
#end if
|
||||
#if $builtInRoot
|
||||
<tr>
|
||||
<th>Buildroot</th><td><a href="buildrootinfo?buildrootID=$builtInRoot.id">$builtInRoot.tag_name-$builtInRoot.id-$builtInRoot.repo_id</a></td>
|
||||
<th>Buildroot</th><td><a href="buildrootinfo?buildrootID=$builtInRoot.id">$util.brLabel($builtInRoot)</a></td>
|
||||
</tr>
|
||||
#end if
|
||||
#if $files
|
||||
|
|
@ -126,7 +126,7 @@
|
|||
</tr>
|
||||
#for $buildroot in $buildroots
|
||||
<tr class="$util.rowToggle($self)">
|
||||
<td><a href="buildrootinfo?buildrootID=$buildroot.id">$buildroot._display</a></td>
|
||||
<td><a href="buildrootinfo?buildrootID=$buildroot.id">$util.brLabel($buildroot)</a></td>
|
||||
<td>$util.formatTime($buildroot.create_event_time)</td>
|
||||
<td>$util.imageTag($util.brStateName($buildroot.state))</td>
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -1341,10 +1341,6 @@ def rpminfo(environ, rpmID, fileOrder='name', fileStart=None, buildrootOrder='-i
|
|||
builtInRoot = None
|
||||
if rpm['buildroot_id'] != None:
|
||||
builtInRoot = server.getBuildroot(rpm['buildroot_id'])
|
||||
if builtInRoot['br_type'] == koji.BR_TYPES['STANDARD']:
|
||||
builtInRoot['_display'] = '%(tag_name)s-%(id)i-%(repo_id)i' % builtInRoot
|
||||
else:
|
||||
builtInRoot['_display'] = '%(cg_name)s:%(id)i' % builtInRoot
|
||||
if rpm['external_repo_id'] == 0:
|
||||
values['requires'] = server.getRPMDeps(rpm['id'], koji.DEP_REQUIRE)
|
||||
values['requires'].sort(_sortbyname)
|
||||
|
|
@ -1395,12 +1391,6 @@ def archiveinfo(environ, archiveID, fileOrder='name', fileStart=None, buildrootO
|
|||
start=buildrootStart, dataName='buildroots', prefix='buildroot',
|
||||
order=buildrootOrder)
|
||||
|
||||
for br in buildroots:
|
||||
if br['br_type'] == koji.BR_TYPES['STANDARD']:
|
||||
br['_display'] = '%(tag_name)s-%(id)i-%(repo_id)i' % br
|
||||
else:
|
||||
br['_display'] = '%(cg_name)s:%(id)i' % br
|
||||
|
||||
values['title'] = archive['filename'] + ' | Archive Info'
|
||||
|
||||
values['archiveID'] = archive['id']
|
||||
|
|
@ -1638,14 +1628,13 @@ def buildrootinfo(environ, buildrootID, builtStart=None, builtOrder=None, compon
|
|||
|
||||
elif buildroot['br_type'] == koji.BR_TYPES['STANDARD']:
|
||||
template = 'buildrootinfo.chtml'
|
||||
values['title'] = '%(tag_name)s-%(id)i-%(repo_id)i | Buildroot Info' % buildroot
|
||||
values['task'] = server.getTaskInfo(buildroot['task_id'], request=True)
|
||||
|
||||
else:
|
||||
template = 'buildrootinfo_cg.chtml'
|
||||
values['title'] = '%(cg_name)s:%(id)i | Buildroot Info' % buildroot
|
||||
# TODO - fetch tools and extras info
|
||||
|
||||
values['title'] = '%s | Buildroot Info' % kojiweb.util.brLabel(buildroot)
|
||||
values['buildroot'] = buildroot
|
||||
|
||||
return _genHTML(environ, template)
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@
|
|||
</tr>
|
||||
#if $builtInRoot
|
||||
<tr>
|
||||
<th>Buildroot</th><td><a href="buildrootinfo?buildrootID=$builtInRoot.id">$builtInRoot._display</a></td>
|
||||
<th>Buildroot</th><td><a href="buildrootinfo?buildrootID=$builtInRoot.id">$util.brLabel($builtInRoot)</a></td>
|
||||
</tr>
|
||||
#end if
|
||||
#if $rpm.external_repo_id == 0
|
||||
|
|
@ -208,7 +208,7 @@
|
|||
</tr>
|
||||
#for $buildroot in $buildroots
|
||||
<tr class="$util.rowToggle($self)">
|
||||
<td><a href="buildrootinfo?buildrootID=$buildroot.id">$buildroot.tag_name-$buildroot.id-$buildroot.repo_id</a></td>
|
||||
<td><a href="buildrootinfo?buildrootID=$buildroot.id">$util.brLabel($buildroot)</a></td>
|
||||
<td>$util.formatTime($buildroot.create_event_time)</td>
|
||||
<td>$util.imageTag($util.brStateName($buildroot.state))</td>
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -377,6 +377,14 @@ def brStateName(stateID):
|
|||
"""Convert a numeric buildroot state into a readable name."""
|
||||
return koji.BR_STATES[stateID].lower()
|
||||
|
||||
|
||||
def brLabel(brinfo):
|
||||
if brinfo['br_type'] == koji.BR_TYPES['STANDARD']:
|
||||
return '%(tag_name)s-%(id)i-%(repo_id)i' % brinfo
|
||||
else:
|
||||
return '%(cg_name)s:%(id)i' % brinfo
|
||||
|
||||
|
||||
def repoStateName(stateID):
|
||||
"""Convert a numeric repository state into a readable name."""
|
||||
if stateID == koji.REPO_INIT:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue