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

fix: Revert "chore: Remove empty canvas prompts and improve widget editor header (#33993)" #34035

Conversation

rahulbarwal
Copy link
Contributor

@rahulbarwal rahulbarwal commented Jun 6, 2024

Description

This reverts commit 8d0091e.

Cypress specs are failing due to this.

Fixes #Issue Number
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="@tag.Templates, @tag.Visual"

🔍 Cypress test results

Caution

🔴 🔴 🔴 Some tests have failed.
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/9400055069
Commit: 2c7077a
Cypress dashboard: Click here!
The following are new failures, please fix them before merging the PR:

  1. cypress/e2e/Regression/ClientSide/VisualTests/JSEditorComment_spec.js
  2. cypress/e2e/Regression/ClientSide/VisualTests/JSEditorIndent_spec.js
  3. cypress/e2e/Regression/ClientSide/VisualTests/JSEditorSaveAndAutoIndent_spec.js
  4. cypress/e2e/Regression/ClientSide/VisualTests/WidgetsLayout_spec.js
To know the list of identified flaky tests - Refer here

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • New Features

    • Introduced prompts for generating a CRUD app or importing from a template when the canvas is empty.
    • Added descriptive titles and descriptions for template cards and page generation.
  • Bug Fixes

    • Improved functionality for forking a template into an existing app connected to Git.
  • Refactor

    • Replaced specific method calls with Cypress commands for better test interaction and assertions.
  • Documentation

    • Updated constants related to template cards and page generation for better clarity.

@rahulbarwal rahulbarwal requested review from a team and marks0351 and removed request for a team June 6, 2024 11:26
Copy link
Contributor

coderabbitai bot commented Jun 6, 2024

Walkthrough

The recent updates enhance the functionality of forking templates into Git-connected apps, improving the user interface interactions and adding new constants for better messaging. Key changes include replacing function calls with Cypress commands for UI interactions, adding new constants for template and page generation descriptions, and updating the WidgetEditorHeader and EmptyCanvasPrompts components to conditionally render prompts based on app state.

Changes

File Path Change Summary
app/client/cypress/e2e/Regression/ClientSide/Templates/ForkTemplateToGitConnectedApp.js Replaced function calls with Cypress commands for UI interactions and adjusted assertions.
app/client/cypress/e2e/Regression/ClientSide/Templates/Fork_Template_To_App_spec.ts Updated test case to use Cypress commands for adding pages from templates.
app/client/src/ce/constants/messages.ts Added new constants for template card titles, descriptions, and page generation.
app/client/src/pages/Editor/WidgetsEditor/WidgetEditorHeader.tsx Imported additional modules and added conditional rendering for EmptyCanvasPrompts.
app/client/src/pages/Editor/WidgetsEditor/components/EmptyCanvasPrompts.tsx Introduced EmptyCanvasPrompts component with new prompts for empty canvas scenarios.

Poem

In the realm of code, where changes flow,
Templates fork with a gentle glow.
Cypress commands now take the stage,
Guiding clicks on every page.
Constants added, prompts anew,
A smoother path for me and you.
🌟✨🚀

Warning

Review ran into problems

Problems (1)
  • Git: Failed to clone repository. Please contact CodeRabbit support.

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.

@rahulbarwal rahulbarwal self-assigned this Jun 6, 2024
@rahulbarwal rahulbarwal added Templates Product Issues related to Templates Templates ok-to-test Required label for CI labels Jun 6, 2024
@rahulbarwal rahulbarwal changed the title Revert "chore: Remove empty canvas prompts and improve widget editor header (#33993)" fix: Revert "chore: Remove empty canvas prompts and improve widget editor header (#33993)" Jun 6, 2024
@rahulbarwal rahulbarwal requested a review from jacquesikot June 6, 2024 11:30
@github-actions github-actions bot added the Bug Something isn't working label Jun 6, 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 UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 05aa9cc and 2c7077a.

Files selected for processing (5)
  • app/client/cypress/e2e/Regression/ClientSide/Templates/ForkTemplateToGitConnectedApp.js (1 hunks)
  • app/client/cypress/e2e/Regression/ClientSide/Templates/Fork_Template_To_App_spec.ts (1 hunks)
  • app/client/src/ce/constants/messages.ts (2 hunks)
  • app/client/src/pages/Editor/WidgetsEditor/WidgetEditorHeader.tsx (2 hunks)
  • app/client/src/pages/Editor/WidgetsEditor/components/EmptyCanvasPrompts.tsx (1 hunks)
Additional context used
Learnings (1)
app/client/cypress/e2e/Regression/ClientSide/Templates/ForkTemplateToGitConnectedApp.js (1)
User: dipyamanbiswas07
PR: appsmithorg/appsmith#29282
File: app/client/cypress/e2e/Regression/ClientSide/Templates/Fork_Template_spec.js:11-17
Timestamp: 2024-01-09T08:39:59.723Z
Learning: The user has clarified that intercepts are called in end-to-end tests, and therefore resetting the feature flag in an `afterEach` hook is not required in their test setup.
Additional comments not posted (6)
app/client/src/pages/Editor/WidgetsEditor/WidgetEditorHeader.tsx (2)

2-8: Ensure that all new imports are used appropriately within the component.


20-32: The conditional rendering logic for EmptyCanvasPrompts is clear and well-implemented. However, ensure that the isPreviewMode and isAppSettingsPaneWithNavigationTabOpen states are correctly managed across the application to prevent unintended UI behavior.

#!/bin/bash
# Description: Verify the usage of `isPreviewMode` and `isAppSettingsPaneWithNavigationTabOpen` across the application.

# Test: Search for the usage of these states. Expect: Consistent usage across the application.
rg --type typescript $'isPreviewMode|isAppSettingsPaneWithNavigationTabOpen'
app/client/cypress/e2e/Regression/ClientSide/Templates/Fork_Template_To_App_spec.ts (1)

36-36: The refactoring to use agHelper.GetNClick for interacting with the template card simplifies the test code and makes it more readable. Ensure that the template.startFromTemplateCard selector is robust and correctly identifies the template card across different test environments.

#!/bin/bash
# Description: Verify the robustness of the `template.startFromTemplateCard` selector.

# Test: Search for the usage of this selector. Expect: Consistent and correct identification in all environments.
rg --type typescript $'template.startFromTemplateCard'
app/client/cypress/e2e/Regression/ClientSide/Templates/ForkTemplateToGitConnectedApp.js (1)

35-40: The update to use Cypress commands for UI interactions enhances the readability and maintainability of the test code. Ensure that these commands are consistently used in similar contexts throughout the test suite.

#!/bin/bash
# Description: Verify the consistent use of Cypress commands in similar test contexts.

# Test: Search for the usage of Cypress commands in the test suite. Expect: Consistent usage.
rg --type javascript $'cy.get|cy.click'
app/client/src/pages/Editor/WidgetsEditor/components/EmptyCanvasPrompts.tsx (2)

1-28: The new imports and hooks are well-integrated into the component. Ensure that these dependencies are properly managed and do not introduce side effects that could affect the component's performance.


85-168: The refactoring of the EmptyCanvasPrompts component enhances its functionality and makes it more modular. However, ensure that the new event handlers and state management logic are thoroughly tested, especially in edge cases where the canvas might transition between states.

#!/bin/bash
# Description: Verify the robustness of the new event handlers and state management logic.

# Test: Search for the usage of `showCanvasTopSection` and `isPreview`. Expect: Robust handling in all states.
rg --type typescript $'showCanvasTopSection|isPreview'

Comment on lines +1774 to +1776
export const TEMPLATE_CARD_TITLE = () => "Start from a template";
export const TEMPLATE_CARD_DESCRIPTION = () =>
"Create app from template by selecting pages";
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider using consistent naming for constants related to similar functionalities.

- export const TEMPLATE_CARD_TITLE = () => "Start from a template";
- export const TEMPLATE_CARD_DESCRIPTION = () =>
-   "Create app from template by selecting pages";
- export const GENERATE_PAGE = () => "Generate page from data table";
- export const GENERATE_PAGE_DESCRIPTION = () =>
-   "Start app with a simple CRUD UI and customize it";
+ export const TEMPLATE_CARD_TITLE = () => "Start From a Template";
+ export const TEMPLATE_CARD_DESCRIPTION = () => "Create App From Template by Selecting Pages";
+ export const GENERATE_PAGE = () => "Generate Page From Data Table";
+ export const GENERATE_PAGE_DESCRIPTION = () => "Start App With a Simple CRUD UI and Customize It";

This change ensures that the function names and return strings are more readable and maintain a consistent format across similar functionalities.

Also applies to: 1829-1831

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
export const TEMPLATE_CARD_TITLE = () => "Start from a template";
export const TEMPLATE_CARD_DESCRIPTION = () =>
"Create app from template by selecting pages";
export const TEMPLATE_CARD_TITLE = () => "Start From a Template";
export const TEMPLATE_CARD_DESCRIPTION = () => "Create App From Template by Selecting Pages";
export const GENERATE_PAGE = () => "Generate Page From Data Table";
export const GENERATE_PAGE_DESCRIPTION = () => "Start App With a Simple CRUD UI and Customize It";

@rahulbarwal
Copy link
Contributor Author

Not needed anymore, it is fixed here #34037

@rahulbarwal rahulbarwal closed this Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working ok-to-test Required label for CI Templates Product Issues related to Templates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant