toaster: Delete notification update front end implementation to design
PATCH 1/2 toaster: Delete notification update front end implementation to design
Update the delete notifications to reflect feedback from design review comments.
Signed-off-by Michael Wood <[email protected]>
--- 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(-)
bitbake/lib/toaster/toastergui/api.py +1 -1
@@ -221,7 +221,7 @@ class XhrLayer(View): return JsonResponse({ "error": "ok", - "gotoUrl": reverse('project', args=(kwargs['pid'],)) + "gotoUrl": reverse('projectlayers', args=(kwargs['pid'],)) })
bitbake/lib/toaster/toastergui/static/js/customrecipe.js +1 -1
@@ -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) {
bitbake/lib/toaster/toastergui/static/js/layerdetails.js +2 -0
@@ -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);
bitbake/lib/toaster/toastergui/static/js/libtoaster.js +1 -1
@@ -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);
bitbake/lib/toaster/toastergui/templates/base.html +1 -1
@@ -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">×</button> + <button type="button" class="close" id="hide-alert" data-toggle="alert">×</button> <span id="change-notification-msg"></span> </div>
bitbake/lib/toaster/toastergui/templates/basebuildpage.html +5 -1
@@ -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">
Signature · 1 line
2.7.4
PATCH 2/2 toaster: Update tests to reflect front end changes
- 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 <[email protected]>
--- 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(-)
bitbake/lib/toaster/tests/browser/test_layerdetails_page.py +4 -0
@@ -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"):
bitbake/lib/toaster/tests/browser/test_project_page.py +1 -1
@@ -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)
bitbake/lib/toaster/toastergui/tests.py +7 -1
@@ -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)
Signature · 1 line
2.7.4
Quoted 31 lines · Michael Wood
Update the delete notifications to reflect feedback from design review comments.
Signed-off-by Michael Wood <[email protected]>--- 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(-)bitbake/lib/toaster/toastergui/api.py +1
-1@@ -221,7 +221,7 @@ class XhrLayer(View): return JsonResponse({ "error": "ok", - "gotoUrl": reverse('project', args=(kwargs['pid'],)) + "gotoUrl": reverse('projectlayers', args=(kwargs['pid'],)) })bitbake/lib/toaster/toastergui/static/js/customrecipe.js +0
-0
bitbake/lib/toaster/toastergui/static/js/customrecipe.js function customRecipePageInit(ctx) { · line 306
Quoted 5 lines
bitbake/lib/toaster/toastergui/static/js/customrecipe.js +1
-1@@ -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.
Quoted 66 lines
bitbake/lib/toaster/toastergui/static/js/customrecipe.js +0
-0} }, error: function (data) {bitbake/lib/toaster/toastergui/static/js/layerdetails.js +2
-0@@ -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);bitbake/lib/toaster/toastergui/static/js/libtoaster.js +1
-1@@ -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);bitbake/lib/toaster/toastergui/templates/base.html +1
-1@@ -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">×</button> + <button type="button" class="close" id="hide-alert" data-toggle="alert">×</button> <span id="change-notification-msg"></span> </div>bitbake/lib/toaster/toastergui/templates/basebuildpage.html +5
-1@@ -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">