mirror of
https://github.com/umap-project/umap.git
synced 2025-04-29 03:42:37 +02:00
wip: make sure we do not add an invalid overpass URL
This commit is contained in:
parent
a70307ea29
commit
115130083d
2 changed files with 8 additions and 4 deletions
|
@ -35,7 +35,7 @@ class Autocomplete extends SingleMixin(BaseAjax) {
|
|||
export class Importer {
|
||||
constructor(map, options) {
|
||||
this.map = map
|
||||
this.name = 'Overpass'
|
||||
this.name = options.name || 'Overpass'
|
||||
this.baseUrl = options?.url || 'https://overpass-api.de/api/interpreter'
|
||||
}
|
||||
|
||||
|
@ -57,8 +57,12 @@ export class Importer {
|
|||
this.map.help.parse(container)
|
||||
|
||||
const confirm = () => {
|
||||
const outMode = container.querySelector('[name=out-mode]').value
|
||||
let tags = container.querySelector('[name=tags]').value
|
||||
if (!tags) {
|
||||
this.map.alert.open({content: translate('Please define an expression for the query first')})
|
||||
return
|
||||
}
|
||||
const outMode = container.querySelector('[name=out-mode]').value
|
||||
if (!tags.startsWith('[')) tags = `[${tags}]`
|
||||
let area = '{south},{west},{north},{east}'
|
||||
if (boundary) area = `area:${boundary}`
|
||||
|
@ -68,7 +72,7 @@ export class Importer {
|
|||
importer.format = 'osm'
|
||||
importer.dialog.close()
|
||||
}
|
||||
L.DomUtil.createButton('', container, 'OK', confirm)
|
||||
L.DomUtil.createButton('', container, translate('Choose this data'), confirm)
|
||||
|
||||
importer.dialog.open({
|
||||
content: container,
|
||||
|
|
|
@ -534,7 +534,7 @@ def test_overpass_import_with_bbox(page, live_server, tilelayer, settings):
|
|||
page.get_by_role("link", name="Import data (Ctrl+I)").click()
|
||||
page.get_by_role("button", name="Overpass").click()
|
||||
page.get_by_placeholder("amenity=drinking_water").fill("building")
|
||||
page.get_by_role("button", name="OK").click()
|
||||
page.get_by_role("button", name="Choose this data").click()
|
||||
expect(page.get_by_placeholder("Provide an URL here")).to_have_value(
|
||||
"https://my.overpass.io/interpreter?data=[out:json];nwr[building]({south},{west},{north},{east});out geom;"
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue