Add a way to select the date and a favicon

This commit is contained in:
Calixte Denizet 2017-03-11 17:54:33 +01:00
Родитель 947c5c64de
Коммит 6a2e826e14
6 изменённых файлов: 68 добавлений и 33 удалений

Просмотреть файл

@ -2,7 +2,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
from flask import Flask
from flask import Flask, send_from_directory
from flask_cors import CORS, cross_origin
from flask_sqlalchemy import SQLAlchemy
import logging
@ -50,3 +50,8 @@ def list_html():
def crashes_html():
from file2crashes import html
return html.crashes()
@app.route('/favicon.ico')
def favicon():
return send_from_directory('../static', 'favicon.ico')

Просмотреть файл

@ -14,11 +14,13 @@ def listdirs():
date = utils.get_correct_date(date)
channel = 'nightly'
dirs = models.Crashes.listdirs(product, channel, date)
dates = models.Crashes.listdates()
url = 'crashes.html?product={}&channel={}&date={}&dir='.format(product,
channel,
date)
return render_template('list.html',
product=product,
dates=dates,
date=date,
quote=quote,
base_url=url,

Просмотреть файл

@ -5,6 +5,7 @@
from collections import defaultdict
from file2crashes import utils as f2cutils
from file2crashes import app, db, analyze
from sqlalchemy import distinct
class Crashes(db.Model):
@ -101,6 +102,15 @@ class Crashes(db.Model):
return {}
@staticmethod
def listdates():
dates = db.session.query(distinct(Crashes.date))
dates = map(lambda d: d[0], dates)
dates = sorted(dates, reverse=True)
dates = map(lambda d: d.strftime('%Y-%m-%d'), dates)
return list(dates)
@staticmethod
def dump(date):
date = f2cutils.get_date(date)

Просмотреть файл

@ -1,22 +1,23 @@
<!doctype html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<title>Files</title>
</head>
<body>
<h1>{{ product }} &mdash; {{ date }}</h1>
<br>
<ul>
{% for file in sortfun(crashes.keys()) -%}
<li>{{ file }}
<ul>
{% for url, count, signature in crashes[file] -%}
<li>{{ count }} {{ plural(count) }}, signature is <a href="{{ url|safe }}">{{ signature }}</a></li>
{% endfor -%}
</ul>
</li>
{% endfor -%}
</ul>
</body>
<head>
<link rel="shortcut icon" href="/favicon.ico">
<meta charset="utf-8">
<title>Files</title>
</head>
<body>
<h1>{{ product }} &mdash; {{ date }}</h1>
<br>
<ul>
{% for file in sortfun(crashes.keys()) -%}
<li>{{ file }}
<ul>
{% for url, count, signature in crashes[file] -%}
<li>{{ count }} {{ plural(count) }}, signature is <a href="{{ url|safe }}">{{ signature }}</a></li>
{% endfor -%}
</ul>
</li>
{% endfor -%}
</ul>
</body>
</html>

Просмотреть файл

@ -1,16 +1,33 @@
<!doctype html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<title>Directories</title>
</head>
<body>
<h1>{{ product }} &mdash; {{ date }}</h1>
<br>
<ul>
{% for d in dirs -%}
<li><a href="{{ (base_url + quote(d, safe=''))|safe}}">{{ d }}</a></li>
{% endfor -%}
</ul>
</body>
<head>
<link rel="shortcut icon" href="/favicon.ico">
<meta charset="utf-8">
<title>Directories</title>
</head>
<body>
<h1>{{ product }} &mdash; {{ date }}</h1>
<p>Select a date:&nbsp
<select onchange="location.href='?date=' + this.options[this.selectedIndex].value;">
{% for d in dates -%}
{% if d == date -%}
<option value="{{ d }}" selected>{{ d }}</option>
{% else -%}
<option value="{{ d }}">{{ d }}</option>
{% endif -%}
{% endfor -%}
</select>
</p>
<p>
These directories contain the files which appeared in a backtrace of a new crash.
</p>
<p>
A new crash is just a crash which doesn't exist in the last three days and appeared suddently.
</p>
<ul>
{% for d in dirs -%}
<li><a href="{{ (base_url + quote(d, safe=''))|safe}}">{{ d }}</a></li>
{% endfor -%}
</ul>
</body>
</html>

Двоичные данные
static/favicon.ico Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.5 KiB