diff options
author | Michael Wood <michael.g.wood@intel.com> | 2016-09-26 13:59:36 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-09-30 16:52:22 +0100 |
commit | ac5aba6cab06f3a8655eea1e368d28eb1025407e (patch) | |
tree | 021d4a1d5c18ff1ae61b06a9a91f81724d955691 /bitbake | |
parent | 5b23bf083b7adcd7884d58aaf26f23102e6e3f5a (diff) | |
download | poky-ac5aba6cab06f3a8655eea1e368d28eb1025407e.tar.gz |
bitbake: toaster: customrecipe Add frontend feature to delete custom image recipe
[YOCTO #8132]
(Bitbake rev: 19aee3dd7fa290e12216f9a5cf25a8b2c8d80d20)
Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/toaster/toastergui/static/js/customrecipe.js | 32 | ||||
-rw-r--r-- | bitbake/lib/toaster/toastergui/templates/customrecipe.html | 35 |
2 files changed, 63 insertions, 4 deletions
diff --git a/bitbake/lib/toaster/toastergui/static/js/customrecipe.js b/bitbake/lib/toaster/toastergui/static/js/customrecipe.js index 505a81ce60..9ea9602881 100644 --- a/bitbake/lib/toaster/toastergui/static/js/customrecipe.js +++ b/bitbake/lib/toaster/toastergui/static/js/customrecipe.js | |||
@@ -281,4 +281,36 @@ function customRecipePageInit(ctx) { | |||
281 | window.location.replace(libtoaster.ctx.projectBuildsUrl); | 281 | window.location.replace(libtoaster.ctx.projectBuildsUrl); |
282 | }); | 282 | }); |
283 | }); | 283 | }); |
284 | |||
285 | $("#delete-custom-recipe-confirmed").click(function(e){ | ||
286 | e.preventDefault(); | ||
287 | libtoaster.disableAjaxLoadingTimer(); | ||
288 | $(this).find('[data-role="submit-state"]').hide(); | ||
289 | $(this).find('[data-role="loading-state"]').show(); | ||
290 | $(this).attr("disabled", "disabled"); | ||
291 | |||
292 | $.ajax({ | ||
293 | type: 'DELETE', | ||
294 | url: ctx.recipe.xhrCustomRecipeUrl, | ||
295 | headers: { 'X-CSRFToken' : $.cookie('csrftoken')}, | ||
296 | success: function (data) { | ||
297 | if (data.error !== "ok") { | ||
298 | console.warn(data.error); | ||
299 | } else { | ||
300 | var msg = $('<span>You have deleted <strong>1</strong> custom image: <strong id="deleted-custom-image-name"></strong></span>'); | ||
301 | msg.find("#deleted-custom-image-name").text(ctx.recipe.name); | ||
302 | |||
303 | libtoaster.setNotification("custom-image-recipe-deleted", | ||
304 | msg.html()); | ||
305 | |||
306 | window.location.replace(data.gotoUrl); | ||
307 | } | ||
308 | }, | ||
309 | error: function (data) { | ||
310 | console.warn(data); | ||
311 | } | ||
312 | }); | ||
313 | }); | ||
314 | |||
315 | |||
284 | } | 316 | } |
diff --git a/bitbake/lib/toaster/toastergui/templates/customrecipe.html b/bitbake/lib/toaster/toastergui/templates/customrecipe.html index 8b61fb7f7c..945fc97977 100644 --- a/bitbake/lib/toaster/toastergui/templates/customrecipe.html +++ b/bitbake/lib/toaster/toastergui/templates/customrecipe.html | |||
@@ -28,6 +28,7 @@ | |||
28 | includedPackagesCount: {{recipe.includes_set.count}}, | 28 | includedPackagesCount: {{recipe.includes_set.count}}, |
29 | baseRecipeId: {{recipe.base_recipe.pk}}, | 29 | baseRecipeId: {{recipe.base_recipe.pk}}, |
30 | xhrPackageListUrl: "{% url 'xhr_customrecipe_packages' recipe.pk %}", | 30 | xhrPackageListUrl: "{% url 'xhr_customrecipe_packages' recipe.pk %}", |
31 | xhrCustomRecipeUrl: "{% url 'xhr_customrecipe_id' recipe.pk %}", | ||
31 | } | 32 | } |
32 | }; | 33 | }; |
33 | 34 | ||
@@ -39,6 +40,32 @@ | |||
39 | } | 40 | } |
40 | }); | 41 | }); |
41 | </script> | 42 | </script> |
43 | |||
44 | <!-- Delete recipe modal --> | ||
45 | <div id="delete-recipe-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="false"> | ||
46 | <div class="modal-dialog"> | ||
47 | <div class="modal-content"> | ||
48 | <div class="modal-body"> | ||
49 | <p>Are you sure you want to delete the <strong>{{recipe.name}}</strong> | ||
50 | custom image?</p> | ||
51 | </div> | ||
52 | <div class="modal-footer"> | ||
53 | <button type="button" class="btn btn-primary" id="delete-custom-recipe-confirmed"> | ||
54 | <span data-role="submit-state">Delete custom image</span> | ||
55 | <span data-role="loading-state" style="display:none"> | ||
56 | <span class="fa-pulse"> | ||
57 | <i class="fa-pulse icon-spinner"></i> | ||
58 | </span> | ||
59 | Deleting custom image... | ||
60 | </span> | ||
61 | </button> | ||
62 | <button type="button" class="btn btn-link" data-dismiss="modal">Cancel</button> | ||
63 | </div> | ||
64 | </div><!-- /.modal-content --> | ||
65 | </div><!-- /.modal-dialog --> | ||
66 | </div><!-- /.modal --> | ||
67 | <!-- end delete recipe modal --> | ||
68 | |||
42 | <!-- package dependencies modal --> | 69 | <!-- package dependencies modal --> |
43 | <div id="package-deps-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="false"> | 70 | <div id="package-deps-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="false"> |
44 | <div class="modal-dialog"> | 71 | <div class="modal-dialog"> |
@@ -229,10 +256,10 @@ | |||
229 | <span class="glyphicon glyphicon-question-sign get-help" title="All custom images have their license set to MIT. This is because the license applies only to the recipe (.bb) file, and not to the image itself. To see which licenses apply to the image you must check the license manifest generated with each build"></i> | 256 | <span class="glyphicon glyphicon-question-sign get-help" title="All custom images have their license set to MIT. This is because the license applies only to the recipe (.bb) file, and not to the image itself. To see which licenses apply to the image you must check the license manifest generated with each build"></i> |
230 | </dd> | 257 | </dd> |
231 | </dl> | 258 | </dl> |
232 | <!-- | 259 | <i class="icon-trash text-danger"></i> |
233 | <i class="icon-trash no-tooltip"></i> | 260 | <a href="#delete-recipe-modal" data-target="#delete-recipe-modal" data-toggle="modal" class="text-danger" id="delete-recipe"> |
234 | <a href="#" class="error" id="delete">Delete custom image</a> | 261 | Delete custom image |
235 | --> | 262 | </a> |
236 | </div> | 263 | </div> |
237 | </div> | 264 | </div> |
238 | </div> | 265 | </div> |