]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
bitbake: toaster: alerts and modals Avoid modals and alerts overlaying each other
authorMichael Wood <michael.g.wood@intel.com>
Mon, 26 Sep 2016 10:59:32 +0000 (13:59 +0300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 30 Sep 2016 15:52:22 +0000 (16:52 +0100)
Make sure that when we spawn a modal we clear any notifications and also
make sure that old notifications are cleared before showing a new one.

(Bitbake rev: c7f30a673ab973a2500092d2e981a47da05fbf12)

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/static/js/layerDepsModal.js
bitbake/lib/toaster/toastergui/static/js/libtoaster.js

index b79049e98c12130f014053f626a410374f5144ca..e9622243a52234cf7623265992f0bb7ecbc6b401 100644 (file)
@@ -6,7 +6,12 @@
  * addToProject: Whether to add layers to project on accept
  * successAdd: function to run on success
  */
-function showLayerDepsModal(layer, dependencies, title, body, addToProject, successAdd) {
+function showLayerDepsModal(layer,
+                            dependencies,
+                            title,
+                            body,
+                            addToProject,
+                            successAdd) {
 
   if ($("#dependencies-modal").length === 0) {
     $.get(libtoaster.ctx.htmlUrl + "/layer_deps_modal.html", function(html){
@@ -43,7 +48,10 @@ function showLayerDepsModal(layer, dependencies, title, body, addToProject, succ
 
     $("#dependencies-modal").data("deps", dependencies);
 
-    $('#dependencies-modal').modal('show');
+    /* Clear any alert notifications before showing the modal */
+    $(".alert").fadeOut(function(){
+      $('#dependencies-modal').modal('show');
+    });
 
     /* Discard the old submission function */
     $("#dependencies-modal-form").unbind('submit');
index 8e2221d2aeb3e8c9027e0319bccae49d32322bb2..0832ba40c34003890c41ddc10247dbc813d04dd2 100644 (file)
@@ -342,10 +342,12 @@ var libtoaster = (function () {
   }
 
   function _showChangeNotification(message){
-    var alertMsg = $("#change-notification-msg");
+    $(".alert").fadeOut().promise().done(function(){
+      var alertMsg = $("#change-notification-msg");
 
-    alertMsg.html(message);
-    $("#change-notification, #change-notification *").fadeIn();
+      alertMsg.html(message);
+      $("#change-notification, #change-notification *").fadeIn();
+    });
   }
 
   function _createCustomRecipe(name, baseRecipeId, doneCb){
@@ -716,6 +718,11 @@ $(document).ready(function() {
       });
     }
 
+    /* Make sure we don't have a notification overlay a modal */
+    $(".modal").on('show.bs.modal', function(){
+      $(".alert-dismissible").fadeOut();
+    });
+
     if (libtoaster.debug) {
       check_for_duplicate_ids();
     } else {