-
Notifications
You must be signed in to change notification settings - Fork 25
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
Refactor/set data action #2454
Draft
chrismclarke
wants to merge
30
commits into
master
Choose a base branch
from
refactor/set-data-action
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Refactor/set data action #2454
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Checklist
TODO
this.item
reference instead of@item
)Blocking
The system works when managing
@items
references, however an initial pass on item processing is handled in the main processor which also replaces@item
withthis.item
references. Whilst it is possible to just add ahackUnparseItem
method, this feels messy. Instead it would be better to improve the item handling at the parser level, to avoid replacing outside of the item processor. The challenge here is that the initialitems
template processor is reasonably untested and quite fragile, so changing as part of this PR isn't advisableDue to the closely coupled nature of the parser and items the best solution appears to be to mostly detach the
data_items
parsing from the template parser, and essentially handle it's own parsing from the ground up. Whilst it is still possible to expose and call methods from the current parser (e.g. processDynamicEvaluators), these methods themselves are quite hacky and have a number of issues (particularly regarding the way dynamic variables are replaced as strings one-by-one, making it harder to evaluate compound expressions, e.g.
@row.first_name === 'Ada'
replaces first_name without quotation).However a full solution for this will likely involve creating a new base parser that can convert full expressions to valid js and evaluate. E.g.
Hello @field.{@local.lookup_field}}
->
"Hello+' '+[field[local.lookup_field]]"
or
`Hello ${field[local.lookup_field]}`
Description
Re-implementation of #2388, to use
set_data
action globally and updateset_item
/set_items
actions in data_items list to call the global function.It also includes better test coverage, and support for items with dynamic expressions, such as global `set_da
Author Notes
General Use
Set values on a specific data_list item
Can include
@item
reference that will use existing row contextCan set item by
_index
Can target all items in a list (no current support for filtered subset) by omitting
_id
Dev Notes
Git Issues
Closes #
Screenshots/Videos
If useful, provide screenshot or capture to highlight main changes