From 7cc91e6a0e84d9ff225318799a3abb28c4bee962 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Fri, 13 Nov 2020 01:46:54 +0100 Subject: [PATCH] Add filter to show only app/results that needs attention --- app/app.py | 2 +- app/models/appci.py | 4 +++ app/static/css/tartiflette.css | 2 +- app/templates/appci_branch.html | 46 +++++---------------------------- 4 files changed, 12 insertions(+), 42 deletions(-) diff --git a/app/app.py b/app/app.py index d279475..45dd892 100644 --- a/app/app.py +++ b/app/app.py @@ -55,7 +55,7 @@ def appci_branch(branch): app_results = sort_test_results(branch.most_recent_tests_per_app()) tests = AppCI.tests.copy() - if "Malformed path" in tests: + if "Malfurmed path" in tests: tests.remove("Malformed path") return render_template("appci_branch.html", tests=tests, diff --git a/app/models/appci.py b/app/models/appci.py index a2da1ed..4d01239 100644 --- a/app/models/appci.py +++ b/app/models/appci.py @@ -101,6 +101,10 @@ class AppCIResult(db.Model): def outdated(self): 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(): diff --git a/app/static/css/tartiflette.css b/app/static/css/tartiflette.css index 95c1606..602a1d0 100644 --- a/app/static/css/tartiflette.css +++ b/app/static/css/tartiflette.css @@ -11,7 +11,7 @@ a { color:#007bff; } .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; } th.ci-app-test-title diff --git a/app/templates/appci_branch.html b/app/templates/appci_branch.html index 9f96dea..04e7846 100644 --- a/app/templates/appci_branch.html +++ b/app/templates/appci_branch.html @@ -7,42 +7,7 @@
- -
- - - - - - - - - - - -
+
@@ -59,7 +24,7 @@ {% for result in app_results %} - +
{% if result.app.long_term_good_quality %} @@ -157,9 +122,10 @@ function toggle(e) { } function update_filters() { - var levelFilter = $("input[type='radio']:checked").attr("level"); - $(".resultline").show(); - if (levelFilter != "all") { $(".resultline[level!='"+levelFilter+"']").hide(); } + var onlyNeedAttention = $("#filter_onlyNeedAttention").hasClass("btn-primary"); + $(".resultline").hide(); + $(".ci-needs-attention").show(); + if (!onlyNeedAttention) { $(".resultline").show(); } }