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 {
|
||||
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![
|
||||
Span::styled("📈 ", Style::default().fg(Color::Cyan)),
|
||||
Span::styled(title, Style::default().fg(Color::White).bold()),
|
||||
Span::styled(description, Style::default().fg(Color::White).bold()),
|
||||
]))
|
||||
.alignment(Alignment::Center)
|
||||
.block(
|
||||
|
|
|
|||
|
|
@ -13,11 +13,9 @@ pub enum MonitorStatus {
|
|||
pub struct MonitorViewState {
|
||||
pub id: u64,
|
||||
pub name: String,
|
||||
pub group_name: String,
|
||||
pub status: MonitorStatus,
|
||||
pub response_time: String,
|
||||
pub uptime_24h: String,
|
||||
pub last_check: String,
|
||||
pub status_history: Vec<MonitorStatus>,
|
||||
}
|
||||
|
||||
|
|
@ -118,20 +116,12 @@ fn add_monitor_view_state(group: UnifiedGroupData) -> Vec<MonitorViewState> {
|
|||
.map(|u| u.get_perc_formated())
|
||||
.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 {
|
||||
id: monitor.monitor_info.id,
|
||||
name: monitor.monitor_info.name,
|
||||
group_name: group.group_info.name.clone(),
|
||||
status,
|
||||
response_time,
|
||||
uptime_24h,
|
||||
last_check,
|
||||
status_history,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue