@@ -206,20 +206,49 @@ export async function buildContextMenuForActions({
206206
207207 // Add a context menu item for this action so it shows up on a context menu panel.
208208 // We add this within the parent group or default to the mainMenu panel.
209- panels [ parentGroupId || 'mainMenu' ] . items ! . push ( {
210- name : action . MenuItem
211- ? React . createElement ( uiToReactComponent ( action . MenuItem ) , { context } )
212- : action . getDisplayName ( context ) ,
213- icon : action . getIconType ( context ) ,
214- 'data-test-subj' : `embeddablePanelAction-${ action . id } ` ,
215- onClick : onClick ( action , context , closeMenu ) ,
216- toolTipContent : action ?. getTooltip ( context ) ,
217- disabled : action ?. isDisabled ( context ) ,
218- id : action ?. id ,
219- href : action . getHref ? await action . getHref ( context ) : undefined ,
220- _order : action . order || 0 ,
221- _title : action . getDisplayName ( context ) ,
222- } ) ;
209+ // panels[parentGroupId || 'mainMenu'].items!.push({
210+ // name: action.MenuItem
211+ // ? React.createElement(uiToReactComponent(action.MenuItem), { context })
212+ // : action.getDisplayName(context),
213+ // icon: action.getIconType(context),
214+ // 'data-test-subj': `embeddablePanelAction-${action.id}`,
215+ // onClick: onClick(action, context, closeMenu),
216+ // toolTipContent: action?.getTooltip(context),
217+ // disabled: action?.isDisabled(context),
218+ // id: action?.id,
219+ // href: action.getHref ? await action.getHref(context) : undefined,
220+ // _order: action.order || 0,
221+ // _title: action.getDisplayName(context),
222+ // });
223+ if ( typeof action ?. getTooltip === 'function' && typeof action ?. isDisabled === 'function' ) {
224+ panels [ parentGroupId || 'mainMenu' ] . items ! . push ( {
225+ name : action . MenuItem
226+ ? React . createElement ( uiToReactComponent ( action . MenuItem ) , { context } )
227+ : action . getDisplayName ( context ) ,
228+ icon : action . getIconType ( context ) ,
229+ 'data-test-subj' : `embeddablePanelAction-${ action . id } ` ,
230+ onClick : onClick ( action , context , closeMenu ) ,
231+ toolTipContent : action ?. getTooltip ( context ) ,
232+ disabled : action ?. isDisabled ( context ) ,
233+ id : action ?. id ,
234+ href : action . getHref ? await action . getHref ( context ) : undefined ,
235+ _order : action . order || 0 ,
236+ _title : action . getDisplayName ( context ) ,
237+ } ) ;
238+ } else {
239+ panels [ parentGroupId || 'mainMenu' ] . items ! . push ( {
240+ name : action . MenuItem
241+ ? React . createElement ( uiToReactComponent ( action . MenuItem ) , { context } )
242+ : action . getDisplayName ( context ) ,
243+ icon : action . getIconType ( context ) ,
244+ 'data-test-subj' : `embeddablePanelAction-${ action . id } ` ,
245+ onClick : onClick ( action , context , closeMenu ) ,
246+ id : action ?. id ,
247+ href : action . getHref ? await action . getHref ( context ) : undefined ,
248+ _order : action . order || 0 ,
249+ _title : action . getDisplayName ( context ) ,
250+ } ) ;
251+ }
223252 } ) ;
224253 await Promise . all ( promises ) ;
225254
0 commit comments