mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-20 23:44:47 +02:00
Add entity display label util function
Condense message and tooltip text for for the untagged feature issue Use lighter border color for error issues
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { t } from '../util/locale';
|
||||
import {
|
||||
utilDisplayName,
|
||||
utilDisplayType
|
||||
utilDisplayLabel
|
||||
} from '../util';
|
||||
import {
|
||||
ValidationIssueType,
|
||||
@@ -35,22 +34,12 @@ export function validationDisconnectedHighway(context) {
|
||||
var issues = [];
|
||||
for (var i = 0; i < changes.created.length; i++) {
|
||||
var entity = changes.created[i];
|
||||
|
||||
if (isDisconnectedHighway(entity, graph)) {
|
||||
var entityLabel = utilDisplayName(entity);
|
||||
if (!entityLabel) {
|
||||
var preset = context.presets().match(entity, graph);
|
||||
if (preset && preset.name()) {
|
||||
entityLabel = preset.name();
|
||||
} else {
|
||||
entityLabel = utilDisplayType(entity.id);
|
||||
}
|
||||
}
|
||||
|
||||
var entityLabel = utilDisplayLabel(entity, context);
|
||||
issues.push(new validationIssue({
|
||||
type: ValidationIssueType.disconnected_highway,
|
||||
severity: ValidationIssueSeverity.warning,
|
||||
message: t('issues.disconnected_highway.message', {entityLabel: entityLabel}),
|
||||
message: t('issues.disconnected_highway.message', {highway: entityLabel}),
|
||||
tooltip: t('issues.disconnected_highway.tooltip'),
|
||||
entities: [entity],
|
||||
}));
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
import _without from 'lodash-es/without';
|
||||
import { t } from '../util/locale';
|
||||
import {
|
||||
utilDisplayLabel
|
||||
} from '../util';
|
||||
import {
|
||||
ValidationIssueType,
|
||||
ValidationIssueSeverity,
|
||||
validationIssue,
|
||||
} from './validation_issue';
|
||||
|
||||
export function validationMissingTag() {
|
||||
export function validationMissingTag(context) {
|
||||
|
||||
// Slightly stricter check than Entity#isUsed (#3091)
|
||||
function hasTags(entity, graph) {
|
||||
@@ -23,11 +26,12 @@ export function validationMissingTag() {
|
||||
geometry = change.geometry(graph);
|
||||
|
||||
if (types.indexOf(geometry) !== -1 && !hasTags(change, graph)) {
|
||||
var entityLabel = utilDisplayLabel(change, context);
|
||||
issues.push(new validationIssue({
|
||||
type: ValidationIssueType.missing_tag,
|
||||
severity: ValidationIssueSeverity.error,
|
||||
message: t('issues.untagged_' + geometry + '.message'),
|
||||
tooltip: t('issues.untagged_' + geometry + '.tooltip'),
|
||||
message: t('issues.untagged_feature.message', {feature: entityLabel}),
|
||||
tooltip: t('issues.untagged_feature.tooltip'),
|
||||
entities: [change],
|
||||
}));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user