From 3ee32776a7750c101bd7eca64361a61cd147e61d Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Wed, 12 Feb 2020 21:25:13 +0000 Subject: [PATCH] Fix QA error icons Pass service itself in to QAItem constructor for purpose of fetching data. Store string as `title` property on the service. --- modules/osm/qa_item.js | 4 ++-- modules/services/improveOSM.js | 8 +++++--- modules/services/keepRight.js | 4 +++- modules/services/osmose.js | 4 +++- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/modules/osm/qa_item.js b/modules/osm/qa_item.js index a53b814ee..ccf1df0fe 100644 --- a/modules/osm/qa_item.js +++ b/modules/osm/qa_item.js @@ -3,7 +3,7 @@ export class QAItem { constructor(loc, service, itemType, id, props) { // Store required properties this.loc = loc; - this.service = service; + this.service = service.title; this.itemType = itemType; // All issues must have an ID for selection, use generic if none specified @@ -33,7 +33,7 @@ export class QAItem { return this; } - // Generic handling for services without nice IDs + // Generic handling for newly created QAItems static id() { return this.nextId--; } diff --git a/modules/services/improveOSM.js b/modules/services/improveOSM.js index 6e48adafa..6f171598a 100644 --- a/modules/services/improveOSM.js +++ b/modules/services/improveOSM.js @@ -118,6 +118,8 @@ function preventCoincident(loc, bumpUp) { } export default { + title: 'improveOSM', + init(context) { context.data().get('qa_data') .then(d => _impOsmData = d.improveOSM); @@ -209,7 +211,7 @@ export default { // One-ways can land on same segment in opposite direction loc = preventCoincident(loc, false); - let d = new QAItem(loc, 'improveOSM', k, itemId, { + let d = new QAItem(loc, this, k, itemId, { issueKey: k, // used as a category identifier: { // used to post changes wayId, @@ -246,7 +248,7 @@ export default { let loc = pointAverage(feature.points); loc = preventCoincident(loc, false); - let d = new QAItem(loc, 'improveOSM', `${k}-${geoType}`, itemId, { + let d = new QAItem(loc, this, `${k}-${geoType}`, itemId, { issueKey: k, identifier: { x, y } }); @@ -282,7 +284,7 @@ export default { const via_node = ids[3]; const to_way = ids[2].split(':')[1]; - let d = new QAItem(loc, 'improveOSM', k, itemId, { + let d = new QAItem(loc, this, k, itemId, { issueKey: k, identifier: id, objectId: via_node, diff --git a/modules/services/keepRight.js b/modules/services/keepRight.js index d0dd9f99d..1c3423c0d 100644 --- a/modules/services/keepRight.js +++ b/modules/services/keepRight.js @@ -255,6 +255,8 @@ function parseError(capture, idType) { export default { + title: 'keepRight', + init(context) { context.data().get('keepRight') .then(d => _krData = d); @@ -381,7 +383,7 @@ export default { coincident = _cache.rtree.search(bbox).length; } while (coincident); - let d = new QAItem(loc, 'keepRight', itemType, id, { + let d = new QAItem(loc, this, itemType, id, { comment, description, whichType, diff --git a/modules/services/osmose.js b/modules/services/osmose.js index 0b3312df8..0d03f2c62 100644 --- a/modules/services/osmose.js +++ b/modules/services/osmose.js @@ -61,6 +61,8 @@ function preventCoincident(loc) { } export default { + title: 'osmose', + init(context) { context.data().get('qa_data') .then(d => { @@ -135,7 +137,7 @@ export default { let loc = issue.geometry.coordinates; // lon, lat loc = preventCoincident(loc); - let d = new QAItem(loc, 'osmose', itemType, id, { item }); + let d = new QAItem(loc, this, itemType, id, { item }); // Setting elems here prevents UI detail requests if (item === 8300 || item === 8360) {