Skip to main content

Mountain/IPC/StatusReporter/
mountain_get_service_info.rs

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