Change autofix to accept arguments to perform, implement "fix all"

This commit is contained in:
Bryan Housel
2019-04-17 17:51:29 -04:00
parent d6327aec56
commit 9c4881cade
7 changed files with 153 additions and 74 deletions
+9 -12
View File
@@ -34,26 +34,23 @@ export function validationOldMultipolygon() {
entities: [outerWay, multipolygon],
fixes: [
new validationIssueFix({
auto: true,
autoArgs: [doUpgrade, t('issues.fix.move_tags.annotation')],
title: t('issues.fix.move_tags.title'),
onClick: function() {
var outerWay = this.issue.entities[0];
var multipolygon = this.issue.entities[1];
context.perform(
function(graph) {
multipolygon = multipolygon.mergeTags(outerWay.tags);
graph = graph.replace(multipolygon);
graph = actionChangeTags(outerWay.id, {})(graph);
return graph;
},
t('issues.fix.move_tags.annotation')
);
context.perform(doUpgrade, t('issues.fix.move_tags.annotation'));
}
})
]
})];
function doUpgrade(graph) {
multipolygon = multipolygon.mergeTags(outerWay.tags);
graph = graph.replace(multipolygon);
return actionChangeTags(outerWay.id, {})(graph);
}
function showReference(selection) {
selection.selectAll('.issue-reference')
.data([0])
+7 -10
View File
@@ -63,26 +63,23 @@ export function validationOutdatedTags() {
message: t('issues.outdated_tags.message', { feature: utilDisplayLabel(entity, context) }),
reference: showReference,
entities: [entity],
data: {
newTags: newTags
},
fixes: [
new validationIssueFix({
auto: true,
autoArgs: [doUpgrade, t('issues.fix.upgrade_tags.annotation')],
title: t('issues.fix.upgrade_tags.title'),
onClick: function() {
var entityID = this.issue.entities[0].id;
var newTags = this.issue.data.newTags;
context.perform(
actionChangeTags(entityID, newTags),
t('issues.fix.upgrade_tags.annotation')
);
context.perform(doUpgrade, t('issues.fix.upgrade_tags.annotation'));
}
})
]
})];
function doUpgrade(graph) {
return actionChangeTags(entity.id, newTags)(graph);
}
function showReference(selection) {
var enter = selection.selectAll('.issue-reference')
.data([0])