Hide jobs with no failures

When filtering the uncategorized page by a time window, completely hide
jobs that have no uncategorized failures in said time window.

Hide entries in the menu that have no hits in the window as well.

This patch doesn't dynamically update any numbers to only show what is
visible in the window.

Also add debug info to web_server script.

Change-Id: I2fd792a1a202a70a3dedd20316b3c4fdd8fcdc6e
This commit is contained in:
Joe Gordon 2015-06-11 13:56:40 +03:00
parent f12c45046c
commit f5a0e015ae
2 changed files with 35 additions and 13 deletions

View File

@ -16,6 +16,10 @@
ev.preventDefault(); ev.preventDefault();
var generated = $('#generated-date').text(); var generated = $('#generated-date').text();
var gen_date = Date.parse(generated); var gen_date = Date.parse(generated);
$("div.job").each(function () {
$(this).show();
});
$( "li.log-link" ).each(function() { $( "li.log-link" ).each(function() {
if (! $( this ).hasClass("dated") ) { if (! $( this ).hasClass("dated") ) {
var timestamp = $( this ).text().substr(0,16); var timestamp = $( this ).text().substr(0,16);
@ -30,6 +34,21 @@
$( this ).show(); $( this ).show();
} }
}); });
$("div.job").each(function () {
var visible = $('ul li:visible', $(this)).size()
if (visible == 0) $(this).hide();
else $(this).show();
});
$("#menu li").each(function () {
var h = $("a", this).attr('href').substring(1);
if ($('a[name="' + h + '"]').closest("div").is(":visible")){
$(this).show();
}else{
$(this).hide();
}
});
} }
$(function() { $(function() {
@ -56,7 +75,7 @@
</div> </div>
<div class="menu"> <div class="menu" id="menu">
<a name="top"></a> <a name="top"></a>
{% for job in jobs %} {% for job in jobs %}
<li><a href="#{{job[0]}}">{{job[0]}} ({{job[1]}})</a></li> <li><a href="#{{job[0]}}">{{job[0]}} ({{job[1]}})</a></li>
@ -81,18 +100,20 @@ Overall Categorization Rate: {{ rate['overall'] }}%
<a id="10days" href="#">10 days</a>) <a id="10days" href="#">10 days</a>)
</p> </p>
{% for job in jobs %} {% for job in jobs %}
<a name="{{job[0]}}"></a> <div class="job">
<a href="#top"><i>back to top</i></a> <a name="{{job[0]}}"></a>
<h2>{{ job[0] }} : {{ job[1] }} Uncategorized Fails. {{rate[job[0]]}}% Classification Rate ({{total_job_failures[job[0]]}} Total Fails)</h2> <a href="#top"><i>back to top</i></a>
<ul> <h2>{{ job[0] }} : {{ job[1] }} Uncategorized Fails. {{rate[job[0]]}}% Classification Rate ({{total_job_failures[job[0]]}} Total Fails)</h2>
{% for url in urls[job[0]] %} <ul>
{% if url['crm114'] %} {% for url in urls[job[0]] %}
<li class="log-link">{{url['timestamp']}}: <a href="{{ url['log'] }}">{{ url['log'] }}</a> : <a href="{{ url['crm114'] }}">crm114</a></li> {% if url['crm114'] %}
{% else %} <li class="log-link">{{url['timestamp']}}: <a href="{{ url['log'] }}">{{ url['log'] }}</a> : <a href="{{ url['crm114'] }}">crm114</a></li>
<li class="log-link">{{url['timestamp']}}: <a href="{{ url['log'] }}">{{ url['log'] }}</a></li> {% else %}
{% endif %} <li class="log-link">{{url['timestamp']}}: <a href="{{ url['log'] }}">{{ url['log'] }}</a></li>
{% endfor %} {% endif %}
</ul> {% endfor %}
</ul>
</div>
{% endfor %} {% endfor %}
{% endblock %} {% endblock %}
</div> </div>

View File

@ -40,6 +40,7 @@ class ERHandler(BaseHTTPServer.BaseHTTPRequestHandler):
# if the file exists locally, we'll serve it up directly # if the file exists locally, we'll serve it up directly
fname = "web/share" + self.path fname = "web/share" + self.path
if os.path.isfile(fname): if os.path.isfile(fname):
print "found local file %s" % (fname)
self.send_response(200, "Success") self.send_response(200, "Success")
self.end_headers() self.end_headers()
with open(fname) as f: with open(fname) as f: