Add Clear Data button to wipe county data folders
This commit is contained in:
@@ -376,6 +376,7 @@
|
||||
<h1>OSM Import Tools</h1>
|
||||
<div class="topbar-sep"></div>
|
||||
<button class="btn-topbar" onclick="runScript('ls', '')">List Files</button>
|
||||
<button class="btn-topbar" onclick="clearData()" style="color:#f88;">Clear Data</button>
|
||||
<div style="flex:1"></div>
|
||||
<div class="config-group">
|
||||
<a href="/api/config/counties.yml" class="btn-topbar-icon" title="Download counties.yml">↓ counties.yml</a>
|
||||
@@ -725,6 +726,21 @@
|
||||
.finally(() => enableButtons());
|
||||
}
|
||||
|
||||
function clearData() {
|
||||
if (!confirm('Delete all downloaded and processed files from all county folders?')) return;
|
||||
fetch('/api/clear-data', { method: 'POST' })
|
||||
.then(r => r.json())
|
||||
.then(data => {
|
||||
if (data.error) {
|
||||
showStatus(`Error: ${data.error}`, 'error');
|
||||
} else {
|
||||
showStatus(`Cleared ${data.removed.length} file(s).`, 'success');
|
||||
setTimeout(() => window.location.reload(), 800);
|
||||
}
|
||||
})
|
||||
.catch(err => showStatus(`Error: ${err.message}`, 'error'));
|
||||
}
|
||||
|
||||
function uploadConfig(filename, input) {
|
||||
if (!input.files.length) return;
|
||||
const formData = new FormData();
|
||||
|
||||
Reference in New Issue
Block a user