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(dashboard): Digest liquid helper and popover handler #7439

Merged
merged 69 commits into from
Feb 3, 2025

Conversation

scopsy
Copy link
Contributor

@scopsy scopsy commented Jan 6, 2025

What changed? Why was the change needed?

  • adds a digest modifier name
  • Adds suggested transformers section based on variable name suggestions

Screenshots

CleanShot 2025-01-06 at 16 45 39@2x

Expand for optional sections

Related enterprise PR

Special notes for your reviewer

filters: Filters[];
};

export function useSuggestedFilters(variableName: string, currentFilters: FilterWithParam[]): SuggestionGroup[] {
Copy link
Contributor Author

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);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@SokratisVidros any name suggestions?

Copy link
Contributor

Choose a reason for hiding this comment

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

Digest is fine, as it points to the step.

Comment on lines +126 to +129
const parserEngine = new Liquid(LIQUID_CONFIG);

// Register digest filter for validation of digest transformers
parserEngine.registerFilter('digest', () => '');
Copy link
Contributor Author

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

@scopsy scopsy requested a review from SokratisVidros January 17, 2025 07:52
@SokratisVidros
Copy link
Contributor

@scopsy let's rebase this so as to resume implementation and do the final touch ups

@scopsy
Copy link
Contributor Author

scopsy commented Jan 27, 2025

@SokratisVidros done

* {{ 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 {
Copy link
Contributor

Choose a reason for hiding this comment

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

How about summarize?

this.templateEngine.registerFilter('json', (value, spaces) =>
stringifyDataStructureWithSingleQuotes(value, spaces)
);
this.templateEngine.registerFilter('digest', digest);
Copy link
Contributor

Choose a reason for hiding this comment

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

Digest is fine, as it points to the step.

@scopsy scopsy merged commit 49c0190 into next Feb 3, 2025
39 of 40 checks passed
@scopsy scopsy deleted the digest-liquid-helper branch February 3, 2025 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants