Merge lp:~gesha/linaro-android-frontend/hide-howtos into lp:linaro-android-frontend

Proposed by Georgy Redkozubov
Status: Merged
Approved by: Stevan Radaković
Approved revision: 316
Merged at revision: 315
Proposed branch: lp:~gesha/linaro-android-frontend/hide-howtos
Merge into: lp:linaro-android-frontend
Diff against target: 50 lines (+18/-1)
1 file modified
static/buildDetails.js (+18/-1)
To merge this branch: bzr merge lp:~gesha/linaro-android-frontend/hide-howtos
Reviewer Review Type Date Requested Status
Stevan Radaković Approve
Review via email: mp+171062@code.launchpad.net

Description of the change

This branch adds possibility to hide files from the Downloads list on the build details page.
Files to be hidden are described by patterns array. All files are checked during generation of the Downloads list against this patterns array and skipped if are found there.

To post a comment you must log in.
Revision history for this message
Stevan Radaković (stevanr) wrote :

Hey Georgy, great work.

One comment about the patternInName function though, IMO the description of this function should be more like patternInName(name, list) to increase its re-usability and also it's a good practice to reduce the references to global variables as much as possible (yes, even in JS:)

review: Needs Fixing
316. By Georgy Redkozubov

Made patternInName function reusable.

Revision history for this message
Georgy Redkozubov (gesha) wrote :

Thanks for comments. Fixed both.

Revision history for this message
Stevan Radaković (stevanr) wrote :

Thanks!
Approve +1.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'static/buildDetails.js'
2--- static/buildDetails.js 2013-02-19 14:48:32 +0000
3+++ static/buildDetails.js 2013-06-24 11:52:25 +0000
4@@ -33,6 +33,18 @@
5 }
6 var jobUrl = globalConfig.jenkinsURL + "/job/" + buildName;
7
8+ function patternInName (name, list) {
9+ // Check for patterns from 'list' in 'name'.
10+ // If found returns 'true' otherwise 'false'.
11+ for (var i = 0; i < list.length; i++) {
12+ if (name.indexOf(list[i])>=0)
13+ {
14+ return true;
15+ }
16+ }
17+ return false;
18+ }
19+
20 function receivedTestResultJSON (response, loadingNode) {
21 var columns = [
22 {label:"Name", formatter: function (o) {
23@@ -252,6 +264,7 @@
24 var downloadUrl = 'http://snapshots.linaro.org/android/' + rawBuildName + '/' + results.number.toString() + '/';
25 handleRenderedFiles('android/' + rawBuildName + '/' +
26 results.number.toString());
27+ var hiddenFilesPatterns = ['HOWTO_', 'BUILD-INFO', 'EULA', 'textile'];
28
29
30 Y.one('#all-output a').setAttribute('href', downloadUrl);
31@@ -286,7 +299,7 @@
32
33 for (var i = 0; i < manifest.length; i++)
34 {
35- if (!manifest[i].match(/\S/))
36+ if (!manifest[i].match(/\S/) || patternInName(manifest[i], hiddenFilesPatterns))
37 {
38 continue;
39 }
40@@ -302,6 +315,10 @@
41 var listNode = Y.Node.create('<ul/>');
42 for (var i = 0; i < results.artifacts.length; i++) {
43 var artifact = results.artifacts[i];
44+ if (patternInName(artifact, hiddenFilesPatterns))
45+ {
46+ continue;
47+ }
48 var itemNode = Y.Node.create('<li><a/></li>');
49 itemNode.one('a').setContent(artifact.displayPath);
50 // Strip static '/build/out' from relativePath

Subscribers

People subscribed via source and target branches