Skip to content

Commit

Permalink
FE: RBAC: Fix missing permissions for topic recreation (#3457)
Browse files Browse the repository at this point in the history
* fix missing permission for recreate topic

Co-authored-by: jay-choe <[email protected]>
Co-authored-by: p-eye <[email protected]>

* fix unnecessary permission

* add disable attribute, ActionDropdownItem

* remove dropdownitem lib

* fix eslint by #3080

---------

Co-authored-by: jay-choe <[email protected]>
Co-authored-by: p-eye <[email protected]>
  • Loading branch information
3 people authored and Kamila Alekbaeva committed Apr 17, 2023
1 parent 16305b2 commit 61a9347
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions kafka-ui-react-app/src/components/Topics/List/ActionsCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@ import { CellContext } from '@tanstack/react-table';
import ClusterContext from 'components/contexts/ClusterContext';
import { ClusterNameRoute } from 'lib/paths';
import useAppParams from 'lib/hooks/useAppParams';
import {
Dropdown,
DropdownItem,
DropdownItemHint,
} from 'components/common/Dropdown';
import { Dropdown, DropdownItemHint } from 'components/common/Dropdown';
import {
useDeleteTopic,
useClearTopicMessages,
Expand Down Expand Up @@ -55,17 +51,23 @@ const ActionsCell: React.FC<CellContext<Topic, unknown>> = ({ row }) => {
with DELETE policy
</DropdownItemHint>
</ActionDropdownItem>
<DropdownItem
<ActionDropdownItem
disabled={!isTopicDeletionAllowed}
onClick={recreateTopic.mutateAsync}
confirm={
<>
Are you sure to recreate <b>{name}</b> topic?
</>
}
danger
permission={{
resource: ResourceType.TOPIC,
action: [Action.VIEW, Action.CREATE, Action.DELETE],
value: name,
}}
>
Recreate Topic
</DropdownItem>
</ActionDropdownItem>
<ActionDropdownItem
disabled={!isTopicDeletionAllowed}
onClick={() => deleteTopic.mutateAsync(name)}
Expand Down

0 comments on commit 61a9347

Please sign in to comment.