More work on import flow

This commit is contained in:
Pieter Vander Vennet 2022-01-25 00:48:05 +01:00
parent 33ef83c4a9
commit fa179af601
8 changed files with 54 additions and 12 deletions

View file

@ -22,6 +22,11 @@ export class CreateNotes extends Combine {
const src = f.properties["source"] ?? f.properties["src"] ?? v.source
delete f.properties["source"]
delete f.properties["src"]
let extraNote = ""
if(f.properties["note"]){
extraNote = f.properties["note"]+"\n"
delete f.properties["note"]
}
const tags: string [] = []
for (const key in f.properties) {
@ -33,7 +38,7 @@ export class CreateNotes extends Combine {
const lat = f.geometry.coordinates[1]
const lon = f.geometry.coordinates[0]
const text = [v.intro,
'',
extraNote,
"Source: " + src,
'More information at ' + v.wikilink,
'',

View file

@ -27,10 +27,7 @@ export default class ImportHelperGui extends LeftIndex {
constructor() {
const state = new UserRelatedState(undefined)
// We disable the userbadge, as various 'showData'-layers will give a read-only view in this case
state.featureSwitchUserbadge.setData(false)
const {flow, furthestStep, titles} =
const {flow, furthestStep, titles} =
FlowPanelFactory
.start("Introduction", new Introdution())
.then("Login", _ => new LoginToImport(state))

View file

@ -99,6 +99,7 @@ export class PreviewPanel extends Combine implements FlowStep<{ features: { prop
super([
new Title(t.inspectDataTitle.Subs({count: geojson.features.length})),
"Extra remark: An attribute with 'source' or 'src' will be added as 'source' into the map pin; an attribute 'note' will be added into the map pin as well. These values won't be imported",
...attributeOverview,
confirm
]);

View file

@ -538,10 +538,15 @@ export class ImportPointButton extends AbstractImportButton {
if (snapOntoWayId !== undefined) {
snapOnto = await OsmObject.DownloadObjectAsync(snapOntoWayId)
}
let specialMotivation = undefined
if(args.note_id !== undefined){
specialMotivation = "source: https://osm.org/note/"+args.note_id
}
const newElementAction = new CreateNewNodeAction(tags, location.lat, location.lon, {
theme: state.layoutToUse.id,
changeType: "import",
snapOnto: <OsmWay>snapOnto
snapOnto: <OsmWay>snapOnto,
specialMotivation
})
await state.changes.applyAction(newElementAction)