remove api holder arg from useOnClick
Signed-off-by: Mark Dunphy <markd@spotify.com>
This commit is contained in:
@@ -19,6 +19,8 @@ import {
|
||||
createExtensionBlueprint,
|
||||
ApiHolder,
|
||||
createExtensionDataRef,
|
||||
dialogApiRef,
|
||||
useApiHolder,
|
||||
} from '@backstage/frontend-plugin-api';
|
||||
import MenuItem from '@material-ui/core/MenuItem';
|
||||
import ListItemIcon from '@material-ui/core/ListItemIcon';
|
||||
@@ -39,11 +41,7 @@ export type FactoryHrefParams =
|
||||
|
||||
/** @alpha */
|
||||
export type FactoryDialogParams = {
|
||||
useOnClick: ({
|
||||
apis,
|
||||
}: {
|
||||
apis: ApiHolder;
|
||||
}) => React.MouseEventHandler<HTMLLIElement>;
|
||||
useOnClick: () => React.MouseEventHandler<HTMLLIElement>;
|
||||
useTitle: () => string;
|
||||
icon: React.JSX.Element;
|
||||
};
|
||||
@@ -81,8 +79,8 @@ export const EntityContextMenuItemBlueprint = createExtensionBlueprint({
|
||||
return (
|
||||
<MenuItem
|
||||
onClick={e => {
|
||||
onClick(e);
|
||||
onClose();
|
||||
onClick(e);
|
||||
}}
|
||||
>
|
||||
<ListItemIcon>{params.icon}</ListItemIcon>
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
|
||||
import Divider from '@material-ui/core/Divider';
|
||||
import FileCopyTwoToneIcon from '@material-ui/icons/FileCopyTwoTone';
|
||||
import IconButton from '@material-ui/core/IconButton';
|
||||
import ListItemIcon from '@material-ui/core/ListItemIcon';
|
||||
import ListItemText from '@material-ui/core/ListItemText';
|
||||
@@ -147,6 +148,9 @@ export function EntityContextMenu(props: EntityContextMenuProps) {
|
||||
>
|
||||
<MenuList autoFocusItem={Boolean(anchorEl)}>
|
||||
{extraItems}
|
||||
{extraMenuItems?.map(ExtraMenuItem => (
|
||||
<ExtraMenuItem onClose={onClose} />
|
||||
))}
|
||||
<UnregisterEntity
|
||||
unregisterEntityOptions={UNSTABLE_contextMenuOptions}
|
||||
isUnregisterAllowed={isAllowed}
|
||||
@@ -164,9 +168,17 @@ export function EntityContextMenu(props: EntityContextMenuProps) {
|
||||
</ListItemIcon>
|
||||
<ListItemText primary={t('entityContextMenu.inspectMenuTitle')} />
|
||||
</MenuItem>
|
||||
{extraMenuItems?.map(ExtraMenuItem => (
|
||||
<ExtraMenuItem onClose={onClose} />
|
||||
))}
|
||||
<MenuItem
|
||||
onClick={() => {
|
||||
onClose();
|
||||
copyToClipboard(window.location.toString());
|
||||
}}
|
||||
>
|
||||
<ListItemIcon>
|
||||
<FileCopyTwoToneIcon fontSize="small" />
|
||||
</ListItemIcon>
|
||||
<ListItemText primary={t('entityContextMenu.copyURLMenuTitle')} />
|
||||
</MenuItem>
|
||||
</MenuList>
|
||||
</Popover>
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user