-
Notifications
You must be signed in to change notification settings - Fork 555
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
Sections #398
base: dev
Are you sure you want to change the base?
Sections #398
Conversation
… and add one when an id is selected
… and add one when an id is selected
…o filter error messages
…upport to the MongoDB plugin
- removed the custom base sql option, which rightfully belongs in a plugin - added tests
WOW that's a lot of changes, it will take a while to review and test. Awesome work BTW; |
Thanks! It looks like I'll need to add some more tests to get coverage up. Would you rather I hold off on that till you've had a chance to make a first pass review? |
Go ahead, I can't do it right away. |
@@ -112,9 +124,15 @@ QueryBuilder.DEFAULTS = { | |||
allow_empty: false, | |||
conditions: ['AND', 'OR'], | |||
default_condition: 'AND', | |||
allow_sections: true, | |||
has_sections: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be in this.prop
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. Will move.
return !section.group.contains(node, true); | ||
} | ||
else { | ||
return true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not false
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be; will fix.
var self = this; | ||
|
||
if (filters === undefined) { | ||
if (Object.prototype.toString.call(delete_orphans) === '[object Array]') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Old js knowledge is old. Will fix.
* @param stypes {array} | ||
* @return {string} | ||
*/ | ||
QueryBuilder.prototype.getSectionTypeSelect = function(section, stypes) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't find any usage of this method.
{ | ||
id: 'subquery-a', | ||
label: 'Subquery A', | ||
base_sql: 'SELECT a_id FROM section_a WHERE parent_id = 10 AND ', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Derp, forgot to remove that.
General remarks :
The main problem I think is that it currently only works with "EXISTS" and "NOT EXISTS", it would be great to make it work with any operand that supports a subquery (about every operand actually). But in order to make it work, the builder needs to be able to build select clauses (like asked here #310). |
Section type (stype) is where you select which section you want to add. I'd initially called it "section_id" -- which makes more sense but collided with the internal section ID. I'm definitely open to calling it something else! (The function I like the idea of binding subqueries to different kinds of operators, and I'd be interested in doing that in the future, if there's a way to expand in that direction. I chose EXISTS/NOT-EXISTS because that's the shortest path to getting working sections -- my client has a lot of business logic that means I'm not really modeling the full subquery, just offering them a proxy of sorts to it and building the query from json later. Asking whether they want the section to be present or not is the only logical distinction they care about at this time. (Although now that you bring up the possibility, I could certainly see them asking for that functionality in the future.) My first attempt at writing this was as a plugin, but I ran into trouble because it changes the group->rule structure. I do know a lot more about the code now than I did then, though, so let me think about it and see if I can't come up with a way to rework this as a plugin that spawns extra builders within a special rule. I'm somewhat concerned I won't have enough time to get that big a change done by the time my client needs it, but I'll see what I can do. |
Quick update: I'm working on a little proof of concept using a plugin: The main problem right now is finding a way to prevent the buttons within the subquery from triggering events in the base query. If I can find a workaround for it, I think a plugin solution is possible. |
|
That did the trick. I'll push forward with the plugin and see if I can get it up to where this one is before I close it out. |
…nique-filter plugin
…g the exists flag
Hello, I was wondering what the status of this plugin was? I tried getting the source and running bower install in the project and was unable to get it to work. I'm kinda green when it comes to how to compile all of this so I'm not sure how to proceed. Thanks! |
I'm also curious if this progressed further. Perhaps at another location? |
Sorry, my client decided not to pursue this feature, so it's effectively abandoned. If anyone wants to pick it up, the most recent work is here -- https://github.com/rsterbin/jQuery-QueryBuilder/tree/subquery-plugin |
Do you guys think to add this feature? |
This is a new feature allowing you to add subqueries ("sections") with their own sets of filters.
Tests and existing plugins work, but not all features available to the root group are available for sections.
NB: I don't know MongoDB, so I've added an error if you try to use getRules and you have a section defined, but I hope that someone else can add that functionality.
Merge request checklist
dev
and I am issuing the PR todev
__locale
and__author
fields