This PR requires a bit of cleanup before it is ready to be merged
This PR adds support for plugins to trigger actions in workbooks and for workbook actions to call functions within a plugin using the notions of action trigger (plugin -> workbook) and action effect (workbook -> plugin).
This PR adds the following config options:
action-trigger: This corresponds to an Action selectable within workbook UI by selecting a Plugin, navigating to the Actions sidebar, and adding an Action.
action-effect: This corresponds to a new Action type within workbooks. This is selectable by selecting any Action in a workbook, and selecting Trigger plugin, then selected the configured action-effect
It adds the following functions:
triggerAction: This function, when called with the config object, will trigger all Actions configured in the workbook UI under the current plugin element
registerEffect: This function registers a handler for when a certain Action, as configured in UI, is triggered.
unregisterEffect: This function will remove any registration (done with the function just above) associated with the id passed in (considering moving this to be a return value of registerEffect above)
In addition, it adds the following react hooks:
useActionTrigger: This function returns a callback that triggers the action associated with the id passed in
useActionEffect: This function takes in the associated config item, and handles the unsubscribe on unmount
This PR requires a bit of cleanup before it is ready to be merged
This PR adds support for plugins to trigger actions in workbooks and for workbook actions to call functions within a plugin using the notions of
action trigger
(plugin -> workbook) andaction effect
(workbook -> plugin).This PR adds the following config options:
action-trigger
: This corresponds to an Action selectable within workbook UI by selecting a Plugin, navigating to the Actions sidebar, and adding an Action.action-effect
: This corresponds to a new Action type within workbooks. This is selectable by selecting any Action in a workbook, and selectingTrigger plugin
, then selected the configuredaction-effect
It adds the following functions:
triggerAction
: This function, when called with the config object, will trigger all Actions configured in the workbook UI under the current plugin elementregisterEffect
: This function registers a handler for when a certain Action, as configured in UI, is triggered.unregisterEffect
: This function will remove any registration (done with the function just above) associated with the id passed in (considering moving this to be a return value ofregisterEffect
above)In addition, it adds the following react hooks:
useActionTrigger
: This function returns a callback that triggers the action associated with the id passed inuseActionEffect
: This function takes in the associated config item, and handles the unsubscribe on unmount