Mountain/RPC/CocoonService/Workspace/UpdateConfiguration.rs
1//! Forward a Cocoon-side configuration change to Sky for workbench
2//! settings refresh.
3
4use serde_json::json;
5use tauri::Emitter;
6use tonic::{Response, Status};
7use ::Vine::Generated::{Empty, UpdateConfigurationRequest};
8
9use crate::{RPC::CocoonService::CocoonServiceImpl, dev_log};
10
11pub async fn Fn(Service:&CocoonServiceImpl, Request:UpdateConfigurationRequest) -> Result<Response<Empty>, Status> {
12 dev_log!(
13 "cocoon",
14 "[CocoonService] update_configuration: {} changed keys",
15 Request.changed_keys.len()
16 );
17
18 let _ = Service
19 .environment
20 .ApplicationHandle
21 .emit("sky://configuration/changed", json!({ "changedKeys": Request.changed_keys }));
22
23 Ok(Response::new(Empty {}))
24}