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
=== modified file 'static/buildDetails.js'
--- static/buildDetails.js 2013-02-19 14:48:32 +0000
+++ static/buildDetails.js 2013-06-24 11:52:25 +0000
@@ -33,6 +33,18 @@
33 }33 }
34 var jobUrl = globalConfig.jenkinsURL + "/job/" + buildName;34 var jobUrl = globalConfig.jenkinsURL + "/job/" + buildName;
3535
36 function patternInName (name, list) {
37 // Check for patterns from 'list' in 'name'.
38 // If found returns 'true' otherwise 'false'.
39 for (var i = 0; i < list.length; i++) {
40 if (name.indexOf(list[i])>=0)
41 {
42 return true;
43 }
44 }
45 return false;
46 }
47
36 function receivedTestResultJSON (response, loadingNode) {48 function receivedTestResultJSON (response, loadingNode) {
37 var columns = [49 var columns = [
38 {label:"Name", formatter: function (o) {50 {label:"Name", formatter: function (o) {
@@ -252,6 +264,7 @@
252 var downloadUrl = 'http://snapshots.linaro.org/android/' + rawBuildName + '/' + results.number.toString() + '/';264 var downloadUrl = 'http://snapshots.linaro.org/android/' + rawBuildName + '/' + results.number.toString() + '/';
253 handleRenderedFiles('android/' + rawBuildName + '/' +265 handleRenderedFiles('android/' + rawBuildName + '/' +
254 results.number.toString());266 results.number.toString());
267 var hiddenFilesPatterns = ['HOWTO_', 'BUILD-INFO', 'EULA', 'textile'];
255268
256269
257 Y.one('#all-output a').setAttribute('href', downloadUrl);270 Y.one('#all-output a').setAttribute('href', downloadUrl);
@@ -286,7 +299,7 @@
286299
287 for (var i = 0; i < manifest.length; i++)300 for (var i = 0; i < manifest.length; i++)
288 {301 {
289 if (!manifest[i].match(/\S/))302 if (!manifest[i].match(/\S/) || patternInName(manifest[i], hiddenFilesPatterns))
290 {303 {
291 continue;304 continue;
292 }305 }
@@ -302,6 +315,10 @@
302 var listNode = Y.Node.create('<ul/>');315 var listNode = Y.Node.create('<ul/>');
303 for (var i = 0; i < results.artifacts.length; i++) {316 for (var i = 0; i < results.artifacts.length; i++) {
304 var artifact = results.artifacts[i];317 var artifact = results.artifacts[i];
318 if (patternInName(artifact, hiddenFilesPatterns))
319 {
320 continue;
321 }
305 var itemNode = Y.Node.create('<li><a/></li>');322 var itemNode = Y.Node.create('<li><a/></li>');
306 itemNode.one('a').setContent(artifact.displayPath);323 itemNode.one('a').setContent(artifact.displayPath);
307 // Strip static '/build/out' from relativePath324 // Strip static '/build/out' from relativePath

Subscribers

People subscribed via source and target branches