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

chore:remove space b/w form and CTA onboarding page #35985

Conversation

Shivam-z
Copy link
Contributor

@Shivam-z Shivam-z commented Aug 29, 2024

Description

Following are the improvements made in this PR:

  • Remove the unnecessary space b/w form and CTA in Gsheet onboarding step
  • Made one new RadioButtonControl in form control and replaced the current
    dropdown by radio buttons.
  • Move the callout to after the permissions | scope property.
  • Limit the width of the white section

Fixes #30523

output screenshot:
Screenshot from 2024-09-20 15-14-59

Desired design:
image

Please also include relevant motivation and context. List any dependencies that are required for this change. Add links to Notion, Figma or any other documents that might be relevant to the PR.

*Fixes #35950
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=""

🔍 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

Summary by CodeRabbit

  • New Features

    • Introduced a new RadioButtonControl component for improved form control options.
    • Enhanced the FormControlRegistry to support radio button controls.
    • Updated the Google Sheets plugin to use radio buttons for permission settings.
  • UI Changes

    • Corrected styling syntax in the FormContainer for proper rendering.
    • Reorganized the display order of information banners in the DatasourceForm for better clarity.
  • Tests

    • Added a comprehensive suite of unit tests for the RadioButtonControl component to ensure proper functionality and user interaction.

Copy link
Contributor

coderabbitai bot commented Aug 29, 2024

Walkthrough

The recent changes introduce a RadioButtonControl component for form controls, enhancing user interaction by allowing radio button selections. Additionally, modifications were made to the layout of the FormContainer in the JSONtoForm.tsx file and the rendering order of UI elements in the DatasourceForm.tsx file. The FormControlRegistry now supports the new radio button control, and the Google Sheets plugin configuration has been updated to use radio buttons for permissions.

Changes

Files Change Summary
app/client/src/components/formControls/RadioButtonControl.tsx Introduced RadioButtonControl component, extending BaseControl, implementing radio button functionality with redux-form.
app/client/src/components/formControls/RadioButtonControl.test.tsx Added unit tests for RadioButtonControl, covering rendering, default selection, and option selection.
app/client/src/pages/Editor/DataSourceEditor/JSONtoForm.tsx Corrected CSS syntax for the height property in FormContainer to ensure proper rendering.
app/client/src/pages/Editor/DataSourceEditor/index.tsx Removed dynamic height calculation for DSEditorWrapper, potentially affecting its layout.
app/client/src/pages/Editor/SaaSEditor/DatasourceForm.tsx Reorganized rendering order of AuthMessage component within the conditional structure for clarity.
app/client/src/utils/formControl/FormControlRegistry.tsx Added support for radio button control by registering a new control builder for RADIO_BUTTON type.
app/client/src/utils/formControl/formControlTypes.ts Added new constant RADIO_BUTTON to the exported object, expanding form control types.
app/server/appsmith-plugins/googleSheetsPlugin/src/main/resources/form.json Changed control type for "Permissions

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Form
    participant RadioButtonControl
    participant ReduxForm

    User->>Form: Interacts with form
    Form->>RadioButtonControl: Renders radio buttons
    RadioButtonControl->>ReduxForm: Updates form state on selection
    ReduxForm-->>Form: Notifies state change
    Form-->>User: Displays updated selection
Loading

Assessment against linked issues

Objective Addressed Explanation
Remove unnecessary space between form and CTA for GSheets (#30523)
Replace the current dropdown by radio buttons (#30523)
Move the callout to after the permissions scope property (#30523)
Limit the width of the white section (#30523) No changes were made to limit the width of the section.

🎉 In code we trust, with buttons anew,
Radio selections, a clearer view.
Forms now more compact, neat and bright,
User experience shines, oh what a delight!
From dropdowns to buttons, we make the switch,
In the world of code, we find our niche! 🌟


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.

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.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 83326ef and 20ba6f0.

Files selected for processing (6)
  • app/client/src/components/formControls/RadioButtonControl.tsx (1 hunks)
  • app/client/src/pages/Editor/DataSourceEditor/JSONtoForm.tsx (1 hunks)
  • app/client/src/pages/Editor/SaaSEditor/DatasourceForm.tsx (2 hunks)
  • app/client/src/utils/formControl/FormControlRegistry.tsx (2 hunks)
  • app/client/src/utils/formControl/formControlTypes.ts (1 hunks)
  • app/server/appsmith-plugins/googleSheetsPlugin/src/main/resources/form.json (1 hunks)
Files skipped from review due to trivial changes (2)
  • app/client/src/pages/Editor/DataSourceEditor/JSONtoForm.tsx
  • app/client/src/pages/Editor/SaaSEditor/DatasourceForm.tsx
Additional context used
Biome
app/client/src/components/formControls/RadioButtonControl.tsx

[error] 33-33: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

Additional comments not posted (8)
app/client/src/utils/formControl/formControlTypes.ts (1)

21-21: LGTM!

The addition of RADIO_BUTTON expands the set of form control types available for use within the application.

The code changes are approved.

app/client/src/components/formControls/RadioButtonControl.tsx (4)

1-7: LGTM!

The necessary modules and types for the RadioButtonControl component are correctly imported.

The code changes are approved.


9-22: LGTM!

The RadioButtonControl class correctly extends BaseControl and implements the necessary methods.

The code changes are approved.


31-53: LGTM!

The renderComponent function correctly handles the rendering and change events for the radio button group.

The code changes are approved.

Tools
Biome

[error] 33-33: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


55-59: LGTM!

The RadioButtonControlProps interface correctly defines the props for the RadioButtonControl component, and the component is correctly exported.

The code changes are approved.

app/server/appsmith-plugins/googleSheetsPlugin/src/main/resources/form.json (1)

36-36: LGTM!

The change to the control type for the "Permissions | Scope" configuration property enhances the user experience by making the selection process clearer and more immediate.

The code changes are approved.

app/client/src/utils/formControl/FormControlRegistry.tsx (2)

38-39: LGTM!

The new imports for RadioButtonControlProps and RadioButtonControl are correctly added.


188-192: LGTM!

The new form control builder for RADIO_BUTTON is correctly implemented and follows the existing pattern.

@sagar-qa007
Copy link
Contributor

@Shivam-z Should we consider updating an existing test case or adding a new one for unit testing?
Your insights would be appreciated.

@Shivam-z
Copy link
Contributor Author

@sagar-qa007 we can add a jest unit testing for RadioButtonControl.

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: 1

Outside diff range, codebase verification and nitpick comments (2)
app/client/src/components/formControls/RadioButtonControl.test.tsx (2)

26-35: Properties for RadioButtonControl

The radioButtonProps object is well-structured and includes all necessary properties to fully configure the RadioButtonControl for testing. However, the formName property is set as an empty string, which might be intentional but could potentially affect form behavior in some contexts.

Consider specifying a non-empty default value for formName or ensuring that this property is handled correctly when empty.

- formName: "",
+ formName: "defaultForm",

82-109: Test case: Option selection behavior

This test case checks the interactive behavior of the RadioButtonControl, specifically that clicking an option updates the selection as expected. The use of click events and subsequent checks for the checked state of options is a good practice to ensure the component's responsiveness to user inputs.

However, the reassignment of radioButtonProps in line 83 is unnecessary since you're not modifying any properties. This could be removed to simplify the test setup.

- radioButtonProps = {
-   ...radioButtonProps,
- };
Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 20ba6f0 and f3d043a.

Files selected for processing (1)
  • app/client/src/components/formControls/RadioButtonControl.test.tsx (1 hunks)
Additional comments not posted (6)
app/client/src/components/formControls/RadioButtonControl.test.tsx (6)

1-8: Review of imports and initial setup

The imports and initial setup look appropriate for the testing environment you're working with. Using react-redux and redux-form along with testUtils for rendering components in a test environment is standard practice. Good job on including @testing-library/jest-dom for extended assertions.


12-14: Utility component for testing

The TestForm component is a simple and effective way to wrap the RadioButtonControl for testing purposes. This is a neat trick to ensure that the form-related props are correctly passed down. Nicely done!


16-18: Redux Form setup

The use of reduxForm to create a higher-order component ReduxFormDecorator is correctly implemented. This setup is crucial for integrating redux-form in your tests, ensuring that form state and behaviors are correctly handled.


20-24: Mock options setup

The array of mockOptions is well-defined, providing clear and distinct values for testing the RadioButtonControl. This setup ensures that each option is rendered and behaves as expected during the tests.


42-57: Test case: Rendering and option count

This test case effectively checks that the RadioButtonControl and its options are rendered correctly. Using waitFor and screen.getByTestId to assert the presence of the component and getAllByRole to count the options are appropriate methods for these assertions. The test is clear and covers the basic rendering and functionality of the component.


59-80: Test case: Default selected option

The test case for checking the default selected option is well-implemented. It ensures that the initial state of the radio buttons matches the expected behavior based on the initialValue property. This test is crucial for verifying that the component respects its initial configuration.

Copy link

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 12, 2024
@Shivam-z
Copy link
Contributor Author

@sagar-qa007 as discussed earlier, I have added a jest unit test case for RadioButtonControl.
can you please review it.

@ayushpahwa
Copy link
Contributor

Tagging @AmanAgarwal041 @sneha122 for review

@ayushpahwa ayushpahwa requested review from AmanAgarwal041 and sneha122 and removed request for ayushpahwa September 16, 2024 06:15
@github-actions github-actions bot removed the Stale label Sep 16, 2024
@carinanfonseca
Copy link
Contributor

Hello @Shivam-z,
The spacing does not conform to the Appsmith Design System guidelines. There should be 16px of space between "Permissions | Scope" and the first radio option. For future reference, spacing should always be a multiple of 4px.

@NilanshBansal NilanshBansal added Query & JS Pod Issues related to the query & JS Pod Integrations Pod General Issues related to the Integrations Pod that don't fit into other tags. Community Contributor Meant to track issues that are assigned to external contributors Integrations Pod labels Sep 19, 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: 1

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between f3d043a and 230a8a7.

Files selected for processing (3)
  • app/client/src/components/formControls/RadioButtonControl.tsx (1 hunks)
  • app/client/src/pages/Editor/DataSourceEditor/JSONtoForm.tsx (1 hunks)
  • app/client/src/pages/Editor/DataSourceEditor/index.tsx (0 hunks)
Files not reviewed due to no reviewable changes (1)
  • app/client/src/pages/Editor/DataSourceEditor/index.tsx
Additional comments not posted (2)
app/client/src/components/formControls/RadioButtonControl.tsx (2)

10-24: Great work on implementing the RadioButtonControl class! 👍

The class correctly extends BaseControl and implements the necessary methods to create a radio button selection interface for forms using Redux Form. The control type is appropriately set to "RADIO_BUTTON", and the render method properly utilizes the Field component to link the radio button group to the form state.

Keep up the excellent work! 🌟


39-64: Excellent implementation of the renderComponent function! 🎉

The function does a great job of handling the rendering of the radio buttons and managing the change events. The onChangeHandler correctly updates the form state when a radio button is selected, ensuring that the selected value is properly synchronized.

I appreciate the use of StyledRadioGroup to style the radio buttons in a vertical layout with appropriate spacing. This enhances the visual presentation and improves the user experience.

The function also correctly maps the provided options to render the radio buttons and initializes the selected value based on the initialValue prop. This ensures that the component behaves as expected.

Fantastic work! Keep it up! 🚀

@AmanAgarwal041
Copy link
Contributor

Hello @Shivam-z, The spacing does not conform to the Appsmith Design System guidelines. There should be 16px of space between "Permissions | Scope" and the first radio option. For future reference, spacing should always be a multiple of 4px.

@Shivam-z Please look into this as well.

chore/refactored missed colone in FormContainer height property
@ankitakinger ankitakinger removed their request for review September 26, 2024 07:12
@Shivam-z Shivam-z force-pushed the Task-#30523/chore-remove_unnecessary_space_between_form_and_CTA branch from 516970a to 8dcc55b Compare September 26, 2024 07:18
@Shivam-z
Copy link
Contributor Author

@AmanAgarwal041 I have rebased my current branch with the release branch.
GoogleSheets_spec.ts is running fine now.
can you please trigger the workflow one more time to verify the cypress results.

ichik
ichik previously approved these changes Sep 26, 2024
Copy link
Contributor

@ichik ichik left a comment

Choose a reason for hiding this comment

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

Visual refinement is a definite improvement.

@AmanAgarwal041
Copy link
Contributor

AmanAgarwal041 commented Sep 26, 2024

@Shivam-z There are still some test failures on the branch, can you please have a look at them ?
Screenshot 2024-09-26 at 5 15 05 PM

@Shivam-z
Copy link
Contributor Author

Shivam-z commented Sep 26, 2024

@AmanAgarwal041 I don't know why GoogleSheets_spec.ts file is failing in the workflow run.
But it is running fine in my local , I am attaching a video for reference.

Screencast.from.26-09-24.05.26.59.PM.IST.webm

@AmanAgarwal041
Copy link
Contributor

@Shivam-z It should be fixed now for Google sheet. Other specs are failing though. Can you try others as well on the local ?

@KelvinOm
Copy link
Collaborator

@jsartisan could you please review this PR?

@KelvinOm KelvinOm removed their request for review September 27, 2024 11:04
@Shivam-z
Copy link
Contributor Author

@AmanAgarwal041 I’ve identified the root cause of the test case failures. The issue stemmed from the removal of the following height property in the DSEditorWrapper:

height: calc(100vh - ${(props) => props.theme.headerHeight});

This height adjustment caused Cypress to fail in locating the required elements, leading to the test failures. In this commit, I’ve restored the original height value.

Could you please trigger the workflow again to verify the fix?`

@AmanAgarwal041
Copy link
Contributor

Hey @Shivam-z , these are the test cases that are failing. Can you please check ?
Screenshot 2024-10-01 at 11 54 44 AM

@Shivam-z
Copy link
Contributor Author

Shivam-z commented Oct 1, 2024

@AmanAgarwal041 @NilanshBansal , I have fixed GoogleSheet_specs file and rebased current branch with relase with latest changes.
All test cases are running fine in local.
can you trigger the workflow once again.

@AmanAgarwal041
Copy link
Contributor

@Shivam-z There seems to be some lint errors. Can you fix those https://github.com/appsmithorg/appsmith/actions/runs/11130343332/job/31021794899?pr=35985 ?

@jsartisan jsartisan removed their request for review October 7, 2024 05:24
@Shivam-z
Copy link
Contributor Author

Shivam-z commented Oct 7, 2024

@AmanAgarwal041 I have fixed client linting errors.
please have look on it.

@AmanAgarwal041
Copy link
Contributor

Here is one more linting error! @Shivam-z can you take a look at it ?
Screenshot 2024-10-08 at 12 31 18 AM

@Shivam-z
Copy link
Contributor Author

Shivam-z commented Oct 8, 2024

@AmanAgarwal041 fixed above linting error

@yatinappsmith yatinappsmith merged commit ac91339 into appsmithorg:release Oct 9, 2024
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community Contributor Meant to track issues that are assigned to external contributors Integrations Pod General Issues related to the Integrations Pod that don't fit into other tags. Integrations Pod Query & JS Pod Issues related to the query & JS Pod
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove unnecessary space between form and the CTA for GSheets in the datasource review form (onboarding step)
9 participants