You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is an example of this in the ui_actions_explorer (once #58765 is merged).
exportconstcreatePhoneUserAction=(getUiActionsApi: ()=>Promise<UiActionsStart>)=>createAction<typeofACTION_PHONE_USER>({type: ACTION_PHONE_USER,getDisplayName: ()=>'Call phone number',isCompatible: async({ user })=>user.phone!==undefined,execute: async({ user })=>{// One option - execute the more specific action directly.// makePhoneCallAction.execute({ phone: user.phone });// Another option - emit the trigger and automatically get *all* the actions attached// to the phone number trigger.// TODO: we need to figure out the best way to handle these nested actions however, since// we don't want multiple context menu's to pop up.if(user.phone!==undefined){(awaitgetUiActionsApi()).executeTriggerActions(PHONE_TRIGGER,{phone: user.phone});}},
This causes two pop up menus to show up. We have a real life desire to support this as well for the VALUE_CLICK_TRIGGER. If the data emitted with the value click trigger can be transformed to a Filter shape then you should be able to execute any actions that are attached to VALUE_CLICK_TRIGGERas well as any actions attached to APPLY_FILTER_TRIGGER.
For instance, say you have an action that just works of field: string, value: string data - e.g. it just searches google or something www.google.com/s?q="${field} ${value}". If you click on a pie slice, you will have this data. You should be able to attach the search google action to that trigger, as well as the usual actions that rely on Filter context.
Implementation thoughts
First: introduce the concept of automatically executed actions. I think this could be useful for other reasons anyway (consider the situation of a HOVER trigger and wanting to attach it to an action that shows a tooltip and an action that shows a global threshold line - those are two actions that should be executed simultaneously, and not shown to the user in a context menu for them to choose from).
Second: introduce batching of emitted triggers to be execute on the next event loop.
Then, an auto executed action can be attached to VALUE_CLICK_TRIGGER - ACTION_EMIT_APPLY_FILTER_TRIGGER. This checks to see if the data can be transformed into a Filter shape. If it does, it uiActionApi.emit(APPLY_FILTER_TRIGGER, filters). Because this is auto executed, it gets emitted before the event loop, should get batched up and then the context menu shown to the user should contain both actions attached to VALUE_CLICK_TRIGGER and actions attached to APPLY_FILTER_TRIGGER
The text was updated successfully, but these errors were encountered:
There is an example of this in the
ui_actions_explorer
(once #58765 is merged).This causes two pop up menus to show up. We have a real life desire to support this as well for the
VALUE_CLICK_TRIGGER
. If the data emitted with the value click trigger can be transformed to aFilter
shape then you should be able to execute any actions that are attached toVALUE_CLICK_TRIGGER
as well as any actions attached toAPPLY_FILTER_TRIGGER
.For instance, say you have an action that just works of
field: string, value: string
data - e.g. it just searches google or somethingwww.google.com/s?q="${field} ${value}"
. If you click on a pie slice, you will have this data. You should be able to attach thesearch google
action to that trigger, as well as the usual actions that rely onFilter
context.Implementation thoughts
First: introduce the concept of automatically executed actions. I think this could be useful for other reasons anyway (consider the situation of a HOVER trigger and wanting to attach it to an action that shows a tooltip and an action that shows a global threshold line - those are two actions that should be executed simultaneously, and not shown to the user in a context menu for them to choose from).
Second: introduce batching of emitted triggers to be execute on the next event loop.
Then, an auto executed action can be attached to
VALUE_CLICK_TRIGGER
-ACTION_EMIT_APPLY_FILTER_TRIGGER
. This checks to see if the data can be transformed into aFilter
shape. If it does, ituiActionApi.emit(APPLY_FILTER_TRIGGER, filters)
. Because this is auto executed, it gets emitted before the event loop, should get batched up and then the context menu shown to the user should contain both actions attached toVALUE_CLICK_TRIGGER
and actions attached toAPPLY_FILTER_TRIGGER
The text was updated successfully, but these errors were encountered: