Skip to content

Conversation

@rahulbarwal
Copy link
Contributor

@rahulbarwal rahulbarwal commented Jul 16, 2024

Description

Fixes #34298
Original PR: #34298
EE PR: https://github.com/appsmithorg/appsmith-ee/pull/5232

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.All"

🔍 Cypress test results

Caution

If you modify the content in this section, you are likely to disrupt the CI result for your PR.

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • New Features

    • Introduced a new test scenario for JSON Form Widget Custom Field.
    • Added new JSON structure representing a form layout with widget configurations.
    • Added support for "row-reverse" direction in JSON Form fields.
    • Added label positioning options for switch fields in JSON Form Widget.
  • Enhancements

    • Updated locators to include new identifiers for custom fields.
    • Enhanced switch field component to manage label positions dynamically.

Warning

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/11047220758
Commit: 5be5319
Cypress dashboard.
Tags: @tag.All
Spec:
It seems like no tests ran 😔. We are not able to recognize it, please check workflow here.


Thu, 26 Sep 2024 07:10:32 UTC

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 16, 2024

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The changes introduce a custom switch field in the JSON Form Widget, allowing for new label positioning options and improved form layout customization. Additionally, the updates include new test scenarios to verify these functionalities and address bugs related to label positioning and text wrapping.

Changes

Files/Paths Change Summary
.../cypress/e2e/Regression/ClientSide/Widgets/JSONForm/JSONForm_EditSwitchFied_spec.js Added test scenario for verifying the functionality of adding and configuring a custom switch field in JSON Form.
.../cypress/fixtures/jsonFormDslSwitchWidgetSourceData.json Introduced a JSON structure representing a form layout with specific widget configurations.
.../cypress/locators/commonlocators.json Added locators for the custom switch field and JSON field prefix.
.../src/widgets/JSONFormWidget/component/Field.tsx Added a new direction option "row-reverse" and updated logic to handle this in the JSON Form Widget.
.../src/widgets/JSONFormWidget/component/FieldLabel.tsx Updated FieldLabelProps to include direction and set the width style property to max-content.
.../src/widgets/JSONFormWidget/fields/SwitchField.tsx Introduced labelPosition in SwitchComponentOwnProps and utilized it to manage label positions.
.../src/widgets/JSONFormWidget/widget/propertyConfig/properties/switch.ts Renamed alignWidget property to labelPosition and updated related values and options.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant JSONFormWidget
    participant SwitchField
    participant LabelPosition
    
    User ->> JSONFormWidget: Add Switch Field
    JSONFormWidget ->> SwitchField: Create Switch Field with Default Config
    SwitchField ->> LabelPosition: Set label position
    LabelPosition -->> SwitchField: Apply label position
    SwitchField ->> JSONFormWidget: Render with updated label position
    JSONFormWidget ->> User: Display updated Switch Field
Loading

Assessment against linked issues

Objective (Issue #) Addressed Explanation
Fix JSONForm Switch Field label position and label wrap issue (#33793)
Add regression tests for the custom switch field element (#34298)

Poem

In the land of code where widgets play,
A switch field finds its custom way.
With labels now that turn and twist,
Bugs and glitches won't be missed.
JSON Forms now shine so bright,
Thanks to changes made just right.


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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

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 the skip-changelog Adding this label to a PR prevents it from being listed in the changelog label Jul 16, 2024
@rahulbarwal rahulbarwal marked this pull request as draft July 16, 2024 06:27
@github-actions
Copy link

🔴 There's new test files in JS, please port to TS and re-trigger Cypress tests:

  1. app/client/cypress/e2e/Regression/ClientSide/Widgets/JSONForm/JSONForm_EditSwitchFied_spec.js

@rahulbarwal
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

@github-actions
Copy link

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/9951869306.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 34958.
recreate: .

@github-actions
Copy link

🔴 There's new test files in JS, please port to TS and re-trigger Cypress tests:

  1. app/client/cypress/e2e/Regression/ClientSide/Widgets/JSONForm/JSONForm_EditSwitchFied_spec.js

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 3ba2f25 and 61b7b82.

Files selected for processing (7)
  • app/client/cypress/e2e/Regression/ClientSide/Widgets/JSONForm/JSONForm_EditSwitchFied_spec.js (1 hunks)
  • app/client/cypress/fixtures/jsonFormDslSwitchWidgetSourceData.json (1 hunks)
  • app/client/cypress/locators/commonlocators.json (1 hunks)
  • app/client/src/widgets/JSONFormWidget/component/Field.tsx (2 hunks)
  • app/client/src/widgets/JSONFormWidget/component/FieldLabel.tsx (2 hunks)
  • app/client/src/widgets/JSONFormWidget/fields/SwitchField.tsx (6 hunks)
  • app/client/src/widgets/JSONFormWidget/widget/propertyConfig/properties/switch.ts (2 hunks)
Files skipped from review due to trivial changes (1)
  • app/client/src/widgets/JSONFormWidget/component/FieldLabel.tsx
Additional context used
Path-based instructions (3)
app/client/cypress/e2e/Regression/ClientSide/Widgets/JSONForm/JSONForm_EditSwitchFied_spec.js (1)

Pattern app/client/cypress/**/**.*:

app/client/cypress/fixtures/jsonFormDslSwitchWidgetSourceData.json (1)

Pattern app/client/cypress/**/**.*:

app/client/cypress/locators/commonlocators.json (1)

Pattern app/client/cypress/**/**.*:

Additional comments not posted (10)
app/client/src/widgets/JSONFormWidget/widget/propertyConfig/properties/switch.ts (2)

5-5: New import added for LabelPosition.

This import is necessary for the new labelPosition property added to the switch configuration. It ensures that the property uses the correct enum values.


27-42: Addition of new property configuration for labelPosition.

This new property allows for better customization of the label's position relative to the switch. The use of LabelPosition enum ensures consistency and reduces the likelihood of errors due to invalid values.

app/client/cypress/e2e/Regression/ClientSide/Widgets/JSONForm/JSONForm_EditSwitchFied_spec.js (2)

1-7: New imports and modifications to support the test scenario.

These changes are necessary to set up the environment and dependencies for the new test scenario. They ensure that the necessary modules and data are available for the tests.


9-63: Comprehensive test scenario for custom field functionality in JSON Form Widget.

This test validates the addition and configuration of a custom switch field, focusing on the label position functionality. It effectively checks both "row" and "row-reverse" positions to ensure they are applied correctly.

app/client/src/widgets/JSONFormWidget/component/Field.tsx (2)

26-26: Updated StyledWrapperProps interface to include "row-reverse".

This update is crucial for supporting the new "row-reverse" label position, allowing for more flexible layout configurations in the JSON Form Widget.


69-75: Logic to determine the direction of the field based on fieldClassName and inlineLabel.

This logic effectively handles the new "row-reverse" option by checking the fieldClassName and inlineLabel properties. It ensures that the field's layout adapts based on the specified configuration.

app/client/src/widgets/JSONFormWidget/fields/SwitchField.tsx (2)

Line range hint 14-26: Updated imports and type declarations to support new labelPosition property.

These updates are necessary to integrate the new labelPosition property into the SwitchField component, ensuring it can utilize the new label positioning options.


40-40: Updated default values to include labelPosition.

Setting the default value for labelPosition ensures that there is a consistent default behavior unless specified otherwise. This change is aligned with the new functionality introduced in the PR.

app/client/cypress/fixtures/jsonFormDslSwitchWidgetSourceData.json (1)

1-172: JSON Structure Review: Valid and Aligns with Functionality

The JSON structure is valid and correctly defines properties and children for the JSON Form Widget. This aligns with the PR's description of introducing a new form layout with specific widget configurations for testing purposes.

app/client/cypress/locators/commonlocators.json (1)

237-246: New Locators Added: Check for Correctness and Relevance

The new locators added (jsonformFieldCustomFieldSwitch and jsonFieldPrefix) are correctly formatted and relevant to the new functionalities introduced in the PR. These locators are essential for the Cypress tests to interact with the new custom field options in the JSON Form Widget.

coderabbitai[bot]
coderabbitai bot previously approved these changes Jul 16, 2024
Harshithazemoso and others added 3 commits July 16, 2024 13:58
…label-position-has-no-effect-label-wraps-text-unnecessarily
…-has-no-effect-label-wraps-text-unnecessarily' of https://github.com/Harshithazemoso/appsmith into external-contri/Issue-33793-fix/Switch-Field-in-JSONForm-label-position-has-no-effect-label-wraps-text-unnecessarily
@rahulbarwal
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

@github-actions
Copy link

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/9953851641.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 34958.
recreate: .

@rahulbarwal rahulbarwal added Widgets & Blocks Pod ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Jul 16, 2024
@github-actions
Copy link

Deploy-Preview-URL: https://ce-34958.dp.appsmith.com

@github-actions
Copy link

github-actions bot commented Aug 2, 2024

Deploy-Preview-URL: https://ce-34958.dp.appsmith.com

@rahulbarwal
Copy link
Contributor Author

/ci-test-limit

@github-actions
Copy link

github-actions bot commented Aug 2, 2024

@github-actions
Copy link

github-actions bot commented Aug 2, 2024

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

@rahulbarwal
Copy link
Contributor Author

/ci-test-limit runId=10215951638

4 similar comments
@rahulbarwal
Copy link
Contributor Author

/ci-test-limit runId=10215951638

@rahulbarwal
Copy link
Contributor Author

/ci-test-limit runId=10215951638

@rahulbarwal
Copy link
Contributor Author

/ci-test-limit runId=10215951638

@rahulbarwal
Copy link
Contributor Author

/ci-test-limit runId=10215951638

@github-actions
Copy link

github-actions bot commented Aug 2, 2024

@github-actions
Copy link

github-actions bot commented Aug 2, 2024

@github-actions
Copy link

github-actions bot commented Aug 2, 2024

@github-actions
Copy link

github-actions bot commented Aug 2, 2024

@github-actions
Copy link

github-actions bot commented Aug 2, 2024

@github-actions
Copy link

github-actions bot commented Aug 2, 2024

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

@github-actions
Copy link

github-actions bot commented Aug 2, 2024

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

@github-actions
Copy link

github-actions bot commented Aug 2, 2024

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

@github-actions
Copy link

github-actions bot commented Aug 2, 2024

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

@github-actions
Copy link

github-actions bot commented Aug 2, 2024

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

@github-actions
Copy link

github-actions bot commented Sep 1, 2024

This PR has not seen activitiy for a while. It will be closed in 7 days unless further activity is detected.

@github-actions github-actions bot added the Stale label Sep 1, 2024
Harshitha-busetti and others added 3 commits September 2, 2024 14:02
…label-position-has-no-effect-label-wraps-text-unnecessarily
…-has-no-effect-label-wraps-text-unnecessarily' of https://github.com/Harshithazemoso/appsmith into external-contri/Issue-33793-fix/Switch-Field-in-JSONForm-label-position-has-no-effect-label-wraps-text-unnecessarily
…o external-contri/Issue-33793-fix/Switch-Field-in-JSONForm-label-position-has-no-effect-label-wraps-text-unnecessarily
@github-actions
Copy link

github-actions bot commented Sep 2, 2024

⚠️ Cyclic Dependency Check:

This PR has increased the number of cyclic dependencies by 2, when compared with the release branch.

Refer this document to identify the cyclic dependencies introduced by this PR.

…o external-contri/Issue-33793-fix/Switch-Field-in-JSONForm-label-position-has-no-effect-label-wraps-text-unnecessarily
@github-actions
Copy link

⚠️ Cyclic Dependency Check:

This PR has increased the number of cyclic dependencies by 2, when compared with the release branch.

Refer this document to identify the cyclic dependencies introduced by this PR.

@github-actions
Copy link

This PR has been closed because of inactivity.

@github-actions github-actions bot closed this Mar 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok-to-test Required label for CI skip-changelog Adding this label to a PR prevents it from being listed in the changelog Stale Widgets Product This label groups issues related to widgets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants