From 6854fa369226c6d45a0af294938ed502c7499fff Mon Sep 17 00:00:00 2001 From: Roland Date: Thu, 27 Oct 2022 20:22:11 -0600 Subject: [PATCH] Handling merging multiple pbf files in map importing. --- app/src/components/Map.js | 18 ++--- modules/map/api.py | 10 +-- modules/map/lib.py | 110 ++++++++++++++++++++--------- modules/map/test/test_api.py | 129 +++++++++++++++++++++++------------ modules/map/test/test_lib.py | 35 ++++++---- 5 files changed, 201 insertions(+), 101 deletions(-) diff --git a/app/src/components/Map.js b/app/src/components/Map.js index 7276fc82..ec5d4ce6 100644 --- a/app/src/components/Map.js +++ b/app/src/components/Map.js @@ -21,7 +21,7 @@ class ManageMap extends React.Component { super(props); this.state = { files: null, - importing: null, + pending: null, import_running: false, selectedPaths: [], dockerized: null, @@ -42,7 +42,7 @@ class ManageMap extends React.Component { const importStatus = await getMapImportStatus(); this.setState({ files: importStatus['files'], - importing: importStatus['importing'], + pending: importStatus['pending'], import_running: importStatus['import_running'], dockerized: importStatus['dockerized'], }); @@ -102,7 +102,7 @@ class ManageMap extends React.Component { {path} - {path === this.state.importing ? + {this.state.pending && this.state.pending.indexOf(path) >= 0 ? : imported ? 'yes' : 'no'} @@ -111,7 +111,7 @@ class ManageMap extends React.Component { } render() { - const {files, selectedPaths, import_running, importing, dockerized} = this.state; + const {files, selectedPaths, import_running, pending, dockerized} = this.state; let dockerWarning; if (dockerized === true) { @@ -164,9 +164,9 @@ class ManageMap extends React.Component { - let importingLoader = ( - Importing: {importing} - ); + const importingMessage = pending ? + pending.length > 1 ? 'Importing...' : `Importing ${pending[0]}` + : null; let disabled = dockerized || !files || files.length === 0 || import_running; let importButton =