couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From deathb...@apache.org
Subject couchdb commit: updated refs/heads/Query-Options-UI to 5464cd1
Date Tue, 18 Mar 2014 19:41:10 GMT
Repository: couchdb
Updated Branches:
  refs/heads/Query-Options-UI 1034032cc -> 5464cd146


Update Keys to be JSON instead of trying to configure that for the user


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/5464cd14
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/5464cd14
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/5464cd14

Branch: refs/heads/Query-Options-UI
Commit: 5464cd14699dcb8f93a9e199fafc3c0f807d243b
Parents: 1034032
Author: suelockwood <deathbear@apache.org>
Authored: Tue Mar 18 12:36:32 2014 -0400
Committer: suelockwood <deathbear@apache.org>
Committed: Tue Mar 18 12:40:56 2014 -0400

----------------------------------------------------------------------
 .../documents/templates/advanced_options.html   |  2 +-
 src/fauxton/app/addons/documents/views.js       | 44 ++------------------
 2 files changed, 4 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/5464cd14/src/fauxton/app/addons/documents/templates/advanced_options.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/documents/templates/advanced_options.html b/src/fauxton/app/addons/documents/templates/advanced_options.html
index 8e78bcb..4ca8f12 100644
--- a/src/fauxton/app/addons/documents/templates/advanced_options.html
+++ b/src/fauxton/app/addons/documents/templates/advanced_options.html
@@ -28,7 +28,7 @@ the License.
   <div class="controls-group well">
     <div class="row-fluid" id="js-showKeys">
       <div class="controls controls-row">
-        <input name="keys" class="input-xxlarge" type="text" placeholder="Enter a key,
or list of keys seperated by a comma.">
+        <input name="keys" class="input-xxlarge" type="text" placeholder="Enter a key,
an array of keys. This must be valid JSON.">
       </div>
     </div>
     <div class="row-fluid hide" id="js-showStartEnd">

http://git-wip-us.apache.org/repos/asf/couchdb/blob/5464cd14/src/fauxton/app/addons/documents/views.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/documents/views.js b/src/fauxton/app/addons/documents/views.js
index 1cdfee9..49ce286 100644
--- a/src/fauxton/app/addons/documents/views.js
+++ b/src/fauxton/app/addons/documents/views.js
@@ -1132,42 +1132,15 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
resizeColum
       this.hasReduce = hasReduce;
       this.render();
     },
-    getKeys: function(val){
-      var keys = val.value.replace(/\s/g,"");
-      
-      var regKeys = keys.match(/(\[.*?\])/g); 
-      if (regKeys) {
-        keys = regKeys;
-      } else {
-        keys = keys.split(',');
-      }
-
-      keys = _.map(keys, function (key) { return JSON.parse(key); });
-
-      if (_.isArray(keys)){
-        return {
-          name: "keys",
-          value: JSON.stringify(keys)
-        };
-      } else if (keys.length === 1) {
-        return {
-          name: "key",
-          value: keys[0]
-        };
-      }
+    validateKeys:  function(val){
+      return JSON.parse(val);
     },
     queryParams: function () {
-      var $form = this.$(".js-view-query-update"),
-          getKeys = this.getKeys;
+      var $form = this.$(".js-view-query-update");
 
       var params = _.reduce($form.serializeArray(), function(params, param) {
         if (!param.value) { return params; }
         if (param.name === "limit" && param.value === 'None') { return params; }
-        
-        if (param.name === "keys"){
-          param = getKeys(param);
-        }
-
         params.push(param);
         return params;
       }, []);
@@ -1249,17 +1222,6 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
resizeColum
           }
           this.updateFiltersFor(key, $ele);
           break;
-          case "keys":
-            val = JSON.parse(val);
-            var processVal = val;
-            if (_.isArray(val)) {
-              processVal = _.map(val, function (arr) {
-                return JSON.stringify(arr);
-              }).join(', ');
-            }
-
-            $form.find("input[name='keys']").val(processVal);
-            break;
           default:
             $form.find("input[name='"+key+"']").val(val);
           break;


Mime
View raw message