Skip to content

Commit debf802

Browse files
committed
fix: resolve export display and button functionality issues
- Fixed export listing to always scan older exports (not just when <50 recent) - Increased limit for scanning older exports from 100 to 500 - Fixed export button conflicts between app.js and exports.html - Added proper button state management (disable on click, reset on error/success) - Excluded export buttons from generic button handler in app.js These changes should resolve: - Only 1 export showing instead of full list (53 total) - Export buttons not working due to JavaScript conflicts
1 parent 8c02df1 commit debf802

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

pkg/web/handlers/exports.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -407,11 +407,9 @@ func (h *ExportsHandler) scanExportFilesOptimized() []ExportItem {
407407
recentExports := h.scanRecentExports(30)
408408
exports = append(exports, recentExports...)
409409

410-
// Si on a moins de 50 exports récents, scanner plus ancien en arrière-plan
411-
if len(exports) < 50 {
412-
olderExports := h.scanOlderExports(30)
413-
exports = append(exports, olderExports...)
414-
}
410+
// Toujours scanner les exports plus anciens pour avoir la liste complète
411+
olderExports := h.scanOlderExports(30)
412+
exports = append(exports, olderExports...)
415413

416414
// Trier par date (plus récent en premier)
417415
sort.Slice(exports, func(i, j int) bool {
@@ -479,10 +477,10 @@ func (h *ExportsHandler) scanOlderExports(skipDays int) []ExportItem {
479477
return exports
480478
}
481479

482-
// Limiter le scan aux 100 premiers dossiers les plus anciens pour éviter la latence
480+
// Limiter le scan aux 500 premiers dossiers les plus anciens pour éviter la latence
483481
count := 0
484482
for _, entry := range entries {
485-
if count >= 100 {
483+
if count >= 500 {
486484
break
487485
}
488486

web/static/js/app.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,10 @@ function refreshStatusData() {
254254

255255
// Interactive elements
256256
function initializeInteractiveElements() {
257-
// Add loading states to buttons
257+
// Add loading states to buttons (except export buttons which have their own logic)
258258
document.addEventListener('click', function(event) {
259-
if (event.target.classList.contains('export-btn') ||
260-
event.target.classList.contains('btn-primary')) {
259+
if (event.target.classList.contains('btn-primary') &&
260+
!event.target.classList.contains('export-btn')) {
261261
const btn = event.target;
262262
const originalText = btn.textContent;
263263

web/templates/exports.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ <h3>No exports found</h3>
330330
if (!data.success) {
331331
showAlert("error", data.error || "Export failed");
332332
hideProgress();
333+
resetExportButtons();
333334
return;
334335
}
335336

@@ -773,6 +774,10 @@ <h4>${typeLabel}</h4>
773774
initializeFiltersFromURL();
774775
document.querySelectorAll(".export-btn").forEach((btn) => {
775776
btn.addEventListener("click", function () {
777+
// Disable button immediately
778+
this.disabled = true;
779+
this.textContent = "🔄 Starting...";
780+
776781
const type = this.dataset.type;
777782
const options = {};
778783

0 commit comments

Comments
 (0)