[Discuss] Trigger context interface #63854
Labels
Feature:UIActions
UI actions. These are client side only, not related to the server side actions..
impact:low
Addressing this issue will have a low level of impact on the quality/strength of our product.
loe:medium
Medium Level of Effort
Currently user passes
context
object totrigger.exec()
method and that object is passed to actions as-is. I would like to propose to augment data passed totrigger.exec()
and pass to actions an augmented/standartizeContext
object.Now user passes
context
directly:Instead user would pass in
data
and augmentedcontext
would be created byui_actions
internally:Initial implementation of
Context
class would have user supplieddata
and two extra fields:trigger
anddisabledActions
.Having
trigger
onContext
interface would be useful because an action can be attached to multiple triggers, this would let action know which trigger executed it.Having
disabledActions
field onContext
would allow us to movedisabledActions
logic out of embeddable panels, which currently usesdisabledActions
only for three triggersCONTEXT_MENU_TRIGGER
,PANEL_BADGE_TRIGGER
, andPANEL_NOTIFICATION_TRIGGER
. Having moveddisabledActions
out of the panel would make this flag work everywhere inui_actions
, not just embeddable panel, and not just for the above 3 triggers.Having
Context
class would allow us in the future add more features to it. An embeddable specific context could have:Alternative design could be to allow user to create the
context
object themselves.And make custom data available immediately on
context.
object instead ofcontext.data.
.This would allow users to create their contexts using inheritance.
P.S. The idea is basically taken from DOM
Event
API andCustomEvent
, where browser'sEvent
has predefined functionality, like.preventDefault()
,.bubble
etc. and you can specify custom "data" when creating a browser event.cc @stacey-gammon @elastic/kibana-app-arch
Part of #71854
The text was updated successfully, but these errors were encountered: