Skip to main content

Mountain/IPC/StatusReporter/
mountain_get_service_info.rs

1
2//! `mountain_get_service_info` Tauri command - look up one
3//! service by name in the registry.
4
5use tauri::Manager;
6
7use crate::{
8	IPC::StatusReporter::{Reporter::Struct as Reporter, ServiceInfo::Struct as ServiceInfo},
9	dev_log,
10};
11
12#[tauri::command]
13pub async fn mountain_get_service_info(
14	app_handle:tauri::AppHandle,
15
16	service_name:String,
17) -> Result<Option<ServiceInfo>, String> {
18	dev_log!("lifecycle", "Tauri command: get_service_info");
19
20	if let Some(reporter) = app_handle.try_state::<Reporter>() {
21		reporter.get_service_info(&service_name).await
22	} else {
23		Err("StatusReporter not found in application state".to_string())
24	}
25}