Refactor
This commit is contained in:
parent
70a70af859
commit
00cb8f7a9b
4 changed files with 41 additions and 27 deletions
|
|
@ -75,7 +75,7 @@ fn render_group(frame: &mut Frame, area: Rect, group: &GroupViewState, is_first_
|
|||
.constraints([Constraint::Length(1), Constraint::Min(1)])
|
||||
.split(area);
|
||||
|
||||
if chunks[0].height <= 0 || chunks[1].height <= 0 || group.monitors.is_empty() {
|
||||
if chunks[0].height == 0 || chunks[1].height == 0 || group.monitors.is_empty() {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -70,8 +70,8 @@ impl DashboardViewState {
|
|||
.sum();
|
||||
|
||||
Self {
|
||||
title: data.title,
|
||||
descriptions: data.description,
|
||||
title: data.title.into_owned(),
|
||||
descriptions: data.description.map(|d| d.into_owned()),
|
||||
groups,
|
||||
is_loading: false,
|
||||
error_message: None,
|
||||
|
|
@ -140,8 +140,13 @@ fn add_monitor_view_state(group: UnifiedGroupData) -> Vec<MonitorViewState> {
|
|||
.map(|u| u.get_perc_formated())
|
||||
.unwrap_or_else(|| t("unknown").to_string());
|
||||
|
||||
let name: Cow<'static, str> = match monitor.name {
|
||||
Cow::Borrowed(borrowed) => Cow::Owned(borrowed.to_string()),
|
||||
Cow::Owned(owned) => Cow::Owned(owned)
|
||||
};
|
||||
|
||||
MonitorViewState {
|
||||
name: Cow::Owned(monitor.name),
|
||||
name,
|
||||
status,
|
||||
response_time,
|
||||
uptime_24h,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue