mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-14 13:18:15 +02:00
Convert KeepRight to use generic error type
This commit is contained in:
@@ -5,7 +5,7 @@ import {
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
import { osmEntity, osmNote, krError, qaError } from '../osm';
|
||||
import { osmEntity, osmNote, qaError } from '../osm';
|
||||
import { utilKeybinding, utilRebind } from '../util';
|
||||
|
||||
|
||||
@@ -112,10 +112,7 @@ export function behaviorHover(context) {
|
||||
entity = datum;
|
||||
selector = '.data' + datum.__featurehash__;
|
||||
|
||||
} else if (
|
||||
datum instanceof qaError ||
|
||||
datum instanceof krError
|
||||
) {
|
||||
} else if (datum instanceof qaError) {
|
||||
entity = datum;
|
||||
selector = '.' + datum.source + '.error_id-' + datum.id;
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ import {
|
||||
import {
|
||||
osmEntity,
|
||||
osmNote,
|
||||
krError,
|
||||
qaError
|
||||
} from '../osm';
|
||||
|
||||
@@ -171,10 +170,6 @@ export function behaviorSelect(context) {
|
||||
context
|
||||
.selectedNoteID(datum.id)
|
||||
.enter(modeSelectNote(context, datum.id));
|
||||
} else if (datum instanceof krError & !isMultiselect) { // clicked a krError error
|
||||
context
|
||||
.selectedErrorID(datum.id)
|
||||
.enter(modeSelectError(context, datum.id, datum.source));
|
||||
} else if (datum instanceof qaError & !isMultiselect) { // clicked an external QA error
|
||||
context
|
||||
.selectedErrorID(datum.id)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
export { osmChangeset } from './changeset';
|
||||
export { osmEntity } from './entity';
|
||||
export { krError } from './keepRight';
|
||||
export { osmNode } from './node';
|
||||
export { osmNote } from './note';
|
||||
export { osmRelation } from './relation';
|
||||
|
||||
@@ -9,7 +9,7 @@ import { json as d3_json } from 'd3-request';
|
||||
import { request as d3_request } from 'd3-request';
|
||||
|
||||
import { geoExtent, geoVecAdd } from '../geo';
|
||||
import { krError } from '../osm';
|
||||
import { qaError } from '../osm';
|
||||
import { t } from '../util/locale';
|
||||
import { utilRebind, utilTiler, utilQsString } from '../util';
|
||||
|
||||
@@ -71,7 +71,7 @@ function updateRtree(item, replace) {
|
||||
|
||||
|
||||
function tokenReplacements(d) {
|
||||
if (!(d instanceof krError)) return;
|
||||
if (!(d instanceof qaError)) return;
|
||||
|
||||
var htmlRegex = new RegExp(/<\/[a-z][\s\S]*>/);
|
||||
var replacements = {};
|
||||
@@ -375,14 +375,17 @@ export default {
|
||||
coincident = _krCache.rtree.search(bbox).length;
|
||||
} while (coincident);
|
||||
|
||||
var d = new krError({
|
||||
var d = new qaError({
|
||||
// Required values
|
||||
loc: loc,
|
||||
service: 'keepRight',
|
||||
error_type: errorType,
|
||||
// Extra values for this service
|
||||
id: props.error_id,
|
||||
comment: props.comment || null,
|
||||
description: props.description || '',
|
||||
error_id: props.error_id,
|
||||
which_type: whichType,
|
||||
error_type: errorType,
|
||||
parent_error_type: parentErrorType,
|
||||
severity: whichTemplate.severity || 'error',
|
||||
object_id: props.object_id,
|
||||
@@ -468,7 +471,7 @@ export default {
|
||||
|
||||
// replace a single error in the cache
|
||||
replaceError: function(error) {
|
||||
if (!(error instanceof krError) || !error.id) return;
|
||||
if (!(error instanceof qaError) || !error.id) return;
|
||||
|
||||
_krCache.data[error.id] = error;
|
||||
updateRtree(encodeErrorRtree(error), true); // true = replace
|
||||
@@ -478,7 +481,7 @@ export default {
|
||||
|
||||
// remove a single error from the cache
|
||||
removeError: function(error) {
|
||||
if (!(error instanceof krError) || !error.id) return;
|
||||
if (!(error instanceof qaError) || !error.id) return;
|
||||
|
||||
delete _krCache.data[error.id];
|
||||
updateRtree(encodeErrorRtree(error), false); // false = remove
|
||||
@@ -496,4 +499,4 @@ export default {
|
||||
return Object.keys(_krCache.closed).sort();
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
@@ -1,7 +1,7 @@
|
||||
import { t } from '../util/locale';
|
||||
import { services } from '../services';
|
||||
import { svgIcon } from '../svg';
|
||||
import { krError } from '../osm';
|
||||
import { qaError } from '../osm';
|
||||
|
||||
|
||||
export function uiViewOnKeepRight() {
|
||||
@@ -10,7 +10,7 @@ export function uiViewOnKeepRight() {
|
||||
|
||||
function viewOnKeepRight(selection) {
|
||||
var url;
|
||||
if (services.keepRight && (_error instanceof krError)) {
|
||||
if (services.keepRight && (_error instanceof qaError)) {
|
||||
url = services.keepRight.errorURL(_error);
|
||||
}
|
||||
|
||||
@@ -42,4 +42,4 @@ export function uiViewOnKeepRight() {
|
||||
};
|
||||
|
||||
return viewOnKeepRight;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user