Merge lp:~stevanr/linaro-android-frontend/bug-1071153 into lp:linaro-android-frontend

Proposed by Stevan Radaković
Status: Merged
Approved by: Georgy Redkozubov
Approved revision: 288
Merged at revision: 289
Proposed branch: lp:~stevanr/linaro-android-frontend/bug-1071153
Merge into: lp:linaro-android-frontend
Diff against target: 136 lines (+45/-32)
4 files modified
android_build/frontend/api.py (+28/-0)
android_build/settings.py (+2/-0)
android_build/urls.py (+1/-0)
static/buildDetails.js (+14/-32)
To merge this branch: bzr merge lp:~stevanr/linaro-android-frontend/bug-1071153
Reviewer Review Type Date Requested Status
Georgy Redkozubov Approve
Linaro Infrastructure Pending
Review via email: mp+131415@code.launchpad.net

Description of the change

Use snapshots API call instead of checking each file individually and using JS textile.

To post a comment you must log in.
Revision history for this message
Georgy Redkozubov (gesha) wrote :

Good to go

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'android_build/frontend/api.py'
--- android_build/frontend/api.py 2012-10-19 14:18:11 +0000
+++ android_build/frontend/api.py 2012-10-25 13:59:23 +0000
@@ -313,6 +313,34 @@
313 else:313 else:
314 return HttpResponse(response.read())314 return HttpResponse(response.read())
315315
316def get_textile_files_request(request):
317 """Give Web UI a proxy to fetch remote textile file data from snapshots."""
318
319 path = ""
320 for thing in request.GET.getlist("path"):
321 path = thing
322
323 requested_view = 'get-textile-files'
324 url = settings.SNAPSHOTS_URL + requested_view + '?path=' + path
325
326 try:
327 response = urllib2.urlopen(url)
328 except urllib2.HTTPError, e:
329 message = "Server error: %d" % e.code
330 resp = HttpResponse(message)
331 resp.status_code = e.code
332 return resp
333 except urllib2.URLError, e:
334 message = "We failed to reach a server."
335
336 if isinstance(e.reason, str):
337 message += " Reason %s" % e.reason
338
339 return HttpResponse(message)
340 else:
341 return HttpResponse(response.read())
342
343
316def test_remote_dir_exists(request):344def test_remote_dir_exists(request):
317 """Give Web UI the ability to test where a build is stored.345 """Give Web UI the ability to test where a build is stored.
318346
319347
=== modified file 'android_build/settings.py'
--- android_build/settings.py 2012-10-19 14:00:38 +0000
+++ android_build/settings.py 2012-10-25 13:59:23 +0000
@@ -106,3 +106,5 @@
106}106}
107107
108USE_OWN_COMBO=False108USE_OWN_COMBO=False
109
110SNAPSHOTS_URL = "https://snapshots.linaro.org/"
109111
=== modified file 'android_build/urls.py'
--- android_build/urls.py 2012-10-19 14:00:38 +0000
+++ android_build/urls.py 2012-10-25 13:59:23 +0000
@@ -28,6 +28,7 @@
28 (r'^api/new$', 'android_build.frontend.api.new'),28 (r'^api/new$', 'android_build.frontend.api.new'),
29 (r'^api/set-daily$', 'android_build.frontend.api.set_daily'),29 (r'^api/set-daily$', 'android_build.frontend.api.set_daily'),
30 (r'^api/proxy-remote-file$', 'android_build.frontend.api.proxy_remote_file'),30 (r'^api/proxy-remote-file$', 'android_build.frontend.api.proxy_remote_file'),
31 (r'^api/get-textile-files-request$', 'android_build.frontend.api.get_textile_files_request'),
31 (r'^api/test-dir-exists$', 'android_build.frontend.api.test_remote_dir_exists'),32 (r'^api/test-dir-exists$', 'android_build.frontend.api.test_remote_dir_exists'),
3233
33 (r'^openid/', include('django_openid_auth.urls')),34 (r'^openid/', include('django_openid_auth.urls')),
3435
=== modified file 'static/buildDetails.js'
--- static/buildDetails.js 2012-10-24 11:59:25 +0000
+++ static/buildDetails.js 2012-10-25 13:59:23 +0000
@@ -22,23 +22,6 @@
22 var buildNumber = history.get('build');22 var buildNumber = history.get('build');
23 var fetchLatest = (buildNumber === undefined);23 var fetchLatest = (buildNumber === undefined);
2424
25 var howto_paths = [
26 "HOWTO_releasenotes.txt",
27 "HOWTO_install.txt",
28 "HOWTO_getsourceandbuild.txt",
29 "HOWTO_flashfirmware.txt",
30 "HOWTO_rtsm.txt"]
31
32 // Mapping for howto_paths tab titles
33 var howto_titles = [
34 "Release Notes",
35 "Binary Image Installation",
36 "Building From Source",
37 "Firmware Update",
38 "RTSM"]
39
40
41
4225
43 var jobData = 'actions[parameters[name,value]],timestamp,duration,artifacts[displayPath,fileName,relativePath],result,number';26 var jobData = 'actions[parameters[name,value]],timestamp,duration,artifacts[displayPath,fileName,relativePath],result,number';
4427
@@ -258,7 +241,8 @@
258 to where new builds should be.241 to where new builds should be.
259 */242 */
260 var downloadUrl = 'http://snapshots.linaro.org/android/' + rawBuildName + '/' + results.number.toString() + '/';243 var downloadUrl = 'http://snapshots.linaro.org/android/' + rawBuildName + '/' + results.number.toString() + '/';
261 handleRenderedFiles(downloadUrl);244 handleRenderedFiles('android/' + rawBuildName + '/' +
245 results.number.toString());
262246
263247
264 Y.one('#all-output a').setAttribute('href', downloadUrl);248 Y.one('#all-output a').setAttribute('href', downloadUrl);
@@ -422,25 +406,23 @@
422406
423 refreshFromScratch();407 refreshFromScratch();
424408
425 function handleRenderedFiles(downloadUrl) {409 function handleRenderedFiles(pathUrl) {
426410
427 var rendered_files = new Object();411 var rendered_files = new Object();
428 var howto_index = 0;412 var howto_index = 0;
429413
430 for (var howto_index in howto_paths) {414 $.ajax({
431 $.ajax({415 url: '/api/get-textile-files-request?path=' + pathUrl,
432 url: '/api/proxy-remote-file?url=' + downloadUrl +416 success: function(data) {
433 howto_paths[howto_index],417 if (data != 'null') {
434 success: function(data) {418 data = $.parseJSON(data);
435 if (data != 'Invalid argument') {419 for (var key in data) {
436 rendered_files[howto_titles[howto_index]] =420 rendered_files[key] = data[key];
437 convert_textile(data);
438 }421 }
439 howto_index++;422 }
440 },423 },
441 async: false,424 async: false,
442 });425 });
443 }
444426
445 refresh_tabs(rendered_files);427 refresh_tabs(rendered_files);
446 }428 }

Subscribers

People subscribed via source and target branches