Enhance upload results display by organizing duplicate files in a collapsible section and adding alerts for detected duplicates

This commit is contained in:
Ross
2025-08-11 09:57:19 +01:00
parent ddb5783f7f
commit 8e63dcc7c5
+28 -5
View File
@@ -40,8 +40,11 @@
<h5>Uploaded</h5>
<ul id="uploaded-files"></ul>
<h5>Duplicates</h5>
<ul id="duplicate-files"></ul>
<ul id="duplicate-series"></ul>
<details>
<summary>Files</summary>
<ul id="duplicate-files"></ul>
</details>
<h5>Failed</h5>
<ul id="failed-files"></ul>
</div>
@@ -170,12 +173,32 @@
if (current_chunk + 1 == total_chunks) {
$("#loading").hide();
// If there are duplicates, open the details and highlight the series
if (window.duplicate_series.size > 0) {
$("#upload-results").attr("open", true);
$("#duplicate-series").closest("details").attr("open", true);
// Show a global alert for duplicate files
toastr.warning(
"Some duplicate files have been detected and not re-imported.",
"Duplicate Files Warning",
{
"closeButton": true,
"progressBar": true,
"positionClass": "toast-top-full-width",
"timeOut": 7000
}
);
window.duplicate_series.forEach((element) => {
let item = document.createElement("a");
item.href = element;
item.textContent = element;
$("#duplicate-series").append(item, "<br/>");
const wrapper = document.createElement("div");
wrapper.className = "alert alert-warning duplicate-series-highlight";
const link = document.createElement("a");
link.href = element;
link.textContent = `Series exists: ${element}`;
link.target = "_blank";
wrapper.appendChild(link);
$("#duplicate-series").append(wrapper);
});
};
//$("#duplicate-series").append([...window.duplicate_series].join("<br/>"));
alert("Uploading complete")
}