diff --git a/bitbake/lib/toaster/toastergui/static/js/layerdetails.js b/bitbake/lib/toaster/toastergui/static/js/layerdetails.js index a56087b738..683486e53b 100644 --- a/bitbake/lib/toaster/toastergui/static/js/layerdetails.js +++ b/bitbake/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/bitbake/lib/toaster/toastergui/static/js/projectpage.js b/bitbake/lib/toaster/toastergui/static/js/projectpage.js index 6d92490ba2..df79849e37 100644 --- a/bitbake/lib/toaster/toastergui/static/js/projectpage.js +++ b/bitbake/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 1 layer from your "; + message += "project: " + layer + ""; + + libtoaster.showChangeNotification(message); + + $.removeCookie("layer-deleted", { path: "/"}); + } + + /* Layer imported notification */ function layerImportedNotification(){ var imported = $.cookie("layer-imported-alert"); diff --git a/bitbake/lib/toaster/toastergui/templates/layerdetails.html b/bitbake/lib/toaster/toastergui/templates/layerdetails.html index 143ec25dd7..4b51d1a39c 100644 --- a/bitbake/lib/toaster/toastergui/templates/layerdetails.html +++ b/bitbake/lib/toaster/toastergui/templates/layerdetails.html @@ -6,6 +6,20 @@ {% block title %} {{layerversion.layer.name}} - {{project.name}} - Toaster {% endblock %} {% block pagecontent %} + +
diff --git a/bitbake/lib/toaster/toastergui/urls.py b/bitbake/lib/toaster/toastergui/urls.py index 15b1063c59..1c0ccbb2e1 100644 --- a/bitbake/lib/toaster/toastergui/urls.py +++ b/bitbake/lib/toaster/toastergui/urls.py @@ -191,7 +191,7 @@ urlpatterns = patterns('toastergui.views', url(r'^xhr_importlayer/$', 'xhr_importlayer', name='xhr_importlayer'), - url(r'^xhr_layer/(?P\d+)$', + url(r'^xhr_layer/(?P\d+)/(?P\d+)$', api.XhrLayer.as_view(), name='xhr_layer'),