mark draft rpms in web ui lists
This commit is contained in:
parent
69d6f4139e
commit
134360df2e
2 changed files with 20 additions and 1 deletions
|
|
@ -65,7 +65,7 @@ colspan="2" #slurp
|
|||
#for $rpm in $rpms
|
||||
<tr class="$util.rowToggle($self)">
|
||||
#set $epoch = ($rpm.epoch != None and $str($rpm.epoch) + ':' or '')
|
||||
<td><a href="rpminfo?rpmID=$rpm.id">$util.escapeHTML($rpm.name)-$epoch$rpm.version-$rpm.release.${rpm.arch}.rpm</a></td>
|
||||
<td>$util.formatRPM($rpm)</td>
|
||||
#if $type in ['component', 'image']
|
||||
#if $rpm.external_repo_id == 0
|
||||
<td>internal</td>
|
||||
|
|
|
|||
|
|
@ -568,6 +568,25 @@ def formatLink(url):
|
|||
return url
|
||||
|
||||
|
||||
def formatRPM(rpminfo, link=True):
|
||||
"""Format an rpm dict for display"""
|
||||
rpminfo = rpminfo.copy()
|
||||
if rpminfo.get('epoch'):
|
||||
rpminfo['epoch'] = str(rpminfo['epoch']) + ':'
|
||||
else:
|
||||
rpminfo['epoch'] = ''
|
||||
if rpminfo.get('draft'):
|
||||
rpminfo['suffix'] = f" (draft_{rpminfo.get('build_id', '???')})"
|
||||
else:
|
||||
rpminfo['suffix'] = ''
|
||||
label = escapeHTML("%(name)s-%(epoch)s%(version)s-%(release)s.%(arch)s%(suffix)s" % rpminfo)
|
||||
if link:
|
||||
rpm_id = rpminfo['id']
|
||||
return f'<a href="rpminfo?rpmID={rpm_id}">{label}</a>'
|
||||
else:
|
||||
return label
|
||||
|
||||
|
||||
def rowToggle(template):
|
||||
"""If the value of template._rowNum is even, return 'row-even';
|
||||
if it is odd, return 'row-odd'. Increment the value before checking it.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue