Files
iD/modules/validations/mapcss_checks.js
Xiaoming Gao 07a53fe6ea Extend data model for validation issues
Add the Issues pane

1. Add a class to represent the validation issue
2. Extend the data model for an validation issue to
  (1) add a severity level field (useful for identify save-blocking issues later)
  (2) replace single entity with an array of entities (useful for issues involving multiple entities)
  (3) add a coordinates field for highlighting the location of the issue on the map
  (4) add a fixes field for possible automatic fixes

3. Update existing validation modules to use the new data model
2018-12-19 10:37:32 -05:00

26 lines
775 B
JavaScript

import { services } from '../services';
export function validationMapCSSChecks() {
var validation = function(changes, graph) {
if (!services.maprules) return [];
var rules = services.maprules.validationRules();
var issues = [];
var createdModified = ['created', 'modified'];
for (var i = 0; i < rules.length; i++) {
var rule = rules[i];
for (var j = 0; j < createdModified.length; j++) {
var type = createdModified[j];
var entities = changes[type];
for (var k = 0; k < entities.length; k++) {
rule.findIssues(entities[k], graph, issues);
}
}
}
return issues;
};
return validation;
}