--- a/static/main.css Tue Jun 14 13:24:35 2016 +0800
+++ b/static/main.css Tue Jun 14 13:37:38 2016 +0800
+ min-width: 42px; /* 4 digits */
+.check-log div a::before {
+ content: attr(data-line-number);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/check.html Tue Jun 14 13:37:38 2016 +0800
+{% extends "base.html" %}
+{% block title %}Check #{{ check.ordinal }}{% end %}
+ <div class="uk-container uk-container-center uk-margin-large-top">
+ <h2>{{ project.name }}: check #{{ check.ordinal }}</h2>
+ {{ locale.translate('{} error', '{} errors', check.errors).format(check.errors) }},
+ {{ locale.translate('{} warning', '{} warnings', check.warnings).format(check.warnings) }}
+ <div class="uk-width-medium-1-3">
+ <dl class="uk-description-list-horizontal list-terse">
+ <dd>{{ check.started }}</dd>
+ <dd>{{ check.finished }}</dd>
+ <dd>{{ check.finished - check.started }}</dd>
+ <div class="uk-width-medium-2-3">
+ <dl class="uk-description-list-horizontal list-terse">
+ {% set change = check.change %}
+ <dd>{{ change.rev }}:{{ change.node[:12] }} {{ change.branch }}</dd>
+ <dd>{{ change.author }}</dd>
+ <dd><time>{{ change.date }}</time></dd>
+ <dd>{{ change.message }}</dd>
+ <pre class="check-log">{#
+ #}{% for number, (cls, line) in enumerate(lines, 1) %}{#
+ #}<div id="l{{ number }}"{% if cls %} class="{{ cls }}"{% end %}>{#
+ #}<a href="#l{{ number }}" data-line-number="{{ number }}"></a>{#
--- a/templates/project.html Tue Jun 14 13:24:35 2016 +0800
+++ b/templates/project.html Tue Jun 14 13:37:38 2016 +0800
{% set change = check.change %}
<td>{{ check.errors }} error(s), {{ check.warnings }} warning(s)</td>
- <td>#{{ check.ordinal }}</td>
+ <a href="/{{ project.domain }}/{{ project.user or '-' }}/{{ project.name }}/{{ check.ordinal }}">
<td>{{ change.rev }}:{{ change.node[:12] }} {{ change.branch }}</td>
<div>{{ change.message }}</div>
--- a/viewer.py Tue Jun 14 13:24:35 2016 +0800
+++ b/viewer.py Tue Jun 14 13:37:38 2016 +0800
+from tornado.escape import json_decode
from tornado.ioloop import IOLoop
from tornado.options import define, options
from tornado.web import Application, RequestHandler, URLSpec
self.render('project.html', project=project, checks=checks)
+class CheckHandler(BaseHandler):
+ def get(self, domain, user, name, check_num):
+ project = Project.select().where(
+ Project.domain == domain,
+ Project.user == (user if user != '-' else None),
+ Project.name == name).get()
+ if check_num == 'latest':
+ check = Check.get(project=project)
+ check = Check.get(project=project, ordinal=check_num)
+ lines = json_decode(check.lines)
+ self.render('check.html', project=project, check=check, lines=lines)
class CandolintViewer(Application):
URLSpec(r'/', IndexHandler),
URLSpec(r'/([.a-z0-9_-]+)/([^/]+)/([^/]+)', ProjectHandler),
+ URLSpec(r'/([.a-z0-9_-]+)/([^/]+)/([^/]+)/([\d]+|latest)', CheckHandler),
static_path=rel('static'),