diff --git a/CHANGELOG.md b/CHANGELOG.md index c13589a5..2f26e5f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file. - Handle status callbacks from Twilio, show delivery failures in Integrations - Removing unused /api/v1/notifications/{uuid}/bounce endpoint - Less verbose output in the `senddeletionnotices` command +- Host a read-only dashboard (from github.com/healthchecks/dashboard/) ## Bug Fixes - Handle excessively long email addresses in the signup form. diff --git a/hc/accounts/models.py b/hc/accounts/models.py index 5a4af9c2..bd7cd909 100644 --- a/hc/accounts/models.py +++ b/hc/accounts/models.py @@ -1,5 +1,6 @@ from datetime import timedelta from secrets import token_urlsafe +from urllib.parse import quote, urlencode import uuid from django.conf import settings @@ -359,6 +360,13 @@ class Project(models.Model): def transfer_request(self): return self.member_set.filter(transfer_request_date__isnull=False).first() + def dashboard_url(self): + if not self.api_key_readonly: + return None + + frag = urlencode({self.api_key_readonly: str(self)}, quote_via=quote) + return reverse("hc-dashboard") + "#" + frag + class Member(models.Model): user = models.ForeignKey(User, models.CASCADE, related_name="memberships") diff --git a/hc/front/urls.py b/hc/front/urls.py index bce15731..b99292b2 100644 --- a/hc/front/urls.py +++ b/hc/front/urls.py @@ -90,6 +90,7 @@ project_urls = [ urlpatterns = [ path("", views.index, name="hc-index"), + path("tv/", views.dashboard, name="hc-dashboard"), path("checks/cron_preview/", views.cron_preview), path("checks//", include(check_urls)), path("integrations/", include(channel_urls)), diff --git a/hc/front/views.py b/hc/front/views.py index e892781c..74850e9a 100644 --- a/hc/front/views.py +++ b/hc/front/views.py @@ -279,6 +279,10 @@ def index(request): return render(request, "front/welcome.html", ctx) +def dashboard(request): + return render(request, "front/dashboard.html", {}) + + def serve_doc(request, doc="introduction"): path = os.path.join(settings.BASE_DIR, "templates/docs", doc + ".html") if not os.path.exists(path): diff --git a/templates/accounts/project.html b/templates/accounts/project.html index eb2c3eee..1479e617 100644 --- a/templates/accounts/project.html +++ b/templates/accounts/project.html @@ -80,17 +80,24 @@ {% if show_api_keys %}

API key:
- {{ project.api_key }} +

{{ project.api_key }}

{% if project.api_key_readonly %}

API key (read-only):
- {{ project.api_key_readonly }} -

-

- Prometheus metrics endpoint: - here +

{{ project.api_key_readonly }}

+

Related links:

+ {% endif %} + class="btn btn-default pull-right">Show API Keys {% endif %} {% else %} @@ -117,7 +124,7 @@ + class="btn btn-default pull-right">Create API Keys {% endif %} diff --git a/templates/front/dashboard.html b/templates/front/dashboard.html new file mode 100644 index 00000000..89314286 --- /dev/null +++ b/templates/front/dashboard.html @@ -0,0 +1,266 @@ + + + + + {{ site_name }} + + + +
+ +
+
+
+
+
+ + + +