Skip to main content

Mountain/IPC/StatusReporter/
mountain_get_ipc_status_history.rs

1
2//! `mountain_get_ipc_status_history` Tauri command - returns
3//! the last-100 ring buffer of `IPCStatusReport::Struct`.
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_history(app_handle:tauri::AppHandle) -> Result<serde_json::Value, String> {
11	dev_log!("lifecycle", "Tauri command: get_ipc_status_history");
12
13	if let Some(reporter) = app_handle.try_state::<Reporter>() {
14		reporter
15			.get_status_history()
16			.map(|history| serde_json::to_value(history).unwrap_or(serde_json::Value::Null))
17	} else {
18		Err("StatusReporter not found in application state".to_string())
19	}
20}