This commit is contained in:
oussi
2026-04-27 16:41:16 +02:00
parent 607ff0629c
commit ebd5482070
269 changed files with 155 additions and 20 deletions

View File

@@ -36,6 +36,7 @@
<tr>
<th class="small">Date</th>
<th class="small">Actions</th>
<th class="small">Erreurs</th>
<th class="small">Présence</th>
<th class="small">Actif</th>
<th class="small">Sessions</th>
@@ -190,9 +191,16 @@ function renderChart(data, options) {
bar.style.borderRadius = '3px 3px 0 0';
bar.style.opacity = count > 0 ? '1' : '0.15';
bar.style.transition = 'height 0.3s';
bar.title = item.hour !== undefined
? item.hour + 'h : ' + count + ' utilisateur(s)'
: item.date + ' : ' + count + ' utilisateur(s)';
var tooltip = '';
if (item.hour !== undefined) {
tooltip = item.hour + 'h : ' + count + ' utilisateur(s)';
} else {
tooltip = item.date + ' : ' + count + ' utilisateur(s)';
if (item.errors !== undefined && item.errors > 0) {
tooltip += ' — ' + item.errors + ' erreur(s)';
}
}
bar.title = tooltip;
if (options && options.onBarClick && item.date !== undefined) {
bar.style.cursor = 'pointer';
@@ -245,7 +253,7 @@ function renderPeakChart(list) {
hint.classList.remove('d-none');
renderChart(
list.map(function(d) { return { date: d.date, count: d.count === null ? 0 : d.count }; }),
list.map(function(d) { return { date: d.date, count: d.count === null ? 0 : d.count, errors: d.errors || 0 }; }),
{ onBarClick: function(item) { loadDayUsers(item.date); } }
);
}
@@ -261,12 +269,12 @@ function setTableMode(mode, dateLabel) {
title.appendChild(icon('person-lines-fill'));
if (mode === 'today') {
title.appendChild(document.createTextNode(' Utilisateurs connectés aujourd\'hui'));
['Utilisateur','Statut','Dernière action','Actions (24h)','Présence / Actif','Depuis'].forEach(function(h) {
['Utilisateur','Statut','Dernière action','Actions (24h)','Erreurs','Présence / Actif','Depuis'].forEach(function(h) {
thead.appendChild(el('th', null, h));
});
} else {
title.appendChild(document.createTextNode(' Utilisateurs — ' + (dateLabel || '')));
['Utilisateur','Dernière utilisation','Actions','Présence / Actif','Sessions'].forEach(function(h) {
['Utilisateur','Dernière utilisation','Actions','Erreurs','Présence / Actif','Sessions'].forEach(function(h) {
thead.appendChild(el('th', null, h));
});
}
@@ -281,7 +289,7 @@ function renderTable(users) {
if (!users || users.length === 0) {
var tr = document.createElement('tr');
var td = el('td', 'text-center text-muted py-3', "Aucun utilisateur détecté aujourd'hui.");
td.colSpan = 6;
td.colSpan = 7;
tr.appendChild(td);
tbody.appendChild(tr);
return;
@@ -316,6 +324,15 @@ function renderTable(users) {
// Actions (24h)
tr.appendChild(el('td', null, String(u.action_count_24h || 0)));
// Erreurs
var tdErr = document.createElement('td');
if ((u.error_count || 0) > 0) {
tdErr.appendChild(el('span', 'badge bg-danger', String(u.error_count)));
} else {
tdErr.textContent = '—';
}
tr.appendChild(tdErr);
// Présence / Actif
var tdPres = document.createElement('td');
if (u.presence_str) {
@@ -345,7 +362,7 @@ function renderDayTable(users, dateStr) {
if (!users || users.length === 0) {
var tr = document.createElement('tr');
var td = el('td', 'text-center text-muted py-3', 'Aucun utilisateur détecté ce jour.');
td.colSpan = 5;
td.colSpan = 6;
tr.appendChild(td);
tbody.appendChild(tr);
return;
@@ -371,6 +388,15 @@ function renderDayTable(users, dateStr) {
tr.appendChild(el('td', null, String(u.action_count || 0)));
// Erreurs
var tdErr2 = document.createElement('td');
if ((u.error_count || 0) > 0) {
tdErr2.appendChild(el('span', 'badge bg-danger', String(u.error_count)));
} else {
tdErr2.textContent = '—';
}
tr.appendChild(tdErr2);
var tdPres = document.createElement('td');
if (u.presence) {
tdPres.textContent = u.presence;
@@ -473,6 +499,9 @@ function renderUserHistory(history) {
bar.style.background = count > 0 ? '#0d6efd' : '#e9ecef';
bar.style.borderRadius = '3px 3px 0 0';
bar.title = d.date + ' : ' + count + ' actions';
if ((d.error_count || 0) > 0) {
bar.title += ' — ' + d.error_count + ' erreur(s)';
}
barsEl.appendChild(bar);
var dt = new Date(d.date);
@@ -492,11 +521,21 @@ function renderUserHistory(history) {
var dLbl = DAYS_FR[dt.getUTCDay()] + ' ' + dt.getUTCDate() + '/' + (dt.getUTCMonth() + 1);
if (!d.action_count) {
var td = el('td', 'text-muted small', dLbl + ' — aucun log');
td.colSpan = 5;
td.colSpan = 6;
tr.appendChild(td);
} else {
[dLbl, String(d.action_count), d.presence || '—', d.active_time || '—', String(d.sessions || 1)]
.forEach(function(txt) { tr.appendChild(el('td', 'small', txt)); });
tr.appendChild(el('td', 'small', dLbl));
tr.appendChild(el('td', 'small', String(d.action_count)));
var errTd = el('td', 'small');
if ((d.error_count || 0) > 0) {
errTd.appendChild(el('span', 'badge bg-danger', String(d.error_count)));
} else {
errTd.textContent = '—';
}
tr.appendChild(errTd);
tr.appendChild(el('td', 'small', d.presence || '—'));
tr.appendChild(el('td', 'small', d.active_time || '—'));
tr.appendChild(el('td', 'small', String(d.sessions || 1)));
}
tbody.appendChild(tr);
});