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

feat(jexl): add cross-form jexl resolution #154

Merged
merged 3 commits into from
Apr 29, 2019

Conversation

czosel
Copy link
Contributor

@czosel czosel commented Apr 24, 2019

This allows specifying cross-form jexl expressions like that:

  • "sub1.question1"|answer // will look for answer to "question1" in child form "sub1"
  • "parent.question1"|answer // will look for answer to "question1" in parent document
  • "parent.sub1question1"|answer // will look answer to "question1" in sibiling document "sub1"

This allows specifying cross-form jexl expressing like that:

- "question1"|answer("sub1") // will look for answer to "question1" in child form "sub1"
- "question1"|answer("parent") // will look for answer to "question1" in parent document
- "question1"|answer("parent.sub1") // will look answer to "question1" in sibiling document "sub1"
@czosel czosel requested a review from kaldras April 24, 2019 07:39
@czosel
Copy link
Contributor Author

czosel commented Apr 24, 2019

@kaldras This is not completely finished yet, but I'd like to get your feedback on the design.

@czosel
Copy link
Contributor Author

czosel commented Apr 24, 2019

/cc @winged @open-dynaMIX considering that we'll have to implement this in the backend as well 😉

@czosel czosel marked this pull request as ready for review April 24, 2019 07:42
@czosel czosel changed the title feat(jexl): add cross-form jexl resolution WIP: feat(jexl): add cross-form jexl resolution Apr 24, 2019
@kaldras
Copy link
Contributor

kaldras commented Apr 24, 2019

As discussed with @czosel this seems like a good solution! 👍 If the backend implementation proves no problem or issues which we didn't thought about, I suppose we implement it this way.

@czosel czosel force-pushed the cross-form-jexl branch 3 times, most recently from 0810cab to b7f2791 Compare April 28, 2019 11:01
@czosel czosel changed the title WIP: feat(jexl): add cross-form jexl resolution feat(jexl): add cross-form jexl resolution Apr 28, 2019
@czosel czosel requested a review from fkm April 28, 2019 11:18
@czosel
Copy link
Contributor Author

czosel commented Apr 28, 2019

@kaldras @fkm ready for review.

@fkm
Copy link
Contributor

fkm commented Apr 29, 2019

I wonder if we could have a problem with people naming their forms/documents "parent".

But I like the idea of the traversal! Close enough to DOM to feel like home 😃

@czosel
Copy link
Contributor Author

czosel commented Apr 29, 2019

I had the same thought yesterday! What do you think about making sure that form's cant be called parent in the form builder?

@fkm
Copy link
Contributor

fkm commented Apr 29, 2019

Yeah. We could introduce a list of reserved words. I would have just called it "PARENT" or something for the traversal as slugs need to be lower-case. But I like your idea! Much cleaner.

@czosel
Copy link
Contributor Author

czosel commented Apr 29, 2019

I've also toyed with the idea of using ../ to get one layer up, but I decided against it because then people will start expecting all the other features of file system traversal like ./ and whatnot 😉

@fkm
Copy link
Contributor

fkm commented Apr 29, 2019

I also prefer the named route. Having reserved words for slugs might come in handy later on anyway. And if it's a list of words we only need one error-message and other handling.

@czosel
Copy link
Contributor Author

czosel commented Apr 29, 2019

@fkm I tweaked the API as suggested in projectcaluma/caluma#398 (comment).
Can you take another look?

Copy link
Contributor

@fkm fkm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

@czosel czosel merged commit c137e29 into projectcaluma:master Apr 29, 2019
@czosel czosel deleted the cross-form-jexl branch April 29, 2019 15:33
@czosel
Copy link
Contributor Author

czosel commented May 8, 2019

🎉 This PR is included in version 0.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@czosel czosel added the released label May 8, 2019
czosel pushed a commit that referenced this pull request May 22, 2019
# [0.1.0](v0.0.4...v0.1.0) (2019-05-22)

### Bug Fixes

* **cf-navigation:** add compute watcher on hidden state ([#225](#225)) ([41ba470](41ba470))
* **cf-navigation:** add minor safety checks ([#217](#217)) ([cf3ca9e](cf3ca9e))
* **cf-navigation:** auto-link empty form sections to first subsection ([#185](#185)) ([a50a442](a50a442))
* **deps:** downgrade to jexl 1.x for IE 11 compat ([#197](#197)) ([cca7d03](cca7d03))
* **deps:** Move ember-cli-showdown to dependencies ([#171](#171)) ([2dca978](2dca978))
* **deps:** remove obsolete dependency ([be4dbad](be4dbad))
* **deps:** update @adfinis-sygroup/semantic-release-config ([2225e00](2225e00))
* **deps:** update dependency ember-cli-sass to v10 ([#32](#32)) ([2877c64](2877c64))
* **deps:** update dependency ember-composable-helpers to v2.3.1 ([#156](#156)) ([0a1498d](0a1498d))
* **deps:** update dependency ember-uikit to ^0.8.0 ([#219](#219)) ([28a841b](28a841b))
* **deps:** update dependency ember-uikit to v0.8.1 ([#223](#223)) ([b892a50](b892a50))
* **deps:** update dependency graphql to v14.3.0 ([#208](#208)) ([6cf38cc](6cf38cc))
* **deps:** update dependency sass to v1.20.1 ([#196](#196)) ([1d7a944](1d7a944))
* **field:** drop running requests on next ([aa5f99c](aa5f99c))
* **field:** fix invalid state of a field ([8c3d6b4](8c3d6b4))
* **form builder:** fix handling of existing metadata ([4d9071f](4d9071f))
* **form builder:** fix usage of nested properties in the question editor ([97a59a5](97a59a5))
* **ie 11:** add "manual" polyfill for array.flat ([#199](#199)) ([fde3a0f](fde3a0f))
* **info:** replace drop by modal ([#193](#193)) ([ea2a026](ea2a026))
* **jexl:** add custom intersects operator to jexl AST parser ([#183](#183)) ([30ddf10](30ddf10))
* **jexl:** don't consider the value of hidden fields in JEXL expr. ([#198](#198)) ([f934741](f934741))
* **mirage:** update mirage schema and fix generic scalar type ([c1cdaa1](c1cdaa1))
* **navigation:** fix document states in navigation ([480b67b](480b67b))
* **powerselect:** render correct slected option for choice questions ([#254](#254)) ([837ca8c](837ca8c))
* **table:** dialog didn't reopen ([#243](#243)) ([7754585](7754585))
* **table:** disable form in table on disabled question ([c79a380](c79a380))
* **table:** fix table rendering for dynamic choice fields ([#239](#239)) ([5d40c13](5d40c13))
* consider empty but required fields ([#220](#220)) ([3538471](3538471))
* do not display warning if no override ([3c2bf1d](3c2bf1d))
* **table:** render download links for file questions in tables ([#187](#187)) ([25cfd80](25cfd80))
* **translations:** add missing german translations ([#152](#152)) ([dba21ec](dba21ec))
* **translations:** add missing translations ([e786b52](e786b52))
* **validation:** add validation for static, fix multiple choice ([#228](#228)) ([7ab76a7](7ab76a7))
* **validation:** ignore hidden required fields ([#175](#175)) ([2d1f490](2d1f490))
* remove jexl logic and hide toggle ([#233](#233)) ([9627dec](9627dec))

### Features

* **cf-form:** all passing context information to cf-form, cf-navigation ([7372e4d](7372e4d))
* **cf-form:** allow passing context information to cf-form, cf-navigation ([#218](#218)) ([2955dc6](2955dc6))
* **cf-navigation:** add disabled attribute ([#242](#242)) ([926b9de](926b9de))
* **cf-navigation:** add possibility to pass custom headers ([#255](#255)) ([16e4448](16e4448))
* **form:** add support for static question ([#169](#169)) ([17afa26](17afa26))
* **form:** enable widget overrides for forms ([581de15](581de15))
* **jexl:** add "interesects" binary operator ([#176](#176)) ([502c747](502c747))
* **jexl:** add cross-form jexl resolution ([#154](#154)) ([c137e29](c137e29)), closes [/github.com/projectcaluma/caluma/pull/398#discussion_r279346810](https://github.com//github.com/projectcaluma/caluma/pull/398/issues/discussion_r279346810)
* **jexl:** add support for multiline expressions ([#177](#177)) ([8fb2b6b](8fb2b6b))
* **jexl:** support jexl referencing TableQuestions ([#229](#229)) ([858d95e](858d95e))
* **table:** remove action buttons in disabled state ([#238](#238)) ([9037a3b](9037a3b))
* **table:** show spinner while saving ([fe4fc33](fe4fc33))
* **tooling:** add semantic release ([#200](#200)) ([64b943c](64b943c))
* add jexl textarea for isRequired ([#232](#232)) ([7b3e16a](7b3e16a))
* add table column display configuration ([#237](#237)) ([88a1ae9](88a1ae9)), closes [#236](#236)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants