[GitHub] couchdb pull request: Improved Query Options
Github user garrensmith commented on the pull request: https://github.com/apache/couchdb/pull/180#issuecomment-38259646 This has been merged. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb pull request: Improved Query Options
Github user garrensmith closed the pull request at: https://github.com/apache/couchdb/pull/180 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb pull request: Improved Query Options
Github user kxepal commented on the pull request: https://github.com/apache/couchdb/pull/180#issuecomment-38250360 For history: I'm +1 on technically part. Have sent @deathbearbrown yesterday screenshot with possible relocation of error message box, waiting for her decision. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb pull request: Improved Query Options
Github user kxepal commented on the pull request: https://github.com/apache/couchdb/pull/180#issuecomment-38157205 That was `1` - valid JSON, but invalid keys value. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb pull request: Improved Query Options
Github user garrensmith commented on the pull request: https://github.com/apache/couchdb/pull/180#issuecomment-38157022 Could you give me an example of valid Json. I don't quite understand what you are inputting. All misspelling thanks to my iPhone > On 20 Mar 2014, at 12:41 PM, Alexander Shorin wrote: > > Now it doesn't report anything if keys textarea has invalid JSON value (: > > â > Reply to this email directly or view it on GitHub. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb pull request: Improved Query Options
Github user kxepal commented on the pull request: https://github.com/apache/couchdb/pull/180#issuecomment-38153594 Also, bug: http://i.imgur.com/EropqtH.png Just enter non JSON array value and click multiple times on Query button. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb pull request: Improved Query Options
Github user kxepal commented on the pull request: https://github.com/apache/couchdb/pull/180#issuecomment-38153349 Btw, how about to place error message block somewhere right under Query button? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb pull request: Improved Query Options
Github user kxepal commented on the pull request: https://github.com/apache/couchdb/pull/180#issuecomment-38153220 Now it doesn't report anything if keys textarea has invalid JSON value (: --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb pull request: Improved Query Options
Github user garrensmith commented on the pull request: https://github.com/apache/couchdb/pull/180#issuecomment-38151931 I've added some keys validation. It now checks the keys and determines if it is an array or not. It also has an error message next to the keys if the input is not an array. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb pull request: Improved Query Options
Github user kxepal commented on the pull request: https://github.com/apache/couchdb/pull/180#issuecomment-38143227 BIG + for keys text area! Bug: on invalid keys value (like `1`) spinner runs forever. Bug: on invalid keys value type (not an array) query limit parameter sets automagically to 100. Notice: on invalid keys value (but valid JSON) error report shows on top of the page (An Error occurred`keys` must be an array of strings.), while on invalid JSON value error shows inside Query Options tab (Make sure that strings are properly quoted and any other values are valid JSON structures). --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb pull request: Improved Query Options
Github user garrensmith commented on the pull request: https://github.com/apache/couchdb/pull/180#issuecomment-38142527 The PR is now updated. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb pull request: Improved Query Options
Github user kxepal commented on the pull request: https://github.com/apache/couchdb/pull/180#issuecomment-38135676 Probably, it'll not. @garrensmith could you update this PR? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb pull request: Improved Query Options
Github user deathbearbrown commented on the pull request: https://github.com/apache/couchdb/pull/180#issuecomment-38070736 I re-enabled Skip and Limit. I changed the keys field to be a textarea so there is more room to add stuff and so that when clicking from bounded and keys, you don't get as much of a jump. I also fixed the issue in _all_docs where errors are returned. This should update on the git mirror soon. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb pull request: Improved Query Options
Github user kxepal commented on the pull request: https://github.com/apache/couchdb/pull/180#issuecomment-38036253 Ok, the bug with URL copy isn't related to this PR since it happens because Fauxton process incorrently quest to _all_docs with keys: in case when key is missed the _all_docs returns error report about while regular views are just ignores such in response. So only question about Skip/Limit is left. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb pull request: Improved Query Options
Github user kxepal commented on the pull request: https://github.com/apache/couchdb/pull/180#issuecomment-38034222 > Bug: Try to enter on Specific Keys tab some array, query the view and copy URL to another browser (Chrome->Firefox), or open it in another tab). Fauxton will not be able to render such page. More details: actually that happens only if some key in the specified keys array is missed in view. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb pull request: Improved Query Options
Github user kxepal commented on the pull request: https://github.com/apache/couchdb/pull/180#issuecomment-38033485 Bug: Try to enter on Specific Keys tab some array, query the view and copy URL to another browser (Chrome->Firefox), or open it in another tab). Fauxton will not be able to render such page. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb pull request: Improved Query Options
Github user kxepal commented on the pull request: https://github.com/apache/couchdb/pull/180#issuecomment-38033274 Bug: quick double click on Query for Specific keys tab allows to show spinner forever. Until next different query (e.g. one that wouldn't cause CouchDB return 304 response). --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb pull request: Improved Query Options
Github user kxepal commented on the pull request: https://github.com/apache/couchdb/pull/180#issuecomment-38033014 Btw, is it possible to highlight the field where invalid JSON was detected? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb pull request: Improved Query Options
Github user kxepal commented on the pull request: https://github.com/apache/couchdb/pull/180#issuecomment-38032831 Why limit/skip are disabled for "Specific Keys" tab? Since they actually could be used with such request. I would like to note, that options layout is completely in chaos, but I hope the new design will fix all these bits. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb pull request: Improved Query Options
Github user kxepal commented on the pull request: https://github.com/apache/couchdb/pull/180#issuecomment-38031911 Let me test a bit for 10 minutes. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb pull request: Improved Query Options
Github user garrensmith commented on the pull request: https://github.com/apache/couchdb/pull/180#issuecomment-38031755 +1 I'm happy with this. @kxepal what do you think? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb pull request: Improved Query Options
Github user kxepal commented on a diff in the pull request: https://github.com/apache/couchdb/pull/180#discussion_r10659855 --- Diff: src/fauxton/app/addons/documents/views.js --- @@ -1090,20 +1117,48 @@ 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); }); --- End diff -- How about to a bit simplify the logic: try `JSON.parse(val.value)` first. If it fails - wrap it with `[` and `]` and try again? No need to regex, no need to map and make multiple `JSON.parse` calls. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb pull request: Improved Query Options
Github user kxepal commented on a diff in the pull request: https://github.com/apache/couchdb/pull/180#discussion_r10659543 --- Diff: src/fauxton/app/addons/documents/views.js --- @@ -1090,20 +1117,48 @@ 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); --- End diff -- @garrensmith the idea is ok, but if I just copy my `keys` value to Fauxton without any braces striping it'll fail to search anything. And even if so, here is another test case: > "[[1,2,3]],[[4,5,6]]".match(/(\[.*?\])/g) > ["[[1,2,3]", "[[4,5,6]"] --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb pull request: Improved Query Options
Github user garrensmith commented on a diff in the pull request: https://github.com/apache/couchdb/pull/180#discussion_r10650943 --- Diff: src/fauxton/app/addons/documents/views.js --- @@ -1178,6 +1233,17 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, resizeColum } this.updateFiltersFor(key, $ele); break; + case "keys": --- End diff -- No, a user sees a comma separated list when viewing keys. However the url is an array of keys so we need to remove the array and make it a string. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb pull request: Improved Query Options
Github user garrensmith commented on a diff in the pull request: https://github.com/apache/couchdb/pull/180#discussion_r10650925 --- Diff: src/fauxton/app/addons/documents/views.js --- @@ -1090,20 +1117,48 @@ 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); }); --- End diff -- See my previous comment to explain why we do all of this. Its because we changing way the user inputs keys (to make it simpler) to the way Couchdb requires the keys parameter. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb pull request: Improved Query Options
Github user garrensmith commented on a diff in the pull request: https://github.com/apache/couchdb/pull/180#discussion_r10650864 --- Diff: src/fauxton/app/addons/documents/views.js --- @@ -1090,20 +1117,48 @@ 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); --- End diff -- @kxepal this is correct. What we get from the user is a list of keys e.g 1,2,3 or [1,2],[3,4]. We then need to split that string up into individual keys and put it in an array for `keys` to work. That is what we are doing. The idea around this is so that the user doesn't need to create an array when adding keys elements. Just a comma separated list. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb pull request: Improved Query Options
Github user kxepal commented on a diff in the pull request: https://github.com/apache/couchdb/pull/180#discussion_r10632393 --- Diff: src/fauxton/app/addons/documents/views.js --- @@ -1090,20 +1117,48 @@ 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); }); --- End diff -- I don't think that support something older than IE8 is ever reasonable in 2014. But my note was not about browser support about about to replace all code in 1121-1130 lines with just `keys = JSON.parse(val.value)`. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb pull request: Improved Query Options
Github user deathbearbrown commented on a diff in the pull request: https://github.com/apache/couchdb/pull/180#discussion_r10632272 --- Diff: src/fauxton/app/addons/documents/views.js --- @@ -1090,20 +1117,48 @@ 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); }); --- End diff -- Just a note on this one, if we aren't supporting older than IE8, we can use JSON.parse() @kxepal we originally didn't want to because of a concern around browser support. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb pull request: Improved Query Options
Github user kxepal commented on a diff in the pull request: https://github.com/apache/couchdb/pull/180#discussion_r10631275 --- Diff: src/fauxton/app/addons/documents/views.js --- @@ -1178,6 +1233,17 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, resizeColum } this.updateFiltersFor(key, $ele); break; + case "keys": --- End diff -- Isn't there any logic duplication with changes above? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb pull request: Improved Query Options
Github user kxepal commented on a diff in the pull request: https://github.com/apache/couchdb/pull/180#discussion_r10631246 --- Diff: src/fauxton/app/addons/documents/views.js --- @@ -1090,20 +1117,48 @@ 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); }); --- End diff -- Could this be more simple: instead of regex, split and iteration over the array with validation of every item to be valid JSON, just `JSON.parse(keys)` - if `keys` is a valid JSON array, all elements inside are also have valid JSON format. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb pull request: Improved Query Options
Github user kxepal commented on a diff in the pull request: https://github.com/apache/couchdb/pull/180#discussion_r10631133 --- Diff: src/fauxton/app/addons/documents/views.js --- @@ -1090,20 +1117,48 @@ 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); --- End diff -- This wouldn't work correctly if key is array and you need to filter by multiple of them: > "[[1,2,3],[4,5,6]]".match(/(\[.*?\])/g) > ["[[1,2,3]", "[4,5,6]"] --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb pull request: Improved Query Options
GitHub user garrensmith opened a pull request: https://github.com/apache/couchdb/pull/180 Improved Query Options Improved query options view. With all the query options broken up and grouped more appropriately. You can merge this pull request into a Git repository by running: $ git pull https://github.com/garrensmith/couchdb Query-Options-UI Alternatively you can review and apply these changes as the patch at: https://github.com/apache/couchdb/pull/180.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #180 commit 7595fd4f44e8528e9a860c740dc9d0cd82258a83 Author: suelockwood Date: 2014-02-21T18:42:45Z Cleaning up query options UI commit 32add596aa33422b3238fbb644d4471ac4b9b308 Author: suelockwood Date: 2014-03-05T19:27:44Z 2183 (JIRA) remove stale from query options commit 28ce3961c906f734519c5c22d0cfde52fae1129d Author: Garren Smith Date: 2014-03-06T10:21:20Z Fix linting issue commit 0687d479b607ce63e55e288fe2b25175737ed175 Author: Garren Smith Date: 2014-03-11T15:48:50Z initial linking with paginate commit 1295cce44da89be044d31f95987e4351fe658423 Author: Garren Smith Date: 2014-03-14T16:05:55Z Improved key support --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---