aboutsummaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2016-09-26 13:59:36 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-09-30 16:52:22 +0100
commitac5aba6cab06f3a8655eea1e368d28eb1025407e (patch)
tree021d4a1d5c18ff1ae61b06a9a91f81724d955691 /bitbake/lib
parent5b23bf083b7adcd7884d58aaf26f23102e6e3f5a (diff)
downloadopenembedded-core-contrib-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/lib')
-rw-r--r--bitbake/lib/toaster/toastergui/static/js/customrecipe.js32
-rw-r--r--bitbake/lib/toaster/toastergui/templates/customrecipe.html35
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) {
window.location.replace(libtoaster.ctx.projectBuildsUrl);
});
});
+
+ $("#delete-custom-recipe-confirmed").click(function(e){
+ e.preventDefault();
+ libtoaster.disableAjaxLoadingTimer();
+ $(this).find('[data-role="submit-state"]').hide();
+ $(this).find('[data-role="loading-state"]').show();
+ $(this).attr("disabled", "disabled");
+
+ $.ajax({
+ type: 'DELETE',
+ url: ctx.recipe.xhrCustomRecipeUrl,
+ headers: { 'X-CSRFToken' : $.cookie('csrftoken')},
+ success: function (data) {
+ if (data.error !== "ok") {
+ console.warn(data.error);
+ } else {
+ var msg = $('<span>You have deleted <strong>1</strong> custom image: <strong id="deleted-custom-image-name"></strong></span>');
+ msg.find("#deleted-custom-image-name").text(ctx.recipe.name);
+
+ libtoaster.setNotification("custom-image-recipe-deleted",
+ msg.html());
+
+ window.location.replace(data.gotoUrl);
+ }
+ },
+ error: function (data) {
+ console.warn(data);
+ }
+ });
+ });
+
+
}
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 @@
includedPackagesCount: {{recipe.includes_set.count}},
baseRecipeId: {{recipe.base_recipe.pk}},
xhrPackageListUrl: "{% url 'xhr_customrecipe_packages' recipe.pk %}",
+ xhrCustomRecipeUrl: "{% url 'xhr_customrecipe_id' recipe.pk %}",
}
};
@@ -39,6 +40,32 @@
}
});
</script>
+
+<!-- Delete recipe modal -->
+<div id="delete-recipe-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="false">
+ <div class="modal-dialog">
+ <div class="modal-content">
+ <div class="modal-body">
+ <p>Are you sure you want to delete the <strong>{{recipe.name}}</strong>
+ custom image?</p>
+ </div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-primary" id="delete-custom-recipe-confirmed">
+ <span data-role="submit-state">Delete custom image</span>
+ <span data-role="loading-state" style="display:none">
+ <span class="fa-pulse">
+ <i class="fa-pulse icon-spinner"></i>
+ </span>
+ &nbsp;Deleting custom image...
+ </span>
+ </button>
+ <button type="button" class="btn btn-link" data-dismiss="modal">Cancel</button>
+ </div>
+ </div><!-- /.modal-content -->
+ </div><!-- /.modal-dialog -->
+</div><!-- /.modal -->
+<!-- end delete recipe modal -->
+
<!-- package dependencies modal -->
<div id="package-deps-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="false">
<div class="modal-dialog">
@@ -229,10 +256,10 @@
<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>
</dd>
</dl>
- <!--
- <i class="icon-trash no-tooltip"></i>
- <a href="#" class="error" id="delete">Delete custom image</a>
- -->
+ <i class="icon-trash text-danger"></i>
+ <a href="#delete-recipe-modal" data-target="#delete-recipe-modal" data-toggle="modal" class="text-danger" id="delete-recipe">
+ Delete custom image
+ </a>
</div>
</div>
</div>