From 7d1734d1473ee0b8d1aef445b3c348cfa3d5a399 Mon Sep 17 00:00:00 2001 From: George Lacey Date: Sat, 8 May 2021 16:27:21 +0100 Subject: [PATCH] Improve aesthetic and layout - Return error count --- borgweb/borg/models/repo.py | 5 +--- borgweb/borg/static/css/index.css | 20 ++++++--------- borgweb/borg/templates/borg/index.html | 34 ++++++++++++++++++-------- 3 files changed, 33 insertions(+), 26 deletions(-) diff --git a/borgweb/borg/models/repo.py b/borgweb/borg/models/repo.py index 9c026e8..29cc473 100644 --- a/borgweb/borg/models/repo.py +++ b/borgweb/borg/models/repo.py @@ -33,10 +33,7 @@ class Repo(models.Model): days = 7 days_ago = (datetime.utcnow() - timedelta(days=7)) errors = self.label.errors.all().filter(time__gt=days_ago) - if len(errors) == 1: - return f"1 error since {days} days ago" - else: - return f"{len(errors)} errors since {days} days ago" + return len(errors) def archive_dates(self): days = self.get_archive_days() diff --git a/borgweb/borg/static/css/index.css b/borgweb/borg/static/css/index.css index ad74ac5..a9ae253 100644 --- a/borgweb/borg/static/css/index.css +++ b/borgweb/borg/static/css/index.css @@ -1,19 +1,15 @@ -.repo_info { - outline: 2px solid black; +div { padding: 8px; - float: left; - width: auto; - margin: 16px; + margin: 8px; + background: lightblue; } -.repo_label { +header { font-size: x-large; + text-align: center; } -.repo_point { - list-style-type: none; -} - -.point_label { - font-weight: bold; +dl { + margin: 0px; + font-size: 16px; } \ No newline at end of file diff --git a/borgweb/borg/templates/borg/index.html b/borgweb/borg/templates/borg/index.html index 805dca5..2c97794 100644 --- a/borgweb/borg/templates/borg/index.html +++ b/borgweb/borg/templates/borg/index.html @@ -1,26 +1,40 @@ - + + Borg Summary {% load static %} - + + + + {{ hour_list|json_script:"hour_list" }}

{% if repo_list %} {% for repo in repo_list %} -
-
{{ repo.label }} ({{ repo.location }})
- +
+

{{ repo.label }} {{ repo.location }}

+
+
Latest backup:
+
{{ repo.last_backup }}
+
+
+
Hourly backups:
+
{{ repo.get_archive_hours }}
+
+
+
Size:
+
{{ repo.size }}
+
+
+
Recent errors:
+
{{ repo.recent_errors }}
+
{% endfor %}