Merge ~ovidiu-florin/ka:master into ka:master

Proposed by Ovidiu-Florin BOGDAN on 2017-02-26
Status: Merged
Merge reported by: Ovidiu-Florin BOGDAN
Merged at revision: not available
Proposed branch: ~ovidiu-florin/ka:master
Merge into: ka:master
Diff against target: 79 lines (+53/-1)
1 file modified
ppa-build-status (+53/-1)
Reviewer Review Type Date Requested Status
Jose Manuel Santamaria Lema 2017-02-26 Approve on 2017-03-02
Review via email: mp+318326@code.launchpad.net

Commit Message

Added filter based on build status

Description of the Change

Added filter based on build status

To post a comment you must log in.

Hi,

I have tested the patch against applications in staging, and checked the resulting htm using various web browsers from *yakkety*. Just FYI
* It works:
  - with firefox
  - with chromium
* It doesn't work:
  - with konqueror using the KHTML engine
  - with konqueror using the QtWebkit engine
  - with rekonq (uses QtWebkit)

Nitpicking: wrt to user friendliness, I was expecting that checking the "Error" checkbox would display only the packages in "Error" status, however it works the other way around: clicking the checkboxes hides packages from the list. I guess what is tricking me is the meaning of the word "filter". So as a humble suggestion ¿what about changing the thing to...
"Show only packages in these states: <checkboxes>"
so clicking on the textboxes would show only the packages in the selected states?
Keep in mind that we could also add a filter for package name:
"Package name contains: <textbox> <button to click and show only the package in question>"
so the select_what_you_want_to_see logic makes more sense to me than the select_what_you_want_to_hide logic. Note that this logic (and meaning of the word 'filter') is the current logic used for the LP's web interface, see:
https://launchpad.net/~kubuntu-ppa/+archive/ubuntu/staging-frameworks/+packages

The idea of showing only the interesting packages looks very good to me, so thank you for working on this :)

Cheers.

FYI, this patch uses HTML5.

FYI, this patch uses HTML5.

Hi,

I have retried with your latest changes and seems to work fine after a quick test with chromium and firefox. Still doesn't work with my yakkety's konqueror, however, what you are proposing looks already better than what we have right now (even if it doesn't work on all possible browsers), so I would mark this as "Approved".

Also note that I have reviewed this from a user point of view. Unfortunately, I don't know enough about JavaScript/HTML to have a great opinion about the code itself, but I hope it's ok.

review: Approve

P.S. I have here a "demo" of a webpage generated by the code proposed in this merge request:

http://gpul.grupos.udc.es/things/ovi_filter_demo/staging_apps_16.12.2.html

Rik Mills (rikmills) wrote :

From checking the 'demo', that seems to be working nicely in Firefox

Clive Johnston (clivejo) wrote :

Looks good on mobile browser, I'd like to see this MR accepted and working
on weegie.

On 2 Mar 2017 17:33, "Rik Mills" <email address hidden> wrote:

> >From checking the 'demo', that seems to be working nicely in Firefox
> --
> https://code.launchpad.net/~ovidiu-florin/ka/+git/ka/+merge/318326
> Your team Kubuntu Packagers is subscribed to branch ka:master.
>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/ppa-build-status b/ppa-build-status
2index 7827877..e177458 100755
3--- a/ppa-build-status
4+++ b/ppa-build-status
5@@ -323,6 +323,45 @@ print("""
6
7 return false;
8 }
9+
10+ function filterList() {
11+ filterStatus("status0");
12+ filterStatus("status1");
13+ filterStatus("status2");
14+ filterStatus("status-2");
15+
16+ var filterText = document.getElementById("filterText").value;
17+
18+ var allElements = document.querySelectorAll(".pkname");
19+ var elements = []
20+
21+ allElements.forEach(function(item, index) {
22+ if (item.parentNode.parentNode.style.display == "")
23+ elements.push(item)
24+ });
25+
26+ elements.forEach(function(item, index) {
27+ var packageName = item.textContent.split(" - ")[0];
28+
29+ var display = "none";
30+ if (packageName.includes(filterText) || filterText.length == 0)
31+ display = "";
32+
33+ item.parentNode.parentNode.style.display = display;
34+ });
35+ }
36+
37+ function filterStatus(status) {
38+ var elements = document.querySelectorAll("." + status);
39+
40+ var display = "none";
41+ if (document.getElementById("ck-" + status).checked)
42+ display = "";
43+
44+ elements.forEach(function(item, index) {
45+ item.parentNode.style.display = display;
46+ });
47+ }
48 //-->
49 </script>
50
51@@ -332,6 +371,19 @@ print("""
52
53 <h1 id="top">Kubuntu %s %s -> %s status [<a href="https://launchpad.net/~%s/+archive/%s/+packages?field.series_filter=%s">%s</a>]</h1>
54 """ % (releaseString, releaseString, version, release, ppaParts[0], ppaParts[1], release, args.ppa))
55+
56+print("""
57+ <table>
58+ <tr>
59+ <td><input type="text" id="filterText" placeholder="Package Name" oninput="filterList()"/></td>
60+ <td><input type="checkbox" id="ck-status0" onchange="filterList()" checked /> OK</td>
61+ <td><input type="checkbox" id="ck-status1" onchange="filterList()" checked /> Warning</td>
62+ <td><input type="checkbox" id="ck-status2" onchange="filterList()" checked /> Error</td>
63+ <td><input type="checkbox" id="ck-status-2" onchange="filterList()" checked /> Dependency wait</td>
64+ </tr>
65+ </table>
66+""")
67+
68 print("<br/><div>Last updated on %s (UTC)</div>\n" % datetime.datetime.utcnow().strftime("%Y-%m-%d %H:%M"))
69 print("""
70 <table class="grid">
71@@ -495,7 +547,7 @@ for package in sorted(builds.keys()):
72 if len(message) > 150 and build["status"] != STATUS_WAITING:
73 message = '<a href="#" onclick="return toggleVisibility(\'msg-%d\')">show/hide</a><div id="msg-%d" style="display:none;">%s</div>' % (i, i, message)
74
75- print('<tr class="%s"><td class="status%d"><span title="%s">%s - %s</span></td><td><a href="%s">%s</a></td>' % (trclass, build["status"], cgi.escape(build["version"]), package, cgi.escape(build["version"]), build["weblink"], arch))
76+ print('<tr class="%s"><td class="status%d"><span class="pkname" title="%s">%s - %s</span></td><td><a href="%s">%s</a></td>' % (trclass, build["status"], cgi.escape(build["version"]), package, cgi.escape(build["version"]), build["weblink"], arch))
77 if build["logfile"]:
78 print('<td><a href="%s">logfile</a></td>' % (build["logfile"],))
79 else:

Subscribers

People subscribed via source and target branches