diff --git a/CHANGES b/CHANGES index ca4de9c99..1a6d75aa4 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,8 @@ +master +------ + +* Fix check plugins not displaying checks correctly on service details page + Version 0.11.6 -------------- diff --git a/cabot/cabotapp/models/base.py b/cabot/cabotapp/models/base.py index e4fcc25d8..f530f0168 100644 --- a/cabot/cabotapp/models/base.py +++ b/cabot/cabotapp/models/base.py @@ -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 diff --git a/cabot/cabotapp/templatetags/extra.py b/cabot/cabotapp/templatetags/extra.py index 92be8bee0..c3fc846c5 100644 --- a/cabot/cabotapp/templatetags/extra.py +++ b/cabot/cabotapp/templatetags/extra.py @@ -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) diff --git a/cabot/templates/cabotapp/service_detail.html b/cabot/templates/cabotapp/service_detail.html index d1a2375ab..4c15d389a 100644 --- a/cabot/templates/cabotapp/service_detail.html +++ b/cabot/templates/cabotapp/service_detail.html @@ -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 %}
- -{% for check_class in custom_check_types %} -
-{% 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 %}