fix missing last-seen display

This commit is contained in:
4cuck committed 2023-10-16 23:32:10 +02:00
1 parent 0342427835
commit 46771abb05
3 files changed
+8 -3

No files matched your search

+2
View File
@@ -66,4 +66,6 @@ pub struct CacheHost {
/// Percentage of healthy checks since first seen
pub healthy_percentage_overall: u8,
pub connectivity: Option<Connectivity>,
/// Internal: show last-seen information
pub __show_last_seen: bool,
}
+5 -2
View File
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
use std::collections::HashMap;
use chrono::TimeZone;
use chrono::{TimeZone, Duration};
use chrono::{Days, Utc};
use entities::host;
use entities::prelude::*;
@@ -137,8 +137,11 @@ impl Scanner {
(!last_check.healthy) && self.inner.config.bad_hosts.contains(&host.domain);
let host_ping_data = ping_data.remove(&host.id);
let last_healthy = last_healthy_check.remove(&host.id);
let __show_last_seen = last_healthy.map_or(true, |e|(time_now - e) > Duration::hours(4));
host_statistics.push(CacheHost {
last_healthy: last_healthy_check.remove(&host.id),
last_healthy: last_healthy,
__show_last_seen,
url: host.url,
domain: host.domain,
points,
+1 -1
View File
@@ -59,7 +59,7 @@
{%- set width = 110 -%}
{%- set width_bar = 5 -%}
{%- set offset = 5 -%}
{%- if host.recent_checks -%}
{%- if not host.__show_last_seen -%}
<svg class="uptime-graph" viewBox="0 0 {{width}} {{height}}" height="{{height}}">
{%- for check in host.recent_checks -%}
{%- if check.1 -%}