## Description Created a pre delete hook to delete datasource files on Appsmith AI server when datasource is deleted in Appsmith instance. #### PR fixes following issue(s) Fixes https://github.com/appsmithorg/appsmith-ee/issues/3617 #### How Has This Been Tested? - [x] Manual ## Automation /ok-to-test tags="@tag.Datasource" ## Checklist: #### Dev activity - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a new method `preDeleteHook` in the `PluginExecutor` interface to serve as a hook after deleting a datasource. - Added a new method `disassociateDatasource` in the AI plugin to notify the AI server about datasource deletion and provide file context if available. - **Refactor** - Enhanced the AI plugin by refactoring methods to use a new `createAssociateDTO` method for generating `AssociateDTO` instances, improving code readability and maintainability. - **Chores** - Updated the `archiveById` method in DatasourceServiceCEImpl to include a `flatMap` operation that triggers a `preDeleteHook` method on the plugin executor before archiving the datasource. Also added a new private method `findPluginExecutor` for retrieving the plugin executor. <!-- end of auto-generated comment: release notes by coderabbit.ai --><!-- This is an auto-generated comment: Cypress test results --> > [!IMPORTANT] > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/8338230830> > Commit: `800915ea99c93663af34d08e8bcf4a14ad1356d0` > Cypress dashboard url: <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=8338230830&attempt=2" target="_blank">Click here!</a> > All cypress tests have passed 🎉🎉🎉 <!-- end of auto-generated comment: Cypress test results --> |
||
|---|---|---|
| .. | ||
| main | ||
| test/java/com/external/plugins/services | ||