bitbake: 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]

(Bitbake rev: 91815229f60eb9deba7d299f05c69b52ff1df59c)

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>
This commit is contained in:
Michael Wood
2016-07-06 18:22:38 +01:00
committed by Richard Purdie
parent e1ba2fd331
commit 8813726f1d
4 changed files with 58 additions and 2 deletions

View File

@@ -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();

View File

@@ -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");