appsmithorg / appsmith

Platform to build admin panels, internal tools, and dashboards. Integrates with 25+ databases and any API.
https://www.appsmith.com
Apache License 2.0
34.2k stars 3.7k forks source link

[Task]: Create sagas for Anvil. #27005

Closed prsidhu closed 1 year ago

prsidhu commented 1 year ago

Sagas should handle the following functionalities:

  1. addNewWidget: a) if parentLayout uses a childTemplate. Construct a new layout using childTemplate json and add the movedWidgets to it. b) Add childTemplate / movedWidgets to the parentLayout using components static method addChild. c) Store the updated parent widget in redux.

  2. removeWidget: a) For each widget - b) Traverse the layout tree of parentLayout to find the layoutId of the layout that wraps the widget. c) Remove the widgetId from layout property of the affectedLayout. d) If affectedLayout.layout is empty and affectedLayout.canBeDeleted, remove affectedLayoutId from the layout property of its parent layout. e) Recursively perform the step d) until (i) parentLayout is reached; or (ii) current layout is not empty.

prsidhu commented 1 year ago

should canBeDeleted be replaced by cantDelete, since the latter are going to be fewer in number?

aswathkk commented 1 year ago

We also need unit testing for these