From 342dcbabbe32dc725e051e773efbd798a611391b Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Mon, 3 Jun 2024 15:44:12 +0200 Subject: [PATCH] wip: no need for AVAILABLE_IMPORTERS --- umap/static/umap/js/modules/importer.js | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/umap/static/umap/js/modules/importer.js b/umap/static/umap/js/modules/importer.js index b0eac871..28f0a7fb 100644 --- a/umap/static/umap/js/modules/importer.js +++ b/umap/static/umap/js/modules/importer.js @@ -3,8 +3,6 @@ import { translate } from './i18n.js' import { uMapAlert as Alert } from '../components/alerts/alert.js' import Dialog from './ui/dialog.js' -const AVAILABLE_IMPORTERS = ['geodatamine', 'communesfr', 'presets'] - const TEMPLATE = `

${translate('Import data')}

@@ -46,14 +44,10 @@ export default class Importer { } loadImporterss() { - for (const key of AVAILABLE_IMPORTERS) { - if (key in this.map.options.importers) { - import(`./importers/${key}.js`).then((mod) => { - this.IMPORTERS.push( - new mod.Importer(this.map, this.map.options.importers[key]) - ) - }) - } + for (const key of Object.keys(this.map.options.importers || {})) { + import(`./importers/${key}.js`).then((mod) => { + this.IMPORTERS.push(new mod.Importer(this.map, this.map.options.importers[key])) + }) } }