per-row buttons locking, progress
This commit is contained in:
@@ -330,8 +330,16 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||
// Validate first
|
||||
clearValidationErrors();
|
||||
|
||||
// Show validating state on the row
|
||||
setRowExporting(gridRow, true);
|
||||
const spinner = gridRow.querySelector(".batch-row-spinner");
|
||||
if (spinner) spinner.innerHTML = '<i class="fas fa-spinner fa-spin"></i> Validating...';
|
||||
|
||||
validateRows([{ iddatadb: parseInt(iddatadb), index: parseInt(rowIndex) }])
|
||||
.then((validationData) => {
|
||||
setRowExporting(gridRow, false);
|
||||
gridRow.classList.remove("batch-disabled");
|
||||
|
||||
if (!validationData.success) {
|
||||
showExportResult({ success: false, message: validationData.message || "Errore di validazione" });
|
||||
return;
|
||||
@@ -348,6 +356,9 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||
showConfirmAndExport(iddatadb, btn);
|
||||
})
|
||||
.catch((error) => {
|
||||
setRowExporting(gridRow, false);
|
||||
gridRow.classList.remove("batch-disabled");
|
||||
|
||||
console.error("Validation error:", error);
|
||||
showExportResult({ success: false, message: "Errore di validazione: " + error.message });
|
||||
});
|
||||
@@ -379,13 +390,29 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||
console.log(`Confirmed export for iddatadb: ${iddatadb}`);
|
||||
confirmModal.hide();
|
||||
|
||||
const gridRow = btn.closest(".grid-row");
|
||||
setRowExporting(gridRow, true);
|
||||
|
||||
try {
|
||||
const gridRow = btn.closest(".grid-row");
|
||||
const data = await sendExport(iddatadb, gridRow);
|
||||
console.log("Export response:", data);
|
||||
|
||||
// Stop spinner, fully restore row
|
||||
setRowExporting(gridRow, false);
|
||||
gridRow.classList.remove("batch-disabled");
|
||||
|
||||
if (!data.success) {
|
||||
showRowError(gridRow, iddatadb, data.message || "Errore sconosciuto");
|
||||
}
|
||||
showExportResult(data);
|
||||
} catch (error) {
|
||||
console.error("Export error:", error);
|
||||
|
||||
// Stop spinner, fully restore row so user can retry
|
||||
setRowExporting(gridRow, false);
|
||||
gridRow.classList.remove("batch-disabled");
|
||||
|
||||
showRowError(gridRow, iddatadb, error.message);
|
||||
showExportResult({
|
||||
success: false,
|
||||
message: error.message,
|
||||
|
||||
Reference in New Issue
Block a user