Browse Source

Replace the gear icon with three horizontal dots icon. Fixes #322.

Add a Pause button in the checks list. Fixes #312
pull/325/head
Pēteris Caune 5 years ago
parent
commit
7cf324872c
No known key found for this signature in database GPG Key ID: E28D7679E9A9EDE2
10 changed files with 64 additions and 9 deletions
  1. +2
    -0
      CHANGELOG.md
  2. +5
    -0
      hc/front/tests/test_pause.py
  3. +4
    -0
      hc/front/views.py
  4. +5
    -5
      static/css/icomoon.css
  5. +26
    -0
      static/css/my_checks_desktop.css
  6. BIN
      static/fonts/icomoon.eot
  7. BIN
      static/fonts/icomoon.ttf
  8. BIN
      static/fonts/icomoon.woff
  9. +15
    -1
      static/js/checks.js
  10. +7
    -3
      templates/front/my_checks_desktop.html

+ 2
- 0
CHANGELOG.md View File

@ -9,6 +9,8 @@ All notable changes to this project will be documented in this file.
- For superusers, show "Site Administration" in top navigation, note in README (#317) - For superusers, show "Site Administration" in top navigation, note in README (#317)
- Make Ping.body size limit configurable (#301) - Make Ping.body size limit configurable (#301)
- Show sub-second durations with higher precision, 2 digits after decimal point (#321) - Show sub-second durations with higher precision, 2 digits after decimal point (#321)
- Replace the gear icon with three horizontal dots icon (#322)
- Add a Pause button in the checks list (#312)
### Bug Fixes ### Bug Fixes
- Increase the allowable length of Matrix room alias to 100 (#320) - Increase the allowable length of Matrix room alias to 100 (#320)


+ 5
- 0
hc/front/tests/test_pause.py View File

@ -44,3 +44,8 @@ class PauseTestCase(BaseTestCase):
self.check.refresh_from_db() self.check.refresh_from_db()
self.assertEqual(self.check.last_start, None) self.assertEqual(self.check.last_start, None)
self.assertEqual(self.check.alert_after, None) self.assertEqual(self.check.alert_after, None)
def test_it_does_not_redirect_ajax(self):
self.client.login(username="[email protected]", password="password")
r = self.client.post(self.url, HTTP_X_REQUESTED_WITH="XMLHttpRequest")
self.assertEqual(r.status_code, 200)

+ 4
- 0
hc/front/views.py View File

@ -428,6 +428,10 @@ def pause(request, code):
if "/details/" in request.META.get("HTTP_REFERER", ""): if "/details/" in request.META.get("HTTP_REFERER", ""):
return redirect("hc-details", code) return redirect("hc-details", code)
# Don't redirect after an AJAX request:
if request.META.get("HTTP_X_REQUESTED_WITH") == "XMLHttpRequest":
return HttpResponse()
return redirect("hc-checks", check.project.code) return redirect("hc-checks", check.project.code)


+ 5
- 5
static/css/icomoon.css View File

@ -1,10 +1,10 @@
@font-face { @font-face {
font-family: 'icomoon'; font-family: 'icomoon';
src: url('../fonts/icomoon.eot?jvwv9j');
src: url('../fonts/icomoon.eot?jvwv9j#iefix') format('embedded-opentype'),
url('../fonts/icomoon.ttf?jvwv9j') format('truetype'),
url('../fonts/icomoon.woff?jvwv9j') format('woff'),
url('../fonts/icomoon.svg?jvwv9j#icomoon') format('svg');
src: url('../fonts/icomoon.eot?pl16ut');
src: url('../fonts/icomoon.eot?pl16ut#iefix') format('embedded-opentype'),
url('../fonts/icomoon.ttf?pl16ut') format('truetype'),
url('../fonts/icomoon.woff?pl16ut') format('woff'),
url('../fonts/icomoon.svg?pl16ut#icomoon') format('svg');
font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal;
} }


+ 26
- 0
static/css/my_checks_desktop.css View File

@ -132,3 +132,29 @@ tr:hover .copy-link {
color: #888; color: #888;
white-space: nowrap; white-space: nowrap;
} }
#checks-table .actions {
white-space: nowrap;
}
#checks-table .btn {
border-color: transparent;
font-size: 20px;
color: #999;
}
#checks-table tr:hover .btn {
color: #666;
background: transparent;
opacity: 1;
}
#checks-table tr:hover .btn:hover {
background: #DDD;
color: #000;
}
#checks-table .pause {
opacity: 0;
}

BIN
static/fonts/icomoon.eot View File


BIN
static/fonts/icomoon.ttf View File


BIN
static/fonts/icomoon.woff View File


+ 15
- 1
static/js/checks.js View File

@ -138,6 +138,21 @@ $(function () {
return false; return false;
}); });
$(".pause").click(function(e) {
var code = $(this).closest("tr.checks-row").attr("id");
$("#" + code + " span.status").attr("class", "status icon-paused");
var url = base + "/checks/" + code + "/pause/";
var token = $('input[name=csrfmiddlewaretoken]').val();
$.ajax({
url: url,
type: "post",
headers: {"X-CSRFToken": token}
});
return false;
});
$('[data-toggle="tooltip"]').tooltip({ $('[data-toggle="tooltip"]').tooltip({
html: true, html: true,
container: "body", container: "body",
@ -171,7 +186,6 @@ $(function () {
if (lastStatus[el.code] != el.status) { if (lastStatus[el.code] != el.status) {
lastStatus[el.code] = el.status; lastStatus[el.code] = el.status;
$("#" + el.code + " span.status").attr("class", "status icon-" + el.status); $("#" + el.code + " span.status").attr("class", "status icon-" + el.status);
$("#" + el.code + " .pause-li").toggleClass("disabled", el.status == "paused");
} }
if (lastPing[el.code] != el.last_ping) { if (lastPing[el.code] != el.last_ping) {


+ 7
- 3
templates/front/my_checks_desktop.html View File

@ -120,9 +120,13 @@
{% include "front/last_ping_cell.html" with check=check %} {% include "front/last_ping_cell.html" with check=check %}
</div> </div>
</td> </td>
<td>
<button class="btn btn-sm btn-default show-log" type="button">
<span class="icon-settings" aria-hidden="true"></span>
<td class="actions">
<button title="Pause" class="btn btn-default pause" type="button">
<span class="icon-paused" />
</button>
<button title="Show Details" class="btn btn-default show-log" type="button">
<span class="icon-dots" />
</button> </button>
</td> </td>
</tr> </tr>


Loading…
Cancel
Save