diff options
author | Michael Wood <michael.g.wood@intel.com> | 2015-09-28 21:45:24 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-09-29 14:11:37 +0100 |
commit | d98c771a9aa047a71a30b570aba544c043d05447 (patch) | |
tree | 2fdcddd23547a1a6cea72cb9ed7e576f4d8a5c5e /bitbake/lib/toaster/toastergui/static/js/customrecipe.js | |
parent | 37948cc5d0e9274a2ca0ec70a5b4788fa26e55e5 (diff) | |
download | poky-d98c771a9aa047a71a30b570aba544c043d05447.tar.gz |
bitbake: toaster: Add Image customisation frontend feature
Add the Image customisation front end feature to Toaster.
Caveat - This feature is currently in development and should not be
enabled by default.
(Bitbake rev: 543586462b66434741f47f2884b4ccdeda5397b5)
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/js/customrecipe.js')
-rw-r--r-- | bitbake/lib/toaster/toastergui/static/js/customrecipe.js | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/toastergui/static/js/customrecipe.js b/bitbake/lib/toaster/toastergui/static/js/customrecipe.js new file mode 100644 index 0000000000..4f6b304dd6 --- /dev/null +++ b/bitbake/lib/toaster/toastergui/static/js/customrecipe.js | |||
@@ -0,0 +1,50 @@ | |||
1 | "use strict"; | ||
2 | |||
3 | function customRecipePageInit(ctx) { | ||
4 | |||
5 | var urlParams = libtoaster.parseUrlParams(); | ||
6 | |||
7 | (function notificationRequest(){ | ||
8 | if (urlParams.hasOwnProperty('notify') && urlParams.notify === 'new'){ | ||
9 | $("#image-created-notification").show(); | ||
10 | } | ||
11 | })(); | ||
12 | |||
13 | $("#recipeselection").on('table-done', function(e, total, tableParams){ | ||
14 | /* Table is done so now setup the click handler for the package buttons */ | ||
15 | $(".add-rm-package-btn").click(function(e){ | ||
16 | e.preventDefault(); | ||
17 | addRemovePackage($(this), tableParams); | ||
18 | }); | ||
19 | }); | ||
20 | |||
21 | function addRemovePackage(pkgBtn, tableParams){ | ||
22 | var pkgBtnData = pkgBtn.data(); | ||
23 | var method; | ||
24 | var buttonToShow; | ||
25 | |||
26 | if (pkgBtnData.directive == 'add') { | ||
27 | method = 'PUT'; | ||
28 | buttonToShow = '#package-rm-btn-' + pkgBtnData.package; | ||
29 | } else if (pkgBtnData.directive == 'remove') { | ||
30 | method = 'DELETE'; | ||
31 | buttonToShow = '#package-add-btn-' + pkgBtnData.package; | ||
32 | } else { | ||
33 | throw("Unknown package directive: should be add or remove"); | ||
34 | } | ||
35 | |||
36 | $.ajax({ | ||
37 | type: method, | ||
38 | url: pkgBtnData.packageUrl, | ||
39 | headers: { 'X-CSRFToken' : $.cookie('csrftoken')}, | ||
40 | success: function(data){ | ||
41 | /* Invalidate the Add | Rm package table's current cache */ | ||
42 | tableParams.nocache = true; | ||
43 | $.get(ctx.tableApiUrl, tableParams); | ||
44 | /* Swap the buttons around */ | ||
45 | pkgBtn.hide(); | ||
46 | $(buttonToShow).show(); | ||
47 | } | ||
48 | }); | ||
49 | } | ||
50 | } | ||