www: repoinfo page

Fixes: https://pagure.io/koji/issue/2181
This commit is contained in:
Tomas Kopecek 2020-04-27 14:17:08 +02:00
parent a492140d9c
commit b84be525c0
7 changed files with 65 additions and 10 deletions

View file

@ -29,7 +29,7 @@
<th>Retired</th><td>$util.formatTimeLong($buildroot.retire_event_time)</td>
</tr>
<tr>
<th>Repo ID</th><td>$buildroot.repo_id</td>
<th>Repo ID</th><td><a href="repoinfo?repoID=$buildroot.repo_id">$buildroot.repo_id</a></td>
</tr>
<tr>
<th>Repo Tag</th><td><a href="taginfo?tagID=$buildroot.tag_id">$buildroot.tag_name</a></td>

View file

@ -2521,3 +2521,22 @@ def watchlogs(environ, taskID):
</html>
""" % values
return html
def repoinfo(environ, repoID):
values = _initValues(environ, 'Repo Info', 'tags')
server = _getServer(environ)
values['repo_id'] = repoID
repo_info = server.repoInfo(repoID, strict=False)
values['repo'] = repo_info
if repo_info:
topurl = environ['koji.options']['KojiFilesURL']
pathinfo = koji.PathInfo(topdir=topurl)
if repo_info['dist']:
values['url'] = pathinfo.distrepo(repo_info['id'], repo_info['tag_name'])
else:
values['url'] = pathinfo.repo(repo_info['id'], repo_info['tag_name'])
values['repo_json'] = os.path.join(pathinfo.repo(repo_info['id'], repo_info['tag_name']),
'repo.json')
return _genHTML(environ, 'repoinfo.chtml')

View file

@ -0,0 +1,26 @@
#import koji
#from kojiweb import util
#include "includes/header.chtml"
<h4>Information for repo $repo_id</h4>
#if $repo
<table>
<tr><th>ID</th><td>$repo.id</td><th></tr>
<tr><th>Tag</th><td><a href="taginfo?tagID=$repo.tag_id">$repo.tag_name</a></td></tr>
#set $state = $util.repoState($repo.state)
<tr><th>State</th><td class="repo$state">$state</td></tr>
<tr><th>Event</th><td>$repo.create_event ($util.formatTimeLong($repo.creation_time))</td></tr>
#if $repo.state != koji.REPO_STATES['DELETED']
<tr><th>URL</th><td><a href="$url">repodata</a></td></tr>
<tr><th>Repo json</th><td><a href="$repo_json">repo.json</a></td></tr>
#end if
<tr><th>Dist repo?</th><td class="$str($repo.dist).lower()">#if $repo.dist then 'yes' else 'no'#</td></tr>
</table>
#else
Repo $repo_id not found.
#end if
#include "includes/footer.chtml"

View file

@ -112,7 +112,12 @@
</tr>
#end if
<tr>
<th>Repo&nbsp;created</th><td>#if $repo then $util.formatTimeRSS($repo.creation_time) else ''#</td>
<th>Repo&nbsp;created</th>
<td>
#if $repo
<a href="repoinfo?repoID=$repo.id">$util.formatTimeRSS($repo.creation_time)</a>
#end if
</td>
</tr>
<tr>
<th>Packages</th>

View file

@ -184,17 +184,17 @@ $printOpts($params[2])
#end if
#elif $task.method == 'distRepo'
<strong>Tag:</strong> <a href="taginfo?tagID=$tag.id">$tag.name</a><br/>
<strong>Repo ID:</strong> <a href="$pathinfo.distrepo($params[1],$tag.name)">$params[1]</a></br>
<strong>Repo ID:</strong> <a href="repoinfo?repoID=$params[1]">$params[1]</a></br>
<strong>Keys:</strong> $printValue(0, $params[2])<br/>
$printOpts($params[3])
#elif $task.method == 'prepRepo'
<strong>Tag:</strong> <a href="taginfo?tagID=$params[0].id">$params[0].name</a>
#elif $task.method == 'createrepo'
<strong>Repo ID:</strong> $params[0]<br/>
<strong>Repo ID:</strong> <a href="repoinfo?repoID=$params[0]">$params[0]</a><br/>
<strong>Arch:</strong> $params[1]<br/>
#set $oldrepo = $params[2]
#if $oldrepo
<strong>Old Repo ID:</strong> $oldrepo.id<br/>
<strong>Old Repo ID:</strong> <a href="repoinfo?repoID=$oldrepo.id">$oldrepo.id</a><br/>
<strong>Old Repo Creation:</strong> $koji.formatTimeLong($oldrepo.creation_time)<br/>
#end if
#if $len($params) > 4 and $params[4]
@ -202,7 +202,7 @@ $printOpts($params[3])
#end if
#elif $task.method == 'createdistrepo'
<strong>Tag:</strong> <a href="taginfo?tagID=$tag.id">$tag.name</a><br/>
<strong>Repo ID:</strong> <a href="$pathinfo.distrepo($params[1],$tag.name)">$params[1]</a></br>
<strong>Repo ID:</strong> <a href="repoinfo?repoID=$params[1]">$params[1]</a></br>
<strong>Arch:</strong> $printValue(0, $params[2])<br/>
<strong>Keys:</strong> $printValue(0, $params[3])<br/>
<strong>Options:</strong> $printMap($params[4], '&nbsp;&nbsp;&nbsp;&nbsp;')

View file

@ -447,6 +447,11 @@ def repoStateName(stateID):
return 'unknown'
def repoState(stateID):
"""Convert a numeric repo state into a readable name"""
return koji.REPO_STATES[stateID].lower()
def taskState(stateID):
"""Convert a numeric task state into a readable name"""
return koji.TASK_STATES[stateID].lower()

View file

@ -387,7 +387,7 @@ tr.row-even td.tree span.treeLabel {
background-color: #eee;
}
.taskfree {
.taskfree, .repoinit {
color: #30c;
}
@ -395,11 +395,11 @@ tr.row-even td.tree span.treeLabel {
color: #f60;
}
.taskclosed {
.taskclosed, .repoready {
color: #0c0;
}
.taskcanceled {
.taskcanceled, .repoexpired {
color: #c90;
}
@ -407,7 +407,7 @@ tr.row-even td.tree span.treeLabel {
color: #c0f;
}
.taskfailed {
.taskfailed, .repodeleted, .repoproblem {
color: #c00;
}