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: external merge request from Contributor #34272

Conversation

somangshu
Copy link
Contributor

@somangshu somangshu commented Jun 17, 2024

…in the table widget; are decreased by 1 day #25081

Description

Tip

Add a TL;DR when the description is longer than 500 words or extremely technical (helps the content, marketing, and DevRel team).

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 #25081
or
Fixes https://github.com/appsmithorg/appsmith/issues/25081

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

🔍 Cypress test results

Warning

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

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • New Features

    • Added test cases for adding new rows and editing columns in the table widget.
  • Bug Fixes

    • Ensured consistent date handling and saving in the DateCell component for new row entries.

Harshithazemoso and others added 6 commits May 31, 2024 17:48
…ictable-movements-of-the-dates-in-the-date-picker-included-in-the-table-widget-are-decreased-by-1-day' into external-contri/Issue-25081-fix/Unpredictable-movements-of-the-dates-in-the-date-picker-included-in-the-table-widget-are-decreased-by-1-day
Copy link
Contributor

coderabbitai bot commented Jun 17, 2024

Walkthrough

The recent changes introduce new test cases for verifying the functionality of adding rows and editing columns in the table widget. Additionally, improvements have been made in the DateCell component to ensure consistent handling and formatting of date values when adding new rows and saving dates.

Changes

Files Change Summary
app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/AddNewRowEditColumn_spec.js Added test cases for adding new rows, editing columns, and validating date selections in a table widget.
app/client/src/widgets/TableWidgetV2/component/cellComponents/DateCell.tsx Enhanced DateCell to use formattedDate consistently, ensuring correct behavior for new row values and date saving.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant TableWidget
    participant DateCell

    User->>TableWidget: Add new row
    TableWidget->>DateCell: Insert date
    DateCell->>DateCell: Format date
    DateCell->>TableWidget: Update new row with formatted date
    User-->>TableWidget: Edit column
    User->>DateCell: Save date
    DateCell->>DateCell: Format and save date
    DateCell->>TableWidget: Update table with formatted date
Loading

Poem

In the realm of code, updates we bring,
New rows and dates, a tale to sing.
Test cases guard our treasure's glint,
Ensuring columns shimmer with mint.
To every widget, a task divine,
DateCell's formatted, it now aligns!


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.

@github-actions github-actions bot added the skip-changelog Adding this label to a PR prevents it from being listed in the changelog label Jun 17, 2024
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/TableV2/AddNewRowEditColumn_spec.js

@somangshu somangshu added the ok-to-test Required label for CI label Jun 17, 2024
@github-actions github-actions bot added Widgets Product This label groups issues related to widgets Bug Something isn't working Community Reported issues reported by community members Date Picker Widget Medium Issues that frustrate users due to poor UX Needs Triaging Needs attention from maintainers to triage Production Table Inline Edit Issues related to inline editing Table Widget V2 Issues related to Table Widget V2 and removed Bug Something isn't working labels Jun 17, 2024
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/TableV2/AddNewRowEditColumn_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: 1

Outside diff range and nitpick comments (2)
app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/AddNewRowEditColumn_spec.js (1)

24-65: Ensure consistent use of single or double quotes for string literals to improve code readability.

app/client/src/widgets/TableWidgetV2/component/cellComponents/DateCell.tsx (1)

Line range hint 108-115: Remove the unnecessary else clause as suggested by static analysis to simplify control flow.

- else {
+ // Removed unnecessary else clause
  }
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e97dc64 and 7187085.

Files selected for processing (2)
  • app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/AddNewRowEditColumn_spec.js (1 hunks)
  • app/client/src/widgets/TableWidgetV2/component/cellComponents/DateCell.tsx (2 hunks)
Additional context used
Biome
app/client/src/widgets/TableWidgetV2/component/cellComponents/DateCell.tsx

[error] 108-115: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)

Unsafe fix: Omit the else clause.

Additional comments not posted (2)
app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/AddNewRowEditColumn_spec.js (1)

29-30: Consider adding error handling or assertions to verify successful widget drag-and-drop and property setting operations.

app/client/src/widgets/TableWidgetV2/component/cellComponents/DateCell.tsx (1)

216-218: Refactor to avoid duplicate calls to moment(date).format(inputFormat) by storing the result in a variable if used multiple times.

- const formattedDate: string = date ? moment(date).format(inputFormat) : "";
+ const formattedDate: string = date ? moment(date).format(inputFormat) : "";
  if (isNewRow) {
-   updateNewRowValues(alias, date, formattedDate);
+   updateNewRowValues(alias, date, formattedDate);
    return;
  }

Likely invalid or redundant comment.

Comment on lines +34 to +63
_.propPane.TogglePropertyState("Allow adding a row", "On");
cy.get(".t--add-new-row").should("exist");
// enabling the ediatable option for the three columns
cy.makeColumnEditable("step");
cy.makeColumnEditable("task");
cy.makeColumnEditable("Date");
cy.get(".t--add-new-row").click();
cy.get(".tableWrap .new-row").should("exist");

// entering the values in the table
cy.enterTableCellValue(0, 0, "22");
cy.enterTableCellValue(1, 0, "21");

// Click on the date input to open the date picker
cy.enterTableCellValue(3, 0);
const now = new Date();

cy.get(".DayPicker-Day--today > .bp3-datepicker-day-wrapper").click();
cy.dragAndDropToCanvas("textwidget", { x: 300, y: 600 });
cy.openPropertyPane("textwidget");
cy.updateCodeInput(".t--property-control-text", "{{Table1.newRow.Date}}");

// checking the date selected and the date in the text widget matches correctly
now.setHours(0, 0, 0, 0); // Reset time to 00:00:00
const offset = now.getTimezoneOffset() * 60000; // offset in milliseconds
const localISOTime = `${new Date(now.getTime() - offset).toISOString().slice(0, 19)}+05:30`; // adjust to the desired timezone// adjust to the desired timezone
cy.get(".t--widget-textwidget .bp3-ui-text").should(
"contain",
`${localISOTime.split("T")[0]}T00:00:00+05:30`,
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Codebase Verification

The test case does not validate the actual values entered in the table, only the presence of elements. Consider adding assertions to verify that the values entered match expected results.

  • The test file contains assertions checking for the existence of elements but lacks assertions to verify the actual values entered in the table.
Analysis chain

The test case does not validate the actual values entered in the table, only the presence of elements. Consider adding assertions to verify that the values entered match expected results.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that assertions are in place to check entered values.

# Test: Search for assertions related to entered values.
rg --type python 'expect' app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/AddNewRowEditColumn_spec.js

Length of output: 145



Script:

#!/bin/bash
# Correcting the file type to JavaScript and searching for assertions related to entered values in the test file.

rg --type js 'should|expect' app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/AddNewRowEditColumn_spec.js

Length of output: 280

@jsartisan
Copy link
Contributor

/build-deploy-preview skip-tests=true

@jsartisan
Copy link
Contributor

@ramsaptami Can you QA this PR once?

Copy link

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

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/TableV2/AddNewRowEditColumn_spec.js

@somangshu
Copy link
Contributor Author

@pratapaprasanna none of the PRs are generating the DP. Can you please check?

Another PR here

@somangshu somangshu closed this Jun 18, 2024
@somangshu somangshu deleted the external-contri/Issue-25081-fix/Unpredictable-movements-of-the-dates-in-the-date-picker-included-in-the-table-widget-are-decreased-by-1-day branch June 18, 2024 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community Reported issues reported by community members Date Picker Widget Medium Issues that frustrate users due to poor UX Needs Triaging Needs attention from maintainers to triage ok-to-test Required label for CI Production skip-changelog Adding this label to a PR prevents it from being listed in the changelog Table Inline Edit Issues related to inline editing Table Widget V2 Issues related to Table Widget V2 Widgets Product This label groups issues related to widgets
Projects
None yet
2 participants