UI: Link playbooks to filtered results based on status

This will apply a default filter to playbook links based on its status.

When failed, it will search for results with the status "failed" or
"unreachable" -- otherwise, it will search for results that have
resulted in a change.

The objective is to highlight changed, failed and unreachable results in
an ocean of skipped and ok results.

Change-Id: I662682296be68e387a26da16be8313daa15584bf
This commit is contained in:
David Moreau Simard 2020-09-18 20:39:11 -04:00
parent 9ddce955e3
commit fbe34695ff
1 changed files with 10 additions and 2 deletions

View File

@ -142,8 +142,16 @@
{{ playbook.ansible_version }}
</td>
<td role="cell" data-label="Name (or path)" class="pf-m-fit-content">
<a href="{% if page != "index" %}../{% endif %}playbooks/{{ playbook.id }}.html" title="{{ playbook.path }}">
{% if playbook.name is not None %}{{ playbook.name }}{% else %}{{ playbook.path | truncatepath:50 }}{% endif %}
{% if static_generation %}
<a href="{% if page != "index" %}../{% endif %}playbooks/{{ playbook.id }}.html" title="{{ playbook.path }}">
{% else %}
{% if playbook.status == "failed" %}
<a href="{% url 'ui:playbook' playbook.id %}?status=failed&status=unreachable#results">
{% else %}
<a href="{% url 'ui:playbook' playbook.id %}?changed=True#results">
{% endif %}
{% endif %}
{% if playbook.name is not None %}{{ playbook.name }}{% else %}{{ playbook.path | truncatepath:50 }}{% endif %}
</a>
</td>
<td role="cell" data-label="Labels" class="pf-m-wrap">