Mountain/Environment/TreeViewProvider/
Visibility.rs1use CommonLibrary::Error::CommonError::CommonError;
6use serde_json::json;
7use tauri::Emitter;
8
9use crate::dev_log;
10
11pub(super) async fn reveal_tree_item(
13 env:&crate::Environment::MountainEnvironment::MountainEnvironment,
14 view_identifier:String,
15 item_handle:String,
16 options:serde_json::Value,
17) -> Result<(), CommonError> {
18 dev_log!(
19 "extensions",
20 "[TreeViewProvider] Revealing item '{}' in view '{}'",
21 item_handle,
22 view_identifier
23 );
24
25 env.ApplicationHandle
26 .emit(
27 "sky://tree-view/reveal",
28 json!({ "viewId": view_identifier, "itemHandle": item_handle, "options": options }),
29 )
30 .map_err(|Error| CommonError::UserInterfaceInteraction { Reason:Error.to_string() })
31}
32
33pub(super) async fn refresh_tree_view(
35 env:&crate::Environment::MountainEnvironment::MountainEnvironment,
36 view_identifier:String,
37 items_to_refresh:Option<serde_json::Value>,
38) -> Result<(), CommonError> {
39 dev_log!("extensions", "[TreeViewProvider] Refreshing view '{}'", view_identifier);
40
41 env.ApplicationHandle
42 .emit(
43 "sky://tree-view/refresh",
44 json!({ "viewId": view_identifier, "itemsToRefresh": items_to_refresh }),
45 )
46 .map_err(|Error| CommonError::UserInterfaceInteraction { Reason:Error.to_string() })
47}