All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] toaster: Delete notification update front end implementation to design
@ 2016-09-29 15:03 Michael Wood
  2016-09-29 15:03 ` [PATCH 2/2] toaster: Update tests to reflect front end changes Michael Wood
  2016-09-29 15:10 ` [PATCH 1/2] toaster: Delete notification update front end implementation to design Michael Wood
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Wood @ 2016-09-29 15:03 UTC (permalink / raw)
  To: toaster

Update the delete notifications to reflect feedback from design
review comments.

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
---
 bitbake/lib/toaster/toastergui/api.py                       | 2 +-
 bitbake/lib/toaster/toastergui/static/js/customrecipe.js    | 2 +-
 bitbake/lib/toaster/toastergui/static/js/layerdetails.js    | 2 ++
 bitbake/lib/toaster/toastergui/static/js/libtoaster.js      | 2 +-
 bitbake/lib/toaster/toastergui/templates/base.html          | 2 +-
 bitbake/lib/toaster/toastergui/templates/basebuildpage.html | 6 +++++-
 6 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/bitbake/lib/toaster/toastergui/api.py b/bitbake/lib/toaster/toastergui/api.py
index 3a05d66..d609ed9 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",
-            "gotoUrl": reverse('project', args=(kwargs['pid'],))
+            "gotoUrl": reverse('projectlayers', args=(kwargs['pid'],))
         })
 
 
diff --git a/bitbake/lib/toaster/toastergui/static/js/customrecipe.js b/bitbake/lib/toaster/toastergui/static/js/customrecipe.js
index 9ea9602..7bf79a0 100644
--- a/bitbake/lib/toaster/toastergui/static/js/customrecipe.js
+++ b/bitbake/lib/toaster/toastergui/static/js/customrecipe.js
@@ -303,7 +303,7 @@ function customRecipePageInit(ctx) {
             libtoaster.setNotification("custom-image-recipe-deleted",
                                        msg.html());
 
-            window.location.replace(data.gotoUrl);
+            window.location.replace(data.gotoUrl + "?nocache=true");
           }
         },
         error: function (data) {
diff --git a/bitbake/lib/toaster/toastergui/static/js/layerdetails.js b/bitbake/lib/toaster/toastergui/static/js/layerdetails.js
index 4c0d042..9ead393 100644
--- a/bitbake/lib/toaster/toastergui/static/js/layerdetails.js
+++ b/bitbake/lib/toaster/toastergui/static/js/layerdetails.js
@@ -392,6 +392,8 @@ function layerDetailsPageInit (ctx) {
 
   $("#layer-delete-confirmed").click(function(){
 
+    $("#delete-layer-modal button[data-dismiss='modal']").hide();
+
     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);
 
diff --git a/bitbake/lib/toaster/toastergui/static/js/libtoaster.js b/bitbake/lib/toaster/toastergui/static/js/libtoaster.js
index 0832ba4..86662b7 100644
--- a/bitbake/lib/toaster/toastergui/static/js/libtoaster.js
+++ b/bitbake/lib/toaster/toastergui/static/js/libtoaster.js
@@ -342,7 +342,7 @@ var libtoaster = (function () {
   }
 
   function _showChangeNotification(message){
-    $(".alert").fadeOut().promise().done(function(){
+    $(".alert-dismissible").fadeOut().promise().done(function(){
       var alertMsg = $("#change-notification-msg");
 
       alertMsg.html(message);
diff --git a/bitbake/lib/toaster/toastergui/templates/base.html b/bitbake/lib/toaster/toastergui/templates/base.html
index c1b1417..496dd6e 100644
--- a/bitbake/lib/toaster/toastergui/templates/base.html
+++ b/bitbake/lib/toaster/toastergui/templates/base.html
@@ -74,7 +74,7 @@
     </div>
 
     <div id="change-notification" class="alert alert-info alert-dismissible change-notification" style="display:none">
-      <button type="button" class="close" id="hide-alert" data-dismiss="alert">&times;</button>
+      <button type="button" class="close" id="hide-alert" data-toggle="alert">&times;</button>
       <span id="change-notification-msg"></span>
     </div>
 
diff --git a/bitbake/lib/toaster/toastergui/templates/basebuildpage.html b/bitbake/lib/toaster/toastergui/templates/basebuildpage.html
index 0b6ef56..f5eee96 100644
--- a/bitbake/lib/toaster/toastergui/templates/basebuildpage.html
+++ b/bitbake/lib/toaster/toastergui/templates/basebuildpage.html
@@ -28,6 +28,8 @@
             if (data.error !== "ok") {
               console.warn(data.error);
             } else {
+              libtoaster.setNotification("build-deleted",
+                $("#deleted-build-message").html());
              window.location.replace(data.gotoUrl);
             }
           },
@@ -61,7 +63,9 @@
   });
  </script>
 
-
+<span style="display:none" id="deleted-build-message">
+  You have deleted 1 build: <strong>{{build.get_sorted_target_list|field_values:"target"|join:", "}} {{build.machine}}</strong> completed on <strong>{{build.completed_on|date:"d/m/y H:i"}}</strong>
+</span>
 
 <div class="modal fade" tabindex="-1" role="dialog" id="delete-build-modal" style="display: none;" data-backdrop="static" data-keyboard="false">
   <div class="modal-dialog">
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] toaster: Update tests to reflect front end changes
  2016-09-29 15:03 [PATCH 1/2] toaster: Delete notification update front end implementation to design Michael Wood
@ 2016-09-29 15:03 ` Michael Wood
  2016-09-29 15:10 ` [PATCH 1/2] toaster: Delete notification update front end implementation to design Michael Wood
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Wood @ 2016-09-29 15:03 UTC (permalink / raw)
  To: toaster

 - Browser test we changed the project heading access to use the class name
 - Update toastergui unit test for additional gotoUrl property
 - On faster browsers we had a race for layer details inputs being
   visible

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
---
 bitbake/lib/toaster/tests/browser/test_layerdetails_page.py | 4 ++++
 bitbake/lib/toaster/tests/browser/test_project_page.py      | 2 +-
 bitbake/lib/toaster/toastergui/tests.py                     | 8 +++++++-
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/bitbake/lib/toaster/tests/browser/test_layerdetails_page.py b/bitbake/lib/toaster/tests/browser/test_layerdetails_page.py
index 72b6f60..6392d1e 100644
--- a/bitbake/lib/toaster/tests/browser/test_layerdetails_page.py
+++ b/bitbake/lib/toaster/tests/browser/test_layerdetails_page.py
@@ -91,6 +91,10 @@ class TestLayerDetailsPage(SeleniumTestCase):
         for btn in self.find_all("dd .glyphicon-edit"):
             btn.click()
 
+        # Wait for the inputs to become visible
+        self.wait_until_visible("#layer-git input[type=text]")
+        self.wait_until_visible("dd textarea")
+
         # Edit each value
         for inputs in self.find_all("#layer-git input[type=text]") + \
                 self.find_all("dd textarea"):
diff --git a/bitbake/lib/toaster/tests/browser/test_project_page.py b/bitbake/lib/toaster/tests/browser/test_project_page.py
index 786bef1..0186463 100644
--- a/bitbake/lib/toaster/tests/browser/test_project_page.py
+++ b/bitbake/lib/toaster/tests/browser/test_project_page.py
@@ -55,5 +55,5 @@ class TestProjectPage(SeleniumTestCase):
         self.get(url)
 
         # check that we get a project page with the correct heading
-        project_name = self.find('#project-name').text.strip()
+        project_name = self.find('.project-name').text.strip()
         self.assertEqual(project_name, self.CLI_BUILDS_PROJECT_NAME)
diff --git a/bitbake/lib/toaster/toastergui/tests.py b/bitbake/lib/toaster/toastergui/tests.py
index 0508611..2b5894f 100644
--- a/bitbake/lib/toaster/toastergui/tests.py
+++ b/bitbake/lib/toaster/toastergui/tests.py
@@ -248,7 +248,13 @@ class ViewTests(TestCase):
         url = reverse('xhr_customrecipe_id', args=(recipe.id,))
         response = self.client.delete(url)
         self.assertEqual(response.status_code, 200)
-        self.assertEqual(json.loads(response.content.decode('utf-8')), {"error": "ok"})
+
+        gotoUrl = reverse('projectcustomimages', args=(self.project.pk,))
+
+        self.assertEqual(json.loads(response.content.decode('utf-8')),
+                         {"error": "ok",
+                          "gotoUrl": gotoUrl})
+
         # try to delete not-existent recipe
         url = reverse('xhr_customrecipe_id', args=(recipe.id,))
         response = self.client.delete(url)
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] toaster: Delete notification update front end implementation to design
  2016-09-29 15:03 [PATCH 1/2] toaster: Delete notification update front end implementation to design Michael Wood
  2016-09-29 15:03 ` [PATCH 2/2] toaster: Update tests to reflect front end changes Michael Wood
@ 2016-09-29 15:10 ` Michael Wood
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Wood @ 2016-09-29 15:10 UTC (permalink / raw)
  To: toaster

On 29/09/16 16:03, Michael Wood wrote:
> Update the delete notifications to reflect feedback from design
> review comments.
>
> Signed-off-by: Michael Wood <michael.g.wood@intel.com>
> ---
>   bitbake/lib/toaster/toastergui/api.py                       | 2 +-
>   bitbake/lib/toaster/toastergui/static/js/customrecipe.js    | 2 +-
>   bitbake/lib/toaster/toastergui/static/js/layerdetails.js    | 2 ++
>   bitbake/lib/toaster/toastergui/static/js/libtoaster.js      | 2 +-
>   bitbake/lib/toaster/toastergui/templates/base.html          | 2 +-
>   bitbake/lib/toaster/toastergui/templates/basebuildpage.html | 6 +++++-
>   6 files changed, 11 insertions(+), 5 deletions(-)
>
> diff --git a/bitbake/lib/toaster/toastergui/api.py b/bitbake/lib/toaster/toastergui/api.py
> index 3a05d66..d609ed9 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",
> -            "gotoUrl": reverse('project', args=(kwargs['pid'],))
> +            "gotoUrl": reverse('projectlayers', args=(kwargs['pid'],))
>           })
>   
>   
> diff --git a/bitbake/lib/toaster/toastergui/static/js/customrecipe.js b/bitbake/lib/toaster/toastergui/static/js/customrecipe.js
> index 9ea9602..7bf79a0 100644
> --- a/bitbake/lib/toaster/toastergui/static/js/customrecipe.js
> +++ b/bitbake/lib/toaster/toastergui/static/js/customrecipe.js
> @@ -303,7 +303,7 @@ function customRecipePageInit(ctx) {
>               libtoaster.setNotification("custom-image-recipe-deleted",
>                                          msg.html());
>   
> -            window.location.replace(data.gotoUrl);
> +            window.location.replace(data.gotoUrl + "?nocache=true");


Ah, this shouldn't have had a "nocache=true" that was set for debugging. 
Will re-send patches.


>             }
>           },
>           error: function (data) {
> diff --git a/bitbake/lib/toaster/toastergui/static/js/layerdetails.js b/bitbake/lib/toaster/toastergui/static/js/layerdetails.js
> index 4c0d042..9ead393 100644
> --- a/bitbake/lib/toaster/toastergui/static/js/layerdetails.js
> +++ b/bitbake/lib/toaster/toastergui/static/js/layerdetails.js
> @@ -392,6 +392,8 @@ function layerDetailsPageInit (ctx) {
>   
>     $("#layer-delete-confirmed").click(function(){
>   
> +    $("#delete-layer-modal button[data-dismiss='modal']").hide();
> +
>       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);
>   
> diff --git a/bitbake/lib/toaster/toastergui/static/js/libtoaster.js b/bitbake/lib/toaster/toastergui/static/js/libtoaster.js
> index 0832ba4..86662b7 100644
> --- a/bitbake/lib/toaster/toastergui/static/js/libtoaster.js
> +++ b/bitbake/lib/toaster/toastergui/static/js/libtoaster.js
> @@ -342,7 +342,7 @@ var libtoaster = (function () {
>     }
>   
>     function _showChangeNotification(message){
> -    $(".alert").fadeOut().promise().done(function(){
> +    $(".alert-dismissible").fadeOut().promise().done(function(){
>         var alertMsg = $("#change-notification-msg");
>   
>         alertMsg.html(message);
> diff --git a/bitbake/lib/toaster/toastergui/templates/base.html b/bitbake/lib/toaster/toastergui/templates/base.html
> index c1b1417..496dd6e 100644
> --- a/bitbake/lib/toaster/toastergui/templates/base.html
> +++ b/bitbake/lib/toaster/toastergui/templates/base.html
> @@ -74,7 +74,7 @@
>       </div>
>   
>       <div id="change-notification" class="alert alert-info alert-dismissible change-notification" style="display:none">
> -      <button type="button" class="close" id="hide-alert" data-dismiss="alert">&times;</button>
> +      <button type="button" class="close" id="hide-alert" data-toggle="alert">&times;</button>
>         <span id="change-notification-msg"></span>
>       </div>
>   
> diff --git a/bitbake/lib/toaster/toastergui/templates/basebuildpage.html b/bitbake/lib/toaster/toastergui/templates/basebuildpage.html
> index 0b6ef56..f5eee96 100644
> --- a/bitbake/lib/toaster/toastergui/templates/basebuildpage.html
> +++ b/bitbake/lib/toaster/toastergui/templates/basebuildpage.html
> @@ -28,6 +28,8 @@
>               if (data.error !== "ok") {
>                 console.warn(data.error);
>               } else {
> +              libtoaster.setNotification("build-deleted",
> +                $("#deleted-build-message").html());
>                window.location.replace(data.gotoUrl);
>               }
>             },
> @@ -61,7 +63,9 @@
>     });
>    </script>
>   
> -
> +<span style="display:none" id="deleted-build-message">
> +  You have deleted 1 build: <strong>{{build.get_sorted_target_list|field_values:"target"|join:", "}} {{build.machine}}</strong> completed on <strong>{{build.completed_on|date:"d/m/y H:i"}}</strong>
> +</span>
>   
>   <div class="modal fade" tabindex="-1" role="dialog" id="delete-build-modal" style="display: none;" data-backdrop="static" data-keyboard="false">
>     <div class="modal-dialog">




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-09-29 15:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-29 15:03 [PATCH 1/2] toaster: Delete notification update front end implementation to design Michael Wood
2016-09-29 15:03 ` [PATCH 2/2] toaster: Update tests to reflect front end changes Michael Wood
2016-09-29 15:10 ` [PATCH 1/2] toaster: Delete notification update front end implementation to design Michael Wood

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.