1use crate::models::ComponentStatus;
2use crate::ui::PremiumUI;
3use anyhow::Result;
4use console::style;
5use std::{thread, time::Duration};
6use tabled::Table;
7
8impl PremiumUI {
9 pub async fn status_interactive(&self) -> Result<()> {
10 let mut spinner = self.create_spinner("Fetching application status...");
11 thread::sleep(Duration::from_secs(1));
12
13 let status = vec![
14 ComponentStatus {
15 name: "Web Frontend".into(),
16 status: "Healthy".into(),
17 replicas: "3/3".into(),
18 cpu: "65%".into(),
19 memory: "78%".into(),
20 },
21 ComponentStatus {
22 name: "API Backend".into(),
23 status: "Healthy".into(),
24 replicas: "2/2".into(),
25 cpu: "45%".into(),
26 memory: "52%".into(),
27 },
28 ComponentStatus {
29 name: "Database".into(),
30 status: "Healthy".into(),
31 replicas: "1/1".into(),
32 cpu: "35%".into(),
33 memory: "60%".into(),
34 },
35 ];
36
37 spinner.stop();
38
39 println!("\n{}", style("📊 System Status").cyan().bold());
40 println!("{}", Table::new(status).to_string());
41
42 println!("\n{}", style("🔍 System Metrics").cyan().bold());
43 println!("Uptime: {}", style("15d 7h 23m").green());
44 println!("Response Time: {}", style("145ms").green());
45 println!("Error Rate: {}", style("0.02%").green());
46 println!("CPU Usage: {}", style("48.3%").green());
47 println!("Memory Usage: {}", style("63.5%").green());
48
49 Ok(())
50 }
51}