diff --git a/static/css/my_checks_desktop.css b/static/css/my_checks_desktop.css index 58ff8031..710a86d2 100644 --- a/static/css/my_checks_desktop.css +++ b/static/css/my_checks_desktop.css @@ -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; } diff --git a/static/js/checks.js b/static/js/checks.js index 39612c58..f9237fe8 100644 --- a/static/js/checks.js +++ b/static/js/checks.js @@ -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; }); diff --git a/templates/front/last_ping_cell.html b/templates/front/last_ping_cell.html index e712098f..88453940 100644 --- a/templates/front/last_ping_cell.html +++ b/templates/front/last_ping_cell.html @@ -1,12 +1,10 @@ {% load humanize %} {% if check.last_ping %} -