Spaces:
Configuration error
Configuration error
Update frontend/app.js
Browse files- frontend/app.js +4 -4
frontend/app.js
CHANGED
|
@@ -274,7 +274,7 @@ async function processBatches() {
|
|
| 274 |
}
|
| 275 |
|
| 276 |
// Show last 5 rows in feed
|
| 277 |
-
const feedSlice = batch.slice(-
|
| 278 |
feedSlice.forEach((row, i) => {
|
| 279 |
const ri = bEnd - feedSlice.length + i;
|
| 280 |
addCsvFeedRow(ri+1, row, results[batch.length-feedSlice.length+i].predicted_class,
|
|
@@ -297,9 +297,9 @@ async function processBatches() {
|
|
| 297 |
if (csvIntrusionCount / Math.max(csvIndex,1) > 0.5)
|
| 298 |
document.getElementById('csvProgressFill').classList.add('warning');
|
| 299 |
|
| 300 |
-
if (batchNum %
|
| 301 |
setText('csvAlertCount', csvIntrusionCount.toLocaleString() + ' THREATS');
|
| 302 |
-
await new Promise(r => setTimeout(r,
|
| 303 |
}
|
| 304 |
if (csvIndex >= csvRows.length) finishCsvAnalysis();
|
| 305 |
}
|
|
@@ -340,7 +340,7 @@ function addCsvFeedRow(rowNum, row, cls, conf, sev) {
|
|
| 340 |
<td style="color:${conf>0.9?'var(--accent)':conf>0.8?'var(--cyan)':'var(--amber)'}">${(conf*100).toFixed(1)}%</td>
|
| 341 |
<td style="color:${SEV_COLOR[sev]}">● ${sev}</td>`;
|
| 342 |
tbody.insertBefore(tr, tbody.firstChild);
|
| 343 |
-
while (tbody.children.length >
|
| 344 |
}
|
| 345 |
|
| 346 |
function updateCsvSidebar(rate) {
|
|
|
|
| 274 |
}
|
| 275 |
|
| 276 |
// Show last 5 rows in feed
|
| 277 |
+
const feedSlice = batch.slice(-2);
|
| 278 |
feedSlice.forEach((row, i) => {
|
| 279 |
const ri = bEnd - feedSlice.length + i;
|
| 280 |
addCsvFeedRow(ri+1, row, results[batch.length-feedSlice.length+i].predicted_class,
|
|
|
|
| 297 |
if (csvIntrusionCount / Math.max(csvIndex,1) > 0.5)
|
| 298 |
document.getElementById('csvProgressFill').classList.add('warning');
|
| 299 |
|
| 300 |
+
if (batchNum % 5 === 0 || batchNum === totalBatches) updateCsvSidebar(rate);
|
| 301 |
setText('csvAlertCount', csvIntrusionCount.toLocaleString() + ' THREATS');
|
| 302 |
+
await new Promise(r => setTimeout(r, 100));
|
| 303 |
}
|
| 304 |
if (csvIndex >= csvRows.length) finishCsvAnalysis();
|
| 305 |
}
|
|
|
|
| 340 |
<td style="color:${conf>0.9?'var(--accent)':conf>0.8?'var(--cyan)':'var(--amber)'}">${(conf*100).toFixed(1)}%</td>
|
| 341 |
<td style="color:${SEV_COLOR[sev]}">● ${sev}</td>`;
|
| 342 |
tbody.insertBefore(tr, tbody.firstChild);
|
| 343 |
+
while (tbody.children.length > 50) tbody.removeChild(tbody.lastChild);
|
| 344 |
}
|
| 345 |
|
| 346 |
function updateCsvSidebar(rate) {
|