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:55 UTC

svn commit: r1739648 - in /qpid/java/trunk/broker-plugins/management-http/src/main/java/resources: css/ js/qpid/management/query/ query/

Author: orudyy
Date: Sun Apr 17 20:29:54 2016
New Revision: 1739648

URL: http://svn.apache.org/viewvc?rev=1739648&view=rev
Log:
QPID-6983: Stop displaying warnings on changes in where control in advanced mode

Added:
    qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/MessageDialog.js
    qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/query/MessageDialogForm.html
Modified:
    qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/css/common.css
    qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/DropDownSelect.js
    qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/QueryBuilder.js

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/css/common.css
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/css/common.css?rev=1739648&r1=1739647&r2=1739648&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/css/common.css (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/css/common.css Sun Apr 17 20:29:54 2016
@@ -434,4 +434,20 @@ div .messages {
 .criteriaCondition
 {
   vertical-align: top;
+}
+
+.informationMessage
+{
+    font-weight: bold;
+    padding: 1em 0em 1em 3.2em;
+    background: url("../images/notification.svg") left center no-repeat;
+    background-size: 3em;
+    vertical-align: middle;
+    width: 100%;
+    height: 100%;
+}
+
+.messageExtra
+{
+  padding: 1em 0em 1em 3.2em;
 }
\ No newline at end of file

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/DropDownSelect.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/DropDownSelect.js?rev=1739648&r1=1739647&r2=1739648&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/DropDownSelect.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/DropDownSelect.js Sun Apr 17 20:29:54 2016
@@ -88,7 +88,7 @@ function(declare, lang, array, json, dom
                                           }
                         });
 
-    OptionsPanel = declare("qpid.management.query.OptionsPanel",
+   var OptionsPanel = declare("qpid.management.query.OptionsPanel",
                    [dijit._WidgetBase, dijit._TemplatedMixin, dijit._WidgetsInTemplateMixin],
                    {
                        /**

Added: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/MessageDialog.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/MessageDialog.js?rev=1739648&view=auto
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/MessageDialog.js (added)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/MessageDialog.js Sun Apr 17 20:29:54 2016
@@ -0,0 +1,116 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+define([
+  "dojo/_base/declare",
+  "dojo/_base/lang",
+  "dojo/_base/array",
+  "dojo/json",
+  "dojo/dom-construct",
+  "dojo/text!query/MessageDialogForm.html",
+  "dojo/Evented",
+  "dojox/html/entities",
+  "dijit/Dialog",
+  "dijit/form/Button",
+  "dijit/form/CheckBox",
+  "dijit/_WidgetBase",
+  "dijit/_TemplatedMixin",
+  "dijit/_WidgetsInTemplateMixin",
+  "dojo/domReady!"
+],
+function(declare, lang, array, json, domConstruct, template, Evented, entities)
+{
+
+    var MessageDialogForm = declare("qpid.management.query.MessageDialogForm",
+                   [dijit._WidgetBase, dijit._TemplatedMixin, dijit._WidgetsInTemplateMixin, Evented],
+                   {
+                       /**
+                        * dijit._TemplatedMixin enforced fields
+                        */
+                       //Strip out the apache comment header from the template html as comments unsupported.
+                       templateString: template.replace(/<!--[\s\S]*?-->/g, ""),
+
+                       /**
+                        * template attach points
+                        */
+                       messageNode: null,
+                       messagePanel: null,
+                       stopDisplaying: null,
+                       okButton: null,
+                       cancelButton: null,
+
+                       postCreate:  function()
+                                    {
+                                      this.inherited(arguments);
+                                      this._postCreate();
+                                      console.log("Message box is created");
+                                    },
+                       _postCreate: function()
+                                    {
+                                      if (this.message)
+                                      {
+                                        this.messageNode.innerHTML = this.message;
+                                      }
+                                      this.okButton.on("click", lang.hitch(this, this._onOk));
+                                      this.cancelButton.on("click", lang.hitch(this, this._onCancel));
+                                    },
+                       _onOk: function()
+                                    {
+                                      this.emit("execute", this.stopDisplaying.checked);
+                                    },
+                       _onCancel:function(data)
+                                    {
+                                      this.emit("cancel");
+                                    }
+                   });
+
+    return declare("qpid.management.query.MessageDialog",
+                   [dijit.Dialog, Evented],
+                   {
+                       postCreate:  function()
+                                    {
+                                      this.inherited(arguments);
+                                      this._postCreate();
+                                    },
+                       _postCreate: function()
+                                    {
+                                      var options = {};
+                                      if (this.message)
+                                      {
+                                         options.message = this.message;
+                                      }
+                                      var contentForm = new MessageDialogForm(options);
+                                      this.set("content", contentForm);
+                                      contentForm.on("execute", lang.hitch(this, this._onExecute));
+                                      contentForm.on("cancel", lang.hitch(this, this._onCancel))
+                                    },
+                       _onExecute:  function(stopDisplaying)
+                                    {
+                                      this.hide();
+                                      this.emit("execute", stopDisplaying);
+                                    },
+                       _onCancel:   function(data)
+                                    {
+                                      this.hide();
+                                      this.emit("cancel");
+                                    }
+                   });
+});

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/QueryBuilder.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/QueryBuilder.js?rev=1739648&r1=1739647&r2=1739648&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/QueryBuilder.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/QueryBuilder.js Sun Apr 17 20:29:54 2016
@@ -55,7 +55,7 @@ define(["dojo/_base/declare",
         "dijit/TooltipDialog",
         "dijit/Dialog",
         "dojo/Deferred",
-        "dojo/json"
+        "qpid/management/query/MessageDialog"
         ],
         function(declare,
                  lang,
@@ -76,7 +76,7 @@ define(["dojo/_base/declare",
                  WhereExpression
                  )
         {
-             var selectExpressionToArray =  function(value)
+            var selectExpressionToArray =   function(value)
                                             {
                                               var columns = [];
                                               if (value)
@@ -91,7 +91,7 @@ define(["dojo/_base/declare",
                                               return columns;
                                             };
 
-             var arrayToSelectExpression =  function(value)
+            var arrayToSelectExpression =   function(value)
                                             {
                                               var expression = "";
                                               if (lang.isArray(value))
@@ -105,7 +105,7 @@ define(["dojo/_base/declare",
                                               }
                                               return expression;
                                             };
-             var predefinedCategories =     [ {id: "queue", name: "queue"},  {id: "connection", name: "connection"} ];
+            var predefinedCategories =      [ {id: "queue", name: "queue"},  {id: "connection", name: "connection"} ];
 
             return declare( "qpid.management.query.QueryBuilder",
                             [dijit._Widget, dijit._TemplatedMixin, dijit._WidgetsInTemplateMixin],
@@ -145,6 +145,7 @@ define(["dojo/_base/declare",
                                 _searchScopeSelector: null,
                                 _lastCategory: null,
                                 _lastSearchQuery: null,
+                                _showWarningOnAdvancedWhereChanged: true,
 
                                 constructor: function(args)
                                              {
@@ -167,7 +168,8 @@ define(["dojo/_base/declare",
 
                                                // advanced mode widgets
                                                this.selectExpression.on("change", lang.hitch(this, this._advancedModeSelectChanged));
-                                               this.whereExpression.on("change", lang.hitch(this, this._advancedModeWhereChanged));
+                                               this.whereExpression.on("blur", lang.hitch(this, this._advancedModeWhereChanged));
+                                               this.whereExpression.on("change", lang.hitch(this, function(){this._showWarningOnAdvancedWhereChanged=true;}));
                                                this.selectExpression.on("keyUp", lang.hitch(this, this._advancedModeKeyPressed));
                                                this.whereExpression.on("keyUp", lang.hitch(this, this._advancedModeKeyPressed));
 
@@ -236,14 +238,49 @@ define(["dojo/_base/declare",
                                              },
                                 _advancedModeWhereChanged:  function()
                                              {
-                                               if (this._standardModeLastWhereExpression && !this._standardMode)
+                                               if (this._standardModeLastWhereExpression &&
+                                                   this._standardModeLastWhereExpression!= this.whereExpression.value &&
+                                                   !this._standardMode )
                                                {
-                                                 dijit.showTooltip("On switching into Standard Mode where expression"
-                                                                 + " will be erased. Copying of where expression from "
-                                                                 + " Advanced Mode into Standard Mode is unsupported!",
-                                                                 this.whereExpression.domNode,
-                                                                 this.whereExpression.get("tooltipPosition"),
-                                                                 !this.whereExpression.isLeftToRight());
+                                                 var userPreferences = this._management.userPreferences;
+                                                 var displayWarning = !userPreferences || !userPreferences.query ||
+                                                                     (userPreferences.query.displaySwitchModeWarning == undefined
+                                                                      || userPreferences.query.displaySwitchModeWarning );
+                                                 if (displayWarning && this._showWarningOnAdvancedWhereChanged)
+                                                 {
+                                                   if (!this._switchModeWarningDialog)
+                                                   {
+                                                     var that = this;
+                                                     this._switchModeWarningDialog = new qpid.management.query.MessageDialog({title: "Warning!",
+                                                                                                                             message: "<div>On switching into Standard Mode where expression will be erased.</div>"
+                                                                                                                                      + "<div>Copying of where expression from  Advanced Mode into Standard Mode is unsupported!</div>"},
+                                                                                                                             domConstruct.create("div"));
+                                                     this._switchModeWarningDialog.on( "execute",
+                                                                                       function(stopDisplaying)
+                                                                                       {
+                                                                                         if (stopDisplaying)
+                                                                                         {
+                                                                                            if (!userPreferences.query)
+                                                                                            {
+                                                                                              userPreferences.query= {};
+                                                                                            }
+                                                                                            userPreferences.query.displaySwitchModeWarning = false;
+                                                                                            userPreferences.save({query:  userPreferences.query});
+
+                                                                                         }
+                                                                                         else
+                                                                                         {
+                                                                                           that._showWarningOnAdvancedWhereChanged = false;
+                                                                                         }
+                                                                                       });
+                                                     this._switchModeWarningDialog.on( "cancel",
+                                                                                       function(val)
+                                                                                       {
+                                                                                         that.whereExpression.set("value", that._standardModeLastWhereExpression);
+                                                                                       });
+                                                   }
+                                                   this._switchModeWarningDialog.show();
+                                                 }
                                                }
                                              },
                                 _advancedModeSelectChanged: function()

Added: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/query/MessageDialogForm.html
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/query/MessageDialogForm.html?rev=1739648&view=auto
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/query/MessageDialogForm.html (added)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/query/MessageDialogForm.html Sun Apr 17 20:29:54 2016
@@ -0,0 +1,44 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+<form data-dojo-attach-point="containerNode" data-dojo-type="dijit/form/Form">
+    <div>
+        <div class="informationMessage" data-dojo-attach-point='messagePanel'>
+            <div data-dojo-attach-point='messageNode'>
+            </div>
+        </div>
+        <div class="messageExtra">
+            <input id="${id}_stopDisplaying"
+                   data-dojo-attach-point="stopDisplaying"
+                   data-dojo-type='dijit/form/CheckBox'
+                   name='stopDisplaying' value='true'/>
+            <span>Stop displaying this dialog</span>
+        </div>
+    </div>
+    <div class="dijitDialogPaneActionBar">
+        <input id="${id}_cancelButton"
+               data-dojo-attach-point="cancelButton"
+               data-dojo-type="dijit/form/Button"
+               type="button"
+               label="Cancel"/>
+        <input id="${id}_okButton"
+               data-dojo-attach-point="okButton"
+               data-dojo-type="dijit/form/Button"
+               type="button" label="Ok"/>
+    </div>
+</form>
\ No newline at end of file



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