Skip to content

Commit

Permalink
Add last_scan_dt check if no scan yet
Browse files Browse the repository at this point in the history
closes #41
  • Loading branch information
fliepeltje committed Nov 16, 2023
1 parent 1756a0b commit 537772d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion humitifier/dash/templates/infra_index_details_table.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
{# Last Scan #}
<tr>
<td>Last Scan</td>
<td>{{ host.last_scan_dt.isoformat(' ') }}</td>
<td>{{ host.last_scan_dt_iso }}</td>
</tr>

{# Contact #}
Expand Down
4 changes: 4 additions & 0 deletions humitifier/infra/models/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ def package_names(self) -> list[str]:
def last_scan_dt(self) -> datetime:
return datetime.fromtimestamp(self.facts.timestamp)

@property
def last_scan_dt_iso(self) -> datetime:
return self.last_scan_dt.isoformat(" ") if self.facts else "Not scanned yet"

@property
def meta_props(self) -> list[tuple[str, str]]:
ignore = ["department"]
Expand Down

0 comments on commit 537772d

Please sign in to comment.