From b84be525c0da4da0c213323f231c07b623836c30 Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Mon, 27 Apr 2020 14:17:08 +0200 Subject: [PATCH] www: repoinfo page Fixes: https://pagure.io/koji/issue/2181 --- www/kojiweb/buildrootinfo.chtml | 2 +- www/kojiweb/index.py | 19 +++++++++++++++++++ www/kojiweb/repoinfo.chtml | 26 ++++++++++++++++++++++++++ www/kojiweb/taginfo.chtml | 7 ++++++- www/kojiweb/taskinfo_params.chtml | 8 ++++---- www/lib/kojiweb/util.py | 5 +++++ www/static/koji.css | 8 ++++---- 7 files changed, 65 insertions(+), 10 deletions(-) create mode 100644 www/kojiweb/repoinfo.chtml diff --git a/www/kojiweb/buildrootinfo.chtml b/www/kojiweb/buildrootinfo.chtml index e04781a5..7d1d4de6 100644 --- a/www/kojiweb/buildrootinfo.chtml +++ b/www/kojiweb/buildrootinfo.chtml @@ -29,7 +29,7 @@ Retired$util.formatTimeLong($buildroot.retire_event_time) - Repo ID$buildroot.repo_id + Repo ID$buildroot.repo_id Repo Tag$buildroot.tag_name diff --git a/www/kojiweb/index.py b/www/kojiweb/index.py index d27e4f08..d6b847a9 100644 --- a/www/kojiweb/index.py +++ b/www/kojiweb/index.py @@ -2521,3 +2521,22 @@ def watchlogs(environ, taskID): """ % 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') diff --git a/www/kojiweb/repoinfo.chtml b/www/kojiweb/repoinfo.chtml new file mode 100644 index 00000000..afbcfe07 --- /dev/null +++ b/www/kojiweb/repoinfo.chtml @@ -0,0 +1,26 @@ +#import koji +#from kojiweb import util + +#include "includes/header.chtml" + +

Information for repo $repo_id

+ +#if $repo + + + + #set $state = $util.repoState($repo.state) + + + #if $repo.state != koji.REPO_STATES['DELETED'] + + + #end if + +
ID$repo.id
Tag$repo.tag_name
State$state
Event$repo.create_event ($util.formatTimeLong($repo.creation_time))
URLrepodata
Repo jsonrepo.json
Dist repo?#if $repo.dist then 'yes' else 'no'#
+#else +Repo $repo_id not found. +#end if + + +#include "includes/footer.chtml" diff --git a/www/kojiweb/taginfo.chtml b/www/kojiweb/taginfo.chtml index 6bf5a182..63b1fb9e 100644 --- a/www/kojiweb/taginfo.chtml +++ b/www/kojiweb/taginfo.chtml @@ -112,7 +112,12 @@ #end if - Repo created#if $repo then $util.formatTimeRSS($repo.creation_time) else ''# + Repo created + + #if $repo + $util.formatTimeRSS($repo.creation_time) + #end if + Packages diff --git a/www/kojiweb/taskinfo_params.chtml b/www/kojiweb/taskinfo_params.chtml index eed2f6b5..b83a4d2b 100644 --- a/www/kojiweb/taskinfo_params.chtml +++ b/www/kojiweb/taskinfo_params.chtml @@ -184,17 +184,17 @@ $printOpts($params[2]) #end if #elif $task.method == 'distRepo' Tag: $tag.name
-Repo ID: $params[1]
+Repo ID: $params[1]
Keys: $printValue(0, $params[2])
$printOpts($params[3]) #elif $task.method == 'prepRepo' Tag: $params[0].name #elif $task.method == 'createrepo' -Repo ID: $params[0]
+Repo ID: $params[0]
Arch: $params[1]
#set $oldrepo = $params[2] #if $oldrepo - Old Repo ID: $oldrepo.id
+ Old Repo ID: $oldrepo.id
Old Repo Creation: $koji.formatTimeLong($oldrepo.creation_time)
#end if #if $len($params) > 4 and $params[4] @@ -202,7 +202,7 @@ $printOpts($params[3]) #end if #elif $task.method == 'createdistrepo' Tag: $tag.name
-Repo ID: $params[1]
+Repo ID: $params[1]
Arch: $printValue(0, $params[2])
Keys: $printValue(0, $params[3])
Options: $printMap($params[4], '    ') diff --git a/www/lib/kojiweb/util.py b/www/lib/kojiweb/util.py index 90f569f3..8d9f5f3b 100644 --- a/www/lib/kojiweb/util.py +++ b/www/lib/kojiweb/util.py @@ -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() diff --git a/www/static/koji.css b/www/static/koji.css index aa0b912e..b2535f99 100644 --- a/www/static/koji.css +++ b/www/static/koji.css @@ -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; }