mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-19 12:49:01 +02:00

We were using uitablefilter.js to provide live filtering of table rows based upon a search field value, but it turns out this module really isn't necessary - we can accomplish the same thing using simple jQuery code. While we're at it, enable the search field on the layers list page to work in conjunction with with the drop-down layer type selection, fix pasting into the search field and refreshing with a search specified. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
269 lines
8.6 KiB
HTML
269 lines
8.6 KiB
HTML
{% extends "rrs/base_toplevel.html" %}
|
|
{% load i18n %}
|
|
{% load staticfiles %}
|
|
|
|
{% comment %}
|
|
|
|
rrs-web - maintainers page template
|
|
|
|
Copyright (C) 2015 Intel Corporation
|
|
Licensed under the MIT license, see COPYING.MIT for details
|
|
|
|
{% endcomment %}
|
|
|
|
{% block navs %}
|
|
{% endblock %}
|
|
|
|
<!--
|
|
{% block title_append %} - recipe maintainers - {{ maintplan_name }}{% endblock %}
|
|
-->
|
|
|
|
{% block content_inner %}
|
|
<nav class="navbar navbar-default navbar-table-controls">
|
|
<div class="container-fluid table-controls">
|
|
<ul class="nav navbar-nav">
|
|
<li class="dropdown">
|
|
<span class="badge navbar-badge" id="maintainer-count" style="margin-top:11px;"></span>
|
|
</li>
|
|
</ul>
|
|
<form id="form-search" class="pull-right navbar-form">
|
|
<div class="input-group">
|
|
<input type="text" class="form-control" placeholder="Search maintainers" id="filter">
|
|
<div class="input-group-btn">
|
|
<a class="btn btn-default" id="clear-search-btn" style="display:none">
|
|
<i class="glyphicon glyphicon-remove" aria-hidden="true"></i>
|
|
</a>
|
|
<button type="submit" value="Search" class="btn btn-default" id="btn-search">Search</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</nav>
|
|
|
|
<div id="no_maintainers_alert" class="alert alert-warning" style="display:none">
|
|
No maintainers found <a href="#" id="view-all-maintainers" style="margin-left:10px;">View all maintainers</a>
|
|
</div>
|
|
<table class="table table-bordered table-hover" id="statistics-table">
|
|
<thead>
|
|
<tr class="headerRow">
|
|
<th class="sorted">Maintainer</th>
|
|
<th class="text-muted">Assigned recipes</th>
|
|
<th class="text-muted">Up-to-date</th>
|
|
<th class="text-muted">Not updated</th>
|
|
<th class="text-muted">Can't be updated</th>
|
|
<th class="text-muted">Unknown</th>
|
|
<th class="text-muted">% done</th>
|
|
|
|
{% for i in intervals %}
|
|
{% if current_interval == forloop.counter0 %}
|
|
<th class="current-wk">
|
|
{% else %}
|
|
<th class="text-muted">
|
|
{% endif %}
|
|
{{ i }}
|
|
</th>
|
|
{% endfor %}
|
|
</tr>
|
|
</thead>
|
|
<tbody id="statistics-table-body">
|
|
{% for ml in maintainer_list %}
|
|
<tr>
|
|
<td>
|
|
{{ ml.name }}
|
|
</td>
|
|
<td>
|
|
<a class="rowData" href="{% url 'rrs_recipes' maintplan_name release_name milestone_name %}?maintainer_name={{ ml.name|urlencode }}">
|
|
{{ ml.recipes_all }}
|
|
</a>
|
|
</td>
|
|
<td>
|
|
<a class="rowData" href="{% url 'rrs_recipes' maintplan_name release_name milestone_name %}?upstream_status={{ "Up-to-date"|urlencode }}&maintainer_name={{ ml.name|urlencode }}">
|
|
{{ ml.recipes_up_to_date }}
|
|
</a>
|
|
</td>
|
|
<td>
|
|
<a class="rowData" href="{% url 'rrs_recipes' maintplan_name release_name milestone_name %}?upstream_status={{ "Not updated"|urlencode }}&maintainer_name={{ ml.name|urlencode }}">
|
|
{{ ml.recipes_not_updated }}
|
|
</a>
|
|
</td>
|
|
<td>
|
|
<a class="rowData" href="{% url 'rrs_recipes' maintplan_name release_name milestone_name %}?upstream_status={{ "Can't be updated"|urlencode }}&maintainer_name={{ ml.name|urlencode }}">
|
|
{{ ml.recipes_cant_be_updated }}
|
|
</a>
|
|
</td>
|
|
<td>
|
|
<a class="rowData" href="{% url 'rrs_recipes' maintplan_name release_name milestone_name %}?upstream_status={{ "Unknown"|urlencode }}&maintainer_name={{ ml.name|urlencode }}">
|
|
{{ ml.recipes_unknown }}
|
|
</a>
|
|
</td>
|
|
<td>{{ ml.percentage_done }}</td>
|
|
{% for number in ml.interval_statistics %}
|
|
{% if current_interval == forloop.counter0 %}
|
|
<td class="current-wk">
|
|
{% else %}
|
|
<td class="text-muted">
|
|
{% endif %}
|
|
{{ number }}
|
|
</td>
|
|
{% endfor %}
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
<tfoot id="statistics-table-foot">
|
|
<tr class="totalRow">
|
|
<td id="totalCell">Total</td>
|
|
<td>
|
|
<a id="totalAssigned" class="totalCol" href="{% url 'rrs_recipes' maintplan_name release_name milestone_name %}">
|
|
</a>
|
|
</td>
|
|
<td>
|
|
<a id="totalUptoDate" class="totalCol" href="{% url 'rrs_recipes' maintplan_name release_name milestone_name %}?upstream_status={{ "Up-to-date"|urlencode }}">
|
|
</a>
|
|
</td>
|
|
<td>
|
|
<a class="totalCol" href="{% url 'rrs_recipes' maintplan_name release_name milestone_name %}?upstream_status={{ "Not updated"|urlencode }}">
|
|
</a>
|
|
</td>
|
|
<td>
|
|
<a class="totalCol" href="{% url 'rrs_recipes' maintplan_name release_name milestone_name %}?upstream_status={{ "Can't be updated"|urlencode }}">
|
|
</a>
|
|
</td>
|
|
<td>
|
|
<a class="totalCol" href="{% url 'rrs_recipes' maintplan_name release_name milestone_name %}?upstream_status={{ "Unknown"|urlencode }}">
|
|
</a>
|
|
</td>
|
|
<td id="totalPercentage"></td>
|
|
{% for i in intervals %}
|
|
{% if current_interval == forloop.counter0 %}
|
|
<td class="current-wk">
|
|
{% else %}
|
|
<td class="totalCol">
|
|
{% endif %}
|
|
{{ i }}
|
|
</td>
|
|
{% endfor %}
|
|
</tr>
|
|
</tfoot>
|
|
</table>
|
|
<style>
|
|
th.header {
|
|
background-image: url({{ STATIC_URL }}/img/small.gif);
|
|
cursor: pointer;
|
|
font-weight: bold;
|
|
background-repeat: no-repeat;
|
|
background-position: center left;
|
|
padding-left: 20px;
|
|
border-right: 1px solid #dad9c7;
|
|
margin-left: -1px;
|
|
}
|
|
th.headerSortUp {
|
|
background-image: url({{ STATIC_URL }}/img/small_asc.gif);
|
|
}
|
|
th.headerSortDown {
|
|
background-image: url({{ STATIC_URL }}/img/small_desc.gif);
|
|
}
|
|
</style>
|
|
{% endblock %}
|
|
|
|
{% block scripts %}
|
|
<script src="{% static "js/jquery.tablesorter.js" %}"></script>
|
|
<script>
|
|
$(document).ready(function() {
|
|
var totals = []
|
|
$("#statistics-table th").each(function(i){
|
|
totals.push(0);
|
|
});
|
|
|
|
function updateMaintainerCount() {
|
|
$('#statistics-table').show()
|
|
$('#no_maintainers_alert').hide()
|
|
|
|
count = -1
|
|
$('tr:visible').each(function() {
|
|
count++
|
|
});
|
|
|
|
if (count == 1) {
|
|
$('#statistics-table').hide()
|
|
$('#no_maintainers_alert').show()
|
|
}
|
|
|
|
if (count == 2) {
|
|
$('#maintainer-count').html("1 maintainer");
|
|
} else {
|
|
$('#maintainer-count').html((count - 1) + " maintainers")
|
|
}
|
|
updateTotals()
|
|
}
|
|
|
|
$("#form-search").submit(function( event ) {
|
|
search_text = $("#filter").val().toLowerCase();
|
|
$("#statistics-table > tbody > tr").filter(function() {
|
|
$(this).toggle($(this).text().toLowerCase().indexOf(search_text) > -1)
|
|
});
|
|
updateMaintainerCount()
|
|
$("#clear-search-btn").show()
|
|
event.preventDefault();
|
|
});
|
|
|
|
function clearSearch() {
|
|
$("#filter").val('');
|
|
$("#statistics-table > tbody > tr").show();
|
|
$("#clear-search-btn").hide()
|
|
updateMaintainerCount()
|
|
}
|
|
|
|
$("#view-all-maintainers").click(function() {
|
|
clearSearch()
|
|
});
|
|
|
|
$("#clear-search-btn").click(function() {
|
|
clearSearch()
|
|
});
|
|
|
|
function updateTotals() {
|
|
for (count=0; count<totals.length; count++) {
|
|
totals[count]=0
|
|
}
|
|
var $dataRows=$("#statistics-table-body tr:visible")
|
|
$dataRows.each(function() {
|
|
$(this).find('.rowData, .current-wk, .text-muted').each(function(i){
|
|
if ($(this).html().trim() != '') {
|
|
totals[i] += parseInt($(this).html())
|
|
}
|
|
})
|
|
})
|
|
|
|
var $totalRow=$("#statistics-table-foot tr.totalRow")
|
|
$totalRow.find('.totalCol, .current-wk').each(function(i) {
|
|
$(this).html(totals[i]);
|
|
})
|
|
|
|
tempInt1 = parseInt($("#totalUptoDate").html())
|
|
tempInt2 = parseInt($("#totalAssigned").html())
|
|
tempInt1 = ((tempInt1/tempInt2).toFixed(2))*100
|
|
$("#totalPercentage").html(tempInt1 +'%')
|
|
}
|
|
|
|
{% if maintainer_count > 0 %}
|
|
$(statisticsTable).tablesorter({
|
|
sortList: [[0,0]],
|
|
headers: {
|
|
1: { sorter: false },
|
|
2: { sorter: false },
|
|
3: { sorter: false },
|
|
4: { sorter: false },
|
|
5: { sorter: false },
|
|
6: { sorter: false },
|
|
{% for i in interval_range %}
|
|
{{ i|add:"7" }}: { sorter: false },
|
|
{% endfor %}
|
|
}
|
|
});
|
|
{% endif %}
|
|
|
|
updateMaintainerCount()
|
|
});
|
|
</script>
|
|
{% endblock %}
|