Dashboard: link the product package

This commit is contained in:
Stephan Kulow 2020-01-31 07:41:58 +01:00
parent 1ad5de89a7
commit d38759cc26
2 changed files with 25 additions and 13 deletions

View File

@ -37,9 +37,9 @@ class Fetcher(object):
amqp_prefix = 'opensuse' amqp_prefix = 'opensuse'
openqa_url = 'https://openqa.opensuse.org' openqa_url = 'https://openqa.opensuse.org'
def add(self, name, nick): def add(self, name, **kwargs):
# cyclic dependency! # cyclic dependency!
self.projects.append(Project(self, name, nick)) self.projects.append(Project(self, name, kwargs))
def build_summary(self, project, repository): def build_summary(self, project, repository):
url = makeurl(self.apiurl, ['build', project, '_result'], { 'repository': repository, 'view': 'summary' }) url = makeurl(self.apiurl, ['build', project, '_result'], { 'repository': repository, 'view': 'summary' })
@ -93,10 +93,11 @@ class Fetcher(object):
return attribute_value_load(self.apiurl, project, 'ProductVersion') return attribute_value_load(self.apiurl, project, 'ProductVersion')
class Project(object): class Project(object):
def __init__(self, fetcher, name, nick): def __init__(self, fetcher, name, kwargs):
self.fetcher = fetcher self.fetcher = fetcher
self.name = name self.name = name
self.nick = nick self.nick = kwargs.get('nick')
self.download_url = kwargs.get('download_url')
self.all_archs = fetcher.generate_all_archs(name) self.all_archs = fetcher.generate_all_archs(name)
self.ttm_status = fetcher.fetch_ttm_status(name) self.ttm_status = fetcher.fetch_ttm_status(name)
self.ttm_version = fetcher.fetch_product_version(name) self.ttm_version = fetcher.fetch_product_version(name)
@ -134,13 +135,14 @@ if __name__ == '__main__':
app = Flask(__name__) app = Flask(__name__)
fetcher.add('openSUSE:Factory', 'Factory') fetcher.add('openSUSE:Factory', nick='Factory', download_url='https://download.opensuse.org/tumbleweed/iso/')
fetcher.add('openSUSE:Factory:Rings:0-Bootstrap', 'Ring 0') fetcher.add('openSUSE:Factory:Live', nick='Live')
fetcher.add('openSUSE:Factory:Rings:1-MinimalX', 'Ring 1') fetcher.add('openSUSE:Factory:Rings:0-Bootstrap', nick='Ring 0')
fetcher.add('openSUSE:Factory:ARM', 'ARM') fetcher.add('openSUSE:Factory:Rings:1-MinimalX', nick='Ring 1')
fetcher.add('openSUSE:Factory:PowerPC', 'Power') fetcher.add('openSUSE:Factory:ARM', nick='ARM', download_url='http://download.opensuse.org/ports/aarch64/tumbleweed/iso/')
fetcher.add('openSUSE:Factory:zSystems', 'System Z') fetcher.add('openSUSE:Factory:PowerPC', nick='Power', download_url='http://download.opensuse.org/ports/ppc/tumbleweed/iso/')
fetcher.add('openSUSE:Factory:RISCV', 'Risc V') fetcher.add('openSUSE:Factory:zSystems', nick='System Z', download_url='http://download.opensuse.org/ports/zsystems/tumbleweed/iso/')
fetcher.add('openSUSE:Factory:RISCV', nick='Risc V', download_url='http://download.opensuse.org/ports/riscv/tumbleweed/iso/')
with app.app_context(): with app.app_context():
rendered = render_template('dashboard.html', rendered = render_template('dashboard.html',

View File

@ -4,6 +4,7 @@
<head> <head>
<!-- Required meta tags --> <!-- Required meta tags -->
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="refresh" content="60" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous"> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
@ -63,13 +64,22 @@
{% endif %} {% endif %}
</td> </td>
<td> <td>
{{ project.ttm_version or 'n.a.' }} {% if project.ttm_version %}
<a href="https://build.opensuse.org/package/show/{{ project.name }}/000product">{{ project.ttm_version }}</a>
{% else %}
n.a.
{% endif %}
</td> </td>
<td> <td>
{{ project.ttm_status.get('testing', 'n.a.') }} {{ project.ttm_status.get('testing', 'n.a.') }}
</td> </td>
<td> <td>
{{ project.ttm_status.get('published', 'n.a.') }} {% set ttm_published = project.ttm_status.get('published', None) %}
{% if ttm_published %}
<a href="{{ project.download_url }}">{{ ttm_published }}</a>
{% else %}
n.a.
{% endif %}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}