wip: no need for AVAILABLE_IMPORTERS

This commit is contained in:
Yohan Boniface 2024-06-03 15:44:12 +02:00
parent f5eea1fe3f
commit 342dcbabbe

View file

@ -3,8 +3,6 @@ import { translate } from './i18n.js'
import { uMapAlert as Alert } from '../components/alerts/alert.js' import { uMapAlert as Alert } from '../components/alerts/alert.js'
import Dialog from './ui/dialog.js' import Dialog from './ui/dialog.js'
const AVAILABLE_IMPORTERS = ['geodatamine', 'communesfr', 'presets']
const TEMPLATE = ` const TEMPLATE = `
<h3><i class="icon icon-16 icon-upload"></i><span>${translate('Import data')}</span></h3> <h3><i class="icon icon-16 icon-upload"></i><span>${translate('Import data')}</span></h3>
<div class="formbox"> <div class="formbox">
@ -46,16 +44,12 @@ export default class Importer {
} }
loadImporterss() { loadImporterss() {
for (const key of AVAILABLE_IMPORTERS) { for (const key of Object.keys(this.map.options.importers || {})) {
if (key in this.map.options.importers) {
import(`./importers/${key}.js`).then((mod) => { import(`./importers/${key}.js`).then((mod) => {
this.IMPORTERS.push( this.IMPORTERS.push(new mod.Importer(this.map, this.map.options.importers[key]))
new mod.Importer(this.map, this.map.options.importers[key])
)
}) })
} }
} }
}
qs(query) { qs(query) {
return this.container.querySelector(query) return this.container.querySelector(query)