Compare commits
No commits in common. "82c67f6b01eb7de7249e5b2903613484118972e4" and "2eeb8266c7e91275fb98f5772f9a5dfa7629bfbc" have entirely different histories.
82c67f6b01
...
2eeb8266c7
@ -1 +1 @@
|
||||
changes-v20260103-02-reports-delete
|
||||
v20260103-01-reports-jobs-delete
|
||||
|
||||
@ -147,8 +147,6 @@
|
||||
var rawLimit = 100;
|
||||
var rawOffset = 0;
|
||||
|
||||
var canDeleteReports = {{ 'true' if active_role in ('admin','operator','reporter') else 'false' }};
|
||||
|
||||
function qs(id) { return document.getElementById(id); }
|
||||
|
||||
function fmtPeriod(item) {
|
||||
@ -343,7 +341,6 @@
|
||||
'<button type="button" class="btn btn-sm btn-outline-primary me-1 rep-generate-btn" data-id="' + item.id + '">Generate</button>' +
|
||||
'<button type="button" class="btn btn-sm btn-outline-secondary me-1 rep-view-btn" data-id="' + item.id + '">View raw</button>' +
|
||||
'<a class="btn btn-sm btn-outline-success rep-download-btn" href="/api/reports/' + item.id + '/export.csv" target="_blank" rel="noopener">Download</a>' +
|
||||
(canDeleteReports ? '<button type="button" class="btn btn-sm btn-outline-danger ms-1 rep-delete-btn" data-id="' + item.id + '">Delete</button>' : '') +
|
||||
'</td>';;
|
||||
|
||||
body.appendChild(tr);
|
||||
@ -364,12 +361,6 @@
|
||||
});
|
||||
}
|
||||
|
||||
body.querySelectorAll('.rep-delete-btn').forEach(function (btn) {
|
||||
btn.addEventListener('click', function () {
|
||||
var id = btn.getAttribute('data-id');
|
||||
deleteReport(id, btn);
|
||||
});
|
||||
});
|
||||
function loadReports() {
|
||||
setTableLoading('Loading…');
|
||||
fetch('/api/reports', { credentials: 'same-origin' })
|
||||
@ -382,33 +373,6 @@
|
||||
});
|
||||
}
|
||||
|
||||
function deleteReport(id, btnEl) {
|
||||
if (!id) return;
|
||||
if (!confirm('Delete this report definition? This cannot be undone.')) return;
|
||||
var oldText = btnEl ? btnEl.textContent : '';
|
||||
if (btnEl) { btnEl.disabled = true; btnEl.textContent = 'Deleting…'; }
|
||||
|
||||
fetch('/api/reports/' + id, { method: 'DELETE', credentials: 'same-origin' })
|
||||
.then(function (r) { return r.json().then(function (j) { return { ok: r.ok, json: j }; }); })
|
||||
.then(function (res) {
|
||||
if (btnEl) { btnEl.disabled = false; btnEl.textContent = oldText; }
|
||||
if (!res.ok) {
|
||||
alert((res.json && res.json.error) ? res.json.error : 'Delete failed.');
|
||||
return;
|
||||
}
|
||||
// If the raw modal is open for this report, close it.
|
||||
if (rawReportId && String(rawReportId) === String(id) && rawModal) {
|
||||
rawModal.hide();
|
||||
rawReportId = null;
|
||||
}
|
||||
loadReports();
|
||||
})
|
||||
.catch(function () {
|
||||
if (btnEl) { btnEl.disabled = false; btnEl.textContent = oldText; }
|
||||
alert('Delete failed.');
|
||||
});
|
||||
}
|
||||
|
||||
function generateReport(id, btnEl) {
|
||||
if (!id) return;
|
||||
var oldText = btnEl.textContent;
|
||||
@ -471,4 +435,4 @@
|
||||
</script>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
@ -4,13 +4,6 @@
|
||||
- Updated report generation logic to build snapshots and summaries based on job runs.
|
||||
- Added the ability to delete reports, including removal of all associated report data.
|
||||
|
||||
---
|
||||
|
||||
## v20260103-02-reports-delete
|
||||
|
||||
- Added the ability to delete reports from the Reports overview.
|
||||
- Introduced a Delete action per report, available to authorized roles (admin/operator/reporter).
|
||||
- Implemented backend deletion handling and automatic refresh of the reports list after removal.
|
||||
|
||||
================================================================================================================================================
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user