Browse Source

/checks/status/ sends smaller payload.

pull/178/head
Pēteris Caune 7 years ago
parent
commit
639249a395
No known key found for this signature in database GPG Key ID: E28D7679E9A9EDE2
4 changed files with 35 additions and 27 deletions
  1. +1
    -2
      static/css/my_checks_desktop.css
  2. +18
    -8
      static/js/checks.js
  3. +5
    -7
      templates/front/last_ping_cell.html
  4. +11
    -10
      templates/front/my_checks_desktop.html

+ 1
- 2
static/css/my_checks_desktop.css View File

@ -35,8 +35,7 @@
#checks-table .my-checks-name,
#checks-table .integrations,
#checks-table .timeout-grace,
#checks-table .last-ping,
#checks-table .last-ping-never {
#checks-table .last-ping {
border: 1px solid rgba(0, 0, 0, 0);
padding: 6px;
}


+ 18
- 8
static/js/checks.js View File

@ -188,13 +188,21 @@ $(function () {
return false;
});
$(".last-ping-cell").on("click", ".last-ping", function() {
$(".last-ping").on("click", function() {
if (this.innerText == "Never") {
showUsage(this);
return false;
}
$("#ping-details-body").text("Updating...");
$('#ping-details-modal').modal("show");
var code = $(this).closest("tr").data("code");
var url = "/checks/" + code + "/last_ping/";
var token = $('input[name=csrfmiddlewaretoken]').val();
$.ajax({
url: this.dataset.url,
url: url,
type: "post",
headers: {"X-CSRFToken": token},
success: function(data) {
@ -270,15 +278,17 @@ $(function () {
}
});
$(".usage-examples").click(function(e) {
var a = e.target;
var url = a.getAttribute("data-url");
var email = a.getAttribute("data-email");
function showUsage(el) {
var tr = $(el).closest("tr");
$(".ex", "#show-usage-modal").text(url);
$(".em", "#show-usage-modal").text(email);
$(".ex", "#show-usage-modal").text(tr.data("url"));
$(".em", "#show-usage-modal").text(tr.data("email"));
$("#show-usage-modal").modal("show");
}
$(".usage-examples").click(function(e) {
showUsage(e.target);
return false;
});


+ 5
- 7
templates/front/last_ping_cell.html View File

@ -1,12 +1,10 @@
{% load humanize %}
{% if check.last_ping %}
<div class="last-ping" data-url="{% url 'hc-last-ping' check.code %}">
{{ check.last_ping|naturaltime }}
{% if check.has_confirmation_link %}
<br /><span class="label label-confirmation">confirmation link</span>
{% endif %}
</div>
{{ check.last_ping|naturaltime }}
{% if check.has_confirmation_link %}
<br /><span class="label label-confirmation">confirmation link</span>
{% endif %}
{% else %}
<div class="last-ping-never">Never</div>
Never
{% endif %}

+ 11
- 10
templates/front/my_checks_desktop.html View File

@ -41,7 +41,12 @@
<th></th>
</tr>
{% for check in checks %}
<tr class="checks-row">
<tr
class="checks-row"
data-code="{{ check.code }}"
data-url="{{ check.url }}"
data-email="{{ check.email }}">
<td class="indicator-cell">
{% if check.in_grace_period %}
<span id="si-{{ check.code }}" class="status icon-grace" data-toggle="tooltip"></span>
@ -108,8 +113,10 @@
</span>
</div>
</td>
<td id="lpd-{{ check.code}}" class="last-ping-cell">
{% include "front/last_ping_cell.html" with check=check %}
<td>
<div id="lpd-{{ check.code}}" class="last-ping">
{% include "front/last_ping_cell.html" with check=check %}
</div>
</td>
<td>
<div class="check-menu dropdown">
@ -131,13 +138,7 @@
</a>
</li>
<li>
<a
href="#"
class="usage-examples"
data-url="{{ check.url }}"
data-email="{{ check.email }}">
Usage Examples
</a>
<a href="#" class="usage-examples">Usage Examples</a>
</li>
<li role="separator" class="divider"></li>
<li>


Loading…
Cancel
Save