Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(glossary) Fix dropdown where disabled buttons are still clickable #5430

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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