diff options
author | Michael Wood <michael.g.wood@intel.com> | 2015-11-04 15:37:19 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-02-10 13:29:17 +0000 |
commit | 2a3dd32d669f4d114fe9c978c9fc1269c2566b8a (patch) | |
tree | 0ed51b92443a32d7a399ce322cdf3293cc544c0a /bitbake/lib/toaster/toastergui/static | |
parent | d6e7e4ad43471fdaa1b6184bd13c91069478839e (diff) | |
download | poky-2a3dd32d669f4d114fe9c978c9fc1269c2566b8a.tar.gz |
bitbake: toaster: Continue front end features to custom image recipe page.
Continuation of the work on the custom image recipe page, this brings
in:
- Basic notification of having added/removed a package.
- Connect up Build button
- Download recipe feature
- No packages states
- Project bread crumb
- Display additional recipe metadata
- Update accessors for recipe object inheritance changes
[YOCTO #8082]
(Bitbake rev: a656756a9255ec5882686ce9563d17f2eb3136e3)
Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: brian avery <avery.brian@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastergui/static')
-rw-r--r-- | bitbake/lib/toaster/toastergui/static/js/customrecipe.js | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/bitbake/lib/toaster/toastergui/static/js/customrecipe.js b/bitbake/lib/toaster/toastergui/static/js/customrecipe.js index 4f6b304dd6..4cd9382b49 100644 --- a/bitbake/lib/toaster/toastergui/static/js/customrecipe.js +++ b/bitbake/lib/toaster/toastergui/static/js/customrecipe.js | |||
@@ -3,6 +3,7 @@ | |||
3 | function customRecipePageInit(ctx) { | 3 | function customRecipePageInit(ctx) { |
4 | 4 | ||
5 | var urlParams = libtoaster.parseUrlParams(); | 5 | var urlParams = libtoaster.parseUrlParams(); |
6 | var customiseTable = $("#selectpackagestable"); | ||
6 | 7 | ||
7 | (function notificationRequest(){ | 8 | (function notificationRequest(){ |
8 | if (urlParams.hasOwnProperty('notify') && urlParams.notify === 'new'){ | 9 | if (urlParams.hasOwnProperty('notify') && urlParams.notify === 'new'){ |
@@ -10,7 +11,7 @@ function customRecipePageInit(ctx) { | |||
10 | } | 11 | } |
11 | })(); | 12 | })(); |
12 | 13 | ||
13 | $("#recipeselection").on('table-done', function(e, total, tableParams){ | 14 | customiseTable.on('table-done', function(e, total, tableParams){ |
14 | /* Table is done so now setup the click handler for the package buttons */ | 15 | /* Table is done so now setup the click handler for the package buttons */ |
15 | $(".add-rm-package-btn").click(function(e){ | 16 | $(".add-rm-package-btn").click(function(e){ |
16 | e.preventDefault(); | 17 | e.preventDefault(); |
@@ -21,30 +22,45 @@ function customRecipePageInit(ctx) { | |||
21 | function addRemovePackage(pkgBtn, tableParams){ | 22 | function addRemovePackage(pkgBtn, tableParams){ |
22 | var pkgBtnData = pkgBtn.data(); | 23 | var pkgBtnData = pkgBtn.data(); |
23 | var method; | 24 | var method; |
24 | var buttonToShow; | 25 | var msg = "You have "; |
25 | 26 | ||
26 | if (pkgBtnData.directive == 'add') { | 27 | if (pkgBtnData.directive == 'add') { |
27 | method = 'PUT'; | 28 | method = 'PUT'; |
28 | buttonToShow = '#package-rm-btn-' + pkgBtnData.package; | 29 | msg += "added 1 package to "+ctx.recipe.name+":"; |
29 | } else if (pkgBtnData.directive == 'remove') { | 30 | } else if (pkgBtnData.directive == 'remove') { |
30 | method = 'DELETE'; | 31 | method = 'DELETE'; |
31 | buttonToShow = '#package-add-btn-' + pkgBtnData.package; | 32 | msg += "removed 1 package from "+ctx.recipe.name+":"; |
32 | } else { | 33 | } else { |
33 | throw("Unknown package directive: should be add or remove"); | 34 | throw("Unknown package directive: should be add or remove"); |
34 | } | 35 | } |
35 | 36 | ||
37 | msg += ' <strong>' + pkgBtnData.name + '<strong>'; | ||
38 | |||
36 | $.ajax({ | 39 | $.ajax({ |
37 | type: method, | 40 | type: method, |
38 | url: pkgBtnData.packageUrl, | 41 | url: pkgBtnData.packageUrl, |
39 | headers: { 'X-CSRFToken' : $.cookie('csrftoken')}, | 42 | headers: { 'X-CSRFToken' : $.cookie('csrftoken')}, |
40 | success: function(data){ | 43 | success: function(data){ |
41 | /* Invalidate the Add | Rm package table's current cache */ | 44 | if (data.error !== 'ok'){ |
45 | console.warn(data.error); | ||
46 | return; | ||
47 | } | ||
48 | /* Reload and Invalidate the Add | Rm package table's current data */ | ||
42 | tableParams.nocache = true; | 49 | tableParams.nocache = true; |
43 | $.get(ctx.tableApiUrl, tableParams); | 50 | customiseTable.trigger('reload', [tableParams]); |
44 | /* Swap the buttons around */ | 51 | |
45 | pkgBtn.hide(); | 52 | libtoaster.showChangeNotification(msg); |
46 | $(buttonToShow).show(); | ||
47 | } | 53 | } |
48 | }); | 54 | }); |
49 | } | 55 | } |
56 | |||
57 | /* Trigger a build of your custom image */ | ||
58 | $(".build-custom-image").click(function(){ | ||
59 | libtoaster.startABuild(libtoaster.ctx.projectBuildsUrl, | ||
60 | libtoaster.ctx.projectId, | ||
61 | ctx.recipe.name, | ||
62 | function(){ | ||
63 | window.location.replace(libtoaster.ctx.projectBuildsUrl); | ||
64 | }); | ||
65 | }); | ||
50 | } | 66 | } |