mirror of
https://github.com/pa11y/pa11y-dashboard.git
synced 2025-09-25 06:41:21 +00:00
Merge branch 'master' of https://github.com/nature/pa11y-dashboard
This commit is contained in:
1
app.js
1
app.js
@@ -55,6 +55,7 @@ function initApp (config, callback) {
|
||||
require('./route/new')(app);
|
||||
require('./route/task/index')(app);
|
||||
require('./route/task/delete')(app);
|
||||
require('./route/result/index')(app);
|
||||
|
||||
// Error handling
|
||||
app.express.get('*', function (req, res) {
|
||||
|
@@ -25,7 +25,7 @@
|
||||
"express": "~3.4",
|
||||
"express-hbs": "~0.2",
|
||||
"moment": "~2.2",
|
||||
"pa11y-webservice-client-node": "git+ssh://git@github.com:nature/pa11y-webservice-client-node.git#1.0.0-beta.2",
|
||||
"pa11y-webservice-client-node": "git+ssh://git@github.com:nature/pa11y-webservice-client-node.git#1.0.0-beta.3",
|
||||
"underscore": "~1.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
31
route/result/index.js
Normal file
31
route/result/index.js
Normal file
@@ -0,0 +1,31 @@
|
||||
'use strict';
|
||||
|
||||
var presentTask = require('../../view/presenter/task');
|
||||
var presentResult = require('../../view/presenter/result');
|
||||
|
||||
module.exports = route;
|
||||
|
||||
// Route definition
|
||||
function route (app) {
|
||||
|
||||
app.express.get('/:id/:rid', function (req, res, next) {
|
||||
app.webservice.task(req.params.id).get({}, function (err, task) {
|
||||
if (err) {
|
||||
return next();
|
||||
}
|
||||
app.webservice
|
||||
.task(req.params.id)
|
||||
.result(req.params.rid)
|
||||
.get({full: true}, function (err, result) {
|
||||
if (err) {
|
||||
return next();
|
||||
}
|
||||
res.render('result', {
|
||||
task: presentTask(task),
|
||||
mainResult: presentResult(result)
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
}
|
@@ -20,26 +20,11 @@ function route (app) {
|
||||
res.render('task', {
|
||||
task: presentTask(task),
|
||||
results: results.map(presentResult),
|
||||
lastResult: task.lastResult || null,
|
||||
mainResult: task.lastResult || null,
|
||||
added: (typeof req.query.added !== 'undefined')
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
app.express.get('/:id.json', function (req, res, next) {
|
||||
app.webservice.task(req.params.id).get({}, function (err, task) {
|
||||
if (err) {
|
||||
return next();
|
||||
}
|
||||
app.webservice.task(req.params.id).results({}, function (err, results) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
task.results = results;
|
||||
res.send(task);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
6
view/result/index.html
Normal file
6
view/result/index.html
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
{{#content "title"}}
|
||||
{{task.url}} ({{task.standard}}) {{date-format mainResult.date format="DD MMM YYYY"}}
|
||||
{{/content}}
|
||||
|
||||
<h1>{{task.url}} ({{task.standard}}) {{date-format mainResult.date format="DD MMM YYYY"}}</h1>
|
@@ -23,9 +23,9 @@
|
||||
<div class="col-md-2 text-right run-details">
|
||||
<!-- ########### To be done ############## -->
|
||||
<button class="btn btn-success">Run <span class="glyphicon glyphicon-play"></span></button>
|
||||
{{#if lastResult}}
|
||||
{{#if task.lastResult}}
|
||||
<!-- ########################## -->
|
||||
<div class="date">Last run : {{date-format lastResult.date format="DD MMM YYYY"}}</div>
|
||||
<div class="date">Last run : {{date-format task.lastResult.date format="DD MMM YYYY"}}</div>
|
||||
{{else}}
|
||||
<div class="date">Not yet run</div>
|
||||
{{/if}}
|
||||
@@ -54,22 +54,21 @@
|
||||
<div id="top" class="col-md-12 col-xs-6 dropdown-container">
|
||||
<h4 class="show-stats hidden">Select a date to show stats for</h4>
|
||||
<div class="btn-group block-level clearfix">
|
||||
<button data-toggle="dropdown" class="btn-full-width btn btn-primary dropdown-toggle" type="button">{{date-format lastResult.date format="DD MMM YYYY"}} <span class="glyphicon glyphicon-calendar"></span> <span class="caret"></span></button>
|
||||
<button data-toggle="dropdown" class="btn-full-width btn btn-primary dropdown-toggle" type="button">{{date-format task.lastResult.date format="DD MMM YYYY"}} <span class="glyphicon glyphicon-calendar"></span> <span class="caret"></span></button>
|
||||
<ul role="navigation" class="date-links list-group">
|
||||
<li><a class="list-group-item active" href="#">21 Sept 2013</a></li>
|
||||
{{#results}}
|
||||
<li><a class="list-group-item" href="#">{{date-format date format="DD MMM YYYY"}}</a></li>
|
||||
<li><a class="list-group-item" href="{{href}}">{{date-format date format="DD MMM YYYY"}}</a></li>
|
||||
{{/results}}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12 col-xs-6">
|
||||
<ul data-role="task-list" class="clearfix list-unstyled floated-list task-stats">
|
||||
{{#lastResult}}
|
||||
{{#mainResult}}
|
||||
<li class="danger"><a href="#errors" title="See errors">{{count.error}}</a></li>
|
||||
<li class="warning"><a href="#warnings" title="See warnings">{{count.warning}}</a></li>
|
||||
<li class="info last"><a href="#notices" title="See notices">{{count.notice}}</a></li>
|
||||
{{/lastResult}}
|
||||
{{/mainResult}}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -104,20 +103,20 @@
|
||||
|
||||
<div class="col-md-9">
|
||||
{{#if results}}
|
||||
{{#if lastResult.count.error}}
|
||||
{{#if mainResult.count.error}}
|
||||
<div class="heading label-danger showing first" id="errors">
|
||||
<span data-role="expander" class="pull-right expander"> - </span>
|
||||
Errors ( {{lastResult.count.error}} )
|
||||
Errors ( {{mainResult.count.error}} )
|
||||
</div>
|
||||
<div class="task-danger tasks-list collapse clearfix in">
|
||||
|
||||
<ul class="list-unstyled">
|
||||
{{#lastResult.errors}}
|
||||
{{#mainResult.errors}}
|
||||
<li>
|
||||
<p class="crunch rule-name">{{type}} : {{code}} <span class="badge">{{count}}</span></p>
|
||||
<p>{{message}}</p>
|
||||
</li>
|
||||
{{/lastResult.errors}}
|
||||
{{/mainResult.errors}}
|
||||
</ul>
|
||||
<a class="pull-right" href="#top" data-role="top">Back to top</a>
|
||||
</div>
|
||||
@@ -125,19 +124,19 @@
|
||||
<p class="heading label-danger" id="errors">Well done! You have 0 errors. <span class="glyphicon glyphicon-ok pull-right"></span></p>
|
||||
{{/if}}
|
||||
|
||||
{{#if lastResult.count.warning}}
|
||||
{{#if mainResult.count.warning}}
|
||||
<div class="heading label-warning" id="warnings">
|
||||
<span data-role="expander" class="pull-right expander"> + </span>
|
||||
Warnings ( {{lastResult.count.warning}} )
|
||||
Warnings ( {{mainResult.count.warning}} )
|
||||
</div>
|
||||
<div class="task-warning tasks-list collapse clearfix">
|
||||
<ul class="list-unstyled">
|
||||
{{#lastResult.warnings}}
|
||||
{{#mainResult.warnings}}
|
||||
<li>
|
||||
<p class="crunch rule-name">{{type}} : {{code}} <span class="badge">{{count}}</span></p>
|
||||
<p>{{message}}</p>
|
||||
</li>
|
||||
{{/lastResult.warnings}}
|
||||
{{/mainResult.warnings}}
|
||||
</ul>
|
||||
<a class="pull-right" href="#top" data-role="top">Back to top</a>
|
||||
</div>
|
||||
@@ -146,19 +145,19 @@
|
||||
<p class="heading label-warning" id="warnings">Well done! You have 0 warnings. <span class="glyphicon glyphicon-ok pull-right"></span></p>
|
||||
{{/if}}
|
||||
|
||||
{{#if lastResult.count.notice}}
|
||||
{{#if mainResult.count.notice}}
|
||||
<div class="heading label-info" id="notices">
|
||||
<span data-role="expander" class="pull-right expander"> + </span>
|
||||
Notices ( {{lastResult.count.notice}} )
|
||||
Notices ( {{mainResult.count.notice}} )
|
||||
</div>
|
||||
<div class="task-info tasks-list collapse clearfix">
|
||||
<ul class="list-unstyled">
|
||||
{{#lastResult.notices}}
|
||||
{{#mainResult.notices}}
|
||||
<li>
|
||||
<p class="crunch rule-name">{{type}} : {{code}} <span class="badge">{{count}}</span></p>
|
||||
<p>{{message}}</p>
|
||||
</li>
|
||||
{{/lastResult.notices}}
|
||||
{{/mainResult.notices}}
|
||||
</ul>
|
||||
<a class="pull-right" href="#top" data-role="top">Back to top</a>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user