Skip to content

Commit

Permalink
fix(glossary) Fix dropdown where disabled buttons are still clickable (
Browse files Browse the repository at this point in the history
…datahub-project#5430)

Co-authored-by: Chris Collins <chriscollins@Chriss-MBP-2.lan>
  • Loading branch information
2 people authored and PiotrSierkin-Ki committed Jul 26, 2022
1 parent 1b21e01 commit cbec5d2
Showing 1 changed file with 24 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,35 +162,51 @@ function EntityDropdown(props: Props) {
</Menu.Item>
)}
{menuItems.has(EntityMenuItems.ADD_TERM) && (
<StyledMenuItem key="2" disabled={!canManageGlossaries}>
<MenuItem onClick={() => setIsCreateTermModalVisible(true)}>
<StyledMenuItem
key="2"
disabled={!canManageGlossaries}
onClick={() => setIsCreateTermModalVisible(true)}
>
<MenuItem>
<PlusOutlined /> &nbsp;Add Term
</MenuItem>
</StyledMenuItem>
)}
{menuItems.has(EntityMenuItems.ADD_TERM_GROUP) && (
<StyledMenuItem key="3" disabled={!canManageGlossaries}>
<MenuItem onClick={() => setIsCreateNodeModalVisible(true)}>
<StyledMenuItem
key="3"
disabled={!canManageGlossaries}
onClick={() => setIsCreateNodeModalVisible(true)}
>
<MenuItem>
<FolderAddOutlined /> &nbsp;Add Term Group
</MenuItem>
</StyledMenuItem>
)}
{menuItems.has(EntityMenuItems.MOVE) && (
<StyledMenuItem key="4" disabled={!canManageGlossaries}>
<MenuItem onClick={() => setIsMoveModalVisible(true)}>
<StyledMenuItem
key="4"
disabled={!canManageGlossaries}
onClick={() => setIsMoveModalVisible(true)}
>
<MenuItem>
<FolderOpenOutlined /> &nbsp;Move
</MenuItem>
</StyledMenuItem>
)}
{menuItems.has(EntityMenuItems.DELETE) && (
<StyledMenuItem key="5" disabled={isDeleteDisabled || !canManageGlossaries}>
<StyledMenuItem
key="5"
disabled={isDeleteDisabled || !canManageGlossaries}
onClick={onDeleteEntity}
>
<Tooltip
title={`Can't delete ${entityRegistry.getEntityName(
entityType,
)} with child entities.`}
overlayStyle={isDeleteDisabled ? {} : { display: 'none' }}
>
<MenuItem onClick={onDeleteEntity}>
<MenuItem>
<DeleteOutlined /> &nbsp;Delete
</MenuItem>
</Tooltip>
Expand Down

0 comments on commit cbec5d2

Please sign in to comment.