Add filter to show only app/results that needs attention

This commit is contained in:
Alexandre Aubin 2020-11-13 01:46:54 +01:00
parent c1c8c5b927
commit 7cc91e6a0e
4 changed files with 12 additions and 42 deletions

View file

@ -55,7 +55,7 @@ def appci_branch(branch):
app_results = sort_test_results(branch.most_recent_tests_per_app()) app_results = sort_test_results(branch.most_recent_tests_per_app())
tests = AppCI.tests.copy() tests = AppCI.tests.copy()
if "Malformed path" in tests: if "Malfurmed path" in tests:
tests.remove("Malformed path") tests.remove("Malformed path")
return render_template("appci_branch.html", tests=tests, return render_template("appci_branch.html", tests=tests,

View file

@ -101,6 +101,10 @@ class AppCIResult(db.Model):
def outdated(self): def outdated(self):
return (datetime.datetime.now() - self.date).days > 30 return (datetime.datetime.now() - self.date).days > 30
@property
def needs_attention(self):
return self.outdated or self.level is None or self.app.public_level == "?" or (int(self.app.public_level) > self.level)
class AppCI(): class AppCI():

View file

@ -11,7 +11,7 @@
a { color:#007bff; } a { color:#007bff; }
.ci-app-table > thead, .ci-app-table > tbody { display: block; width: 100%;} .ci-app-table > thead, .ci-app-table > tbody { display: block; width: 100%;}
.ci-app-table { margin: 0 auto; margin-top: 100px; max-width: 1200px; overflow-x: visible; } .ci-app-table { margin: 0 auto; margin-top: 120px; max-width: 1200px; overflow-x: visible; }
.ci-app-table th, .ci-app-table td { display: block; border: none; padding; 0px;float: left; height:33px; width: 33px; margin: 5px; margin-top: -5px; } .ci-app-table th, .ci-app-table td { display: block; border: none; padding; 0px;float: left; height:33px; width: 33px; margin: 5px; margin-top: -5px; }
th.ci-app-test-title th.ci-app-test-title

View file

@ -7,42 +7,7 @@
<div class="row"> <div class="row">
<div class="mx-auto"> <div class="mx-auto">
<div style="text-align:center;"> <div style="text-align:center;">
<label for="level-all">Level : </label> <button id="filter_onlyNeedAttention" type="button" class="btn btn-light btn-sm" href="javascript:void(0)" onclick="toggle(this)">Show only app that needs attention</button>
<div class="btn-group btn-group-toggle" data-toggle="buttons">
<label class="btn btn-sm btn-light active">
<input type="radio" name="options" level="all" id="filter_level-all" autocomplete="off" checked> All
</label>
<label class="btn btn-sm btn-light">
<input type="radio" name="options" level="?" autocomplete="off"> ?
</label>
<label class="btn btn-sm btn-light">
<input type="radio" name="options" level="0" autocomplete="off"> 0
</label>
<label class="btn btn-sm btn-light">
<input type="radio" name="options" level="1" autocomplete="off"> 1
</label>
<label class="btn btn-sm btn-light">
<input type="radio" name="options" level="2" autocomplete="off"> 2
</label>
<label class="btn btn-sm btn-light">
<input type="radio" name="options" level="3" autocomplete="off"> 3
</label>
<label class="btn btn-sm btn-light">
<input type="radio" name="options" level="4" autocomplete="off"> 4
</label>
<label class="btn btn-sm btn-light">
<input type="radio" name="options" level="5" autocomplete="off"> 5
</label>
<label class="btn btn-sm btn-light">
<input type="radio" name="options" level="6" autocomplete="off"> 6
</label>
<label class="btn btn-sm btn-light">
<input type="radio" name="options" level="7" autocomplete="off"> 7
</label>
<label class="btn btn-sm btn-light">
<input type="radio" name="options" level="8" autocomplete="off"> 8
</label>
</div>
</div> </div>
<div> <div>
<table class="table table-responsive ci-app-table"> <table class="table table-responsive ci-app-table">
@ -59,7 +24,7 @@
</thead> </thead>
<tbody> <tbody>
{% for result in app_results %} {% for result in app_results %}
<tr app="{{ result.app.name }}" class="resultline" level="{{ result.level if result.level >= 0 else "?" }}" {% if result.outdated %}style="opacity: 0.8; background-color: #ddd;"{% endif %} > <tr app="{{ result.app.name }}" class="resultline {% if result.needs_attention %}ci-needs-attention{% endif %}" {% if result.outdated %}style="opacity: 0.8; background-color: #ddd;"{% endif %} >
<td class="ci-app-row-title"> <td class="ci-app-row-title">
{% if result.app.long_term_good_quality %} {% if result.app.long_term_good_quality %}
<span class="oi oi-star" title="Long-term good quality" aria-hidden="true" style="color: goldenrod;"></span> <span class="oi oi-star" title="Long-term good quality" aria-hidden="true" style="color: goldenrod;"></span>
@ -157,9 +122,10 @@ function toggle(e) {
} }
function update_filters() { function update_filters() {
var levelFilter = $("input[type='radio']:checked").attr("level"); var onlyNeedAttention = $("#filter_onlyNeedAttention").hasClass("btn-primary");
$(".resultline").show(); $(".resultline").hide();
if (levelFilter != "all") { $(".resultline[level!='"+levelFilter+"']").hide(); } $(".ci-needs-attention").show();
if (!onlyNeedAttention) { $(".resultline").show(); }
} }
</script> </script>