Add page for unlisted apps

This commit is contained in:
Alexandre Aubin 2018-05-30 02:52:58 +02:00
parent 01cf55c602
commit f248bc81cb
4 changed files with 42 additions and 10 deletions

View file

@ -1,6 +1,7 @@
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.appci import App, AppCI, AppCIBranch from .models.appci import App, AppCI, AppCIBranch
from .models.unlistedapps import UnlistedApp
from .settings import SITE_ROOT from .settings import SITE_ROOT
import json import json
@ -143,3 +144,10 @@ def appsobservatory_rss():
response.headers['Content-Type'] = 'application/rss+xml' response.headers['Content-Type'] = 'application/rss+xml'
return response return response
@main.route('/appsobservatory/unlisted')
def appsobservatory_unlisted():
apps = sorted(UnlistedApp.query.all(), key=lambda a: a.updated_days_ago)
return render_template("unlistedapps.html", apps=apps)

View file

@ -63,16 +63,6 @@ class UnlistedApp(db.Model):
db.session.commit() db.session.commit()
#apps = sorted(apps, key=lambda x: x["updated_days_ago"])
#for app in apps:
# if app["updated_days_ago"] > 100:
# continue
# print(app["name"] + " ... " + app["url"] + " ... " + str(app["updated_days_ago"]))
#with open('apps.json', 'w') as f:
# json.dump(apps, f)
def githubDateToDaysAgo(date): def githubDateToDaysAgo(date):
now = datetime.datetime.now() now = datetime.datetime.now()

View file

@ -47,6 +47,7 @@
<div class="dropdown-menu" aria-labelledby="navbarDropdown"> <div class="dropdown-menu" aria-labelledby="navbarDropdown">
<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>
</div> </div>
</li> </li>
</ul> </ul>

View file

@ -0,0 +1,33 @@
{% extends "base.html" %}
{% block content %}
<h3 class="text-center font-weight-bold my-5">Unlisted apps</h3>
<div class="row">
<div class="mx-auto">
<table id="pullrequests" class="table table-responsive table-sm table-pullrequests">
<thead>
<tr>
<th></th>
<th>Description</th>
<th>Updated</th>
</tr>
</thead>
<tbody>
{% for app in apps %}
<tr>
<td class="col-md-2 text-center">
<a class="btn btn-sm mx-4 py-2 px-3 btn-light text-uppercase
font-weight-bold"
href="{{ app.url }}">{{ app.owner}}/{{ app.name }}</a>
</td>
<td class="column-pr-title font-weight-bold">{{ app.description
or "" }}</td>
<td class="col-md-1 daysAgo" style="font-size: 12px;"
>{{app.updated_days_ago}} days ago</td>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endblock %}