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: building block canvas dragging #31398
Conversation
WalkthroughWalkthroughThe recent updates to the Appsmith server focus on enhancing the Partial Import Export (PIE) API by introducing the ability to import building blocks, such as queries, JavaScript functions, and datasources, into existing applications. This includes backend operations to support drag-and-drop functionality, efficient management of resources, and updating the application's widget structure for client rendering. The changes involve the addition of new services, methods, and utilities aimed at refining the process of integrating building blocks with components, thereby improving the user experience and operational efficiency. Changes
Assessment against linked issues
The code changes successfully address the key objectives outlined in the linked issue, focusing on enhancing the backend functionality of the PIE API to support the integration of building blocks into applications, which is crucial for improving the user experience and operational efficiency. 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? TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Additionally, you can add CodeRabbit Configration File (
|
...rc/main/java/com/appsmith/server/newactions/importable/NewActionImportableServiceCEImpl.java
Show resolved
Hide resolved
...r/src/main/java/com/appsmith/server/imports/internal/partial/PartialImportServiceCEImpl.java
Outdated
Show resolved
Hide resolved
...r/src/main/java/com/appsmith/server/imports/internal/partial/PartialImportServiceCEImpl.java
Outdated
Show resolved
Hide resolved
…o feat/block-canvas-dragging
public Mono<String> importBuildingBlock(BuildingBlockDTO buildingBlockDTO, String branchName) { | ||
Mono<ApplicationJson> applicationJsonMono = | ||
applicationTemplateService.getApplicationJsonFromTemplate(buildingBlockDTO.getTemplateId()); | ||
|
||
return applicationJsonMono | ||
.flatMap(applicationJson -> this.importResourceInPage( | ||
buildingBlockDTO.getWorkspaceId(), | ||
buildingBlockDTO.getPageId(), | ||
buildingBlockDTO.getApplicationId(), | ||
branchName, | ||
applicationJson)) | ||
.map(BuildingBlockImportDTO::getWidgetDsl); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The importBuildingBlock
method introduces functionality for importing a building block based on a template ID. Ensure that the applicationTemplateService.getApplicationJsonFromTemplate
method properly handles errors and edge cases, such as invalid template IDs or templates that cannot be converted to ApplicationJson
. Additionally, consider adding more detailed logging or metrics around this process for better observability.
+ log.info("Starting import of building block with template ID: {}", buildingBlockDTO.getTemplateId());
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.
public Mono<String> importBuildingBlock(BuildingBlockDTO buildingBlockDTO, String branchName) { | |
Mono<ApplicationJson> applicationJsonMono = | |
applicationTemplateService.getApplicationJsonFromTemplate(buildingBlockDTO.getTemplateId()); | |
return applicationJsonMono | |
.flatMap(applicationJson -> this.importResourceInPage( | |
buildingBlockDTO.getWorkspaceId(), | |
buildingBlockDTO.getPageId(), | |
buildingBlockDTO.getApplicationId(), | |
branchName, | |
applicationJson)) | |
.map(BuildingBlockImportDTO::getWidgetDsl); | |
} | |
public Mono<String> importBuildingBlock(BuildingBlockDTO buildingBlockDTO, String branchName) { | |
log.info("Starting import of building block with template ID: {}", buildingBlockDTO.getTemplateId()); | |
Mono<ApplicationJson> applicationJsonMono = | |
applicationTemplateService.getApplicationJsonFromTemplate(buildingBlockDTO.getTemplateId()); | |
return applicationJsonMono | |
.flatMap(applicationJson -> this.importResourceInPage( | |
buildingBlockDTO.getWorkspaceId(), | |
buildingBlockDTO.getPageId(), | |
buildingBlockDTO.getApplicationId(), | |
branchName, | |
applicationJson)) | |
.map(BuildingBlockImportDTO::getWidgetDsl); | |
} |
/build-deploy-preview |
Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/8109137973. |
Deploy-Preview-URL: https://ce-31398.dp.appsmith.com |
/build-deploy-preview skip-tests=true |
Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/8137837034. |
Deploy-Preview-URL: https://ce-31398.dp.appsmith.com |
Failed server tests
|
/build-deploy-preview skip-tests=true |
Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/8139178189. |
Deploy-Preview-URL: https://ce-31398.dp.appsmith.com |
/build-deploy-preview skip-tests=true |
Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/8141759694. |
Deploy-Preview-URL: https://ce-31398.dp.appsmith.com |
Failed server tests
|
...r/src/main/java/com/appsmith/server/imports/internal/partial/PartialImportServiceCEImpl.java
Show resolved
Hide resolved
...r/src/main/java/com/appsmith/server/imports/internal/partial/PartialImportServiceCEImpl.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Backend Code LGTM
@AnaghHegde can you share steps on how to test this on dp? |
@NilanshBansal This can be tested via postman, since this is a new API. The FE work is still pending. Since this a new API, this will be tested in the same DP where we have the FE code is present. |
/ok-to-test tags="@tag.ImportExport" |
Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/8167616711. |
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/8167616711. |
/build-deploy-preview skip-tests=true |
Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/8184808160. |
Description
The primary aim of this feature is to empower users by enabling them to seamlessly integrate building blocks along with their associated components (queries, JavaScript, datasources, and widgets) into their existing applications through drag-and-drop functionality.
This PR adds change to create a Partial IE engine to download the json file from CS, then add all DS, JS, Queries and Custom JS Libs. Also handle the name refactoring in js, queries and dsl and then return modified widget dsl to frontend.
PR fixes following issue(s)
Fixes #31315
Media
Type of change
Testing
How Has This Been Tested?
Test Plan
https://www.notion.so/appsmith/Test-planning-Drag-and-drop-building-blocks-030b0a5e944a478c9598ad65ba5096e2?pm=c
Issues raised during DP testing
Checklist:
Dev activity
QA activity:
Test Plan Approved
label after Cypress tests were reviewedTest Plan Approved
label after JUnit tests were reviewedSummary by CodeRabbit
New Features
BuildingBlockDTO
import.ApplicationTemplateService
andWidgetRefactorUtil
services.importBuildingBlock
method.Enhancements
Refactor
Tests