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 layout on load actions to import block API response #31993

Merged
merged 3 commits into from
Mar 22, 2024

Conversation

AnaghHegde
Copy link
Member

@AnaghHegde AnaghHegde commented Mar 21, 2024

Description

  • After importing the block into a page, the browser does not have the updated values on the on page load actions.
  • The newly created actions, actionCollections which needs to run after adding the block to canvas are missing.
  • This is because unlike normal flow, here the server fetch the Block data from DSL and then has to import it and send the widget DSL from the block to client so that the widgets are visible on the canvas. Hence adding this to response to make the experience same as other widgets

Fixes #31992

Automation

/ok-to-test tags="tag.ImportExport"

🔍 Cypress test results

Important

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/8379501235
Commit: a6599b14c4027179f79a31b3d6a8e1dad1cc96f0
Cypress dashboard url: Click here!
All cypress tests have passed 🎉🎉🎉

Summary by CodeRabbit

  • New Features
    • Introduced a new data structure to enhance building block imports, including widget layouts and onPageLoad actions.
  • Refactor
    • Updated the import functionality to utilize the new data structure for building blocks, improving the handling of layout data and onPageLoad actions.
  • Tests
    • Modified unit tests to align with the new data structure for building block imports, ensuring compatibility and correctness.

@AnaghHegde AnaghHegde self-assigned this Mar 21, 2024
Copy link
Contributor

coderabbitai bot commented Mar 21, 2024

Walkthrough

The overall change involves enhancing the import functionality within an application development platform to support more complex building block imports. This includes the introduction of a new DTO to encapsulate widget DSL and onPageLoad actions, modifications to the import service to utilize this new DTO, and updates to tests to align with these changes. These enhancements aim to improve the user experience by ensuring the latest client data and necessary actions are available after importing a building block into a page.

Changes

File Path Change Summary
.../dtos/BuildingBlockResponseDTO.java Introduced BuildingBlockResponseDTO to include widgetDsl and onPageLoad actions.
.../imports/internal/partial/PartialImportServiceCE.java
.../imports/internal/partial/PartialImportServiceCEImpl.java
Updated import statement and return type to Mono<BuildingBlockResponseDTO>. Modified importBuildingBlock method logic for enhanced import processing.
.../solutions/PartialImportServiceTest.java Updated imports, return types, and assertions to accommodate BuildingBlockResponseDTO.
.../controllers/ce/ApplicationControllerCE.java Added import for BuildingBlockResponseDTO and changed return type of importBlock method.

Assessment against linked issues

Objective Addressed Explanation
Add layoutOnLoadActions for the import block API response (#31992)
Enable users to integrate building blocks with components into existing applications (#31315) The changes seem to facilitate this, but without explicit mention of drag-and-drop functionality, the full integration scope is not entirely clear.
Enhance the PIE API to support backend operations for adding queries, JavaScript, and datasources (#31315) The updates suggest backend improvements for importing building blocks, which may include these components, but specifics on queries, JavaScript, and datasources are not detailed.
Transmit the updated application's widget structure back to the client (#31315)

Related issues


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 Configuration 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 Building blocks Building blocks on cavas, on templates listing or drag and drop of building blocks. Task A simple Todo Templates Templates Product Issues related to Templates labels Mar 21, 2024
@AnaghHegde AnaghHegde added ok-to-test Required label for CI and removed Task A simple Todo Templates Product Issues related to Templates Templates Building blocks Building blocks on cavas, on templates listing or drag and drop of building blocks. labels Mar 21, 2024
@github-actions github-actions bot added Building blocks Building blocks on cavas, on templates listing or drag and drop of building blocks. Task A simple Todo Templates Templates Product Issues related to Templates Enhancement New feature or request labels Mar 21, 2024
Copy link

Failed server tests

  • com.appsmith.server.solutions.PartialImportServiceTest#testPartialImportWithBuildingBlock_nameClash_success

@AnaghHegde AnaghHegde added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Mar 21, 2024
Copy link
Contributor

@NilanshBansal NilanshBansal left a comment

Choose a reason for hiding this comment

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

LGTM

@AnaghHegde AnaghHegde merged commit 6b3c9f4 into release Mar 22, 2024
48 checks passed
@AnaghHegde AnaghHegde deleted the feat/import-block-api branch March 22, 2024 07:04
@Nikhil-Nandagopal Nikhil-Nandagopal added Accelerators Product Issues related to app building accelerators and removed Templates Product Issues related to Templates labels Aug 6, 2024
@github-actions github-actions bot added the Widgets & Accelerators Pod Issues related to widgets & Accelerators label Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accelerators Product Issues related to app building accelerators Building blocks Building blocks on cavas, on templates listing or drag and drop of building blocks. Enhancement New feature or request ok-to-test Required label for CI Task A simple Todo Widgets & Accelerators Pod Issues related to widgets & Accelerators
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task]: Add layoutOnLoadActions for the import block API response
3 participants