From: Michael Wood Date: Mon, 26 Sep 2016 10:59:37 +0000 (+0300) Subject: bitbake: toaster: layerdetails Update implementation of delete imported layer X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5b035ed9be2a79a31d25a0b527d3688a0ce6f97e;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git bitbake: toaster: layerdetails Update implementation of delete imported layer Update the implementation of delete an imported layer so that it is consistent with the other delete messages and wording. Also use the new libtoaster way of setting a notification that the delete was successful. (Bitbake rev: 0b8d3ac48b5a0984963d664ff5630e3b02c4ecd1) Signed-off-by: Michael Wood Signed-off-by: Ed Bartosh Signed-off-by: Richard Purdie --- diff --git a/bitbake/lib/toaster/toastergui/api.py b/bitbake/lib/toaster/toastergui/api.py index 149abf7a5b3..3a05d663832 100644 --- a/bitbake/lib/toaster/toastergui/api.py +++ b/bitbake/lib/toaster/toastergui/api.py @@ -221,7 +221,7 @@ class XhrLayer(View): return JsonResponse({ "error": "ok", - "redirect": reverse('project', args=(kwargs['pid'],)) + "gotoUrl": reverse('project', args=(kwargs['pid'],)) }) diff --git a/bitbake/lib/toaster/toastergui/static/js/layerdetails.js b/bitbake/lib/toaster/toastergui/static/js/layerdetails.js index 8165bad5dd6..4c0d0426ebd 100644 --- a/bitbake/lib/toaster/toastergui/static/js/layerdetails.js +++ b/bitbake/lib/toaster/toastergui/static/js/layerdetails.js @@ -391,7 +391,9 @@ function layerDetailsPageInit (ctx) { }); $("#layer-delete-confirmed").click(function(){ - $.cookie("layer-deleted", ctx.layerVersion.name, { path: '/'}); + + var message = $('You have deleted 1 layer from your project: '); + message.find("#deleted-layer-name").text(ctx.layerVersion.name); $.ajax({ type: "DELETE", @@ -401,7 +403,8 @@ function layerDetailsPageInit (ctx) { if (data.error != "ok") { console.warn(data.error); } else { - window.location = data.redirect + "?notify=layer-deleted"; + libtoaster.setNotification("layer-deleted", message.html()); + window.location.replace(data.gotoUrl); } }, error: function(data) { diff --git a/bitbake/lib/toaster/toastergui/templates/layerdetails.html b/bitbake/lib/toaster/toastergui/templates/layerdetails.html index 0594b551aaf..f1569bd6302 100644 --- a/bitbake/lib/toaster/toastergui/templates/layerdetails.html +++ b/bitbake/lib/toaster/toastergui/templates/layerdetails.html @@ -6,14 +6,16 @@ {% block title %} {{layerversion.layer.name}} - {{project.name}} - Toaster {% endblock %} {% block pagecontent %} -