summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/toaster/toastergui/static/js/layerdetails.js20
-rw-r--r--bitbake/lib/toaster/toastergui/static/js/projectpage.js18
-rw-r--r--bitbake/lib/toaster/toastergui/templates/layerdetails.html20
-rw-r--r--bitbake/lib/toaster/toastergui/urls.py2
4 files changed, 58 insertions, 2 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");
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 @@
6{% block title %} {{layerversion.layer.name}} - {{project.name}} - Toaster {% endblock %} 6{% block title %} {{layerversion.layer.name}} - {{project.name}} - Toaster {% endblock %}
7{% block pagecontent %} 7{% block pagecontent %}
8 8
9<div id="delete-layer-modal" class="modal fade" tabindex="-1" role="dialog">
10 <div class="modal-dialog" role="document">
11 <div class="modal-content">
12 <div class="modal-body">
13 Are you sure you want to delete the <strong>{{layerversion.layer.name}}</strong> layer?
14 </div>
15 <div class="modal-footer">
16 <button type="button" id="layer-delete-confirmed" class="btn btn-primary">Delete</button>
17 <button type="button" class="btn btn-default btn-link" data-dismiss="modal">Cancel</button>
18 </div>
19 </div>
20 </div>
21</div>
22
9<div class="row"> 23<div class="row">
10 <div class="col-md-12"> 24 <div class="col-md-12">
11 <ul class="breadcrumb"> 25 <ul class="breadcrumb">
@@ -44,7 +58,7 @@
44 58
45 $(document).ready(function(){ 59 $(document).ready(function(){
46 var ctx = { 60 var ctx = {
47 xhrUpdateLayerUrl : "{% url 'xhr_layer' layerversion.pk %}", 61 xhrUpdateLayerUrl : "{% url 'xhr_layer' project.id layerversion.pk %}",
48 layerVersion : { 62 layerVersion : {
49 name : "{{layerversion.layer.name}}", 63 name : "{{layerversion.layer.name}}",
50 id : {{layerversion.id}}, 64 id : {{layerversion.id}},
@@ -271,6 +285,10 @@
271 </dd> 285 </dd>
272 {% endif %} 286 {% endif %}
273 </dl> 287 </dl>
288 {% if layerversion.layer_source_id and layerversion.layer_source.sourcetype == layerversion.layer_source.TYPE_IMPORTED %}
289 <i class="icon-trash text-danger"></i>
290 <a href="#delete-layer-modal" role="button" class="text-danger" data-toggle="modal" data-target="#delete-layer-modal">Delete {{layerversion.layer.name}}</a>
291 {% endif %}
274 </div> 292 </div>
275 </div> 293 </div>
276 </div> 294 </div>
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',
191 191
192 url(r'^xhr_importlayer/$', 'xhr_importlayer', name='xhr_importlayer'), 192 url(r'^xhr_importlayer/$', 'xhr_importlayer', name='xhr_importlayer'),
193 193
194 url(r'^xhr_layer/(?P<layerversion_id>\d+)$', 194 url(r'^xhr_layer/(?P<pid>\d+)/(?P<layerversion_id>\d+)$',
195 api.XhrLayer.as_view(), 195 api.XhrLayer.as_view(),
196 name='xhr_layer'), 196 name='xhr_layer'),
197 197