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: added modal name, lint warning for string, action selector modal #32893

Merged
merged 14 commits into from
May 2, 2024

Conversation

AmanAgarwal041
Copy link
Contributor

@AmanAgarwal041 AmanAgarwal041 commented Apr 23, 2024

Description

This PR introduces a new property to modal widget to enable the consistency with the showing and closing of modal that requires modal name to execute these functions. The Pr contributes defined functionalities:

  • Added name property to modal widget that returns the modalName of the widget
  • Adds a suggestion property when modal with . is accessed in the JS object or in mustache bindings
  • Displays bindings in the entity explorer left hand side for the modal widget 3 dotted menu
  • Gives warning if the showModal or closeModal use string as a parameter.
  • Updates the Ast parser to detect the modal name from showModal and closeModal functions

Limitation is if you have a showModal("Modal1") or closeModal("Modal1") function in the widget property value, then action selector might not show the selected modal in the dropdown, however the code will work.

Fixes #32410
or
Fixes Issue URL

Warning

If no issue exists, please create an issue first, and check with the maintainers if the issue is valid.

Automation

/ok-to-test tags="@tag.JS, @tag.Widget"

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/8921123132
Commit: c0e92ca
Cypress dashboard url: Click here!

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

  • New Features

    • Enhanced modal handling by directly referencing modal object names for improved clarity and consistency.
    • Expanded linting capabilities to include checks for modal name usage.
    • Updated autocomplete suggestions for modal actions.
  • Bug Fixes

    • Resolved default parameter settings for modal actions.
  • Refactor

    • Streamlined modal name extraction and handling to enhance maintainability.

@AmanAgarwal041 AmanAgarwal041 requested review from a team and riodeuno and removed request for a team April 23, 2024 11:47
@github-actions github-actions bot added Query & JS Pod Issues related to the query & JS Pod Bug Something isn't working Integrations Product Issues related to a specific integration Integrations Pod General Issues related to the Integrations Pod that don't fit into other tags. Medium Issues that frustrate users due to poor UX Medium effort Takes < 2 weeks labels Apr 23, 2024
Copy link
Contributor

coderabbitai bot commented Apr 23, 2024

Walkthrough

Walkthrough

The updates primarily focus on enhancing the modal functionality by transitioning from hardcoded string identifiers to dynamic property references (Modal1.name). This change aims to improve maintainability and user experience by reducing the need for manual code adjustments when modal names change. Additionally, the update includes linting enhancements and modifications to various utility functions to support this new approach.

Changes

Files Change Summary
app/client/packages/ast/index.ts
app/client/packages/ast/src/index.ts
Added a new CallExpressionData type and interface to handle call expressions. Updated type definitions and functions accordingly.
app/client/packages/ast/src/actionCreator/index.ts Updated handling for NodeTypes.MemberExpression in getModalName. Modified setModalName to use changeValue directly without quotes.
app/client/src/ce/utils/autocomplete/EntityDefinitions.ts
app/client/src/components/editorComponents/ActionCreator/Field/FieldConfig.ts
Updated exampleArgs and exampleText values to use dynamic property references like Modal1.name.
app/client/src/components/editorComponents/ActionCreator/FieldGroup/FieldGroupConfig.ts Updated defaultParams value for the showModal field configuration.
app/client/src/components/editorComponents/ActionCreator/viewComponents/ActionBlockTree/utils.tsx Modified getActionHeading function to handle dynamic property references for showModal and closeModal cases.
app/client/src/plugins/Linting/constants.ts
app/client/src/plugins/Linting/utils/getLintingErrors.ts
Added a new linting error ACTION_MODAL_STRING and related functions to handle string usage for modals.
app/client/src/selectors/widgetSelectors.ts Updated getModalDropdownList selector to use dynamic property references.
app/client/src/widgets/ModalWidget/widget/index.tsx Added SetterConfig type, updated propertyValue assignments, and introduced new static methods for autocomplete definitions and configurations.
app/client/src/components/editorComponents/ActionCreator/helpers.tsx Updated value assignment in useModalDropdownList function to include .name after modalName.
app/client/cypress/e2e/Regression/ClientSide/ActionExecution/ActionSelector_JsToNonJSMode_1_spec.ts
app/client/src/utils/testDSLs.ts
app/client/test/factories/Widgets/ModalFactory.ts
Updated function calls to use dynamic property values instead of hardcoded strings.

Assessment against linked issues

Objective Addressed Explanation
Add modal.name property (#32410) The changes introduce dynamic property references like Modal1.name to address the need for a modal.name property.
Suggest modal.name property in action selector (#32410) The updates enable suggesting modal.name in the action selector by transitioning to dynamic property references.
Suggest modal.name property in docs (#32410) Documentation updates are not part of the PR changes.
Give warning for using string in showModal and suggest to replace with modal.name (#32410) The changes include modifications to handle linting errors related to using strings for modals and suggest using dynamic property references instead.

Possibly related issues

  • Fix modal widget issues  #30788: The PR changes do not directly address accessibility and performance enhancements for modals, but the transition to dynamic properties could indirectly improve maintainability and future modal-related enhancements.

Recent Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 652cba2 and c0e92ca.
Files selected for processing (1)
  • app/client/src/components/editorComponents/ActionCreator/utils.test.ts (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • app/client/src/components/editorComponents/ActionCreator/utils.test.ts

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:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • 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.

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 a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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.

@github-actions github-actions bot added Enhancement New feature or request Bug Something isn't working and removed Bug Something isn't working labels Apr 23, 2024
@github-actions github-actions bot added the Bug Something isn't working label Apr 23, 2024
@AmanAgarwal041 AmanAgarwal041 added the ok-to-test Required label for CI label Apr 23, 2024
@github-actions github-actions bot added Bug Something isn't working and removed Bug Something isn't working labels Apr 23, 2024
@AmanAgarwal041 AmanAgarwal041 requested review from rishabhrathod01 and removed request for riodeuno April 23, 2024 19:10
Copy link
Contributor

@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: 0

Out of diff range and nitpick comments (1)
app/client/cypress/fixtures/CommunityIssuesExport.json (1)

4130-4130: Ensure consistency in expression syntax; consider removing the semicolon.

@github-actions github-actions bot added Bug Something isn't working and removed Bug Something isn't working labels Apr 23, 2024
@AmanAgarwal041 AmanAgarwal041 added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Apr 23, 2024
@AmanAgarwal041 AmanAgarwal041 added the ok-to-test Required label for CI label Apr 24, 2024
@github-actions github-actions bot removed the Bug Something isn't working label Apr 25, 2024
Copy link
Contributor

@rishabhrathod01 rishabhrathod01 left a comment

Choose a reason for hiding this comment

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

Changes look good to me.
Great work on this PR.

@github-actions github-actions bot added the Bug Something isn't working label Apr 30, 2024
@github-actions github-actions bot removed the Bug Something isn't working label Apr 30, 2024
@github-actions github-actions bot added the Bug Something isn't working label Apr 30, 2024
Copy link
Contributor

@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: 2

@AmanAgarwal041 AmanAgarwal041 added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Apr 30, 2024
@AmanAgarwal041 AmanAgarwal041 added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels May 2, 2024
@AmanAgarwal041 AmanAgarwal041 added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels May 2, 2024
@github-actions github-actions bot removed the Bug Something isn't working label May 2, 2024
@sneha122 sneha122 requested a review from rishabhrathod01 May 2, 2024 10:24
@AmanAgarwal041 AmanAgarwal041 merged commit c412368 into release May 2, 2024
44 checks passed
@AmanAgarwal041 AmanAgarwal041 deleted the feat/32410-modal-name branch May 2, 2024 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request Integrations Pod General Issues related to the Integrations Pod that don't fit into other tags. Integrations Product Issues related to a specific integration Medium effort Takes < 2 weeks Medium Issues that frustrate users due to poor UX ok-to-test Required label for CI Query & JS Pod Issues related to the query & JS Pod
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Add a Modal.name property to be used in showModal
2 participants