forked from GithubBackups/healthchecks
Can remove checks from "My Checks" page.
This commit is contained in:
parent
40a0271f43
commit
29e36fc14d
@ -8,6 +8,7 @@ urlpatterns = [
|
|||||||
url(r'^checks/([\w-]+)/name/$', views.update_name, name="hc-update-name"),
|
url(r'^checks/([\w-]+)/name/$', views.update_name, name="hc-update-name"),
|
||||||
url(r'^checks/([\w-]+)/timeout/$', views.update_timeout, name="hc-update-timeout"),
|
url(r'^checks/([\w-]+)/timeout/$', views.update_timeout, name="hc-update-timeout"),
|
||||||
url(r'^checks/([\w-]+)/email/$', views.email_preview),
|
url(r'^checks/([\w-]+)/email/$', views.email_preview),
|
||||||
|
url(r'^checks/([\w-]+)/remove/$', views.remove, name="hc-remove-check"),
|
||||||
url(r'^pricing/$', views.pricing, name="hc-pricing"),
|
url(r'^pricing/$', views.pricing, name="hc-pricing"),
|
||||||
url(r'^docs/$', views.docs, name="hc-docs"),
|
url(r'^docs/$', views.docs, name="hc-docs"),
|
||||||
url(r'^about/$', views.about, name="hc-about"),
|
url(r'^about/$', views.about, name="hc-about"),
|
||||||
|
@ -128,3 +128,16 @@ def email_preview(request, code):
|
|||||||
}
|
}
|
||||||
|
|
||||||
return render(request, "emails/alert/body.html", ctx)
|
return render(request, "emails/alert/body.html", ctx)
|
||||||
|
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
def remove(request, code):
|
||||||
|
assert request.method == "POST"
|
||||||
|
|
||||||
|
check = Check.objects.get(code=code)
|
||||||
|
if check.user != request.user:
|
||||||
|
return HttpResponseForbidden()
|
||||||
|
|
||||||
|
check.delete()
|
||||||
|
|
||||||
|
return redirect("hc-index")
|
||||||
|
@ -109,10 +109,6 @@ table.table tr > th.th-name {
|
|||||||
padding-left: 21px;
|
padding-left: 21px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.setup-link {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#checks-table .indicator-cell {
|
#checks-table .indicator-cell {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
@ -125,10 +121,6 @@ table.table tr > th.th-name {
|
|||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
.checks-row:hover .setup-link {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.name-edit.inactive .input-name {
|
.name-edit.inactive .input-name {
|
||||||
border: 1px solid rgba(0, 0, 0, 0);
|
border: 1px solid rgba(0, 0, 0, 0);
|
||||||
background: none;
|
background: none;
|
||||||
@ -175,3 +167,11 @@ td.inactive .popover {
|
|||||||
color: #337ab7;
|
color: #337ab7;
|
||||||
border: 1px dotted #AAA;
|
border: 1px dotted #AAA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.check-menu {
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
tr:hover .check-menu {
|
||||||
|
visibility: visible;
|
||||||
|
}
|
@ -38,5 +38,14 @@ $(function () {
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(".check-menu-remove").click(function() {
|
||||||
|
var $this = $(this);
|
||||||
|
|
||||||
|
$("#remove-check-form").attr("action", $this.data("url"));
|
||||||
|
$(".remove-check-name").text($this.data("name"));
|
||||||
|
$('#remove-check-modal').modal("show");
|
||||||
|
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
@ -16,6 +16,7 @@
|
|||||||
<th>URL</th>
|
<th>URL</th>
|
||||||
<th>Frequency</th>
|
<th>Frequency</th>
|
||||||
<th>Last Ping</th>
|
<th>Last Ping</th>
|
||||||
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
{% for check in checks %}
|
{% for check in checks %}
|
||||||
<tr class="checks-row">
|
<tr class="checks-row">
|
||||||
@ -98,6 +99,23 @@
|
|||||||
Never
|
Never
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
<div class="check-menu dropdown">
|
||||||
|
<button class="btn btn-sm btn-default dropdown-toggle" type="button" data-toggle="dropdown">
|
||||||
|
<span class="glyphicon glyphicon-cog" aria-hidden="true"></span>
|
||||||
|
</button>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li>
|
||||||
|
<a href="#" class="check-menu-remove"
|
||||||
|
data-name="{{ check.name|default:check.code }}"
|
||||||
|
data-url="{% url 'hc-remove-check' check.code %}">
|
||||||
|
<span class="glyphicon glyphicon-trash"></span>
|
||||||
|
Remove
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
@ -117,6 +135,32 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="remove-check-modal" class="modal fade">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<form id="remove-check-form" method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
<input type="hidden" name="code" class="remove-check-code" />
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal">×</span></button>
|
||||||
|
<h4 class="remove-check-title">Remove Check <span class="remove-check-name"></h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<p>You are about to remove check
|
||||||
|
<strong class="remove-check-name">---</strong>.
|
||||||
|
</p>
|
||||||
|
<p>Once it's gone there is no "undo" and you cannot get
|
||||||
|
the old ping URL back.</p>
|
||||||
|
<p>Are you sure?</p>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
||||||
|
<button type="submit" class="btn btn-danger">Remove</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user