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

Function spawn_delete_sandbox_setting

crates/openshell-tui/src/lib.rs:2205–2245  ·  view source on GitHub ↗
(app: &App, tx: mpsc::UnboundedSender<Event>)

Source from the content-addressed store, hash-verified

2203}
2204
2205fn spawn_delete_sandbox_setting(app: &App, tx: mpsc::UnboundedSender<Event>) {
2206 let idx = app
2207 .sandbox_confirm_setting_delete
2208 .unwrap_or(app.sandbox_settings_selected);
2209 let Some(entry) = app.sandbox_settings.get(idx) else {
2210 return;
2211 };
2212 let Some(sandbox_name) = app.selected_sandbox_name() else {
2213 return;
2214 };
2215
2216 let name = sandbox_name.to_string();
2217 let key = entry.key.clone();
2218 let mut client = app.client.clone();
2219
2220 tokio::spawn(async move {
2221 use openshell_core::proto::UpdateConfigRequest;
2222
2223 let req = UpdateConfigRequest {
2224 name,
2225 policy: None,
2226 setting_key: key,
2227 setting_value: None,
2228 delete_setting: true,
2229 global: false,
2230 merge_operations: vec![],
2231 expected_resource_version: 0,
2232 };
2233
2234 let result = tokio::time::timeout(Duration::from_secs(5), client.update_config(req)).await;
2235
2236 let event = match result {
2237 Ok(Ok(resp)) => {
2238 Event::SandboxSettingDeleteResult(Ok(resp.into_inner().settings_revision))
2239 }
2240 Ok(Err(e)) => Event::SandboxSettingDeleteResult(Err(e.message().to_string())),
2241 Err(_) => Event::SandboxSettingDeleteResult(Err("timeout".to_string())),
2242 };
2243 let _ = tx.send(event);
2244 });
2245}
2246
2247async fn refresh_health(app: &mut App) {
2248 let req = openshell_core::proto::HealthRequest {};

Callers 1

runFunction · 0.85

Calls 5

selected_sandbox_nameMethod · 0.80
messageMethod · 0.80
spawnFunction · 0.50
getMethod · 0.45
update_configMethod · 0.45

Tested by

no test coverage detected