mirror of
https://github.com/pa11y/pa11y-dashboard.git
synced 2025-09-24 22:31:15 +00:00
Add the ability to run tasks ad-hoc
This commit is contained in:
1
app.js
1
app.js
@@ -69,6 +69,7 @@ function initApp (config, callback) {
|
|||||||
require('./route/new')(app);
|
require('./route/new')(app);
|
||||||
require('./route/task/index')(app);
|
require('./route/task/index')(app);
|
||||||
require('./route/task/delete')(app);
|
require('./route/task/delete')(app);
|
||||||
|
require('./route/task/run')(app);
|
||||||
require('./route/result/index')(app);
|
require('./route/result/index')(app);
|
||||||
require('./route/result/download')(app);
|
require('./route/result/download')(app);
|
||||||
|
|
||||||
|
@@ -216,7 +216,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.date {
|
.date {
|
||||||
margin-top:45px;
|
margin-top:5px;
|
||||||
}
|
}
|
||||||
.tasks-list {
|
.tasks-list {
|
||||||
padding:15px;
|
padding:15px;
|
||||||
|
@@ -23,6 +23,7 @@ function route (app) {
|
|||||||
results: presentResultList(results.map(presentResult)),
|
results: presentResultList(results.map(presentResult)),
|
||||||
mainResult: task.lastResult || null,
|
mainResult: task.lastResult || null,
|
||||||
added: (typeof req.query.added !== 'undefined'),
|
added: (typeof req.query.added !== 'undefined'),
|
||||||
|
running: (typeof req.query.running !== 'undefined'),
|
||||||
isTaskPage: true
|
isTaskPage: true
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
17
route/task/run.js
Normal file
17
route/task/run.js
Normal file
@@ -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');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
@@ -6,7 +6,7 @@
|
|||||||
<p class="h4">({{task.standard}})</p>
|
<p class="h4">({{task.standard}})</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-2 text-right run-details">
|
<div class="col-md-2 text-right run-details">
|
||||||
<!-- <button class="btn btn-success">Run <span class="glyphicon glyphicon-play"></span></button> -->
|
<a href="{{task.hrefRun}}" class="btn btn-success">Run <span class="glyphicon glyphicon-play"></span></a>
|
||||||
{{#if mainResult}}
|
{{#if mainResult}}
|
||||||
<div class="date">Last run : {{date-format mainResult.date format="DD MMM YYYY"}}</div>
|
<div class="date">Last run : {{date-format mainResult.date format="DD MMM YYYY"}}</div>
|
||||||
{{else}}
|
{{else}}
|
||||||
|
@@ -12,6 +12,7 @@ function presentTask (task) {
|
|||||||
// Add additional info
|
// Add additional info
|
||||||
task.href = '/' + task.id;
|
task.href = '/' + task.id;
|
||||||
task.hrefDelete = '/' + task.id + '/delete';
|
task.hrefDelete = '/' + task.id + '/delete';
|
||||||
|
task.hrefRun = '/' + task.id + '/run';
|
||||||
task.hrefJson = '/' + task.id + '.json';
|
task.hrefJson = '/' + task.id + '.json';
|
||||||
|
|
||||||
// Enhance the ignored rules
|
// Enhance the ignored rules
|
||||||
|
@@ -13,6 +13,20 @@
|
|||||||
</div>
|
</div>
|
||||||
{{/added}}
|
{{/added}}
|
||||||
|
|
||||||
|
{{#running}}
|
||||||
|
<div class="col-md-12 clearfix">
|
||||||
|
<div class="alert alert-success">
|
||||||
|
<button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button>
|
||||||
|
<strong>New results incoming!</strong>
|
||||||
|
<p>
|
||||||
|
New results are being generated for this URL in the background.
|
||||||
|
This can take up to a minute to complete.
|
||||||
|
<a href="/{{task.id}}">Click here to refresh this page</a>.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{/running}}
|
||||||
|
|
||||||
{{> task-header}}
|
{{> task-header}}
|
||||||
|
|
||||||
{{#if results}}
|
{{#if results}}
|
||||||
@@ -30,7 +44,7 @@
|
|||||||
<div class="alert alert-info">
|
<div class="alert alert-info">
|
||||||
<h4>There are no results to show</h4>
|
<h4>There are no results to show</h4>
|
||||||
<p>pa11y has not been run against this URL yet so there are no results to show.</p>
|
<p>pa11y has not been run against this URL yet so there are no results to show.</p>
|
||||||
<!-- <p>To run pa11y for this URL now <a href="">click here</a></p> -->
|
<p><a href="{{task.hrefRun}}">Click here to generate results for this URL</a>.</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
Reference in New Issue
Block a user