Skip to content

Commit 2106106

Browse files
Archithclaude
andcommitted
Sort sessions by most recent - ended sessions by terminated time, active by created time
- Ended sessions now sorted by terminatedAt timestamp (newest first) - Active sessions sorted by created timestamp (newest first) - Makes it easier to find recent sessions in the dashboard - Falls back to created time if terminatedAt is missing 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent dc14a7b commit 2106106

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

scripts/app.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,7 @@
665665

666666
// Ended sessions go to the ended list
667667
if (session.terminated && session.terminated.terminated) {
668+
sessionInfo.terminatedAt = session.terminated.terminatedAt || session.created; // Add terminated timestamp
668669
archivedSessions.push(sessionInfo); // Using archivedSessions array for ended sessions
669670
} else {
670671
// Active or In Progress sessions
@@ -673,6 +674,18 @@
673674
}
674675
});
675676

677+
// Sort ended sessions by terminated time (most recent first)
678+
archivedSessions.sort((a, b) => {
679+
const timeA = a.terminatedAt || a.created || 0;
680+
const timeB = b.terminatedAt || b.created || 0;
681+
return timeB - timeA; // Descending order (newest first)
682+
});
683+
684+
// Sort active sessions by created time (most recent first)
685+
activeSessions.sort((a, b) => {
686+
return (b.created || 0) - (a.created || 0); // Descending order
687+
});
688+
676689
// Update stats
677690
const activeSessionsCount = document.getElementById('activeSessionsCount');
678691
const totalUsersCount = document.getElementById('totalUsersCount');

0 commit comments

Comments
 (0)