desktop: put this computer health first
The Agent now owns one local view of machine health and top processes. RedFlag opens at dashboard scale, names itself plainly, and renders that evidence before updates.\n\nCI now compiles the Tauri bridge before release day.
This commit is contained in:
parent
320ad46e00
commit
ffa7afbb58
6 changed files with 302 additions and 20 deletions
|
|
@ -122,11 +122,82 @@ struct ScanSnapshot {
|
|||
updates: Vec<UpdateItem>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
struct SystemSnapshot {
|
||||
system: SystemInfo,
|
||||
#[serde(default)]
|
||||
top_processes: Vec<TopProcess>,
|
||||
collected_at: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
struct SystemInfo {
|
||||
hostname: String,
|
||||
os_type: String,
|
||||
os_version: String,
|
||||
os_architecture: String,
|
||||
ip_address: String,
|
||||
cpu_info: CpuInfo,
|
||||
memory_info: MemoryInfo,
|
||||
#[serde(default)]
|
||||
disk_info: Vec<DiskInfo>,
|
||||
running_processes: i64,
|
||||
uptime: String,
|
||||
reboot_required: bool,
|
||||
#[serde(default)]
|
||||
reboot_reason: String,
|
||||
#[serde(default)]
|
||||
device_type: String,
|
||||
#[serde(default)]
|
||||
device_model: String,
|
||||
#[serde(default)]
|
||||
os_distro: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
struct CpuInfo {
|
||||
model_name: String,
|
||||
cores: i64,
|
||||
threads: i64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
struct MemoryInfo {
|
||||
total: u64,
|
||||
available: u64,
|
||||
used: u64,
|
||||
used_percent: f64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
struct DiskInfo {
|
||||
mountpoint: String,
|
||||
total: u64,
|
||||
available: u64,
|
||||
used: u64,
|
||||
used_percent: f64,
|
||||
filesystem: String,
|
||||
is_root: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
struct TopProcess {
|
||||
name: String,
|
||||
pid: i64,
|
||||
cpu: f64,
|
||||
mem: f64,
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn list_updates() -> Result<ScanSnapshot, String> {
|
||||
local_get_json("/v1/packages")
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn system_health() -> Result<SystemSnapshot, String> {
|
||||
local_get_json("/v1/system")
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
struct TriggerScanResponse {
|
||||
accepted: bool,
|
||||
|
|
@ -368,6 +439,7 @@ fn main() {
|
|||
tauri::Builder::default()
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
local_status,
|
||||
system_health,
|
||||
list_updates,
|
||||
trigger_scan,
|
||||
approve_update
|
||||
|
|
|
|||
|
|
@ -12,11 +12,11 @@
|
|||
"windows": [
|
||||
{
|
||||
"label": "main",
|
||||
"title": "RedFlag Local Agent",
|
||||
"width": 460,
|
||||
"height": 640,
|
||||
"minWidth": 400,
|
||||
"minHeight": 520,
|
||||
"title": "RedFlag",
|
||||
"width": 980,
|
||||
"height": 760,
|
||||
"minWidth": 760,
|
||||
"minHeight": 620,
|
||||
"resizable": true,
|
||||
"visible": true
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue