You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by or...@apache.org on 2016/04/17 22:29:35 UTC

svn commit: r1739645 - in /qpid/java/trunk/broker-plugins/management-http/src/main/java/resources: js/qpid/management/query/CriteriaPane.js js/qpid/management/query/WhereCriteria.js query/WhereCriteria.html

Author: orudyy
Date: Sun Apr 17 20:29:35 2016
New Revision: 1739645

URL: http://svn.apache.org/viewvc?rev=1739645&view=rev
Log:
QPID-7204: Fix issue with unexpected close of where criteria popup dialog in chrome and safari on criteria removal

Modified:
    qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/CriteriaPane.js
    qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/WhereCriteria.js
    qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/query/WhereCriteria.html

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/CriteriaPane.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/CriteriaPane.js?rev=1739645&r1=1739644&r2=1739645&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/CriteriaPane.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/CriteriaPane.js Sun Apr 17 20:29:35 2016
@@ -549,36 +549,26 @@ function(declare, array, lang, string, d
                                         },
                         _removalRequested: function()
                                         {
-                                            if (this._stored)
-                                            {
-                                              // do not destroy already stored criteria
-                                              // in order to restore it on cancellation
-
-                                              this._removed = true;
-                                              domStyle.set(this.domNode, "display", "none");
-
-                                              // notify listeners that criteria is changed
-                                              this.emit("change", this);
-                                            }
-                                            else
-                                            {
-                                                this.destroyRecursive(false);
-                                            }
+                                            this._removed = true;
+                                            this.emit("change", this);
+                                        },
+                        _getRemovedAttr:function()
+                                        {
+                                          return this._removed;
                                         },
                         cancelled:      function()
                                         {
-                                            if (this._removed)
-                                            {
-                                              domStyle.set(this.domNode, "display", "");
-                                              this._removed = false;
-                                            }
-
                                             if (!this._stored)
                                             {
                                               this.destroyRecursive(false);
                                             }
                                             else
                                             {
+                                              if (this._removed)
+                                              {
+                                                domStyle.set(this.domNode, "display", "");
+                                                this._removed = false;
+                                              }
                                               this.valueEditor.set("value", this._savedValue);
                                               this.criteriaCondition.set("value", this._savedCondition);
                                             }
@@ -595,11 +585,12 @@ function(declare, array, lang, string, d
                                               this._stored = true;
                                             }
                                         },
-                        setRemovable:   function(removable)
+                        _setRemovableAttr:function(removable)
                                         {
+                                          this._removable = removable
                                           this.removeCriteria.set("disabled", !removable);
                                         },
-                        validate:       function()
+                        isValidCriteria:        function()
                                         {
                                           if (!this.valueEditor.get("disabled"))
                                           {

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/WhereCriteria.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/WhereCriteria.js?rev=1739645&r1=1739644&r2=1739645&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/WhereCriteria.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/WhereCriteria.js Sun Apr 17 20:29:35 2016
@@ -109,7 +109,6 @@ function(declare, array, lang, string, t
                                        this.criteriaContainer.addChild(criteriaPane);
                                        criteriaPane.on("change", lang.hitch(this, this._criteriaConditionChanged));
                                        this._updateRemovable();
-                                       this.conditionDialogContent.connectChildren();
                                        return criteriaPane;
                                      },
                         _getNumberOfCriteria : function()
@@ -118,7 +117,7 @@ function(declare, array, lang, string, t
                                        var criteriaArray = this.criteriaContainer.getChildren();
                                        for(var i = 0;i<criteriaArray.length;i++)
                                        {
-                                          if (!criteriaArray[i]._removed)
+                                          if (!criteriaArray[i].get("removed"))
                                           {
                                             counter = counter + 1;
                                           }
@@ -132,9 +131,10 @@ function(declare, array, lang, string, t
                                        var criteriaArray = this.criteriaContainer.getChildren();
                                        for(var i = 0;i<criteriaArray.length;i++)
                                        {
-                                         if (!criteriaArray[i]._removed)
+                                         if (!criteriaArray[i].get("removed"))
                                          {
-                                            criteriaArray[i].setRemovable(!singleCriteria);
+                                            criteriaArray[i].set("removable", !singleCriteria);
+                                            break;
                                          }
                                        }
                                        this.criteriaMatchCondition.set("disabled", singleCriteria);
@@ -153,9 +153,8 @@ function(declare, array, lang, string, t
                                         var expression = this._getUserFriendlyExpression();
                                         this.criteria.set("label", expression);
                                       },
-                        _criteriaConditionChanged: function()
+                        _criteriaConditionChanged: function(criteria)
                                       {
-                                        this.conditionDialogContent.connectChildren();
                                         var isValid =  this._validateCriteria();
                                         if (isValid)
                                         {
@@ -164,6 +163,35 @@ function(declare, array, lang, string, t
                                           this._updateRemovable();
                                         }
                                         this.doneButton.set("disabled", !isValid);
+                                        if (criteria && criteria.get("removed"))
+                                        {
+                                          var prev = this.criteriaMatchCondition;
+                                          var criteriaArray = this.criteriaContainer.getChildren();
+                                          for(var i = 0;i<criteriaArray.length;i++)
+                                          {
+                                            if (criteriaArray[i] == criteria)
+                                            {
+                                              break;
+                                            }
+                                            if (!criteriaArray[i].get("removed"))
+                                            {
+                                              prev = criteriaArray[i]
+                                            }
+                                          }
+
+                                          if (prev)
+                                          {
+                                            if (prev.focus)
+                                            {
+                                              prev.focus();
+                                            }
+                                            else if (prev instanceof qpid.management.query.CriteriaPane)
+                                            {
+                                              prev.criteriaCondition.focus();
+                                            }
+                                            criteria.domNode.style.display = "none";
+                                          }
+                                        }
                                       },
                         _validateCriteria:function()
                                       {
@@ -171,7 +199,7 @@ function(declare, array, lang, string, t
                                         var criteriaArray = this.criteriaContainer.getChildren();
                                         for(var i = 0;i<criteriaArray.length;i++)
                                         {
-                                          if (!criteriaArray[i].validate())
+                                          if (!criteriaArray[i].get("removed") && !criteriaArray[i].isValidCriteria())
                                           {
                                             isValid = false;
                                           }

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/query/WhereCriteria.html
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/query/WhereCriteria.html?rev=1739645&r1=1739644&r2=1739645&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/query/WhereCriteria.html (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/query/WhereCriteria.html Sun Apr 17 20:29:35 2016
@@ -49,6 +49,7 @@
                     <div id="${id}_whereCriteria_addButton"
                          data-dojo-type="dijit/form/Button"
                          data-dojo-attach-point="addButton"
+                         data-dojo-props="title: 'Add new condition'"
                          type="button"  label="Add" class="alignLeft"></div>
                     <div class="alignRight">
                         <div id="${id}_whereCriteria_cancelButton"



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org