mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-14 13:18:15 +02:00
Add tooltip and updated message to deprecated_tags validation issue
Add a quick fix to upgrade deprecated tags Add more deprecated tag data
This commit is contained in:
+6
-2
@@ -1162,10 +1162,11 @@ en:
|
||||
tag_suggests_area:
|
||||
message: "The tag {tag} suggests line should be area, but it is not an area."
|
||||
deprecated_tags:
|
||||
message: "Deprecated tags: {tags}"
|
||||
message: '{feature} has outdated tags: {tags}'
|
||||
tooltip: Some tags become deprecated over time and should be replaced.
|
||||
generic_name:
|
||||
message: '{feature} has the generic name "{name}".'
|
||||
tooltip: 'Names should be the official, on-the-ground titles of features.'
|
||||
tooltip: Names should be the official, on-the-ground titles of features.
|
||||
building-building_crossing:
|
||||
message: "{building} intersect {building1} on the same layer."
|
||||
tooltip: "Buildings should not intersect except on separate layers."
|
||||
@@ -1224,6 +1225,9 @@ en:
|
||||
move_tags:
|
||||
title: Move the tags
|
||||
undo_redo: Moved tags.
|
||||
upgrade_tags:
|
||||
title: Upgrade tags
|
||||
undo_redo: Upgraded tags.
|
||||
intro:
|
||||
done: done
|
||||
ok: OK
|
||||
|
||||
+93
-1
@@ -1,9 +1,53 @@
|
||||
{
|
||||
"dataDeprecated": [
|
||||
{
|
||||
"old": {"amenity": "advertising"},
|
||||
"replace": {"advertising": "*"}
|
||||
},
|
||||
{
|
||||
"old": {"amenity": "artwork"},
|
||||
"replace": {"tourism": "artwork"}
|
||||
},
|
||||
{
|
||||
"old": {"amenity": "car_repair"},
|
||||
"replace": {"shop": "car_repair"}
|
||||
},
|
||||
{
|
||||
"old": {"amenity": "citymap_post"},
|
||||
"replace": {"tourism": "information"}
|
||||
},
|
||||
{
|
||||
"old": {"amenity": "community_center"},
|
||||
"replace": {"amenity": "community_centre"}
|
||||
},
|
||||
{
|
||||
"old": {"amenity": "firepit"},
|
||||
"replace": {"leisure": "firepit"}
|
||||
},
|
||||
{
|
||||
"old": {"amenity": "register_office"},
|
||||
"replace": {"office": "government", "government": "register_office"}
|
||||
},
|
||||
{
|
||||
"old": {"amenity": "sauna"},
|
||||
"replace": {"leisure": "sauna"}
|
||||
},
|
||||
{
|
||||
"old": {"amenity": "scrapyard"},
|
||||
"replace": {"landuse": "industrial", "industrial": "scrap_yard"}
|
||||
},
|
||||
{
|
||||
"old": {"amenity": "shop"},
|
||||
"replace": {"shop": "*"}
|
||||
},
|
||||
{
|
||||
"old": {"amenity": "swimming_pool"},
|
||||
"replace": {"leisure": "swimming_pool"}
|
||||
},
|
||||
{
|
||||
"old": {"amenity": "vending_machine", "vending": "news_papers"},
|
||||
"replace": {"amenity": "vending_machine", "vending": "newspapers"}
|
||||
},
|
||||
{
|
||||
"old": {"barrier": "wire_fence"},
|
||||
"replace": {"barrier": "fence", "fence_type": "chain"}
|
||||
@@ -12,9 +56,33 @@
|
||||
"old": {"barrier": "wood_fence"},
|
||||
"replace": {"barrier": "fence", "fence_type": "wood"}
|
||||
},
|
||||
{
|
||||
"old": {"building": "entrance"},
|
||||
"replace": {"entrance": "*"}
|
||||
},
|
||||
{
|
||||
"old": {"building:type": "*"},
|
||||
"replace": {"building": "$1"}
|
||||
},
|
||||
{
|
||||
"old": {"color": "*"},
|
||||
"replace": {"colour": "$1"}
|
||||
},
|
||||
{
|
||||
"old": {"craft": "jeweler"},
|
||||
"replace": {"shop": "jewelery"}
|
||||
},
|
||||
{
|
||||
"old": {"craft": "optician"},
|
||||
"replace": {"shop": "optician"}
|
||||
},
|
||||
{
|
||||
"old": {"escalator": "*"},
|
||||
"replace": {"highway": "steps", "conveying": "$1"}
|
||||
},
|
||||
{
|
||||
"old": {"highway": "ford"},
|
||||
"replace": {"ford": "yes"}
|
||||
"replace": {"ford": "*"}
|
||||
},
|
||||
{
|
||||
"old": {"highway": "stile"},
|
||||
@@ -32,6 +100,14 @@
|
||||
"old": {"highway": "unsurfaced"},
|
||||
"replace": {"highway": "road", "incline": "unpaved"}
|
||||
},
|
||||
{
|
||||
"old": {"landuse": "farm"},
|
||||
"replace": {"landuse": "farmland"}
|
||||
},
|
||||
{
|
||||
"old": {"landuse": "pond"},
|
||||
"replace": {"natural": "water", "water": "pond"}
|
||||
},
|
||||
{
|
||||
"old": {"landuse": "wood"},
|
||||
"replace": {"landuse": "forest", "natural": "wood"}
|
||||
@@ -40,6 +116,14 @@
|
||||
"old": {"natural": "marsh"},
|
||||
"replace": {"natural": "wetland", "wetland": "marsh"}
|
||||
},
|
||||
{
|
||||
"old": {"office": "administrative"},
|
||||
"replace": {"office": "government"}
|
||||
},
|
||||
{
|
||||
"old": {"power": "sub_station"},
|
||||
"replace": {"power": "substation"}
|
||||
},
|
||||
{
|
||||
"old": {"power_source": "*"},
|
||||
"replace": {"generator:source": "$1"}
|
||||
@@ -51,6 +135,14 @@
|
||||
{
|
||||
"old": {"shop": "organic"},
|
||||
"replace": {"shop": "supermarket", "organic": "only"}
|
||||
},
|
||||
{
|
||||
"old": {"shop": "fishmonger"},
|
||||
"replace": {"shop": "seafood"}
|
||||
},
|
||||
{
|
||||
"old": {"shop": "furnace"},
|
||||
"replace": {"shop": "fireplace"}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Vendored
+6
-1
@@ -1411,7 +1411,8 @@
|
||||
"message": "The tag {tag} suggests line should be area, but it is not an area."
|
||||
},
|
||||
"deprecated_tags": {
|
||||
"message": "Deprecated tags: {tags}"
|
||||
"message": "{feature} has outdated tags: {tags}",
|
||||
"tooltip": "Some tags become deprecated over time and should be replaced."
|
||||
},
|
||||
"generic_name": {
|
||||
"message": "{feature} has the generic name \"{name}\".",
|
||||
@@ -1494,6 +1495,10 @@
|
||||
"move_tags": {
|
||||
"title": "Move the tags",
|
||||
"undo_redo": "Moved tags."
|
||||
},
|
||||
"upgrade_tags": {
|
||||
"title": "Upgrade tags",
|
||||
"undo_redo": "Upgraded tags."
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -166,14 +166,14 @@ osmEntity.prototype = {
|
||||
|
||||
deprecatedTags: function() {
|
||||
var tags = _toPairs(this.tags);
|
||||
var deprecated = {};
|
||||
var deprecated = [];
|
||||
|
||||
dataDeprecated.forEach(function(d) {
|
||||
var match = _toPairs(d.old)[0];
|
||||
tags.forEach(function(t) {
|
||||
if (t[0] === match[0] &&
|
||||
(t[1] === match[1] || match[1] === '*')) {
|
||||
deprecated[t[0]] = t[1];
|
||||
deprecated.push(d);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,30 +1,85 @@
|
||||
import _isEmpty from 'lodash-es/isEmpty';
|
||||
|
||||
import _clone from 'lodash-es/clone';
|
||||
import { t } from '../util/locale';
|
||||
import { utilTagText } from '../util/index';
|
||||
import {
|
||||
utilDisplayLabel,
|
||||
utilTagText
|
||||
} from '../util';
|
||||
import {
|
||||
ValidationIssueType,
|
||||
ValidationIssueSeverity,
|
||||
validationIssue,
|
||||
validationIssueFix
|
||||
} from './validation_issue';
|
||||
import {
|
||||
actionChangeTags
|
||||
} from '../actions';
|
||||
|
||||
|
||||
export function validationDeprecatedTag() {
|
||||
export function validationDeprecatedTag(context) {
|
||||
|
||||
var validation = function(changes) {
|
||||
var issues = [];
|
||||
for (var i = 0; i < changes.created.length; i++) {
|
||||
var change = changes.created[i];
|
||||
var deprecatedTags = change.deprecatedTags();
|
||||
var deprecatedTagsArray = change.deprecatedTags();
|
||||
|
||||
if (!_isEmpty(deprecatedTags)) {
|
||||
var tags = utilTagText({ tags: deprecatedTags });
|
||||
issues.push(new validationIssue({
|
||||
type: ValidationIssueType.deprecated_tags,
|
||||
severity: ValidationIssueSeverity.warning,
|
||||
message: t('issues.deprecated_tags.message', { tags: tags }),
|
||||
entities: [change],
|
||||
}));
|
||||
if (!_isEmpty(deprecatedTagsArray)) {
|
||||
for (var deprecatedTagIndex in deprecatedTagsArray) {
|
||||
var deprecatedTags = deprecatedTagsArray[deprecatedTagIndex];
|
||||
var tagsLabel = utilTagText({ tags: deprecatedTags.old });
|
||||
var featureLabel = utilDisplayLabel(change, context);
|
||||
issues.push(new validationIssue({
|
||||
type: ValidationIssueType.deprecated_tags,
|
||||
severity: ValidationIssueSeverity.warning,
|
||||
message: t('issues.deprecated_tags.message', { feature: featureLabel, tags: tagsLabel }),
|
||||
tooltip: t('issues.deprecated_tags.tooltip'),
|
||||
entities: [change],
|
||||
info: {
|
||||
oldTags: deprecatedTags.old,
|
||||
replaceTags: deprecatedTags.replace
|
||||
},
|
||||
fixes: [
|
||||
new validationIssueFix({
|
||||
title: t('issues.fix.upgrade_tags.title'),
|
||||
action: function() {
|
||||
var entity = this.issue.entities[0];
|
||||
var tags = _clone(entity.tags);
|
||||
var replaceTags = this.issue.info.replaceTags;
|
||||
var oldTags = this.issue.info.oldTags;
|
||||
var transferValue;
|
||||
for (var oldTagKey in oldTags) {
|
||||
if (oldTags[oldTagKey] === '*') {
|
||||
transferValue = tags[oldTagKey];
|
||||
}
|
||||
delete tags[oldTagKey];
|
||||
}
|
||||
for (var replaceKey in replaceTags) {
|
||||
var replaceValue = replaceTags[replaceKey];
|
||||
if (replaceValue === '*') {
|
||||
if (tags[replaceKey]) {
|
||||
// any value is okay and there already
|
||||
// is one, so don't update it
|
||||
continue;
|
||||
} else {
|
||||
// otherwise assume `yes` is okay
|
||||
tags[replaceKey] = 'yes';
|
||||
}
|
||||
} else if (replaceValue === '$1') {
|
||||
tags[replaceKey] = transferValue;
|
||||
} else {
|
||||
tags[replaceKey] = replaceValue;
|
||||
}
|
||||
}
|
||||
context.perform(
|
||||
actionChangeTags(entity.id, tags),
|
||||
t('issues.fix.upgrade_tags.undo_redo')
|
||||
);
|
||||
}
|
||||
})
|
||||
]
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user