Commit 78bafd2d authored by Aurélien Campéas's avatar Aurélien Campéas
Browse files

tsviewlog: follow tshistory changes

There is no more a global change log.
We get to see the revisions for one series at a time.
parent 7afea1362577
......@@ -22,19 +22,8 @@ bp = Blueprint('tsview', __name__,
def serie_names(engine):
sql = 'select seriename from tsh.registry order by seriename'
return [name for name, in engine.execute(sql).fetchall()]
def author_names(engine):
sql = 'select distinct author from tsh.changeset order by author'
return [name for name, in engine.execute(sql).fetchall()]
def maxrev(engine):
sql = 'select max(id) from tsh.changeset'
return engine.execute(sql).scalar()
def series_names(tshclass, engine):
return list(tshclass().list_series(engine).keys())
def homeurl():
......@@ -42,7 +31,7 @@ def homeurl():
return homeurl[:homeurl.rindex('/')] + '/'
def tsview(engine, tshclass=timeseries, serie_names=serie_names):
def tsview(engine, tshclass=timeseries, series_names=series_names):
def home():
......@@ -52,20 +41,11 @@ def tsview(engine, tshclass=timeseries, serie_names=serie_names):
class logargs(_argsdict):
defaults = {
'limit': 20,
'series': (),
'seriesvocab': lambda: serie_names(engine),
'authors': (),
'authorsvocab': lambda: author_names(engine),
'fromrev': 0,
'torev': lambda: maxrev(engine)
'series': None,
'seriesvocab': lambda: series_names(tshclass, engine),
types = {
'series': list,
'authors': list,
'limit': int,
'fromrev': int,
'torev': int
'series': str,
......@@ -78,14 +58,15 @@ def tsview(engine, tshclass=timeseries, serie_names=serie_names):
args = logargs(request.args)
tsh = tshclass()
with engine.begin() as cn:
log = tsh.log(cn, limit=args.limit, names=args.series,
fromrev=args.fromrev, torev=args.torev)
log = tsh.log(
if not log:
return 'No result.'
return pd.DataFrame(log).to_html(index=False)
return pd.DataFrame(reversed(log)).to_html(index=False)
def tsdelete():
......@@ -2,39 +2,13 @@
<div class=item>
<label for=series>Series</label>
<select name=series id=series class="form-control" multiple>
<select name=series id=series class="form-control">
{% for s in seriesvocab%}
<option value="{{s}}"{% if s in series %}selected{% endif %}>{{s}}</option>
<option value="{{s}}"{% if s == series %}selected{% endif %}>{{s}}</option>
{% endfor %}
<div class=item>
<label for=authors>Authors</label>
<select name=authors id=authors class="form-control" multiple>
{% for a in authorsvocab%}
<option value="{{a}}"{% if a in authors %}selected{% endif %}>{{a}}</option>
{% endfor %}
<div class=item>
<label for=limit>Last N items</label>
<input type=number min=0 id=limit name=limit {% if limit %}value="{{limit}}"{% endif %}
<div class=item>
<label for=fromrev>From revision
<input type=number min=0 id=fromrev name=fromrev {% if fromrev %}value="{{fromrev}}"{% endif %}
<label for=torev>To revision
<input type=number min=0 id=torev name=torev {% if torev %}value="{{torev}}"{% endif %}
<input type=submit value="Apply filter"
class="btn btn-primary form-control">
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment