ui: show total scan time in the card snapshots list

Each snapshot row now renders '(N files, scanned in X.XX sec)' when the
snapshot has timing data (profilerSnapshotCountLabel); old/imported
snapshots without timing keep the plain '(N files)'. RU wording 'за X.XX
сек'. SW cache v100 -> v101.
This commit is contained in:
2026-09-12 15:00:58 +03:00
parent 6d30e7095e
commit 6f63b5172c
3 changed files with 24 additions and 3 deletions
+11 -1
View File
@@ -7293,7 +7293,7 @@ function profilerRenderSnapshotList() {
html += '<b>' + esc(s.name) + '</b>';
if (s.iccid) html += '<span class="text-xs font-mono text-gray-500 dark:text-slate-400">' + esc(s.iccid) + '</span>';
html += '<span class="text-xs text-gray-400 dark:text-slate-500">' + esc(new Date(s.created).toLocaleString()) + '</span>';
html += '<span class="text-xs text-gray-400 dark:text-slate-500">(' + s.files.length + ' ' + esc(t('files')) + ')</span>';
html += '<span class="text-xs text-gray-400 dark:text-slate-500">(' + esc(profilerSnapshotCountLabel(s)) + ')</span>';
html += '<span class="ml-auto flex gap-1">';
html += '<button onclick="snapshotOpen(' + i + ')" class="px-2 py-0.5 text-xs rounded bg-blue-600 text-white hover:bg-blue-700">' + esc(t('Open')) + '</button>';
html += '<button onclick="snapshotExport(' + i + ')" class="px-2 py-0.5 text-xs rounded bg-gray-600 text-white hover:bg-gray-700">' + esc(t('Export')) + '</button>';
@@ -7623,6 +7623,14 @@ function profilerFormatMs(ms) {
return Math.round(ms) + ' ms';
}
function profilerSnapshotCountLabel(s) {
let label = (s.files ? s.files.length : 0) + ' ' + t('files');
if (s.timing && s.timing.total_ms !== undefined) {
label += ', ' + t('scanned in') + ' ' + (s.timing.total_ms / 1000).toFixed(2) + ' ' + t('sec');
}
return label;
}
async function profilerBuildSnapshotFile(path, c, timing) {
let sel;
try {
@@ -8951,6 +8959,8 @@ const LANG_RU = {
'Files': 'Файлов',
'Records': 'Записей',
'Scan time': 'Время сканирования',
'scanned in': 'за',
'sec': 'сек',
'No timing data': 'Нет данных о времени',
'min': 'мин',
'avg': 'сред',