Skip to content

Commit

Permalink
result_summary templates: support for date ranges for creation and la…
Browse files Browse the repository at this point in the history
…st update

Signed-off-by: Ricardo Cañuelo <[email protected]>
  • Loading branch information
Ricardo Cañuelo authored and r-c-n committed Apr 3, 2024
1 parent e1cc5f9 commit 228bc55
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 31 deletions.
39 changes: 28 additions & 11 deletions config/result_summary_templates/generic-regressions.html.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,39 @@ expects the following input parameters:
#}

{% extends "base.html" %}
{% set title = metadata['title'] if 'title' in metadata else 'Regression summary: ' %}

{% block title %}
{% if 'title' in metadata %}
{{ metadata['title'] }} from {{ from_date }} to {{ to_date }}
{% else %}
Regression summary from {{ from_date }} to {{ to_date }}
{% endif %}
{{ title | striptags }}
{% endblock %}

{% block content %}
<h1 class="text-bg-light p-3 rounded">
{% if 'title' in metadata %}
{{ metadata['title'] }} from {{ from_date }} to {{ to_date }}
{% else %}
Regression summary from {{ from_date }} to {{ to_date }}
{% endif %}
{% if created_from and created_to %}
{% set created_string = 'Created between ' + created_from + ' and ' + created_to %}
{% elif created_from %}
{% set created_string = 'Created after ' + created_from %}
{% elif created_to %}
{% set created_string = 'Created before ' + created_to %}
{% endif %}
{% if last_updated_from and last_updated_to %}
{% set last_updated_string = 'Last updated between ' + last_updated_from + ' and ' + last_updated_to %}
{% elif last_updated_from %}
{% set last_updated_string = 'Last updated after ' + last_updated_from %}
{% elif last_updated_to %}
{% set last_updated_string = 'Last updated before ' + last_updated_to %}
{% endif %}

<h1 class="text-bg-light p-3 rounded">{{ title }}
<ul>
{% if created_string %}
<li>{{ created_string }}</li>
{% endif %}
{% if last_updated_string %}
<li>{{ last_updated_string }}</li>
{% endif %}
</ul>
</h1>

{% if results_per_branch | count == 0 %}
No regressions found.
{% else -%}
Expand Down
26 changes: 21 additions & 5 deletions config/result_summary_templates/generic-regressions.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,26 @@ the following input parameters:
}
#}

{% if 'title' in metadata -%}
{{ metadata['title'] }} from {{ from_date }} to {{ to_date }}
{% else -%}
Regressions from {{ from_date }} to {{ to_date }}
{% if created_from and created_to -%}
{% set created_string = 'Created between ' + created_from + ' and ' + created_to -%}
{% elif created_from -%}
{% set created_string = 'Created after ' + created_from -%}
{% elif created_to %}
{% set created_string = 'Created before ' + created_to -%}
{% endif -%}
{% if last_updated_from and last_updated_to -%}
{% set last_updated_string = 'Last updated between ' + last_updated_from + ' and ' + last_updated_to -%}
{% elif last_updated_from -%}
{% set last_updated_string = 'Last updated after ' + last_updated_from -%}
{% elif last_updated_to -%}
{% set last_updated_string = 'Last updated before ' + last_updated_to -%}
{% endif -%}
{{ metadata['title'] if 'title' in metadata else 'Regression summary: ' }}
{% if created_string -%}
- {{ created_string }}
{% endif -%}
{% if last_updated_string -%}
- {{ last_updated_string }}
{% endif -%}
{% if results_per_branch | count == 0 %}
No regressions found.
Expand Down Expand Up @@ -71,7 +87,7 @@ No regressions found.
{% if regression['logs'] | count > 0 -%}
Logs:
{% for log in regression['logs'] -%}
- {{ log }}: {{ regression['logs'][log] }}
- {{ log }}: {{ regression['logs'][log]['url'] }}
{% endfor %}
{% else -%}
No logs available
Expand Down
39 changes: 28 additions & 11 deletions config/result_summary_templates/generic-test-failures.html.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,39 @@ expects the following input parameters:
#}

{% extends "base.html" %}
{% set title = metadata['title'] if 'title' in metadata else 'Test failures: ' %}

{% block title %}
{% if 'title' in metadata %}
{{ metadata['title'] }} from {{ from_date }} to {{ to_date }}
{% else %}
Test failures from {{ from_date }} to {{ to_date }}
{% endif %}
{{ title | striptags }}
{% endblock %}

{% block content %}
<h1 class="text-bg-light p-3 rounded">
{% if 'title' in metadata %}
{{ metadata['title'] }} from {{ from_date }} to {{ to_date }}
{% else %}
Test failures from {{ from_date }} to {{ to_date }}
{% endif %}
{% if created_from and created_to %}
{% set created_string = 'Created between ' + created_from + ' and ' + created_to %}
{% elif created_from %}
{% set created_string = 'Created after ' + created_from %}
{% elif created_to %}
{% set created_string = 'Created before ' + created_to %}
{% endif %}
{% if last_updated_from and last_updated_to %}
{% set last_updated_string = 'Last updated between ' + last_updated_from + ' and ' + last_updated_to %}
{% elif last_updated_from %}
{% set last_updated_string = 'Last updated after ' + last_updated_from %}
{% elif last_updated_to %}
{% set last_updated_string = 'Last updated before ' + last_updated_to %}
{% endif %}

<h1 class="text-bg-light p-3 rounded">{{ title }}
<ul>
{% if created_string %}
<li>{{ created_string }}</li>
{% endif %}
{% if last_updated_string %}
<li>{{ last_updated_string }}</li>
{% endif %}
</ul>
</h1>

{% if results_per_branch | count == 0 %}
No failures found.
{% else -%}
Expand Down
24 changes: 20 additions & 4 deletions config/result_summary_templates/generic-test-failures.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,26 @@ expects the following input parameters:
}
#}

{% if 'title' in metadata -%}
{{ metadata['title'] }} from {{ from_date }} to {{ to_date }}
{% else -%}
Test failures from {{ from_date }} to {{ to_date }}
{% if created_from and created_to -%}
{% set created_string = 'Created between ' + created_from + ' and ' + created_to -%}
{% elif created_from -%}
{% set created_string = 'Created after ' + created_from -%}
{% elif created_to %}
{% set created_string = 'Created before ' + created_to -%}
{% endif -%}
{% if last_updated_from and last_updated_to -%}
{% set last_updated_string = 'Last updated between ' + last_updated_from + ' and ' + last_updated_to -%}
{% elif last_updated_from -%}
{% set last_updated_string = 'Last updated after ' + last_updated_from -%}
{% elif last_updated_to -%}
{% set last_updated_string = 'Last updated before ' + last_updated_to -%}
{% endif -%}
{{ metadata['title'] if 'title' in metadata else 'Test failures: ' }}
{% if created_string -%}
- {{ created_string }}
{% endif -%}
{% if last_updated_string -%}
- {{ last_updated_string }}
{% endif -%}
{% if results_per_branch | count == 0 %}
No failures found.
Expand Down

0 comments on commit 228bc55

Please sign in to comment.