mirror of
https://github.com/umap-project/umap.git
synced 2025-04-29 11:52:38 +02:00
wip: make sure importers are always in the same order
Given they are loaded from an import() call, the order they are added in IMPORTERS in asynchronous, so we cannot rely on this order
This commit is contained in:
parent
c51f8ae5ce
commit
3f6940cd5b
5 changed files with 8 additions and 5 deletions
|
@ -128,7 +128,7 @@ export default class Importer {
|
||||||
this.container = DomUtil.create('div', 'umap-upload')
|
this.container = DomUtil.create('div', 'umap-upload')
|
||||||
this.container.innerHTML = TEMPLATE
|
this.container.innerHTML = TEMPLATE
|
||||||
if (this.IMPORTERS.length) {
|
if (this.IMPORTERS.length) {
|
||||||
for (const plugin of this.IMPORTERS) {
|
for (const plugin of this.IMPORTERS.sort((a, b) => (a.id > b.id ? 1 : -1))) {
|
||||||
L.DomUtil.createButton(
|
L.DomUtil.createButton(
|
||||||
plugin.id,
|
plugin.id,
|
||||||
this.container.querySelector('#importers'),
|
this.container.querySelector('#importers'),
|
||||||
|
|
|
@ -10,7 +10,6 @@ class Autocomplete extends SingleMixin(BaseAjax) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export class Importer {
|
export class Importer {
|
||||||
constructor(map, options) {
|
constructor(map, options) {
|
||||||
this.name = options.name || 'Communes'
|
this.name = options.name || 'Communes'
|
||||||
|
|
|
@ -10,7 +10,7 @@ export class Importer {
|
||||||
|
|
||||||
async open(importer) {
|
async open(importer) {
|
||||||
const container = DomUtil.create('div', 'formbox')
|
const container = DomUtil.create('div', 'formbox')
|
||||||
DomUtil.element({tagName: 'h3', textContent: this.name, parent: container})
|
DomUtil.element({ tagName: 'h3', textContent: this.name, parent: container })
|
||||||
const select = DomUtil.create('select', '', container)
|
const select = DomUtil.create('select', '', container)
|
||||||
const noPreset = DomUtil.element({
|
const noPreset = DomUtil.element({
|
||||||
tagName: 'option',
|
tagName: 'option',
|
||||||
|
|
|
@ -74,7 +74,9 @@ export class Importer {
|
||||||
})
|
})
|
||||||
const confirm = () => {
|
const confirm = () => {
|
||||||
if (!boundary || !select.value) {
|
if (!boundary || !select.value) {
|
||||||
this.map.alert.open({content: translate('Please choose a theme and a boundary first.')})
|
this.map.alert.open({
|
||||||
|
content: translate('Please choose a theme and a boundary first.'),
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
importer.url = `${this.baseUrl}/data/${select.value}/${boundary}?format=geojson&aspoint=${asPoint.checked}`
|
importer.url = `${this.baseUrl}/data/${select.value}/${boundary}?format=geojson&aspoint=${asPoint.checked}`
|
||||||
|
|
|
@ -60,7 +60,9 @@ export class Importer {
|
||||||
const confirm = () => {
|
const confirm = () => {
|
||||||
let tags = container.querySelector('[name=tags]').value
|
let tags = container.querySelector('[name=tags]').value
|
||||||
if (!tags) {
|
if (!tags) {
|
||||||
this.map.alert.open({content: translate('Please define an expression for the query first')})
|
this.map.alert.open({
|
||||||
|
content: translate('Please define an expression for the query first'),
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const outMode = container.querySelector('[name=out-mode]').value
|
const outMode = container.querySelector('[name=out-mode]').value
|
||||||
|
|
Loading…
Reference in a new issue