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: change value to label in onItemSelect inside SelectCell of table widget #34743

Merged
merged 2 commits into from
Jul 9, 2024

Conversation

jacquesikot
Copy link
Contributor

@jacquesikot jacquesikot commented Jul 5, 2024

Description

Issue
In the table widget, the select column currently displays the value from the dropdown when a user makes a selection, rather than the label. This behaviour is inconsistent with the standalone select widget, which correctly renders the label upon selection.

Fix
This PR addresses the inconsistency by modifying the table widget's select column to display the label of the selected item, ensuring alignment with the behaviour of the standalone select widget.

Fixes #26188

Automation

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

🔍 Cypress test results

Tip

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


Mon, 08 Jul 2024 18:21:02 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • Bug Fixes

    • Updated the SelectCell component to use the option.label instead of option.value for item selection.
  • Tests

    • Revised test descriptions and assertions for select options in Table Widget to reflect the new functionality of using labels as values in select cells.

@jacquesikot jacquesikot added the Widgets & Blocks Pod Issues under widgets and blocks pod. label Jul 5, 2024
@jacquesikot jacquesikot self-assigned this Jul 5, 2024
@github-actions github-actions bot added App Viewers Pod This label assigns issues to the app viewers pod Bug Something isn't working High This issue blocks a user from building or impacts a lot of users Production Table Widget labels Jul 5, 2024
@jacquesikot jacquesikot added the ok-to-test Required label for CI label Jul 5, 2024
@github-actions github-actions bot added Enhancement New feature or request Bug Something isn't working and removed Bug Something isn't working labels Jul 5, 2024
@jacquesikot
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

Copy link
Contributor

coderabbitai bot commented Jul 5, 2024

Walkthrough

The recent changes modify the SelectCell component to update the cell data with the label of the selected option instead of its value. Corresponding Cypress tests have also been updated to validate this new behavior, ensuring that selection within cells uses labels correctly.

Changes

Files/Paths Change Summary
app/client/src/widgets/TableWidgetV2/component/cellComponents/SelectCell.tsx Modified the parameter passed to onItemSelect from option.value to option.label.
app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts Updated test descriptions and assertions to reflect the use of labels as values in select cells.

Sequence Diagram(s)

The changes are straightforward and don't involve significant control flow modifications; hence no sequence diagrams are necessary.

Assessment against linked issues

Objective Addressed Explanation
Update cell data to reflect option's label instead of value. (#26188)
Ensure tests reflect new behavior of using labels as values. (#27061, #27093)

Poem

> In tables cells, we'll now delight,
> Select options show their label bright.
> No more values in disguise,
> Clear and concise, we'll visualize.
> With code and tests, our tasks align,
> In harmony, our features shine.

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.
    • @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

github-actions bot commented Jul 5, 2024

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

@github-actions github-actions bot added Bug Something isn't working and removed Bug Something isn't working labels Jul 5, 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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between a2f2f79 and 718d8a7.

Files selected for processing (1)
  • app/client/src/widgets/TableWidgetV2/component/cellComponents/SelectCell.tsx (1 hunks)
Files skipped from review due to trivial changes (1)
  • app/client/src/widgets/TableWidgetV2/component/cellComponents/SelectCell.tsx

Copy link

github-actions bot commented Jul 5, 2024

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

Copy link
Contributor

@rahulbarwal rahulbarwal left a comment

Choose a reason for hiding this comment

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

Unit tests?

@jacquesikot
Copy link
Contributor Author

@rahulbarwal I was thinking cypress tests? But i can try with a unit test first?

@rahulbarwal
Copy link
Contributor

@rahulbarwal I was thinking cypress tests? But i can try with a unit test first?

Whatever you think will be best is fine. Any kind of coverage is good.

@github-actions github-actions bot added the Bug Something isn't working label Jul 8, 2024
@jacquesikot jacquesikot removed the ok-to-test Required label for CI label Jul 8, 2024
@jacquesikot jacquesikot added the ok-to-test Required label for CI label Jul 8, 2024
@github-actions github-actions bot removed the Bug Something isn't working label Jul 8, 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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 718d8a7 and 330d0d3.

Files selected for processing (1)
  • app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts (4 hunks)
Additional context used
Path-based instructions (1)
app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts (1)

Pattern app/client/cypress/**/**.*: Follow best practices for Cypress code and e2e automation.
Avoid using cy.wait in code.
Avoid using cy.pause in code.
Use variables for locators, not strings.
Use data-* attributes for selectors; avoid Xpaths and CSS attributes.
Avoid selectors like .btn.submit or button[type=submit].
Perform logins via API with LoginFromAPI.
Only interact with controlled sites/servers.
Ensure tests can run with it.only and are independent.
Use before, beforeEach, after, afterEach correctly; clean state before tests.
Check new specs for flakiness by running them 10 times on CI.
Use multiple assertions; don't treat Cypress as unit tests.
Use constants for strings.
Include datasource operations in before hooks.

Additional comments not posted (1)
app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts (1)

177-207: LGTM! The test case correctly verifies the use of label as value in select cell.

The new test case ensures that the label is used as the value in the select cell, aligning with the PR objectives and fixing the described issue.

@jacquesikot jacquesikot added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Jul 8, 2024
@github-actions github-actions bot added the Bug Something isn't working label Jul 8, 2024
@jacquesikot jacquesikot merged commit b7853a9 into release Jul 9, 2024
71 of 73 checks passed
@jacquesikot jacquesikot deleted the feat/table-select-widget-display-value branch July 9, 2024 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
App Viewers Pod This label assigns issues to the app viewers pod Bug Something isn't working Enhancement New feature or request High This issue blocks a user from building or impacts a lot of users ok-to-test Required label for CI Production Table Widget Widgets & Blocks Pod Issues under widgets and blocks pod.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Select widget should display label instead of value while editing a table cell
2 participants