perf(scanner): ottimizza scansione destinazione con pass unico e barra determinata
Sostituisce le due scansioni sequenziali (cartelle + file CAD) con un unico passaggio parallelo in services/destinationScanner.js. La lettura di primo livello fornisce il totale delle sezioni, rendendo la barra di progresso determinata (N / totale) durante l'analisi della destinazione. Il label mostra contemporaneamente sezioni completate e file CAD trovati
This commit is contained in:
@@ -32,16 +32,22 @@ function hideProgress() {
|
||||
progressContainer.style.display = 'none';
|
||||
}
|
||||
|
||||
let _indexFilesFound = 0;
|
||||
|
||||
function updateProgress({ phase, current, total, file, scanned, folder }) {
|
||||
if (phase === 'scan') {
|
||||
_indexFilesFound = 0;
|
||||
progressLabel.textContent = 'Scansione file sorgente...';
|
||||
progressBar.removeAttribute('value');
|
||||
} else if (phase === 'index-dest') {
|
||||
progressLabel.textContent = `Analisi destinazione: ${scanned} cartelle scansionate${folder ? ` — ${folder}` : ''}`;
|
||||
progressBar.removeAttribute('value');
|
||||
progressBar.max = total;
|
||||
progressBar.value = current;
|
||||
const filesInfo = _indexFilesFound > 0 ? ` — ${_indexFilesFound} file CAD trovati` : '';
|
||||
progressLabel.textContent = `Analisi destinazione: ${current} / ${total}${folder ? ` — ${folder}` : ''}${filesInfo}`;
|
||||
} else if (phase === 'index-dup') {
|
||||
progressLabel.textContent = `Ricerca duplicati: ${scanned} file CAD trovati${file ? ` — ${file}` : ''}`;
|
||||
progressBar.removeAttribute('value');
|
||||
_indexFilesFound = scanned;
|
||||
const dirInfo = progressBar.max > 0 ? `${progressBar.value} / ${progressBar.max} — ` : '';
|
||||
progressLabel.textContent = `Analisi destinazione: ${dirInfo}${scanned} file CAD trovati`;
|
||||
} else if (phase === 'copy') {
|
||||
progressBar.max = total;
|
||||
progressBar.value = current;
|
||||
|
||||
Reference in New Issue
Block a user