-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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(dashboard): Digest liquid helper and popover handler #7439
base: next
Are you sure you want to change the base?
Conversation
Allow arbitrary variables on the payload namespace after adding at least one variable in a previous control value.
…into pills-for-all-inputs
* {{ users | digest: 2, "name" }} => For array of {name: string} | ||
* {{ users | digest: 2, "profile.name", "•" }} => "John • Josh and 3 others" | ||
*/ | ||
export function digest(array: unknown, maxNames = 2, keyPath?: string, separator = ', '): string { |
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 sure if that's the best name 🤔
✅ Deploy Preview for dev-web-novu ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for dashboard-v2-novu-staging ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
filters: Filters[]; | ||
}; | ||
|
||
export function useSuggestedFilters(variableName: string, currentFilters: FilterWithParam[]): SuggestionGroup[] { |
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.
These provide filter suggestion based on common variable names, patterns of data
this.templateEngine.registerFilter('json', (value, spaces) => | ||
stringifyDataStructureWithSingleQuotes(value, spaces) | ||
); | ||
this.templateEngine.registerFilter('digest', digest); |
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.
@SokratisVidros any name suggestions?
const parserEngine = new Liquid(LIQUID_CONFIG); | ||
|
||
// Register digest filter for validation of digest transformers | ||
parserEngine.registerFilter('digest', () => ''); |
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.
Currently we have 2 version of liquid one in the framework and one in the API, didn't do it in this PR but worth considering consolidating them somehow or exporting from the framework the parser
What changed? Why was the change needed?
Screenshots
Expand for optional sections
Related enterprise PR
Special notes for your reviewer