[gnome-continuous-yocto/gnomeostree-3.28-rocko: 2765/8267] bitbake: toaster: layerdetails Update implementation of delete imported layer



commit 5b035ed9be2a79a31d25a0b527d3688a0ce6f97e
Author: Michael Wood <michael g wood intel com>
Date:   Mon Sep 26 13:59:37 2016 +0300

    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>

 bitbake/lib/toaster/toastergui/api.py              |    2 +-
 .../toaster/toastergui/static/js/layerdetails.js   |    7 +++++--
 .../toaster/toastergui/templates/layerdetails.html |    9 ++++++---
 3 files changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/bitbake/lib/toaster/toastergui/api.py b/bitbake/lib/toaster/toastergui/api.py
index 149abf7..3a05d66 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 8165bad..4c0d042 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 = $('<span>You have deleted <strong>1</strong> layer from your project: <strong 
id="deleted-layer-name"></strong>');
+    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 0594b55..f1569bd 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 %}
 
-<div id="delete-layer-modal" class="modal fade" tabindex="-1" role="dialog">
+<div id="delete-layer-modal" class="modal fade" tabindex="-1" role="dialog"
+    data-keyboard="false" data-backdrop="static">
   <div class="modal-dialog" role="document">
     <div class="modal-content">
       <div class="modal-body">
                  Are you sure you want to delete the <strong>{{layerversion.layer.name}}</strong> layer?
       </div>
       <div class="modal-footer">
-        <button type="button" id="layer-delete-confirmed" class="btn btn-primary">Delete</button>
+        <button type="button" id="layer-delete-confirmed" class="btn
+            btn-primary">Delete layer</button>
         <button type="button" class="btn btn-default btn-link" data-dismiss="modal">Cancel</button>
       </div>
     </div>
@@ -358,7 +360,8 @@
           {# Only show delete link for imported layers #}
           {% if layerversion.layer_source == layer_source.TYPE_IMPORTED %}
           <i class="icon-trash text-danger"></i>
-          <a href="#delete-layer-modal"  role="button" class="text-danger" data-toggle="modal" 
data-target="#delete-layer-modal">Delete {{layerversion.layer.name}}</a>
+          <a href="#delete-layer-modal"  role="button" class="text-danger"
+              data-toggle="modal" data-target="#delete-layer-modal">Delete layer</a>
           {% endif %}
         </div>
       </div>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]