Fix check plugins not displaying checks correctly on service details

This commit is contained in:
Frank Hamand 2017-09-14 15:05:16 +01:00
parent 09793356de
commit 8450b0b466
4 changed files with 12 additions and 4 deletions

View File

@ -1,3 +1,8 @@
master
------
* Fix check plugins not displaying checks correctly on service details page
Version 0.11.6
--------------

View File

@ -86,6 +86,7 @@ def get_custom_check_plugins():
custom_check['creation_url'] = "create-" + check_name + "-check"
custom_check['check_name'] = check_name
custom_check['icon_class'] = getattr(check, "icon_class", "glyphicon-ok")
custom_check['objects'] = check.objects
custom_check_types.append(custom_check)
return custom_check_types

View File

@ -19,3 +19,7 @@ def echo_setting(setting):
def format_timedelta(delta):
# Getting rid of microseconds.
return str(timedelta(days=delta.days, seconds=delta.seconds))
@register.filter
def for_service(objects, service):
return objects.filter(service=service)

View File

@ -103,11 +103,9 @@
{% include 'cabotapp/_statuscheck_list.html' with checks=service.jenkins_status_checks.all service=service checks_type="Jenkins" %}
{% for custom_check in custom_check_types %}
<hr>
{% for check_class in custom_check_types %}
<hr>
{% include 'cabotapp/_statuscheck_list.html' with checks=check_class.objects.all service=service checks_type=check_class.check_name %}
{% include 'cabotapp/_statuscheck_list.html' with checks=custom_check.objects|for_service:service service=service checks_type=custom_check.check_name %}
{% endfor %}
<hr>