forked from external-repos/pa11y-dashboard
Updated results page (#196)
* Update gitignore * Update makefile. Add hbs helper * Collect all selectors for errors/warnings/notices * Add list of techniques that help to solve problems * Remove task-stats block from sidebar * Remove script from Makefile * Update tooltips. Map standards and techniques * Update layout for new components: new tabs, errors panels, lists of selectors, tooltips and popovers * Update styles for new layout and components * Graph buttons and popovers styles * Reformat less code * Include popover. Update IE styles * Problem details. Context popovers * Update graph buttons. Add sorting by number of errors * Update graph buttons params * Fix tooltip names * Swap details and ignore link-buttons * Set ignore link colors
This commit is contained in:

committed by
Rowan Manning

parent
a8013834c5
commit
66d97769a0
@@ -16,6 +16,7 @@
|
||||
|
||||
const _ = require('underscore');
|
||||
const presentIgnoreRules = require('./ignore');
|
||||
const techs = require('../../data/techniques')();
|
||||
|
||||
module.exports = presentResult;
|
||||
|
||||
@@ -40,10 +41,30 @@ function presentResult(result) {
|
||||
const results = groupedByType[type] || [];
|
||||
const groupedByCode = _.groupBy(results, 'code');
|
||||
result[pluralType] = _.keys(groupedByCode).map(group => {
|
||||
const firstMessage = groupedByCode[group][0];
|
||||
firstMessage.count = groupedByCode[group].length;
|
||||
return firstMessage;
|
||||
});
|
||||
const groupMessage = groupedByCode[group][0];
|
||||
groupMessage.count = groupedByCode[group].length;
|
||||
groupMessage.items = groupedByCode[group].map(plural => ({
|
||||
selector: plural.selector,
|
||||
context: plural.context
|
||||
}));
|
||||
// Map standard to techniques
|
||||
const data = groupMessage.code.split('.');
|
||||
data.splice(0, 4);
|
||||
const techniques = data.join('.').split(',').map(code => code.split('.')[0]);
|
||||
groupMessage.solutions = techniques.reduce((prev, technique) => {
|
||||
if (techs[technique] && techs[technique].title) {
|
||||
prev.push({
|
||||
title: techs[technique].title || null,
|
||||
url: techs[technique].url || null
|
||||
});
|
||||
}
|
||||
return prev;
|
||||
}, []);
|
||||
return groupMessage;
|
||||
})
|
||||
.sort((currentItem, nextItem) => {
|
||||
return nextItem.count - currentItem.count;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user