Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

INT-456 QB improvements #106

Merged
merged 35 commits into from
Aug 24, 2015
Merged

INT-456 QB improvements #106

merged 35 commits into from
Aug 24, 2015

Conversation

rueckstiess
Copy link
Member

  • dynamic redraw instead of creating each chart from scratch
  • click-drag range queries on strings/numbers/dates/objectids
  • improved event handling in preparation for backward pass

And now for something mind-blowing:

query_builder_steroids

@kangas
Copy link
Contributor

kangas commented Aug 13, 2015

First impression: this looks terrific! A few minor issues that I see:

1: When click-drag works, it's brilliant. Caveats:

  • It doesn't work in the "bar.few" chart type (only shift-click works)
  • Cannot initiate click-drag when the cursor is over a selectable element. I have to move the cursor to "blank" space in the chart before I can initiate click-drag.

Let's try to make click-drag work consistently in all the chart types. I think we should support click-drag as our primary "multiple selection" mechanism, and "shift/command click" as a secondary mechanism. IMO, click-drag is what people will try first. (User testing will be the final arbiter, of course.)

2: Bug? When I run this locally, I see that the "This report is based on a sample of 100 documents" is invisible until the minicharts load. Thus our "progress indicator" of an increasing document count is gone.

EDIT: per @imlucas 's comment, I now see this is also true in master. I'll add a ticket to re-add a progress indicator. We probably need to try a few different designs.

@imlucas
Copy link
Contributor

imlucas commented Aug 13, 2015

2: Bug? When I run this locally, I see that the "This report is based on a sample of 100 documents" is invisible until the minicharts load. Thus our "progress indicator" of an increasing document count is gone.

@kangas has been like this for a while (removed as it's super expensive on perf). Perhaps we make the progress-bar at the top determinate by running an async count. This also addresses I refine a query; how many docs actually matched?

@imlucas imlucas force-pushed the INT-456-QB-backwards-pass branch from ea535a0 to d45d900 Compare August 13, 2015 16:14
@imlucas
Copy link
Contributor

imlucas commented Aug 13, 2015

@rueckstiess once #1 above resolved, :shipit:

@rueckstiess
Copy link
Member Author

Problem 1. is unfortunately not trivial to solve. As Mike Bostock explains himself here, the brush component (that does the drag selection behavior) and the onclick mouse handler for the individual items compete. When the elements are above the brush (current implementation), they can only handle the clicks, not the dragging behavior.

I can try one of the alternatives he suggests in that issue (e.g. manually passing events from one handler to another), but it's a question of time to get it work.

@rueckstiess
Copy link
Member Author

One idea to solve this: remove click handler, and only use the drag handler. Measure the dragged extent distance, and if it's minimal, interpret as click, manually forward event to original click handler. I need to test if that works.

Don't merge this PR yet

…to INT-456-QB-backwards-pass

# Conflicts:
#	src/minicharts/d3fns/boolean.js
#	src/minicharts/d3fns/date.js
#	src/minicharts/d3fns/few.js
#	src/minicharts/d3fns/many.js
#	src/minicharts/d3fns/number.js
#	src/minicharts/d3fns/string.js
#	src/minicharts/querybuilder.js
#	src/minicharts/viz.js
# Conflicts:
#	src/minicharts/d3fns/date.js
#	src/minicharts/d3fns/few.js
#	src/minicharts/d3fns/many.js
@rueckstiess
Copy link
Member Author

Latest update (d0e9dd5)

Click-drag behavior works in both cases now:

  1. when initiated on the white background
  2. when initiated on one of the blue elements

Click-drag and regular click (or shift-click) work interchangeably and can be combined, e.g. click-drag a range of string elements, then shift-click one individual to remove from the range. Note, this will not work with numbers, dates, objectids, because we only support continuous ranges on those types ($gte, $lt).

Click-drag works on the "few" charts now as well. While not as useful as for the histogram bars ("many"), it is now consistent behavior with the other charts.

The overall behavior feels very intuitive to me now. Nonetheless we should conduct more user tests with the new query builder and see if users have less issues building complex queries.

@rueckstiess
Copy link
Member Author

Backwards pass implemented

This required a lot of changes (sorry but the code review will be substantial). I had to rewire the entire query builder up and down path.

This update also requires a minor addition in mongodb-schema, so test this PR with a npm link'ed local copy of the mongodb-schema#dotted-path-added branch.

Check out how the refine bar updates in realtime while dragging the range selection, and how the selection updates while typing the query...

query_builder_up_and_down

@kangas
Copy link
Contributor

kangas commented Aug 23, 2015

Query builder not working for me when I build locally on INT-456-QB-backwards-pass @ a7a8ce1

EDIT: works well when I "npm link mongodb-schema#dotted-path-added" per above. Let's merge mongodb-js/mongodb-schema#25

"npm run check" reports 3 errors which are all "X is defined but never used". Please fix them before merging.

I noticed that "node_modules/pre-commit/hook" is running mocha, rather than ./node_modules/.bin/mongodb-js-precommit. This might explain how the above "run check" errors has crept in. Submitted #108 to resolve.

@kangas
Copy link
Contributor

kangas commented Aug 23, 2015

Modulo the "npm run check" errors, :shipit:

@rueckstiess
Copy link
Member Author

FYI @imlucas @kangas

"Partial" selections on ranges, when the minichart cannot correctly represent the query range because the bounds are half-way between a bar or the operator is $gt instead of $gte.

query_builder_partial

kangas added a commit that referenced this pull request Aug 24, 2015
@kangas kangas merged commit 59e04e5 into master Aug 24, 2015
gribnoysup pushed a commit that referenced this pull request Apr 26, 2021
* COMPASS-213: Pass readonly options to collections

* COMPASS-213: Fix tests, bump collection model
mcasimir pushed a commit that referenced this pull request Jun 25, 2021
mcasimir pushed a commit that referenced this pull request Jun 25, 2021
mcasimir added a commit that referenced this pull request Jun 28, 2021
* move language-specific enums into object; can maybe then use them in codegenerator generically

* Merge pull request #21 from mongodb-js/errors-handling

Errors handling

* Use Symbol table generated from YAML file (#23)

* remove test yaml function

* Add symbols to generator only once

* Remove all visit methods from JavaGenerator

* Rename ecmascript to javascript

* Errors handling and refactoring for using classes instead of prototypes

* Move generators into their own dirs

* Move JavaGenerator into function

* Make both csharp and python generators into functions

* Add shell

* Small fixes

* Update package API and tests

* Set version to 0.0.0

* Update README

* Public package

* remove path-resolve

* 0.0.2

* Improve comments

* Separate json test files by input language

* Add shell error file

* remove old test files

* Avoid using fs

* Use shell not javascript for compile from shell

* Generate symbol table with script

* Add python/csharp/shell

* Fix bug for optional types and include BSON numeric type

* Build symbol table before tests

* Use strings instead of numbers for test

* Cast argument to expected type if numeric

* Add _long; don't cast BSON numeric types

* Add Number to casting

* Merge pull request #40 from mongodb-js/COMPASS-2623-add-bson-to-python-symbol-table

COMPASS-2623 Add BSON object built-in functions to Python symbol table

* Add shell bson constructors as input language (#41)

Also adds functionality in javascript for new Date

* Merge pull request #43 from mongodb-js/COMPASS-2622-2623-bson-object-methods-and-utils

Finished bson object methods and bson utils

* work with objects and arrays

* get numbers working csharp with symbol + emit

* make min/max key emit in generator

* add decimal128 + proper comments

* fix template for methods on bson types

* parsing decimal128 requries a TryParse

* rebase of master and change emit calls based on recent changes

* add back lib to gitingore and get rid of java lexer/parser

* Turn MaxKey into function call for shell

* Remove support for toJSON methods

* Remove support for new X

* Run tests again

* Set ctx.type in emit methods

* Allow js ObjectId.createFromTime to take date

* Add shell bson utils to symbol table + tests

* Add shell bson methods to symbol table + tests

* Java tests all running in jvm

* Java tests all running in jvm

* Add various attributes to js input

* work with objects and arrays

* get numbers working csharp with symbol + emit

* make min/max key emit in generator

* make dates work in c#

* add date.now generation

* add c# date tests

* make regex work in c#

* fix date, regex, and octals based on @aherlihy's review

* More JS/Shell tests

* BSON constructors shell --> javascript

* JS constructors shell --> javascript

* JS/BSON utils shell --> javascript

* BSON methods shell --> javascript

* Rename js to language

* Move JS specific code out of generators

* 0.0.3

* fixing package.json + npm version mismatch

* 0.0.5

* webpack / browser does not handle path.resolve

* 0.0.6

* bson code methods

* add object id bson methods

* binary object methods

* dbref object methods

* int32 value of method

* fix double templates

* decimal128 object method

* add timestamp methods

* add long bson methods

* symbol object methods

* add back output lang in code generation tests

* bson utils added to c# templates

* fix templates after rebasing off master

* bson utils for c# with correct templates

* fix rebase errors with bson double args

* 0.1.0

* Merge pull request #64 from mongodb-js/COMPASS-2790-shell-to-python

Compass 2790 shell to python

* Merge pull request #62 from mongodb-js/add-docs

add an API section to readme

* 0.2.0

* Remove emitBinaryFromJS (#68)

* fix int64 compiler errors

* fix errors that dotnet compiler wasn't liking

* sub bsonobjectid with just object id

* can't do try parse on decimal128

* fix bsonint64 comparison operations

* fix remainder of int64 errors

* fix number, regex and object create methods

* Remove emitBinData

* Rename BinaryFromJS to Binary

* Add comments + move shell process methods into shell visitor

* Move BSONRegExp into process/emit pattern

* Add support for JS --> Shell

* Add getTyped

* accept env variables as output/input params

* Merge pull request #66 from mongodb-js/some-validation-cases-ideas

Some validation cases ideas

* Misc Idiomatic Java

* More idiomatic java numbers

* Turn off csharp tests for Double/Int32

* fix numericals in c#

* return more coherent numbers in c#
* if the original number passed in as arg takes a string, return a parse function

* Merge pull request #85 from mongodb-js/COMPASS-2804-write-error-tests-for-python

COMPASS-2804 write error tests for python

* 0.2.1

* Remove Code.toString; Use java doc constructor

* bson-constructors for shell-csharp (#86)

* fix tests for shell-csharp bson constructors

* implement bson-constructors

* add import string as export

* Add import string as export
* Update README; add csharp imports

* add file for generating target language files

* Add helper file for creating runnable tests
* Update test file for python
* make test file for c#
* CR comments
* Add JS output
* Use imports

* check if a float string is passed in to do a float.parse

* Misc Idiomatic Python (#89)

* Python idiomatic fixes

* Template fixes

* test updates

* Fix Number for python

* Java Numeric Bugfix (#90)

* tests

* Fix octal casting

* add shell-c# bson-methods + bson-utils

* language types shell-c#

* shell-c# language tests
* fix date time ToString in js and shell

* Rename errors and fix bugs

* Add RangeError

* Sort error tests by error type

* don't skip tests if not in unsupported

* add error documentation

* Allow running test by mode

* Fix error tests

* Throw unimplemented errors

* Start compilation from root node

* Add tests for other semantic errors

* Syntax Tests + Fixes (#105)

* 0.3.0

* Tests for function calls without args (#106)

* fix nested documents bugs in c# and python (#107)

* fix bug in python + csharp in nested documents

* add a few extra nested tests

* contributing.md: project architecture docs

* Missing step for adding a new language in contrib

* bump node to 9.8.0

* Remove support for Binary/BinData

* remove initial \n in import strings (#111)

* 0.3.1

* add depth param to help with object/array indents

* 0.4.0

* insert indents in java arrays

* v0.4.1

* remove example package name in java imports

* 0.4.2

* Remove depth argument (#115)

* add tree visiting diagram

* 0.4.3

* Skip array elements that generate only commas

* 0.5.0

* indent items in csharp arrays (#117)

* Add args template for arrays

* indent items in csharp arrays

* move .join logic for arrays to args template

* v0.5.1

* Bump mongodb to 3.1.0 (#118)

* Support for using Java generators. (#119)

* Support for using Java generators.

* Add geoJSON support

* Remove |

* 0.6.0

* Set code to use non idiomatic objects

* Set default to using builders

* Imports now being generated by usage

* Documentation changes

* 0.7.0

* Agg tests

* Use BsonNull in java instead of null

* Adding package.json

* 0.7.2

* Allow getImports before compile

* 0.7.3

* Rename Bson-Compilers to Bson-Transpilers

* README fix

* 0.8.0

* Bump driver dependency

* 0.9.0

* Generators never directly access the tree (#126)

* Add Python as input language (#127)

* Add outline for python input

* grammar updated to python3 java version

* python grammar fixes

* generating simple statements

* updates

* tests for language-types

* indivual literals working

* simple literals

* obj for non-java

* non-java array/tuple

* java obj/array/tuple

* readded tests for idiomatic but w python

* idiomatic objects working from python

* binary ops + compare done

* finish idiomatic

* fill out symbol table

* prelim function calls

* Add attr access basic

* BSON types other than numbers + date/regex

* numerical types

* csharp java tests passing

* tests passing

* readd tests

* Dates fixed and moved into templates

* move regex flags into templates

* add generate helpers to js visitor

* python language-types passing

* python constructor tests done

* Add commented sample template file

* bson-methods and bson-utils tests added (not passing)

* All methods + utils except regex + objectid

* all but regex

* Syntax updates

* Python syntax tests done

* eslint

* Add first python error test

* argument errors done

* All python tests but unimplemented

* Python tests done

* Tests passing

* imports working for python

* tests now one line

* json test running

* using YAML not JSON

* idiomatic in json/yaml

* idiomatic in json/yaml

* idiomatic using yaml

* more YAML tests

* Start casting test

* python casting tests failing for neg numbers

* casting tests

* bson-constructors moved to yaml

* objects + arrays

* rename

* more native types

* Dates

* native types done

* syntax tests done

* bson-methods

* success tests removed

* argument-error

* syntax

* test refactor done :)

* eslint

* all but casting int working

* All but unwind

* all casting tests passing

* update javascript visitor to not set type to first child

* empty visitor class added; tests fixed

* eslint

* move imports to codegenvisitor

* more shared code

* Add better error checking

* move function generation into shared visitor

* move identifier generation into shared visitor

* move attribute generation into shared visitor

* move object generation into shared visitor

* move array generation into shared visitor

* move numeric constructor generation into shared visitor

* do literals next

* part-way through casting refactor

* contiued

* finish moving casting/literals into shared visitor

* eslint

* only use templates if defined

* Add possible bson types to shared visitor

* line length

* Add native regex to python

* Add named arguments to python (#128)

* All working but re.compile

* Finish named args

* update docs

* more docs

* contributing typo

* COMPASS-3196: Bump Node driver dependencies

* 0.10.0

* Add support for translating to javascript objects (#129)

* Don't include all the src in the published artifact

* Using BSON 4.0.x:

- [x] JS Symbol -> BSONSymbol
- [x] All JS types now require new keyword in constructor
- [ ] Fix remaining Long test failures

* Fix remaining Long issues in the test suite

* Fix 3 new Long misses

* Use default symbol args template in java

* 0.11.0

* Fix JS Symbol output

* 0.11.1

* Change test to use shell as input for Symbol

* 0.11.2

* Need codegeneration module

* 0.11.3

* Need helper module

* 0.11.4

* Need config module

* 0.11.5

* Fix up make-test-file (#132)

* 0.11.6

* Update README with supported langs

* Merge pull request #133 from mongodb-js/add-git-info

COMPASS-3823: Add git info for license metadata

* Generate Drivers Syntax for Node & Python (#134)

* 0.12.0

* Update shell driver syntax

* Add driver syntax for java

* Add tests

* Throw error for csharp driver syntax

* 0.13.0

* minor fixes for driver syntax

* Test updates

* 0.13.1

* Add extra newline before connect in javascript

* Update tests

* 0.13.2

* Add comments to driver code; use mongodb instead of bson for node

* 0.13.3

* Added powerpoint slides for transpilers talk

* use PDF

* Merge pull request #135 from mongodb-js/update-antlr

Update ANTLR to 4.7.2

* fix: pin antlr4 version

* 0.13.4

* Update CONTRIBUTING.md

* Merge pull request #138 from mongodb-js/ignore-pdf

chore: do not publish pdf and download antlr

* Merge pull request #140 from mongodb-js/move-pdf-to-google-docs

docs: move pdf to google docs

* 0.13.5

* Merge pull request #141 from mongodb-js/export-fn-to-js

feat: compile functions to js

* 0.13.6

* Merge pull request #142 from mongodb-js/fix-fn-whitespaces

fix functions whitespaces

* 0.14.0

* Merge pull request #143 from mongodb-js/clean-deps

chore: update and clean dependencies

* 0.15.0

* chore(monorepo): add bson-transpilers

* remove ignored pre-commit and regen package-lock

* remove package-lock

* update license

* add star dep for bson-transpilers

* regen package lock

* update scripts

* fix dep alignment and add depcheck to ci

* add depcheck to precheck-ci

* remove precommit

* remove compile from ci

* fix pretest

* regen package-lock

* chore(bson-transpilers): fix eslint

Co-authored-by: aherlihy <anna.herlihy@10gen.com>
Co-authored-by: Alena Khineika <alenakhineika@users.noreply.github.com>
Co-authored-by: Alena Khineika <alena.khineika@gmail.com>
Co-authored-by: Irina Shestak <shestak.irina@gmail.com>
Co-authored-by: Durran Jordan <durran@gmail.com>
Co-authored-by: Irina Shestak <lrlna@users.noreply.github.com>
Co-authored-by: Lucas Hrabovsky <hrabovsky.lucas@gmail.com>
Co-authored-by: Rhys <Anemy@users.noreply.github.com>
Co-authored-by: Anemy <rhysh@live.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants