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

Function spawn_delete_global_setting

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

Source from the content-addressed store, hash-verified

2097}
2098
2099fn spawn_delete_global_setting(app: &App, tx: mpsc::UnboundedSender<Event>) {
2100 let idx = app
2101 .confirm_setting_delete
2102 .unwrap_or(app.global_settings_selected);
2103 let Some(entry) = app.global_settings.get(idx) else {
2104 return;
2105 };
2106
2107 let key = entry.key.clone();
2108 let mut client = app.client.clone();
2109
2110 tokio::spawn(async move {
2111 use openshell_core::proto::UpdateConfigRequest;
2112
2113 let req = UpdateConfigRequest {
2114 name: String::new(),
2115 policy: None,
2116 setting_key: key,
2117 setting_value: None,
2118 delete_setting: true,
2119 global: true,
2120 merge_operations: vec![],
2121 expected_resource_version: 0,
2122 };
2123
2124 let result = tokio::time::timeout(Duration::from_secs(5), client.update_config(req)).await;
2125
2126 let event = match result {
2127 Ok(Ok(resp)) => {
2128 Event::GlobalSettingDeleteResult(Ok(resp.into_inner().settings_revision))
2129 }
2130 Ok(Err(e)) => Event::GlobalSettingDeleteResult(Err(e.message().to_string())),
2131 Err(_) => Event::GlobalSettingDeleteResult(Err("timeout".to_string())),
2132 };
2133 let _ = tx.send(event);
2134 });
2135}
2136
2137fn spawn_set_sandbox_setting(app: &App, tx: mpsc::UnboundedSender<Event>) {
2138 let Some(ref edit) = app.sandbox_setting_edit else {

Callers 1

runFunction · 0.85

Calls 4

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

Tested by

no test coverage detected