Mountain/Command/
SourceControlManagement.rs1#![allow(non_snake_case, non_camel_case_types)]
7
8use std::sync::Arc;
9
10use serde_json::{Value, json};
11use tauri::{State, command};
12
13use crate::ApplicationState::ApplicationState::{ApplicationState, MapLockError};
14
15#[command]
21pub async fn GetAllSourceControlManagementState(State:State<'_, Arc<ApplicationState>>) -> Result<Value, String> {
22 log::debug!("[SourceControlManagement Command] Getting all SCM state for UI.");
23
24 let Providers = State
25 .SourceControlManagementProviders
26 .lock()
27 .map_err(MapLockError)
28 .map_err(|Error| Error.to_string())?
29 .clone();
30
31 let Groups = State
32 .SourceControlManagementGroups
33 .lock()
34 .map_err(MapLockError)
35 .map_err(|Error| Error.to_string())?
36 .clone();
37
38 let Resources = State
39 .SourceControlManagementResources
40 .lock()
41 .map_err(MapLockError)
42 .map_err(|Error| Error.to_string())?
43 .clone();
44
45 Ok(json!({
46 "providers": Providers,
47 "groups": Groups,
48 "resources": Resources,
49 }))
50}