Adding description to the header
This commit is contained in:
parent
44a1c2055e
commit
bb57f3264e
2 changed files with 7 additions and 10 deletions
|
|
@ -14,10 +14,17 @@ pub fn render_header(frame: &mut Frame, area: Rect, state: &DashboardViewState)
|
||||||
} else {
|
} else {
|
||||||
format!("{} - {}", t("dashboard-header"), state.title)
|
format!("{} - {}", t("dashboard-header"), state.title)
|
||||||
};
|
};
|
||||||
|
let description = state
|
||||||
|
.descriptions
|
||||||
|
.as_ref()
|
||||||
|
.filter(|s| !s.trim().is_empty())
|
||||||
|
.map(|s| format!(" - {}", s))
|
||||||
|
.unwrap_or("".to_string());
|
||||||
|
|
||||||
let header = Paragraph::new(Line::from(vec![
|
let header = Paragraph::new(Line::from(vec![
|
||||||
Span::styled("📈 ", Style::default().fg(Color::Cyan)),
|
Span::styled("📈 ", Style::default().fg(Color::Cyan)),
|
||||||
Span::styled(title, Style::default().fg(Color::White).bold()),
|
Span::styled(title, Style::default().fg(Color::White).bold()),
|
||||||
|
Span::styled(description, Style::default().fg(Color::White).bold()),
|
||||||
]))
|
]))
|
||||||
.alignment(Alignment::Center)
|
.alignment(Alignment::Center)
|
||||||
.block(
|
.block(
|
||||||
|
|
|
||||||
|
|
@ -13,11 +13,9 @@ pub enum MonitorStatus {
|
||||||
pub struct MonitorViewState {
|
pub struct MonitorViewState {
|
||||||
pub id: u64,
|
pub id: u64,
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub group_name: String,
|
|
||||||
pub status: MonitorStatus,
|
pub status: MonitorStatus,
|
||||||
pub response_time: String,
|
pub response_time: String,
|
||||||
pub uptime_24h: String,
|
pub uptime_24h: String,
|
||||||
pub last_check: String,
|
|
||||||
pub status_history: Vec<MonitorStatus>,
|
pub status_history: Vec<MonitorStatus>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -118,20 +116,12 @@ fn add_monitor_view_state(group: UnifiedGroupData) -> Vec<MonitorViewState> {
|
||||||
.map(|u| u.get_perc_formated())
|
.map(|u| u.get_perc_formated())
|
||||||
.unwrap_or_else(|| t("unknown").to_string());
|
.unwrap_or_else(|| t("unknown").to_string());
|
||||||
|
|
||||||
let last_check = monitor
|
|
||||||
.heartbeats
|
|
||||||
.last()
|
|
||||||
.map(|h| h.time.clone())
|
|
||||||
.unwrap_or_else(|| t("never").to_string());
|
|
||||||
|
|
||||||
monitors.push(MonitorViewState {
|
monitors.push(MonitorViewState {
|
||||||
id: monitor.monitor_info.id,
|
id: monitor.monitor_info.id,
|
||||||
name: monitor.monitor_info.name,
|
name: monitor.monitor_info.name,
|
||||||
group_name: group.group_info.name.clone(),
|
|
||||||
status,
|
status,
|
||||||
response_time,
|
response_time,
|
||||||
uptime_24h,
|
uptime_24h,
|
||||||
last_check,
|
|
||||||
status_history,
|
status_history,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue