#2193 www: repoinfo page
Merged 2 years ago by tkopecek. Opened 2 years ago by tkopecek.
tkopecek/koji issue2181  into  master

@@ -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>

file modified
+19
@@ -2521,3 +2521,22 @@ 

  </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')

@@ -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"

file modified
+6 -1
@@ -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>

@@ -184,17 +184,17 @@ 

  #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 @@ 

  #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;')

file modified
+5
@@ -447,6 +447,11 @@ 

          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()

file modified
+4 -4
@@ -387,7 +387,7 @@ 

      background-color: #eee;

  }

  

- .taskfree {

+ .taskfree, .repoinit {

      color: #30c;

  }

  
@@ -395,11 +395,11 @@ 

      color: #f60;

  }

  

- .taskclosed {

+ .taskclosed, .repoready {

      color: #0c0;

  }

  

- .taskcanceled {

+ .taskcanceled, .repoexpired {

      color: #c90;

  }

  
@@ -407,7 +407,7 @@ 

      color: #c0f;

  }

  

- .taskfailed {

+ .taskfailed, .repodeleted, .repoproblem {

      color: #c00;

  }

  

@mikem Not sure, if we want to download + parse repo.json. I've put there just a link for now. Is it ok for you?

rebased onto 1808956aef95893463885e9f48fd29975f0cf728

2 years ago

Metadata Update from @tkopecek:
- Pull-request tagged with: testing-ready

2 years ago

rebased onto dd249e0a945290f32bc8ebc108b7e19b35c6124f

2 years ago

rebased onto 52531f947d534122507c749f47780168d0f552e6

2 years ago

We definitely want to display the event id for the repo page and not just the timestamp for that event. We do not want to refer to that time as "Created" since repos can be created at events in the past. I'd say maybe something like:

Event 31587051 (Tue 19 May 2020 11:13:54)

1 new commit added

  • reformat event output
2 years ago

We should probably not display the url and json links when the repo is deleted.

Metadata Update from @jcupova:
- Pull-request tagged with: testing-done

2 years ago

rebased onto 581f2fa

2 years ago

Commit 962e528 fixes this pull-request

Pull-Request has been merged by tkopecek

2 years ago