Add last result of each task to index page

This commit is contained in:
Rowan Manning
2013-09-16 10:18:35 +01:00
parent dbc6a0a5bc
commit 188852129a
4 changed files with 10 additions and 3 deletions

View File

@@ -10,7 +10,7 @@
"chalk": "~0.2", "chalk": "~0.2",
"express": "~3.4", "express": "~3.4",
"express-hbs": "~0.2", "express-hbs": "~0.2",
"pa11y-webservice-client-node": "git+ssh://git@github.com:nature/pa11y-webservice-client-node.git#1.0.0-beta.1" "pa11y-webservice-client-node": "git+ssh://git@github.com:nature/pa11y-webservice-client-node.git#1.0.0-beta.2"
}, },
"devDependencies": { "devDependencies": {
"supervisor": "~0.5" "supervisor": "~0.5"

View File

@@ -5,7 +5,7 @@ module.exports = route;
// Route definition // Route definition
function route (app) { function route (app) {
app.express.get('/', function (req, res, next) { app.express.get('/', function (req, res, next) {
app.webservice.tasks.get(function (err, tasks) { app.webservice.tasks.get({lastres: true}, function (err, tasks) {
if (err) { if (err) {
return next(err); return next(err);
} }

View File

@@ -5,7 +5,7 @@ module.exports = route;
// Route definition // Route definition
function route (app) { function route (app) {
app.express.get('/:id', function (req, res, next) { app.express.get('/:id', function (req, res, next) {
app.webservice.task(req.params.id).get(function (err, task) { app.webservice.task(req.params.id).get({}, function (err, task) {
if (err) { if (err) {
return next(); return next();
} }

View File

@@ -3,7 +3,14 @@
{{#tasks}} {{#tasks}}
<li> <li>
<a href="/{{id}}"> <a href="/{{id}}">
{{url}} ({{standard}}) {{url}} ({{standard}})
{{#last_result}}
<br/>Last run: {{date}}
<br/>Errors: {{count.error}}
{{/last_result}}
</a> </a>
</li> </li>
{{/tasks}} {{/tasks}}