mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-24 09:04:02 +02:00
Remove references to ImproveOSM
This commit is contained in:
@@ -27,7 +27,6 @@ var readOnlyTags = [
|
||||
/^resolved:/,
|
||||
/^closed:note$/,
|
||||
/^closed:keepright$/,
|
||||
/^closed:improveosm:/,
|
||||
/^closed:osmose:/
|
||||
];
|
||||
|
||||
@@ -155,12 +154,6 @@ export function uiCommit(context) {
|
||||
tags['closed:keepright'] = context.cleanTagValue(krClosed.join(';'));
|
||||
}
|
||||
}
|
||||
if (services.improveOSM) {
|
||||
var iOsmClosed = services.improveOSM.getClosedCounts();
|
||||
for (itemType in iOsmClosed) {
|
||||
tags['closed:improveosm:' + itemType] = context.cleanTagValue(iOsmClosed[itemType].toString());
|
||||
}
|
||||
}
|
||||
if (services.osmose) {
|
||||
var osmoseClosed = services.osmose.getClosedCounts();
|
||||
for (itemType in osmoseClosed) {
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
import { select as d3_select } from 'd3-selection';
|
||||
|
||||
import { t, localizer } from '../core/localizer';
|
||||
import { svgIcon } from '../svg/icon';
|
||||
import { services } from '../services';
|
||||
|
||||
export function uiImproveOsmComments() {
|
||||
let _qaItem;
|
||||
|
||||
function issueComments(selection) {
|
||||
// make the div immediately so it appears above the buttons
|
||||
let comments = selection.selectAll('.comments-container')
|
||||
.data([0]);
|
||||
|
||||
comments = comments.enter()
|
||||
.append('div')
|
||||
.attr('class', 'comments-container')
|
||||
.merge(comments);
|
||||
|
||||
// must retrieve comments from API before they can be displayed
|
||||
services.improveOSM.getComments(_qaItem)
|
||||
.then(d => {
|
||||
if (!d.comments) return; // nothing to do here
|
||||
|
||||
const commentEnter = comments.selectAll('.comment')
|
||||
.data(d.comments)
|
||||
.enter()
|
||||
.append('div')
|
||||
.attr('class', 'comment');
|
||||
|
||||
commentEnter
|
||||
.append('div')
|
||||
.attr('class', 'comment-avatar')
|
||||
.call(svgIcon('#iD-icon-avatar', 'comment-avatar-icon'));
|
||||
|
||||
const mainEnter = commentEnter
|
||||
.append('div')
|
||||
.attr('class', 'comment-main');
|
||||
|
||||
const metadataEnter = mainEnter
|
||||
.append('div')
|
||||
.attr('class', 'comment-metadata');
|
||||
|
||||
metadataEnter
|
||||
.append('div')
|
||||
.attr('class', 'comment-author')
|
||||
.each(function(d) {
|
||||
const osm = services.osm;
|
||||
let selection = d3_select(this);
|
||||
if (osm && d.username) {
|
||||
selection = selection
|
||||
.append('a')
|
||||
.attr('class', 'comment-author-link')
|
||||
.attr('href', osm.userURL(d.username))
|
||||
.attr('target', '_blank');
|
||||
}
|
||||
selection
|
||||
.text(d => d.username);
|
||||
});
|
||||
|
||||
metadataEnter
|
||||
.append('div')
|
||||
.attr('class', 'comment-date')
|
||||
.html(d => t.html('note.status.commented', { when: localeDateString(d.timestamp) }));
|
||||
|
||||
mainEnter
|
||||
.append('div')
|
||||
.attr('class', 'comment-text')
|
||||
.append('p')
|
||||
.text(d => d.text);
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err); // eslint-disable-line no-console
|
||||
});
|
||||
}
|
||||
|
||||
function localeDateString(s) {
|
||||
if (!s) return null;
|
||||
const options = { day: 'numeric', month: 'short', year: 'numeric' };
|
||||
const d = new Date(s * 1000); // timestamp is served in seconds, date takes ms
|
||||
if (isNaN(d.getTime())) return null;
|
||||
return d.toLocaleDateString(localizer.localeCode(), options);
|
||||
}
|
||||
|
||||
issueComments.issue = function(val) {
|
||||
if (!arguments.length) return _qaItem;
|
||||
_qaItem = val;
|
||||
return issueComments;
|
||||
};
|
||||
|
||||
return issueComments;
|
||||
}
|
||||
@@ -1,125 +0,0 @@
|
||||
import {
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
import { presetManager } from '../presets';
|
||||
import { modeSelect } from '../modes/select';
|
||||
import { t } from '../core/localizer';
|
||||
import { utilDisplayName, utilHighlightEntities, utilEntityRoot } from '../util';
|
||||
|
||||
export function uiImproveOsmDetails(context) {
|
||||
let _qaItem;
|
||||
|
||||
|
||||
function issueDetail(d) {
|
||||
if (d.desc) return d.desc;
|
||||
const issueKey = d.issueKey;
|
||||
d.replacements = d.replacements || {};
|
||||
d.replacements.default = { html: t.html('inspector.unknown') }; // special key `default` works as a fallback string
|
||||
return t.html(`QA.improveOSM.error_types.${issueKey}.description`, d.replacements);
|
||||
}
|
||||
|
||||
|
||||
function improveOsmDetails(selection) {
|
||||
const details = selection.selectAll('.error-details')
|
||||
.data(
|
||||
(_qaItem ? [_qaItem] : []),
|
||||
d => `${d.id}-${d.status || 0}`
|
||||
);
|
||||
|
||||
details.exit()
|
||||
.remove();
|
||||
|
||||
const detailsEnter = details.enter()
|
||||
.append('div')
|
||||
.attr('class', 'error-details qa-details-container');
|
||||
|
||||
|
||||
// description
|
||||
const descriptionEnter = detailsEnter
|
||||
.append('div')
|
||||
.attr('class', 'qa-details-subsection');
|
||||
|
||||
descriptionEnter
|
||||
.append('h4')
|
||||
.call(t.append('QA.keepRight.detail_description'));
|
||||
|
||||
descriptionEnter
|
||||
.append('div')
|
||||
.attr('class', 'qa-details-description-text')
|
||||
.html(issueDetail);
|
||||
|
||||
// If there are entity links in the error message..
|
||||
let relatedEntities = [];
|
||||
descriptionEnter.selectAll('.error_entity_link, .error_object_link')
|
||||
.attr('href', '#')
|
||||
.each(function() {
|
||||
const link = d3_select(this);
|
||||
const isObjectLink = link.classed('error_object_link');
|
||||
const entityID = isObjectLink ?
|
||||
(utilEntityRoot(_qaItem.objectType) + _qaItem.objectId)
|
||||
: this.textContent;
|
||||
const entity = context.hasEntity(entityID);
|
||||
|
||||
relatedEntities.push(entityID);
|
||||
|
||||
// Add click handler
|
||||
link
|
||||
.on('mouseenter', () => {
|
||||
utilHighlightEntities([entityID], true, context);
|
||||
})
|
||||
.on('mouseleave', () => {
|
||||
utilHighlightEntities([entityID], false, context);
|
||||
})
|
||||
.on('click', (d3_event) => {
|
||||
d3_event.preventDefault();
|
||||
|
||||
utilHighlightEntities([entityID], false, context);
|
||||
|
||||
const osmlayer = context.layers().layer('osm');
|
||||
if (!osmlayer.enabled()) {
|
||||
osmlayer.enabled(true);
|
||||
}
|
||||
|
||||
context.map().centerZoom(_qaItem.loc, 20);
|
||||
|
||||
if (entity) {
|
||||
context.enter(modeSelect(context, [entityID]));
|
||||
} else {
|
||||
context.loadEntity(entityID, (err, result) => {
|
||||
if (err) return;
|
||||
const entity = result.data.find(e => e.id === entityID);
|
||||
if (entity) context.enter(modeSelect(context, [entityID]));
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Replace with friendly name if possible
|
||||
// (The entity may not yet be loaded into the graph)
|
||||
if (entity) {
|
||||
let name = utilDisplayName(entity); // try to use common name
|
||||
|
||||
if (!name && !isObjectLink) {
|
||||
const preset = presetManager.match(entity, context.graph());
|
||||
name = preset && !preset.isFallback() && preset.name(); // fallback to preset name
|
||||
}
|
||||
|
||||
if (name) {
|
||||
this.innerText = name;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Don't hide entities related to this error - #5880
|
||||
context.features().forceVisible(relatedEntities);
|
||||
context.map().pan([0,0]); // trigger a redraw
|
||||
}
|
||||
|
||||
improveOsmDetails.issue = function(val) {
|
||||
if (!arguments.length) return _qaItem;
|
||||
_qaItem = val;
|
||||
return improveOsmDetails;
|
||||
};
|
||||
|
||||
return improveOsmDetails;
|
||||
}
|
||||
@@ -1,200 +0,0 @@
|
||||
import { dispatch as d3_dispatch } from 'd3-dispatch';
|
||||
import { select as d3_select } from 'd3-selection';
|
||||
|
||||
import { t } from '../core/localizer';
|
||||
import { services } from '../services';
|
||||
import { modeBrowse } from '../modes/browse';
|
||||
import { svgIcon } from '../svg/icon';
|
||||
|
||||
import { uiImproveOsmComments } from './improveOSM_comments';
|
||||
import { uiImproveOsmDetails } from './improveOSM_details';
|
||||
import { uiImproveOsmHeader } from './improveOSM_header';
|
||||
|
||||
import { utilNoAuto, utilRebind } from '../util';
|
||||
|
||||
export function uiImproveOsmEditor(context) {
|
||||
const dispatch = d3_dispatch('change');
|
||||
const qaDetails = uiImproveOsmDetails(context);
|
||||
const qaComments = uiImproveOsmComments(context);
|
||||
const qaHeader = uiImproveOsmHeader(context);
|
||||
|
||||
let _qaItem;
|
||||
|
||||
function improveOsmEditor(selection) {
|
||||
|
||||
const headerEnter = selection.selectAll('.header')
|
||||
.data([0])
|
||||
.enter()
|
||||
.append('div')
|
||||
.attr('class', 'header fillL');
|
||||
|
||||
headerEnter
|
||||
.append('button')
|
||||
.attr('class', 'close')
|
||||
.attr('title', t('icons.close'))
|
||||
.on('click', () => context.enter(modeBrowse(context)))
|
||||
.call(svgIcon('#iD-icon-close'));
|
||||
|
||||
headerEnter
|
||||
.append('h2')
|
||||
.call(t.append('QA.improveOSM.title'));
|
||||
|
||||
let body = selection.selectAll('.body')
|
||||
.data([0]);
|
||||
|
||||
body = body.enter()
|
||||
.append('div')
|
||||
.attr('class', 'body')
|
||||
.merge(body);
|
||||
|
||||
const editor = body.selectAll('.qa-editor')
|
||||
.data([0]);
|
||||
|
||||
editor.enter()
|
||||
.append('div')
|
||||
.attr('class', 'modal-section qa-editor')
|
||||
.merge(editor)
|
||||
.call(qaHeader.issue(_qaItem))
|
||||
.call(qaDetails.issue(_qaItem))
|
||||
.call(qaComments.issue(_qaItem))
|
||||
.call(improveOsmSaveSection);
|
||||
}
|
||||
|
||||
function improveOsmSaveSection(selection) {
|
||||
const isSelected = (_qaItem && _qaItem.id === context.selectedErrorID());
|
||||
const isShown = (_qaItem && (isSelected || _qaItem.newComment || _qaItem.comment));
|
||||
let saveSection = selection.selectAll('.qa-save')
|
||||
.data(
|
||||
(isShown ? [_qaItem] : []),
|
||||
d => `${d.id}-${d.status || 0}`
|
||||
);
|
||||
|
||||
// exit
|
||||
saveSection.exit()
|
||||
.remove();
|
||||
|
||||
// enter
|
||||
const saveSectionEnter = saveSection.enter()
|
||||
.append('div')
|
||||
.attr('class', 'qa-save save-section cf');
|
||||
|
||||
saveSectionEnter
|
||||
.append('h4')
|
||||
.attr('class', '.qa-save-header')
|
||||
.call(t.append('note.newComment'));
|
||||
|
||||
saveSectionEnter
|
||||
.append('textarea')
|
||||
.attr('class', 'new-comment-input')
|
||||
.attr('placeholder', t('QA.keepRight.comment_placeholder'))
|
||||
.attr('maxlength', 1000)
|
||||
.property('value', d => d.newComment)
|
||||
.call(utilNoAuto)
|
||||
.on('input', changeInput)
|
||||
.on('blur', changeInput);
|
||||
|
||||
// update
|
||||
saveSection = saveSectionEnter
|
||||
.merge(saveSection)
|
||||
.call(qaSaveButtons);
|
||||
|
||||
function changeInput() {
|
||||
const input = d3_select(this);
|
||||
let val = input.property('value').trim();
|
||||
|
||||
if (val === '') {
|
||||
val = undefined;
|
||||
}
|
||||
|
||||
// store the unsaved comment with the issue itself
|
||||
_qaItem = _qaItem.update({ newComment: val });
|
||||
|
||||
const qaService = services.improveOSM;
|
||||
if (qaService) {
|
||||
qaService.replaceItem(_qaItem);
|
||||
}
|
||||
|
||||
saveSection
|
||||
.call(qaSaveButtons);
|
||||
}
|
||||
}
|
||||
|
||||
function qaSaveButtons(selection) {
|
||||
const isSelected = (_qaItem && _qaItem.id === context.selectedErrorID());
|
||||
let buttonSection = selection.selectAll('.buttons')
|
||||
.data((isSelected ? [_qaItem] : []), d => d.status + d.id);
|
||||
|
||||
// exit
|
||||
buttonSection.exit()
|
||||
.remove();
|
||||
|
||||
// enter
|
||||
const buttonEnter = buttonSection.enter()
|
||||
.append('div')
|
||||
.attr('class', 'buttons');
|
||||
|
||||
buttonEnter
|
||||
.append('button')
|
||||
.attr('class', 'button comment-button action')
|
||||
.call(t.append('QA.keepRight.save_comment'));
|
||||
|
||||
buttonEnter
|
||||
.append('button')
|
||||
.attr('class', 'button close-button action');
|
||||
|
||||
buttonEnter
|
||||
.append('button')
|
||||
.attr('class', 'button ignore-button action');
|
||||
|
||||
// update
|
||||
buttonSection = buttonSection
|
||||
.merge(buttonEnter);
|
||||
|
||||
buttonSection.select('.comment-button')
|
||||
.attr('disabled', d => d.newComment ? null : true)
|
||||
.on('click.comment', function(d3_event, d) {
|
||||
this.blur(); // avoid keeping focus on the button - #4641
|
||||
const qaService = services.improveOSM;
|
||||
if (qaService) {
|
||||
qaService.postUpdate(d, (err, item) => dispatch.call('change', item));
|
||||
}
|
||||
});
|
||||
|
||||
buttonSection.select('.close-button')
|
||||
.html(d => {
|
||||
const andComment = (d.newComment ? '_comment' : '');
|
||||
return t.html(`QA.keepRight.close${andComment}`);
|
||||
})
|
||||
.on('click.close', function(d3_event, d) {
|
||||
this.blur(); // avoid keeping focus on the button - #4641
|
||||
const qaService = services.improveOSM;
|
||||
if (qaService) {
|
||||
d.newStatus = 'SOLVED';
|
||||
qaService.postUpdate(d, (err, item) => dispatch.call('change', item));
|
||||
}
|
||||
});
|
||||
|
||||
buttonSection.select('.ignore-button')
|
||||
.html(d => {
|
||||
const andComment = (d.newComment ? '_comment' : '');
|
||||
return t.html(`QA.keepRight.ignore${andComment}`);
|
||||
})
|
||||
.on('click.ignore', function(d3_event, d) {
|
||||
this.blur(); // avoid keeping focus on the button - #4641
|
||||
const qaService = services.improveOSM;
|
||||
if (qaService) {
|
||||
d.newStatus = 'INVALID';
|
||||
qaService.postUpdate(d, (err, item) => dispatch.call('change', item));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// NOTE: Don't change method name until UI v3 is merged
|
||||
improveOsmEditor.error = function(val) {
|
||||
if (!arguments.length) return _qaItem;
|
||||
_qaItem = val;
|
||||
return improveOsmEditor;
|
||||
};
|
||||
|
||||
return utilRebind(improveOsmEditor, dispatch, 'on');
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
import { t } from '../core/localizer';
|
||||
|
||||
|
||||
export function uiImproveOsmHeader() {
|
||||
let _qaItem;
|
||||
|
||||
|
||||
function issueTitle(d) {
|
||||
const issueKey = d.issueKey;
|
||||
d.replacements = d.replacements || {};
|
||||
d.replacements.default = { html: t.html('inspector.unknown') }; // special key `default` works as a fallback string
|
||||
return t.html(`QA.improveOSM.error_types.${issueKey}.title`, d.replacements);
|
||||
}
|
||||
|
||||
|
||||
function improveOsmHeader(selection) {
|
||||
const header = selection.selectAll('.qa-header')
|
||||
.data(
|
||||
(_qaItem ? [_qaItem] : []),
|
||||
d => `${d.id}-${d.status || 0}`
|
||||
);
|
||||
|
||||
header.exit()
|
||||
.remove();
|
||||
|
||||
const headerEnter = header.enter()
|
||||
.append('div')
|
||||
.attr('class', 'qa-header');
|
||||
|
||||
const svgEnter = headerEnter
|
||||
.append('div')
|
||||
.attr('class', 'qa-header-icon')
|
||||
.classed('new', d => d.id < 0)
|
||||
.append('svg')
|
||||
.attr('width', '20px')
|
||||
.attr('height', '30px')
|
||||
.attr('viewbox', '0 0 20 30')
|
||||
.attr('class', d => `preset-icon-28 qaItem ${d.service} itemId-${d.id} itemType-${d.itemType}`);
|
||||
|
||||
svgEnter
|
||||
.append('polygon')
|
||||
.attr('fill', 'currentColor')
|
||||
.attr('class', 'qaItem-fill')
|
||||
.attr('points', '16,3 4,3 1,6 1,17 4,20 7,20 10,27 13,20 16,20 19,17.033 19,6');
|
||||
|
||||
svgEnter
|
||||
.append('use')
|
||||
.attr('class', 'icon-annotation')
|
||||
.attr('width', '12px')
|
||||
.attr('height', '12px')
|
||||
.attr('transform', 'translate(4, 5.5)')
|
||||
.attr('xlink:href', d => d.icon ? '#' + d.icon : '');
|
||||
|
||||
headerEnter
|
||||
.append('div')
|
||||
.attr('class', 'qa-header-label')
|
||||
.html(issueTitle);
|
||||
}
|
||||
|
||||
improveOsmHeader.issue = function(val) {
|
||||
if (!arguments.length) return _qaItem;
|
||||
_qaItem = val;
|
||||
return improveOsmHeader;
|
||||
};
|
||||
|
||||
return improveOsmHeader;
|
||||
}
|
||||
@@ -23,10 +23,6 @@ export { uiFlash } from './flash';
|
||||
export { uiFormFields } from './form_fields';
|
||||
export { uiFullScreen } from './full_screen';
|
||||
export { uiGeolocate } from './geolocate';
|
||||
export { uiImproveOsmComments } from './improveOSM_comments';
|
||||
export { uiImproveOsmDetails } from './improveOSM_details';
|
||||
export { uiImproveOsmEditor } from './improveOSM_editor';
|
||||
export { uiImproveOsmHeader } from './improveOSM_header';
|
||||
export { uiInfo } from './info';
|
||||
export { uiInspector } from './inspector';
|
||||
export { uiIssuesInfo } from './issues_info';
|
||||
|
||||
@@ -128,7 +128,7 @@ export function uiSectionDataLayers(context) {
|
||||
}
|
||||
|
||||
function drawQAItems(selection) {
|
||||
var qaKeys = ['keepRight', 'improveOSM', 'osmose'];
|
||||
var qaKeys = ['keepRight', 'osmose'];
|
||||
var qaLayers = layers.all().filter(function(obj) { return qaKeys.indexOf(obj.id) !== -1; });
|
||||
|
||||
var ul = selection
|
||||
|
||||
@@ -12,7 +12,6 @@ import { services } from '../services';
|
||||
import { uiDataEditor } from './data_editor';
|
||||
import { uiFeatureList } from './feature_list';
|
||||
import { uiInspector } from './inspector';
|
||||
import { uiImproveOsmEditor } from './improveOSM_editor';
|
||||
import { uiKeepRightEditor } from './keepRight_editor';
|
||||
import { uiOsmoseEditor } from './osmose_editor';
|
||||
import { uiNoteEditor } from './note_editor';
|
||||
@@ -23,7 +22,6 @@ export function uiSidebar(context) {
|
||||
var inspector = uiInspector(context);
|
||||
var dataEditor = uiDataEditor(context);
|
||||
var noteEditor = uiNoteEditor(context);
|
||||
var improveOsmEditor = uiImproveOsmEditor(context);
|
||||
var keepRightEditor = uiKeepRightEditor(context);
|
||||
var osmoseEditor = uiOsmoseEditor(context);
|
||||
var _current;
|
||||
@@ -211,10 +209,8 @@ export function uiSidebar(context) {
|
||||
var errEditor;
|
||||
if (datum.service === 'keepRight') {
|
||||
errEditor = keepRightEditor;
|
||||
} else if (datum.service === 'osmose') {
|
||||
errEditor = osmoseEditor;
|
||||
} else {
|
||||
errEditor = improveOsmEditor;
|
||||
errEditor = osmoseEditor;
|
||||
}
|
||||
|
||||
context.container().selectAll('.qaItem.' + datum.service)
|
||||
|
||||
Reference in New Issue
Block a user