diff options
| author | Michael Wood <michael.g.wood@intel.com> | 2016-07-06 18:22:38 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-07-08 09:57:29 +0100 |
| commit | 8813726f1d5ea1d78fced7fe52abdf826e529e62 (patch) | |
| tree | 073689032966641d0f12415002572de1f1d08e72 /bitbake/lib/toaster/toastergui/static | |
| parent | e1ba2fd331b7f937b8ddf3e83389df5caf33d9e8 (diff) | |
| download | poky-8813726f1d5ea1d78fced7fe52abdf826e529e62.tar.gz | |
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>
Diffstat (limited to 'bitbake/lib/toaster/toastergui/static')
| -rw-r--r-- | bitbake/lib/toaster/toastergui/static/js/layerdetails.js | 20 | ||||
| -rw-r--r-- | bitbake/lib/toaster/toastergui/static/js/projectpage.js | 18 |
2 files changed, 38 insertions, 0 deletions
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) { | |||
| 397 | $(this).parents("form").submit(); | 397 | $(this).parents("form").submit(); |
| 398 | }); | 398 | }); |
| 399 | 399 | ||
| 400 | $("#layer-delete-confirmed").click(function(){ | ||
| 401 | $.cookie("layer-deleted", ctx.layerVersion.name, { path: '/'}); | ||
| 402 | |||
| 403 | $.ajax({ | ||
| 404 | type: "DELETE", | ||
| 405 | url: ctx.xhrUpdateLayerUrl, | ||
| 406 | headers: { 'X-CSRFToken' : $.cookie('csrftoken')}, | ||
| 407 | success: function(data) { | ||
| 408 | if (data.error != "ok") { | ||
| 409 | console.warn(data.error); | ||
| 410 | } else { | ||
| 411 | window.location = data.redirect + "?notify=layer-deleted"; | ||
| 412 | } | ||
| 413 | }, | ||
| 414 | error: function(data) { | ||
| 415 | console.warn("Call failed"); | ||
| 416 | console.warn(data); | ||
| 417 | } | ||
| 418 | }); | ||
| 419 | }); | ||
| 400 | 420 | ||
| 401 | layerDepsList.find(".glyphicon-trash").click(layerDepRemoveClick); | 421 | layerDepsList.find(".glyphicon-trash").click(layerDepRemoveClick); |
| 402 | layerDepsList.find("a").tooltip(); | 422 | 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) { | |||
| 58 | case 'layer-imported': | 58 | case 'layer-imported': |
| 59 | layerImportedNotification(); | 59 | layerImportedNotification(); |
| 60 | break; | 60 | break; |
| 61 | case 'layer-deleted': | ||
| 62 | layerDeletedNotification(); | ||
| 61 | default: | 63 | default: |
| 62 | break; | 64 | break; |
| 63 | } | 65 | } |
| 64 | } | 66 | } |
| 65 | })(); | 67 | })(); |
| 66 | 68 | ||
| 69 | /* Layer deleted notification */ | ||
| 70 | function layerDeletedNotification(){ | ||
| 71 | var layer = $.cookie("layer-deleted"); | ||
| 72 | |||
| 73 | if (!layer) | ||
| 74 | return; | ||
| 75 | |||
| 76 | var message = "You have deleted <strong>1</strong> layer from your "; | ||
| 77 | message += "project: <strong>" + layer + "</strong>"; | ||
| 78 | |||
| 79 | libtoaster.showChangeNotification(message); | ||
| 80 | |||
| 81 | $.removeCookie("layer-deleted", { path: "/"}); | ||
| 82 | } | ||
| 83 | |||
| 84 | |||
| 67 | /* Layer imported notification */ | 85 | /* Layer imported notification */ |
| 68 | function layerImportedNotification(){ | 86 | function layerImportedNotification(){ |
| 69 | var imported = $.cookie("layer-imported-alert"); | 87 | var imported = $.cookie("layer-imported-alert"); |
