Skip to main content

Mountain/IPC/StatusReporter/
mountain_get_ipc_status.rs

1
2//! `mountain_get_ipc_status` Tauri command - one-shot status
3//! report (basic IPC slice only).
4
5use tauri::Manager;
6
7use crate::{IPC::StatusReporter::Reporter::Struct as Reporter, dev_log};
8
9#[tauri::command]
10pub async fn mountain_get_ipc_status(app_handle:tauri::AppHandle) -> Result<serde_json::Value, String> {
11	dev_log!("lifecycle", "Tauri command: get_ipc_status");
12
13	if let Some(reporter) = app_handle.try_state::<Reporter>() {
14		reporter
15			.generate_status_report()
16			.await
17			.map(|report| serde_json::to_value(report).unwrap_or(serde_json::Value::Null))
18	} else {
19		Err("StatusReporter not found in application state".to_string())
20	}
21}