mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-29 11:21:40 +02:00
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
This commit is contained in:
committed by
Xiaoming Gao
parent
0d0521c936
commit
07a53fe6ea
+11
-5
@@ -1,3 +1,4 @@
|
||||
import _map from 'lodash-es/map';
|
||||
import {
|
||||
event as d3_event,
|
||||
select as d3_select
|
||||
@@ -104,9 +105,9 @@ export function uiIssues(context) {
|
||||
var name = 'issues_list';
|
||||
|
||||
var changes = context.history().changes();
|
||||
var validations = context.history().validate(changes);
|
||||
var issues = context.history().validate(changes);
|
||||
|
||||
/*validations = _reduce(validations, function(validations, val) {
|
||||
/*validations = _reduce(issues, function(validations, val) {
|
||||
var severity = val.severity;
|
||||
if (validations.hasOwnProperty(severity)) {
|
||||
validations[severity].push(val);
|
||||
@@ -117,7 +118,7 @@ export function uiIssues(context) {
|
||||
}, {});*/
|
||||
|
||||
var items = selection.selectAll('li')
|
||||
.data(validations);
|
||||
.data(issues);
|
||||
|
||||
// Exit
|
||||
items.exit()
|
||||
@@ -130,13 +131,18 @@ export function uiIssues(context) {
|
||||
.call(tooltip()
|
||||
.html(true)
|
||||
.title(function(d) {
|
||||
var tip = d.tooltip;
|
||||
var tip = d.tooltip ? d.tooltip : '';
|
||||
return uiTooltipHtml(tip);
|
||||
})
|
||||
.placement('bottom')
|
||||
)
|
||||
.on('click', function(d) {
|
||||
context.enter(modeSelect(context, [d.entity.id]));
|
||||
if (d.entities) {
|
||||
context.enter(modeSelect(
|
||||
context,
|
||||
_map(d.entities, function(e) { return e.id; })
|
||||
));
|
||||
}
|
||||
});
|
||||
|
||||
var label = enter
|
||||
|
||||
Reference in New Issue
Block a user