aboutsummaryrefslogtreecommitdiffstats
path: root/lib/toaster/toastergui/static
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2016-07-06 18:22:38 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-07-08 09:57:06 +0100
commit91815229f60eb9deba7d299f05c69b52ff1df59c (patch)
tree6a13fdf16a93e0ce5fa1f565af699d74cc4d1d1a /lib/toaster/toastergui/static
parentaa0845242eda8650a97180bf6675551c26554cde (diff)
downloadbitbake-contrib-91815229f60eb9deba7d299f05c69b52ff1df59c.tar.gz
toaster: add Layer delete front end feature to layerdetails
Add the front end feature to delete a layer from the layer details page. [YOCO #9184] Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Elliot Smith <elliot.smith@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/toaster/toastergui/static')
-rw-r--r--lib/toaster/toastergui/static/js/layerdetails.js20
-rw-r--r--lib/toaster/toastergui/static/js/projectpage.js18
2 files changed, 38 insertions, 0 deletions
diff --git a/lib/toaster/toastergui/static/js/layerdetails.js b/lib/toaster/toastergui/static/js/layerdetails.js
index a56087b73..683486e53 100644
--- a/lib/toaster/toastergui/static/js/layerdetails.js
+++ b/lib/toaster/toastergui/static/js/layerdetails.js
@@ -397,6 +397,26 @@ function layerDetailsPageInit (ctx) {
$(this).parents("form").submit();
});
+ $("#layer-delete-confirmed").click(function(){
+ $.cookie("layer-deleted", ctx.layerVersion.name, { path: '/'});
+
+ $.ajax({
+ type: "DELETE",
+ url: ctx.xhrUpdateLayerUrl,
+ headers: { 'X-CSRFToken' : $.cookie('csrftoken')},
+ success: function(data) {
+ if (data.error != "ok") {
+ console.warn(data.error);
+ } else {
+ window.location = data.redirect + "?notify=layer-deleted";
+ }
+ },
+ error: function(data) {
+ console.warn("Call failed");
+ console.warn(data);
+ }
+ });
+ });
layerDepsList.find(".glyphicon-trash").click(layerDepRemoveClick);
layerDepsList.find("a").tooltip();
diff --git a/lib/toaster/toastergui/static/js/projectpage.js b/lib/toaster/toastergui/static/js/projectpage.js
index 6d92490ba..df79849e3 100644
--- a/lib/toaster/toastergui/static/js/projectpage.js
+++ b/lib/toaster/toastergui/static/js/projectpage.js
@@ -58,12 +58,30 @@ function projectPageInit(ctx) {
case 'layer-imported':
layerImportedNotification();
break;
+ case 'layer-deleted':
+ layerDeletedNotification();
default:
break;
}
}
})();
+ /* Layer deleted notification */
+ function layerDeletedNotification(){
+ var layer = $.cookie("layer-deleted");
+
+ if (!layer)
+ return;
+
+ var message = "You have deleted <strong>1</strong> layer from your ";
+ message += "project: <strong>" + layer + "</strong>";
+
+ libtoaster.showChangeNotification(message);
+
+ $.removeCookie("layer-deleted", { path: "/"});
+ }
+
+
/* Layer imported notification */
function layerImportedNotification(){
var imported = $.cookie("layer-imported-alert");