summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui/static/js
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/toaster/toastergui/static/js')
-rw-r--r--bitbake/lib/toaster/toastergui/static/js/recipedetails.js52
1 files changed, 52 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/toastergui/static/js/recipedetails.js b/bitbake/lib/toaster/toastergui/static/js/recipedetails.js
new file mode 100644
index 0000000000..2bfd0a4b2c
--- /dev/null
+++ b/bitbake/lib/toaster/toastergui/static/js/recipedetails.js
@@ -0,0 +1,52 @@
1"use strict";
2
3function recipeDetailsPageInit(ctx){
4
5 $(".customise-btn").click(function(e){
6 e.preventDefault();
7 var imgCustomModal = $("#new-custom-image-modal");
8
9 if (imgCustomModal.length === 0)
10 throw("Modal new-custom-image not found");
11
12 imgCustomModal.data('recipe', $(this).data('recipe'));
13 imgCustomModal.modal('show');
14 });
15
16 $("#add-layer-btn").click(function(){
17 var btn = $(this);
18
19 libtoaster.addRmLayer(ctx.recipe.layer_version,
20 true,
21 function (layersList){
22 var msg = libtoaster.makeLayerAddRmAlertMsg(ctx.recipe.layer_version,
23 layersList,
24 true);
25
26 libtoaster.showChangeNotification(msg);
27
28 var toShow = $("#customise-build-btns");
29
30 /* If we have no packages built yet also fade in the build packages
31 * hint message
32 */
33 if (ctx.recipe.totalPackages === 0){
34 toShow = toShow.add("#build-to-get-packages-msg");
35 }
36
37 $("#packages-alert").add(btn).fadeOut(function(){
38 toShow.fadeIn();
39 });
40 });
41 });
42
43 /* Trigger a build of your custom image */
44 $(".build-recipe-btn").click(function(){
45 libtoaster.startABuild(libtoaster.ctx.projectBuildsUrl,
46 libtoaster.ctx.projectId,
47 ctx.recipe.name,
48 function(){
49 window.location.replace(libtoaster.ctx.projectBuildsUrl);
50 });
51 });
52}