Add connected technician tracking to dashboard

- Add ViewerInfo struct to track viewer name and connection time
- Update session manager to track viewers with names
- Update API to return viewer list for each session
- Update dashboard to display "Mike Connected (3 min)" on machine bars
- Update viewer.html to pass viewer_name parameter

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-28 19:17:47 -07:00
parent f3b76b7b62
commit 448d3b75ac
5 changed files with 117 additions and 16 deletions

View File

@@ -9,6 +9,24 @@ use uuid::Uuid;
use crate::session::SessionManager;
/// Viewer info returned by API
#[derive(Debug, Serialize)]
pub struct ViewerInfoApi {
pub id: String,
pub name: String,
pub connected_at: String,
}
impl From<crate::session::ViewerInfo> for ViewerInfoApi {
fn from(v: crate::session::ViewerInfo) -> Self {
Self {
id: v.id,
name: v.name,
connected_at: v.connected_at.to_rfc3339(),
}
}
}
/// Session info returned by API
#[derive(Debug, Serialize)]
pub struct SessionInfo {
@@ -17,6 +35,7 @@ pub struct SessionInfo {
pub agent_name: String,
pub started_at: String,
pub viewer_count: usize,
pub viewers: Vec<ViewerInfoApi>,
pub is_streaming: bool,
pub is_online: bool,
pub is_persistent: bool,
@@ -35,6 +54,7 @@ impl From<crate::session::Session> for SessionInfo {
agent_name: s.agent_name,
started_at: s.started_at.to_rfc3339(),
viewer_count: s.viewer_count,
viewers: s.viewers.into_iter().map(ViewerInfoApi::from).collect(),
is_streaming: s.is_streaming,
is_online: s.is_online,
is_persistent: s.is_persistent,