Replace getErrors/getWarnings with getIssues/getIssuesBySeverity

The idea here is that the validator will now hold onto lots of issues,
but the calling code will only want some small subset of them
(edited/everything) (inview/everywhere) and can pass these as options
so that we don't need filtering code spread throughtout the app.
This commit is contained in:
Bryan Housel
2019-04-11 14:48:23 -04:00
parent 569cbd1a92
commit 35049ab40a
4 changed files with 59 additions and 61 deletions
+4 -6
View File
@@ -4,14 +4,12 @@ import { svgIcon } from '../svg';
import { tooltip } from '../util/tooltip';
import { utilEntityOrMemberSelector } from '../util';
export function uiCommitWarnings(context) {
function commitWarnings(selection) {
var issuesBySeverity = {
warning: context.validator().getWarnings(),
error: context.validator().getErrors()
};
var issuesBySeverity = context.validator()
.getIssuesBySeverity({ what: 'edited', where: 'all' });
for (var severity in issuesBySeverity) {
var issues = issuesBySeverity[severity];
@@ -41,7 +39,7 @@ export function uiCommitWarnings(context) {
var items = container.select('ul').selectAll('li')
.data(issues, function(d) { return d.id(); });
.data(issues, function(d) { return d.id; });
items.exit()
.remove();