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:
Quincy Morgan
2018-12-20 14:04:15 -05:00
parent 373be68294
commit d58867df7c
7 changed files with 36 additions and 47 deletions
+1
View File
@@ -4,6 +4,7 @@ export { utilCleanTags } from './clean_tags';
export { utilDisplayName } from './util';
export { utilDisplayNameForPath } from './util';
export { utilDisplayType } from './util';
export { utilDisplayLabel } from './util';
export { utilEditDistance } from './util';
export { utilEntitySelector } from './util';
export { utilEntityOrMemberSelector } from './util';
+16
View File
@@ -121,6 +121,22 @@ export function utilDisplayType(id) {
}
export function utilDisplayLabel(entity, context) {
var displayName = utilDisplayName(entity);
if (displayName) {
// use the display name if there is one
return displayName;
}
var preset = context.presets().match(entity, context.graph());
if (preset && preset.name()) {
// use the preset name if there is a match
return preset.name();
}
// fallback to the display type (node/way/relation)
return utilDisplayType(entity.id);
}
export function utilStringQs(str) {
return str.split('&').reduce(function(obj, pair){
var parts = pair.split('=');