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: add alignment property in style pane for table button cell #38223

Merged
merged 2 commits into from
Dec 24, 2024

Conversation

jacquesikot
Copy link
Contributor

@jacquesikot jacquesikot commented Dec 18, 2024

Description

Problem
When a user uses the button column type in a table widget, the button is automatically aligned to the left, and the style tab of the button property pane does not allow the user change the vertical or horizontal alignment of the button column.

Solution
We have added the Alignment property to the button column type for the table widget, and added tests.

Fixes #38032

Automation

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

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/12417408061
Commit: 07f2eb0
Cypress dashboard.
Tags: @tag.Table, @tag.Widget, @tag.Binding
Spec:


Thu, 19 Dec 2024 18:44:06 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • New Features

    • Added a test suite for validating button cell functionality in the Table Widget V2.
    • Introduced a method to generate CSS selectors for specific table cells.
  • Bug Fixes

    • Enhanced visibility controls for alignment properties based on column types, particularly for button cells.

@jacquesikot jacquesikot added the ok-to-test Required label for CI label Dec 18, 2024
@jacquesikot jacquesikot self-assigned this Dec 18, 2024
Copy link
Contributor

coderabbitai bot commented Dec 18, 2024

Walkthrough

This pull request introduces enhanced alignment capabilities for button cells in the Table Widget V2. The changes span across multiple files, implementing a comprehensive solution for allowing horizontal and vertical alignment of button columns. A new Cypress test suite has been created to validate these alignment functionalities, complemented by updates to the property configuration and support utilities.

Changes

File Change Summary
app/client/.../ButtonCell_spec.ts Added Cypress test suite for button cell alignment validation
app/client/support/Pages/Table.ts Introduced GetTableDataSelector method for table cell selection
app/client/.../Alignment.ts Updated property visibility for button column alignments

Assessment against linked issues

Objective Addressed Explanation
Allow button column alignment [#38032]
Support left, center, right alignment

Possibly related PRs

Suggested labels

Enhancement, Widgets Product, Table Widget, Production, Medium, Widgets & Accelerators Pod

Suggested reviewers

  • ApekshaBhosale
  • NandanAnantharamu
  • rahulbarwal
  • sagar-qa007

Poem

🎯 Buttons aligned with grace and might,
In tables dancing left and right,
Centered, poised, no longer shy,
A widget's art that catches the eye!
Cypress tests, our guiding light 🌟

Tip

CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. We would love to hear your feedback on Discord.


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 836b544 and 07f2eb0.

📒 Files selected for processing (3)
  • app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/ButtonCell_spec.ts (1 hunks)
  • app/client/cypress/support/Pages/Table.ts (1 hunks)
  • app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/Alignment.ts (3 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
app/client/cypress/support/Pages/Table.ts (1)

Pattern app/client/cypress/**/**.*: Review the following e2e test code written using the Cypress test library. Ensure that:

  • Follow best practices for Cypress code and e2e automation.
  • Avoid using cy.wait in code.
  • Avoid using cy.pause in code.
  • Avoid using agHelper.sleep().
  • Use locator variables for locators and do not use plain strings.
  • Use data-* attributes for selectors.
  • Avoid Xpaths, Attributes and CSS path.
  • Avoid selectors like .btn.submit or button[type=submit].
  • Perform logins via API with LoginFromAPI.
  • Perform logout via API with LogOutviaAPI.
  • Perform signup via API with SignupFromAPI.
  • Avoid using it.only.
  • Avoid using after and aftereach in test cases.
  • Use multiple assertions for expect statements.
  • Avoid using strings for assertions.
  • Do not use duplicate filenames even with different paths.
  • Avoid using agHelper.Sleep, this.Sleep in any file in code.
app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/ButtonCell_spec.ts (1)

Pattern app/client/cypress/**/**.*: Review the following e2e test code written using the Cypress test library. Ensure that:

  • Follow best practices for Cypress code and e2e automation.
  • Avoid using cy.wait in code.
  • Avoid using cy.pause in code.
  • Avoid using agHelper.sleep().
  • Use locator variables for locators and do not use plain strings.
  • Use data-* attributes for selectors.
  • Avoid Xpaths, Attributes and CSS path.
  • Avoid selectors like .btn.submit or button[type=submit].
  • Perform logins via API with LoginFromAPI.
  • Perform logout via API with LogOutviaAPI.
  • Perform signup via API with SignupFromAPI.
  • Avoid using it.only.
  • Avoid using after and aftereach in test cases.
  • Use multiple assertions for expect statements.
  • Avoid using strings for assertions.
  • Do not use duplicate filenames even with different paths.
  • Avoid using agHelper.Sleep, this.Sleep in any file in code.
🔇 Additional comments (7)
app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/ButtonCell_spec.ts (3)

8-18: LGTM! Well-structured test setup.

The test suite is properly organized with clear categorization tags and setup in the before hook.


20-34: LGTM! Well-implemented validation helper.

The validateAlignment helper function is well-designed:

  • Handles both horizontal and vertical alignments
  • Uses proper CSS property assertions
  • Follows DRY principle

36-59: LGTM! Comprehensive test coverage.

The test implementation:

  • Covers all alignment options
  • Uses data-driven approach with predefined configurations
  • Follows Cypress best practices
app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/Alignment.ts (3)

12-12: LGTM! Proper column type configuration.

Added button column type to alignment configuration correctly.


60-60: LGTM! Consistent horizontal alignment support.

Button column type properly added to horizontal alignment configuration.


107-107: LGTM! Consistent vertical alignment support.

Button column type properly added to vertical alignment configuration.

app/client/cypress/support/Pages/Table.ts (1)

859-861: LGTM! Well-implemented helper method.

The GetTableDataSelector method:

  • Follows consistent naming convention
  • Uses proper data attributes for selection
  • Returns a properly formatted selector string

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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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 Enhancement New feature or request Table Widget V2 Issues related to Table Widget V2 Widgets & Accelerators Pod Issues related to widgets & Accelerators Widgets Product This label groups issues related to widgets labels Dec 18, 2024
@jacquesikot jacquesikot added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Dec 19, 2024
@jacquesikot
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

Copy link

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

Copy link

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

@jacquesikot jacquesikot merged commit cda656b into release Dec 24, 2024
75 of 77 checks passed
@jacquesikot jacquesikot deleted the feat/allow-button-center-align-in-table-widget branch December 24, 2024 06:18
NandanAnantharamu pushed a commit that referenced this pull request Dec 27, 2024
)

## Description
**Problem**
When a user uses the button column type in a table widget, the button is
automatically aligned to the left, and the style tab of the button
property pane does not allow the user change the vertical or horizontal
alignment of the button column.

**Solution**
We have added the Alignment property to the button column type for the
table widget, and added tests.


Fixes #38032 

## Automation

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

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/12417408061>
> Commit: 07f2eb0
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=12417408061&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Table, @tag.Widget, @tag.Binding`
> Spec:
> <hr>Thu, 19 Dec 2024 18:44:06 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Added a test suite for validating button cell functionality in the
Table Widget V2.
- Introduced a method to generate CSS selectors for specific table
cells.
  
- **Bug Fixes**
- Enhanced visibility controls for alignment properties based on column
types, particularly for button cells.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request ok-to-test Required label for CI Table Widget V2 Issues related to Table Widget V2 Widgets & Accelerators Pod Issues related to widgets & Accelerators Widgets Product This label groups issues related to widgets
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: Allow buttons to be aligned in the centre of a cloumn in a table
3 participants