app/views/templates/nightly.html.twig (224 lines of code) (raw):
{% extends 'base.html.twig' %}
{% block head_additions %}
{% set meta_description = 'Follow Firefox trains and major milestones easily!' %}
<meta name="description" content="{{ meta_description }}">
<meta property="twitter:description" content="{{ meta_description }}">
<meta property="og:url" content="https://whattrainisitnow.com/nightly/">
{% endblock %}
{% block header %}
<header class="mx-auto">
<h1>
<a href="?date={{ previous_date }}">«</a>
{{ display_date|format_datetime('full', 'none') }}
{% if requested_date != today %}<a href="?date={{ next_date }}">»</a><br><a href="?date=today" class="btn btn-primary">Today</a>{% endif %}
</h1>
{% if warning_message %}
<div class="w-50 alert alert-warning mx-auto text-center" role="alert">{{ warning_message }}</div>
{% endif %}
</header>
{% endblock %}
{% block main %}
{%- set android_products = ['Firefox for Android', 'GeckoView', 'Focus'] -%}
{% for dataset in nightly_pairs %}
<a href="#buildid_{{ dataset.buildid }}" name="buildid_{{ dataset.buildid }}" class="buildid pe-2 pt-2 text-light float-start bg-transparent">#</a>
<ul class="list-group list-group-horizontal">
{% if fallback_nightly %}
<li class="list-group-item bg-warning"></li>
{% endif %}
<li class="list-group-item bg-info border-0">
<a href="https://hg.mozilla.org/mozilla-central/changeset/{{ dataset.changeset }}" class="text-light" title="Nightly {{ dataset.version }}">{{ dataset.buildid }}</a>
<li class="list-group-item text-light bg-secondary border-0">
<a href="https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange={{ dataset.prev_changeset }}&tochange={{ dataset.changeset }}" class="text-light">Changelog</a>
</li>
<li class="list-group-item text-light bg-success border-0">
<a href="{{ bug_list[dataset.buildid].url }}" class="text-light">Patches from {{ bug_list[dataset.buildid].count }} bugs</a>
</li>
<li class="list-group-item text-light bg-primary border-0">
<a class="text-light" data-bs-toggle="collapse" aria-expanded="false" href="#collapse{{ dataset.buildid }}">
<span class="text-collapsed">Show list of bugs</span>
<span class="text-expanded">Hide list of bugs</span>
</a>
</li>
<li class="list-group-item text-light bg-danger border-0">
<a href="https://crash-stats.mozilla.org/api/SuperSearch/?build_id={{ dataset.buildid }}&_facets=signature&product=Firefox" class="text-light">{{build_crashes[dataset.buildid] }} crashes</a>
</li>
</ul>
<p>
</p>
<div class="collapse" id="collapse{{ dataset.buildid }}">
<!-- Outstanding bugs -->
{% if outstanding_bugs[dataset.buildid].bugs %}
<table class="table table-light table-striped table-bordered table-sm mb-3 caption-top">
<caption class="table-dark text-center fw-bold">Outstanding bugs</caption>
<thead>
<tr class="table-dark">
<th>Bug</th>
<th>Component</th>
<th>Impact</th>
<th>Summary</th>
</tr>
</thead>
<tbody>
{%- for details in outstanding_bugs[dataset.buildid].bugs -%}
{%- set alert_link = '' -%}
{%- set alert_title = '' -%}
{%- set alert_row = '' -%}
{%- set pill_level = 'text-bg-light border' -%}
{%- set product = '' -%}
{%- if details.type == 'enhancement' -%}
{%- set alert_link =' text-success fw-bold' -%}
{%- set alert_title =' title="Bug marked as Enhancement"' -%}
{%- endif -%}
{%- if details.product in android_products -%}
{%- set product = 'android' -%}
{%- endif -%}
{%- if bug_list_karma[details.id].score > 8 -%}
{%- set pill_level ='text-bg-warning' -%}
{%- endif -%}
{%- if bug_list_karma[details.id].score > 15 -%}
{%- set alert_row ='fw-bold' -%}
{%- set pill_level ='text-bg-danger' -%}
{%- endif -%}
<tr class="small {{ alert_row }}">
<td class="{{ product }}"><a href="https://bugzilla.mozilla.org/{{ details.id }}" class="text-nowrap bug-link link-primary {{ alert_link }}" {{ alert_title|raw }}>{{ details.id }}</a></td>
<td><a href="https://bugzilla.mozilla.org/{{ details.id }}" class="bug-link link-dark {{ alert_link }}">{{ details.component }}</a></td>
<td class="text-center {{ alert_row }}">
<span class="badge rounded-pill {{ pill_level }} score-pill">{{ bug_list_karma[details.id].score }}</span>
<div class="card text-bg-primary mb-3 score-card">
<div class="card-body p-2">
<table class="table table-borderless table-sm">
{%- for key, score_detail in bug_list_karma[details.id].details -%}
{%- if score_detail != 0 -%}
<tr class="small text-light bg-primary">
<th class="text-start p-0 text-light bg-primary">{{ key }}</th>
<td class="text-end p-0 fw-normal text-light bg-primary">{{ score_detail }}</td>
</tr>
{%- endif -%}
{%- endfor -%}
</table>
</div>
</div>
</td>
<td><a href="https://bugzilla.mozilla.org/{{ details.id }}" class="bug-link link-dark {{ alert_link }}">{{ details.summary }}</a></td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
<!-- Less notable bugs -->
<table class="table table-light table-striped table-bordered table-sm mb-3 caption-top">
{% if outstanding_bugs[dataset.buildid].bugs %}
<caption class="table-dark text-center fw-bold">Other bugs</caption>
{% endif %}
<thead>
<tr class="table-dark">
<th>Bug</th>
<th>Component</th>
<th>Impact</th>
<th>Summary</th>
</tr>
</thead>
<tbody>
{%- for details in bug_list[dataset.buildid].bugs -%}
{%- set alert_link = '' -%}
{%- set alert_title = '' -%}
{%- set alert_row = '' -%}
{%- set product = '' -%}
{%- set pill_level = 'text-bg-light border' -%}
{%- if details.type == 'enhancement' -%}
{%- set alert_link =' text-success fw-bold' -%}
{%- set alert_title =' title="Bug marked as Enhancement"' -%}
{%- endif -%}
{%- if details.product in android_products -%}
{%- set product = 'android' -%}
{%- endif -%}
{%- if bug_list_karma[details.id].score > 8 -%}
{%- set pill_level ='text-bg-warning' -%}
{%- endif -%}
{%- if bug_list_karma[details.id].score > 15 -%}
{%- set alert_row ='fw-bold' -%}
{%- set pill_level ='text-bg-danger' -%}
{%- endif -%}
{% if details in outstanding_bugs[dataset.buildid].bugs %}
{# do nothing #}
{% else %}
<tr class="small {{ alert_row }}">
<td class="{{ product }}"><a href="https://bugzilla.mozilla.org/{{ details.id }}" class="text-nowrap bug-link link-primary {{ alert_link }}" {{ alert_title|raw }}>{{ details.id }}</a></td>
<td><a href="https://bugzilla.mozilla.org/{{ details.id }}" class="bug-link link-dark {{ alert_link }}">{{ details.component }}</a></td>
<td class="text-center {{ alert_row }}">
<span class="badge rounded-pill {{ pill_level }} score-pill">{{ bug_list_karma[details.id].score }}</span>
<div class="card text-bg-primary mb-3 score-card">
<div class="card-body p-2">
<table class="table table-borderless table-sm">
{%- for key, score_detail in bug_list_karma[details.id].details -%}
{%- if score_detail != 0 -%}
<tr class="small text-light bg-primary">
<th class="text-start p-0 text-light bg-primary">{{ key }}</th>
<td class="text-end p-0 fw-normal text-light bg-primary">{{ score_detail }}</td>
</tr>
{%- endif -%}
{%- endfor -%}
</table>
</div>
</div>
</td>
<td><a href="https://bugzilla.mozilla.org/{{ details.id }}" class="bug-link link-dark {{ alert_link }}">{{ details.summary }}</a></td>
</tr>
{%- endif -%}
{% endfor %}
</tbody>
</table>
</div>
<ol>
{%for sig in top_sigs[dataset.buildid] %}
{% if sig.term in known_top_crashes %}
{% set button, alert ='btn btn-info btn-sm', 'Known top crash' %}
{% elseif ((sig.count/build_crashes[dataset.buildid])*100)|number_format(2) > 10 %}
{% set button, alert = 'btn btn-danger btn-sm', 'Top crash' %}
{% else %}
{% set button, alert = '', '' %}
{% endif %}
{% if sig.term in crash_bugs|keys %}
{% set crash_bug_button, crash_bug_link = 'btn btn-success btn-sm', '<a class="text-light" href="https://bugzilla.mozilla.org/' ~ crash_bugs[sig.term] ~ '">' ~ crash_bugs[sig.term] ~ '</a>' %}
{% else %}
{% set crash_bug_button, crash_bug_link = '', '' %}
{% endif %}
{% if build_crashes[dataset.buildid] %}
<li class="mb-1">
<a href="https://crash-stats.mozilla.org/signature/?signature={{ sig.term }}" title="Go to Crash Stats"><img src="/assets/img/socorro.png" width="16" height="16" alt=""/></a> <a class="text-info" href="https://crash-stop-addon.herokuapp.com/sumup.html?s={{ sig.term }}">{{ sig.term }}</a> <b title="{{ sig.count }}">({{ ((sig.count/build_crashes[dataset.buildid])*100)|number_format(2) }}%)</b> <span class="{{ button }}">{{ alert }}</span> <span class="{{ crash_bug_button }}">{{ crash_bug_link|raw }}</span>
</li>
{% endif %}
{% endfor %}
</ol>
{% else %}
<p class="text-center mt-5">No Nightly build released yet today</p>
{% endfor %}
{% endblock %}
{% block footer %}
<footer></footer>
<script nonce="{{constant('NONCE')}}">
$(document).ready(function() {
$(document).on("click", "table thead tr th", function() {
var table = $(this).parents("table");
var rows = table.find("> tbody > tr").toArray().sort(TableComparer($(this).index()));
var header_direction = $(this).hasClass("sort-asc") ? "sort-desc" : "sort-asc";
if (header_direction == "sort-desc") {
rows = rows.reverse();
}
table.append(rows);
table.find("th").removeClass("sort-asc sort-desc");
$(this).addClass(header_direction);
});
});
function TableComparer(index) {
var value = function (row, index) {
return $(row).children("td").eq(index).children(":first-child").text();
};
return function(a, b) {
var val_a = value(a, index);
var val_b = value(b, index);
return ($.isNumeric(val_a) && $.isNumeric(val_b)) ? val_a - val_b : val_a.toString().localeCompare(val_b);
}
}
</script>
{% endblock %}