Project code in URL for the "Add Prometheus" page. cc: #336

This commit is contained in:
Pēteris Caune 2020-02-21 15:22:10 +02:00
parent 5fb5b05f2e
commit f6a7d46058
No known key found for this signature in database
GPG Key ID: E28D7679E9A9EDE2
3 changed files with 5 additions and 4 deletions

View File

@ -41,7 +41,6 @@ channel_urls = [
path("add_trello/", views.add_trello, name="hc-add-trello"),
path("add_trello/settings/", views.trello_settings, name="hc-trello-settings"),
path("add_apprise/", views.add_apprise, name="hc-add-apprise"),
path("add_prometheus/", views.add_prometheus, name="hc-add-prometheus"),
path("<uuid:code>/checks/", views.channel_checks, name="hc-channel-checks"),
path("<uuid:code>/name/", views.update_channel_name, name="hc-channel-name"),
path("<uuid:code>/test/", views.send_test_notification, name="hc-channel-test"),
@ -64,6 +63,7 @@ project_urls = [
path("add_opsgenie/", views.add_opsgenie, name="hc-add-opsgenie"),
path("add_pagerteam/", views.add_pagerteam, name="hc-add-pagerteam"),
path("add_pagertree/", views.add_pagertree, name="hc-add-pagertree"),
path("add_prometheus/", views.add_prometheus, name="hc-add-prometheus"),
path("add_webhook/", views.add_webhook, name="hc-add-webhook"),
path("badges/", views.badges, name="hc-badges"),
path("checks/", views.my_checks, name="hc-checks"),

View File

@ -1560,8 +1560,9 @@ def add_msteams(request, code):
@login_required
def add_prometheus(request):
ctx = {"page": "channels", "project": request.project}
def add_prometheus(request, code):
project = _get_project_for_user(request, code)
ctx = {"page": "channels", "project": project}
return render(request, "integrations/add_prometheus.html", ctx)

View File

@ -298,7 +298,7 @@
<h2>Prometheus</h2>
<p>Export check and tag status values to Prometheus.</p>
<a href="{% url 'hc-add-prometheus' %}" class="btn btn-primary">Add Integration</a>
<a href="{% url 'hc-add-prometheus' project.code %}" class="btn btn-primary">Add Integration</a>
</li>
{% if enable_pushbullet %}