mirror of
https://github.com/YunoHost/tartiflette.git
synced 2024-09-03 20:06:08 +02:00
First version of testing PR dashboard
This commit is contained in:
parent
1c86627f77
commit
3101b95213
3 changed files with 84 additions and 0 deletions
16
app/app.py
16
app/app.py
|
@ -1,3 +1,4 @@
|
||||||
|
from datetime import datetime
|
||||||
from flask import render_template, make_response, Blueprint
|
from flask import render_template, make_response, Blueprint
|
||||||
from .models.pr import PullRequest
|
from .models.pr import PullRequest
|
||||||
from .models.applists import App
|
from .models.applists import App
|
||||||
|
@ -181,3 +182,18 @@ def app_maintainer_dash(maintainer=None):
|
||||||
|
|
||||||
return render_template("maintainer.html", maintainers=maintainers, apps=apps, maintainer=maintainer)
|
return render_template("maintainer.html", maintainers=maintainers, apps=apps, maintainer=maintainer)
|
||||||
|
|
||||||
|
@main.route('/testings')
|
||||||
|
def testings():
|
||||||
|
|
||||||
|
apps = App.query.filter(App.testing_pr!=None).all()
|
||||||
|
|
||||||
|
def daysAgo(date):
|
||||||
|
return (datetime.now() - date).days
|
||||||
|
|
||||||
|
for app in apps:
|
||||||
|
app.testing_pr["created_ago"] = daysAgo(app.testing_pr["created_at"])
|
||||||
|
app.testing_pr["updated_ago"] = daysAgo(app.testing_pr["updated_at"])
|
||||||
|
|
||||||
|
apps = sorted(apps, key=lambda app: (-app.testing_pr["created_ago"], -app.testing_pr["updated_ago"], app.name.lower()))
|
||||||
|
|
||||||
|
return render_template("testings.html", apps=apps)
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
<li class="nav-item dropdown">
|
<li class="nav-item dropdown">
|
||||||
<a class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown">Apps observatory</a>
|
<a class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown">Apps observatory</a>
|
||||||
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
|
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
|
||||||
|
<a class="dropdown-item" href="{{ url_for('main.testings')}}">Testing PRs</a>
|
||||||
<a class="dropdown-item" href="{{ url_for('main.appsobservatory_history')}}">History graphs</a>
|
<a class="dropdown-item" href="{{ url_for('main.appsobservatory_history')}}">History graphs</a>
|
||||||
<a class="dropdown-item" href="{{ url_for('main.appsobservatory_rss')}}">RSS</a>
|
<a class="dropdown-item" href="{{ url_for('main.appsobservatory_rss')}}">RSS</a>
|
||||||
<a class="dropdown-item" href="{{ url_for('main.appsobservatory_unlisted')}}">Unlisted apps</a>
|
<a class="dropdown-item" href="{{ url_for('main.appsobservatory_unlisted')}}">Unlisted apps</a>
|
||||||
|
|
67
app/templates/testings.html
Normal file
67
app/templates/testings.html
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<h3 class="text-center font-weight-bold my-5">Opened testings pull requests for apps</h3>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="mx-auto">
|
||||||
|
<div>
|
||||||
|
<table class="table table-responsive ci-app-table" style="margin-top:30px;">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="ci-app-row-title">App</th>
|
||||||
|
<th style="width:150px;"><div>Opened</div></th>
|
||||||
|
<th style="width:150px;"><div>Last update</div></th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for app in apps %}
|
||||||
|
<tr class="appline" app="{{ app.name }}">
|
||||||
|
|
||||||
|
<td class="ci-app-row-title">
|
||||||
|
{% if app.list.name == "official" %}
|
||||||
|
<span class="official-star oi oi-star" title="Official" aria-hidden="true"></span>
|
||||||
|
{% endif %}
|
||||||
|
<a href="{{ url_for('main.appci_app', app=app.name) }}">
|
||||||
|
<span class="font-weight-bold" title="More tests / info for this app">
|
||||||
|
{{ app.name }}</span>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td style="width:150px;"
|
||||||
|
{% if app.testing_pr.created_ago >= 60 %}
|
||||||
|
class="text-danger"
|
||||||
|
{% else %}{% if app.testing_pr.created_ago >= 30 %}
|
||||||
|
class="text-warning"
|
||||||
|
{% endif %}{% endif %}
|
||||||
|
>
|
||||||
|
{{ app.testing_pr.created_ago }} days ago
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td style="width:150px;"
|
||||||
|
{% if app.testing_pr.updated_ago >= 30 %}
|
||||||
|
class="text-danger"
|
||||||
|
{% else %}{% if app.testing_pr.updated_ago >= 15 %}
|
||||||
|
class="text-warning"
|
||||||
|
{% endif %}{% endif %}
|
||||||
|
>
|
||||||
|
{{ app.testing_pr.updated_ago }} days ago
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td class="px-0" style="width:200px">
|
||||||
|
<a href="{{ app.repo }}/pull/{{ app.testing_pr.number }}">
|
||||||
|
<span class="oi oi-external-link text-info"
|
||||||
|
aria-hidden="true"
|
||||||
|
title="To the Pull Request"></span> Go to the pull request
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endblock %}
|
Loading…
Reference in a new issue