diff --git a/app.js b/app.js index ea76d5e..f3a97d7 100644 --- a/app.js +++ b/app.js @@ -69,6 +69,7 @@ function initApp (config, callback) { require('./route/new')(app); require('./route/task/index')(app); require('./route/task/delete')(app); + require('./route/task/run')(app); require('./route/result/index')(app); require('./route/result/download')(app); diff --git a/public/less/site.less b/public/less/site.less index 0a357fc..8e596f5 100644 --- a/public/less/site.less +++ b/public/less/site.less @@ -216,7 +216,7 @@ } } .date { - margin-top:45px; + margin-top:5px; } .tasks-list { padding:15px; diff --git a/route/task/index.js b/route/task/index.js index eff1d3a..92ce0d6 100644 --- a/route/task/index.js +++ b/route/task/index.js @@ -23,6 +23,7 @@ function route (app) { results: presentResultList(results.map(presentResult)), mainResult: task.lastResult || null, added: (typeof req.query.added !== 'undefined'), + running: (typeof req.query.running !== 'undefined'), isTaskPage: true }); }); diff --git a/route/task/run.js b/route/task/run.js new file mode 100644 index 0000000..6c713f1 --- /dev/null +++ b/route/task/run.js @@ -0,0 +1,17 @@ +'use strict'; + +module.exports = route; + +// Route definition +function route (app) { + + app.express.get('/:id/run', function (req, res, next) { + app.webservice.task(req.params.id).run(function (err, task) { + if (err) { + return next(); + } + res.redirect('/' + req.params.id + '?running'); + }); + }); + +} diff --git a/view/partial/task-header.html b/view/partial/task-header.html index ab897c9..c7fe978 100644 --- a/view/partial/task-header.html +++ b/view/partial/task-header.html @@ -6,7 +6,7 @@

({{task.standard}})

- + Run {{#if mainResult}}
Last run : {{date-format mainResult.date format="DD MMM YYYY"}}
{{else}} diff --git a/view/presenter/task.js b/view/presenter/task.js index 53fd2c0..f9a960a 100644 --- a/view/presenter/task.js +++ b/view/presenter/task.js @@ -12,6 +12,7 @@ function presentTask (task) { // Add additional info task.href = '/' + task.id; task.hrefDelete = '/' + task.id + '/delete'; + task.hrefRun = '/' + task.id + '/run'; task.hrefJson = '/' + task.id + '.json'; // Enhance the ignored rules diff --git a/view/task/index.html b/view/task/index.html index f2b3428..2987a78 100644 --- a/view/task/index.html +++ b/view/task/index.html @@ -13,6 +13,20 @@
{{/added}} +{{#running}} +
+
+ + New results incoming! +

+ New results are being generated for this URL in the background. + This can take up to a minute to complete. + Click here to refresh this page. +

+
+
+{{/running}} + {{> task-header}} {{#if results}} @@ -30,7 +44,7 @@

There are no results to show

pa11y has not been run against this URL yet so there are no results to show.

- +

Click here to generate results for this URL.

{{/if}} \ No newline at end of file