MCPcopy Index your code
hub / github.com/ChrisFeldmeier/OpenCodeRust / refresh_session_list_dialog

Method refresh_session_list_dialog

crates/opencode-tui/src/app/app.rs:2564–2600  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

2562 }
2563
2564 fn refresh_session_list_dialog(&mut self) {
2565 let Some(client) = self.context.get_api_client() else {
2566 return;
2567 };
2568
2569 let query = self.session_list_dialog.query().trim().to_string();
2570 let sessions_result = if query.is_empty() {
2571 client.list_sessions()
2572 } else {
2573 client.list_sessions_filtered(Some(&query), Some(30))
2574 };
2575 let Ok(sessions) = sessions_result else {
2576 return;
2577 };
2578 let status_map = client.get_session_status().unwrap_or_default();
2579 {
2580 let mut session_ctx = self.context.session.write();
2581 for session in &sessions {
2582 if let Some(status) = status_map.get(&session.id) {
2583 session_ctx.set_status(&session.id, map_api_run_status(status));
2584 }
2585 }
2586 }
2587
2588 let items = sessions
2589 .into_iter()
2590 .map(|session| SessionItem {
2591 is_busy: status_map.get(&session.id).map(|s| s.busy).unwrap_or(false),
2592 id: session.id,
2593 title: session.title,
2594 directory: session.directory,
2595 parent_id: session.parent_id,
2596 updated_at: session.time.updated,
2597 })
2598 .collect::<Vec<_>>();
2599 self.session_list_dialog.set_sessions(items);
2600 }
2601
2602 fn refresh_theme_list_dialog(&mut self) {
2603 let options = self

Callers 4

newMethod · 0.80
handle_eventMethod · 0.80
handle_dialog_keyMethod · 0.80

Calls 10

map_api_run_statusFunction · 0.85
get_api_clientMethod · 0.80
is_emptyMethod · 0.80
get_session_statusMethod · 0.80
set_sessionsMethod · 0.80
queryMethod · 0.45
list_sessionsMethod · 0.45
getMethod · 0.45
set_statusMethod · 0.45

Tested by

no test coverage detected