Download:
child 9:ac48bb613c6f
parent 7:43cbf5d4ef13
8:12e714447f64
Anton Shestakov <av6@dwimlabs.net>, Mon, 13 Jun 2016 21:51:21 +0800
viewer: add basic index page

3 файлов изменено, 62 вставок(+), 2 удалений(-) [+]
templates/base.html file | annotate | diff | comparison | revisions
templates/index.html file | annotate | diff | comparison | revisions
viewer.py file | annotate | diff | comparison | revisions
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/base.html Mon Jun 13 21:51:21 2016 +0800
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <title>{% block title %}{% end %}{% block extra-title %} - Cat and Owl's online linter{% end %}</title>
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/uikit/2.26.3/css/uikit.almost-flat.min.css" integrity="sha384-5bOKVP1JAsV2lpzCrvNxDsgBg/FrwwHfDcgmtE7quy/iY+stYq7ORPYbkzJYffwS" crossorigin="anonymous">
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js" integrity="sha384-rY/jv8mMhqDabXSo+UCggqKtdmBfd3qC2/KvyTDNQ6PcUJXaxK1tMepoQda4g5vB" crossorigin="anonymous"></script>
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/2.26.3/js/uikit.min.js" integrity="sha384-6OYggLGXv4OPaVsh9O/0baGeEYFu1r1FE3+sNtPeDk6JofnNNZb2sHKzUa7wum04" crossorigin="anonymous"></script>
+ </head>
+ <body>
+ <nav class="uk-navbar uk-navbar-attached">
+ <div class="uk-container uk-container-center" style="position: relative;">
+ <a class="uk-navbar-brand" href="/">Cat and Owl's online linter</a>
+ </div>
+ </nav>
+
+ {% block content %}{% end %}
+
+ </body>
+</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/index.html Mon Jun 13 21:51:21 2016 +0800
@@ -0,0 +1,26 @@
+{% extends "base.html" %}
+
+{% block title %}Recently checked projects{% end %}
+
+{% block content %}
+ <div class="uk-container uk-container-center uk-margin-large-top">
+ <h2>Recently checked projects</h2>
+ <table class="uk-table uk-table-middle">
+ <tbody>
+ {% for check in checks %}
+ {% set project = check.project %}
+ {% set change = check.change %}
+ <tr>
+ <td>{{ check.errors }} error(s), {{ check.warnings }} warning(s)</td>
+ <td>#{{ check.ordinal }}</td>
+ <td>{{ project.name }}</td>
+ <td>{{ change.rev }}:{{ change.node[:12] }} {{ change.branch }}</td>
+ <td>{{ check.started }}</td>
+ <td>{{ check.finished }}</td>
+ <td>{{ check.finished - check.started }}</td>
+ </tr>
+ {% end %}
+ </tbody>
+ </table>
+ </div>
+{% end %}
--- a/viewer.py Mon Jun 13 11:26:22 2016 +0800
+++ b/viewer.py Mon Jun 13 21:51:21 2016 +0800
@@ -4,9 +4,9 @@
from tornado.ioloop import IOLoop
from tornado.options import define, options
-from tornado.web import Application, RequestHandler
+from tornado.web import Application, RequestHandler, URLSpec
-from candolint.models import database
+from candolint.models import database, Project, Change, Check
rel = lambda *x: os.path.abspath(os.path.join(os.path.dirname(__file__), *x))
@@ -28,9 +28,21 @@
database.close()
+class IndexHandler(BaseHandler):
+ def get(self):
+ checks = (Check
+ .select(Check, Project, Change)
+ .join(Project)
+ .switch(Check)
+ .join(Change)
+ .group_by(Check.project))
+ self.render('index.html', checks=checks)
+
+
class CandolintViewer(Application):
def __init__(self):
handlers = [
+ URLSpec(r'/', IndexHandler),
]
settings = dict(
static_path=rel('static'),