MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / refresh_sandbox_draft_counts

Function refresh_sandbox_draft_counts

crates/openshell-tui/src/lib.rs:2431–2446  ·  view source on GitHub ↗

Fetch the count of pending draft recommendations for every sandbox. This runs on the Dashboard tick so the sandbox list can show notification badges without entering the sandbox detail view.

(app: &mut App)

Source from the content-addressed store, hash-verified

2429/// This runs on the Dashboard tick so the sandbox list can show notification
2430/// badges without entering the sandbox detail view.
2431async fn refresh_sandbox_draft_counts(app: &mut App) {
2432 let names: Vec<String> = app.sandbox_names.clone();
2433 let mut counts = vec![0usize; names.len()];
2434 for (i, name) in names.iter().enumerate() {
2435 let req = openshell_core::proto::GetDraftPolicyRequest {
2436 name: name.clone(),
2437 status_filter: "pending".to_string(),
2438 };
2439 if let Ok(Ok(resp)) =
2440 tokio::time::timeout(Duration::from_secs(2), app.client.get_draft_policy(req)).await
2441 {
2442 counts[i] = resp.into_inner().chunks.len();
2443 }
2444 }
2445 app.sandbox_draft_counts = counts;
2446}
2447
2448fn phase_label(phase: i32) -> String {
2449 match phase {

Callers 1

runFunction · 0.85

Calls 2

lenMethod · 0.80
get_draft_policyMethod · 0.45

Tested by

no test coverage detected