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

JNG-5742 fix eager table action lifecycle #407

Merged
merged 22 commits into from
Jun 4, 2024

Conversation

noherczeg
Copy link
Contributor

@noherczeg noherczeg commented May 24, 2024

BugJNG-5742 Composite aggregation tables should not trigger REST calls

  • re-worked validations to properly handle nested aggregated operations
  • re-worked mask generation to support recursive nested querying of every element which can be displayed in an open action
  • templateDataOverride is now used to initialize nested views in case of view screens
  • DeleteAction has been split to reduce template logic overload
  • refactored dialog submit callback api to utilize variant, also added new variant for relation deletion
  • elevated mask generation to page level instead of container level because we need to be able to traverse eager relations

@noherczeg noherczeg marked this pull request as ready for review June 3, 2024 16:51
Copy link

coderabbitai bot commented Jun 3, 2024

Warning

Rate limit exceeded

@noherczeg has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 4 minutes and 30 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between d3cfd9a and a976612.

Walkthrough

The recent updates include version upgrades for dependencies in the pom.xml file and significant changes to the judo-ui-react module. New methods and refactoring have been introduced to enhance the handling of UI actions, masks, and validation logic. Additionally, new functionalities like dialog validation support and rollback handling have been incorporated, improving overall application robustness and user interaction.

Changes

Files/Paths Change Summary
pom.xml Updated versions for judo-meta-ui, judo-ui-typescript-rest, and added junit-jupiter dependency.
judo-ui-react/.../UiActionsHelper.java Updated methods for dialog and form parameters, added new condition checks, and renamed methods for clarity.
judo-ui-react/.../UiPageContainerHelper.java Added new methods for mask serialization and modified existing methods to return MaskEntry objects.
judo-ui-react/.../UiPageHelper.java Added isDialogValidationSupported method to check dialog validation support.
judo-ui-react/.../UiWidgetHelper.java Refactored conditions for row delete actions and adjusted button and table heading logic.
judo-ui-react/.../mask/MaskEntry.java Introduced MaskEntry class with methods for managing and serializing mask entries.
judo-ui-react/.../components/table/EagerTable.tsx.hbs Removed mask property and changed maskAction to a required function.
judo-ui-react/.../components/table/LazyTable.tsx.hbs Similar changes as EagerTable.tsx.hbs, removing mask property and making maskAction mandatory.
judo-ui-react/.../components/link/index.tsx.hbs Updated onClick handler, modified condition checks, and used maskAction function for _mask property.
judo-ui-react/.../components/link/types.ts.hbs Added get{{ firstToUpper link.relationType.name }}Mask method to ActionDefinitions interface.
judo-ui-react/.../components/table/index.tsx.hbs Removed mask property usage and updated conditions for onRowClick and maskAction properties.
judo-ui-react/.../components/table/types.ts.hbs Moved get{{ firstToUpper table.relationName }}Mask function declaration within ActionDefinitions interface.
judo-ui-react/.../containers/dialog.tsx.hbs Refactored queryCustomizer assignment and adjusted button label rendering logic.
judo-ui-react/.../containers/page.tsx.hbs Added isDraft variable and adjusted queryCustomizer initialization.
judo-ui-react/.../containers/types.ts.hbs Altered logic related to getMask function based on container.form.
judo-ui-react/.../dialogs/customization.ts.hbs Modified onSubmit function signature to include reason parameter.
judo-ui-react/.../dialogs/hooks.tsx.hbs Updated onSubmit function parameters and logic.
judo-ui-react/.../dialogs/index.tsx.hbs Reordered imports, added rollback handling functions, updated masks retrieval, modified refresh for drafts, and adjusted validation functions.

Sequence Diagram(s) (Beta)

sequenceDiagram
    participant User
    participant UI as UI Component
    participant Helper as UiActionsHelper
    participant Backend as Backend Service

    User->>UI: Perform Action
    UI->>Helper: getDialogOpenParameters()
    Helper->>UI: Return Parameters
    UI->>Backend: Open Dialog with Parameters
    Backend->>UI: Return Data
    UI->>User: Display Dialog
Loading

Poem

In the code, a dance of change,
With masks and helpers, we rearrange,
Dialogs now validate, eager and bright,
A rabbit's joy, coding delight.
🎉🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 9

Outside diff range and nitpick comments (4)
judo-ui-react/src/main/resources/actor/src/pages/actions/DeleteAction.fragment.hbs (1)

35-38: Improve error handling by providing more context-specific error messages.

Consider enhancing the error messages to give users more detailed feedback about what went wrong.

judo-ui-react/src/main/resources/actor/src/pages/actions/CreateAction.fragment.hbs (1)

Line range hint 8-34: Refactor to simplify nested conditionals and error handling.

- try {
-   setIsLoading(true);
-   await validate(cleanUpPayload(payloadDiff.current));
-   onSubmit(payloadDiff.current, 'submit-draft');
- } catch (error) {
-   if (ownerValidation && !isErrorNestedValidationError(error, '{{ page.dataElement.name }}')) {
-     onSubmit(payloadDiff.current, 'submit-draft');
-   } else {
-     let relationName: string | undefined = (isDraft && ownerValidation) ? '{{ page.dataElement.name }}' : undefined;
-     handleError<{{ classDataName (getReferenceClassType page) '' }}>(error, { setValidation }, data, relationName);
-   }
- } finally {
-   setIsLoading(false);
- }
+ setIsLoading(true);
+ try {
+   await validate(cleanUpPayload(payloadDiff.current));
+   onSubmit(payloadDiff.current, 'submit-draft');
+ } catch (error) {
+   let relationName: string | undefined = (isDraft && ownerValidation) ? '{{ page.dataElement.name }}' : undefined;
+   handleError<{{ classDataName (getReferenceClassType page) '' }}>(error, { setValidation }, data, relationName);
+ } finally {
+   setIsLoading(false);
+ }
judo-ui-react/src/main/java/hu/blackbelt/judo/ui/generator/react/UiWidgetHelper.java (1)

446-452: Clarify the role of isButtonTableRowButton in the context of table row actions.

Consider adding a comment above the isButtonTableRowButton method to explain its purpose and usage within the system, enhancing maintainability for other developers.

judo-ui-react/src/main/java/hu/blackbelt/judo/ui/generator/react/UiPageContainerHelper.java (1)

153-157: Clarify the Logic for Refresh Action Availability in Draft Mode
The logic added in lines 153-157 checks if the container is in draft mode to determine the availability of the refresh action. This is a good safeguard, but the comment suggests there might be cases where this action should not be generated at all. Consider refining the conditions or providing more detailed documentation on when and why these actions should be excluded.

Consider adding more detailed comments or documentation to clarify the intended use cases for this conditional logic.

@noherczeg noherczeg merged commit 6ae884a into develop Jun 4, 2024
4 checks passed
@noherczeg noherczeg deleted the bugfix/JNG-5742-fix-eager-table-action-lifecycle branch June 4, 2024 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants