summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2016-09-26 13:59:37 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-09-30 16:52:22 +0100
commit5b035ed9be2a79a31d25a0b527d3688a0ce6f97e (patch)
treeb36d3e9d61f82e4beb40ee9eb7e29f8c57c06ffc /bitbake/lib/toaster/toastergui
parentac5aba6cab06f3a8655eea1e368d28eb1025407e (diff)
downloadpoky-5b035ed9be2a79a31d25a0b527d3688a0ce6f97e.tar.gz
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 <michael.g.wood@intel.com> Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastergui')
-rw-r--r--bitbake/lib/toaster/toastergui/api.py2
-rw-r--r--bitbake/lib/toaster/toastergui/static/js/layerdetails.js7
-rw-r--r--bitbake/lib/toaster/toastergui/templates/layerdetails.html9
3 files changed, 12 insertions, 6 deletions
diff --git a/bitbake/lib/toaster/toastergui/api.py b/bitbake/lib/toaster/toastergui/api.py
index 149abf7a5b..3a05d66383 100644
--- a/bitbake/lib/toaster/toastergui/api.py
+++ b/bitbake/lib/toaster/toastergui/api.py
@@ -221,7 +221,7 @@ class XhrLayer(View):
221 221
222 return JsonResponse({ 222 return JsonResponse({
223 "error": "ok", 223 "error": "ok",
224 "redirect": reverse('project', args=(kwargs['pid'],)) 224 "gotoUrl": reverse('project', args=(kwargs['pid'],))
225 }) 225 })
226 226
227 227
diff --git a/bitbake/lib/toaster/toastergui/static/js/layerdetails.js b/bitbake/lib/toaster/toastergui/static/js/layerdetails.js
index 8165bad5dd..4c0d0426eb 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) {
391 }); 391 });
392 392
393 $("#layer-delete-confirmed").click(function(){ 393 $("#layer-delete-confirmed").click(function(){
394 $.cookie("layer-deleted", ctx.layerVersion.name, { path: '/'}); 394
395 var message = $('<span>You have deleted <strong>1</strong> layer from your project: <strong id="deleted-layer-name"></strong>');
396 message.find("#deleted-layer-name").text(ctx.layerVersion.name);
395 397
396 $.ajax({ 398 $.ajax({
397 type: "DELETE", 399 type: "DELETE",
@@ -401,7 +403,8 @@ function layerDetailsPageInit (ctx) {
401 if (data.error != "ok") { 403 if (data.error != "ok") {
402 console.warn(data.error); 404 console.warn(data.error);
403 } else { 405 } else {
404 window.location = data.redirect + "?notify=layer-deleted"; 406 libtoaster.setNotification("layer-deleted", message.html());
407 window.location.replace(data.gotoUrl);
405 } 408 }
406 }, 409 },
407 error: function(data) { 410 error: function(data) {
diff --git a/bitbake/lib/toaster/toastergui/templates/layerdetails.html b/bitbake/lib/toaster/toastergui/templates/layerdetails.html
index 0594b551aa..f1569bd630 100644
--- a/bitbake/lib/toaster/toastergui/templates/layerdetails.html
+++ b/bitbake/lib/toaster/toastergui/templates/layerdetails.html
@@ -6,14 +6,16 @@
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"> 9<div id="delete-layer-modal" class="modal fade" tabindex="-1" role="dialog"
10 data-keyboard="false" data-backdrop="static">
10 <div class="modal-dialog" role="document"> 11 <div class="modal-dialog" role="document">
11 <div class="modal-content"> 12 <div class="modal-content">
12 <div class="modal-body"> 13 <div class="modal-body">
13 Are you sure you want to delete the <strong>{{layerversion.layer.name}}</strong> layer? 14 Are you sure you want to delete the <strong>{{layerversion.layer.name}}</strong> layer?
14 </div> 15 </div>
15 <div class="modal-footer"> 16 <div class="modal-footer">
16 <button type="button" id="layer-delete-confirmed" class="btn btn-primary">Delete</button> 17 <button type="button" id="layer-delete-confirmed" class="btn
18 btn-primary">Delete layer</button>
17 <button type="button" class="btn btn-default btn-link" data-dismiss="modal">Cancel</button> 19 <button type="button" class="btn btn-default btn-link" data-dismiss="modal">Cancel</button>
18 </div> 20 </div>
19 </div> 21 </div>
@@ -358,7 +360,8 @@
358 {# Only show delete link for imported layers #} 360 {# Only show delete link for imported layers #}
359 {% if layerversion.layer_source == layer_source.TYPE_IMPORTED %} 361 {% if layerversion.layer_source == layer_source.TYPE_IMPORTED %}
360 <i class="icon-trash text-danger"></i> 362 <i class="icon-trash text-danger"></i>
361 <a href="#delete-layer-modal" role="button" class="text-danger" data-toggle="modal" data-target="#delete-layer-modal">Delete {{layerversion.layer.name}}</a> 363 <a href="#delete-layer-modal" role="button" class="text-danger"
364 data-toggle="modal" data-target="#delete-layer-modal">Delete layer</a>
362 {% endif %} 365 {% endif %}
363 </div> 366 </div>
364 </div> 367 </div>