diff --git a/web/templates/index.html b/web/templates/index.html index a5f029d..6dd1c89 100644 --- a/web/templates/index.html +++ b/web/templates/index.html @@ -5,520 +5,648 @@ OSM Import Tools -
+
+ + +

OSM Import Tools

-

Run data processing scripts and view results

- -
-

Map Viewer

- Open GeoJSON Map Viewer -
- -
-

Data Processing Scripts

- - {% for category, script_names in scripts_by_category.items() %} -
-

{{ category }}

- - {% for script_name in script_names %} - {% if script_name in script_map %} - {% set script_config = script_map[script_name] %} - - {% if script_config is string %} - {# Simple command with no county selection #} -
- -
- {% elif script_config is mapping %} - {# County-specific commands #} -
- {% if 'lake' in script_config %} - {% set lake_config = script_config['lake'] %} - {% if lake_config is mapping and lake_config.get('type') == 'upload' %} -
- - -
- {% else %} -
- - {% if script_name == 'diff-addresses' %} - - {% endif %} -
- {% endif %} - {% endif %} - {% if 'sumter' in script_config %} - {% set sumter_config = script_config['sumter'] %} - {% if sumter_config is mapping and sumter_config.get('type') == 'upload' %} -
- - -
- {% else %} -
- - {% if script_name == 'diff-addresses' %} - - {% endif %} -
- {% endif %} - {% else %} - {% if script_name == 'download-county-paths' %} -
- Download County Paths (Lake): not available -
- {% endif %} - {% endif %} -
- {% endif %} - {% endif %} - {% endfor %} -
- {% endfor %} -
- -
-

Data Downloads

- - {% for county, file_names in data_files.items() %} -
-

{{ county|title }}

- - {% for file_name in file_names %} -
- {% if 'lake' in county %} - - {{ file_name }} - - {% endif %} - {% if 'sumter' in county %} - - {{ file_name }} - - {% endif %} -
- {% endfor %} -
- {% endfor %} -
- -
-

Script Output

-
- -
-
+
+ + +
+ Open Map Viewer
- + const file = input.files[0]; + const formData = new FormData(); + formData.append('file', file); + formData.append('dest', dest); + + showStatus(`Uploading ${file.name}...`, 'info'); + disableButtons(); + + fetch('/api/upload-file', { method: 'POST', body: formData }) + .then(r => r.json()) + .then(data => { + if (data.error) { + showStatus(`Error: ${data.error}`, 'error'); + } else { + showStatus(`Uploaded to ${data.path}`, 'success'); + input.value = ''; + } + }) + .catch(err => showStatus(`Error: ${err.message}`, 'error')) + .finally(() => enableButtons()); + } + + function showStatus(msg, type) { + const el = document.getElementById('status'); + el.textContent = msg; + el.className = type; + el.style.display = 'block'; + } + + function disableButtons() { + document.querySelectorAll('.btn-run').forEach(b => b.disabled = true); + } + + function enableButtons() { + document.querySelectorAll('.btn-run').forEach(b => b.disabled = false); + } +