File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed
kafka-ui-react-app/src/components/Topics/List Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change 99 useDeleteTopic ,
1010} from 'lib/hooks/api/topics' ;
1111import { useConfirm } from 'lib/hooks/useConfirm' ;
12- import { Button } from 'components/common/Button/Button' ;
1312import { clusterTopicCopyRelativePath } from 'lib/paths' ;
1413import { useQueryClient } from '@tanstack/react-query' ;
1514import { ActionCanButton } from 'components/common/ActionComponent' ;
@@ -108,6 +107,19 @@ const BatchActionsbar: React.FC<BatchActionsbarProps> = ({
108107 ) ;
109108 } , [ selectedTopics , clusterName , roles ] ) ;
110109
110+ const canCopySelectedTopic = useMemo ( ( ) => {
111+ return selectedTopics . every ( ( value ) =>
112+ isPermitted ( {
113+ roles,
114+ resource : ResourceType . TOPIC ,
115+ action : Action . CREATE ,
116+ value,
117+ clusterName,
118+ rbacFlag,
119+ } )
120+ ) ;
121+ } , [ selectedTopics , clusterName , roles ] ) ;
122+
111123 const canPurgeSelectedTopics = useMemo ( ( ) => {
112124 return selectedTopics . every ( ( value ) =>
113125 isPermitted ( {
@@ -132,14 +144,15 @@ const BatchActionsbar: React.FC<BatchActionsbarProps> = ({
132144 >
133145 Delete selected topics
134146 </ ActionCanButton >
135- < Button
147+ < ActionCanButton
136148 buttonSize = "M"
137149 buttonType = "secondary"
138150 disabled = { selectedTopics . length !== 1 }
151+ canDoAction = { canCopySelectedTopic }
139152 to = { getCopyTopicPath ( ) }
140153 >
141154 Copy selected topic
142- </ Button >
155+ </ ActionCanButton >
143156 < ActionCanButton
144157 buttonSize = "M"
145158 buttonType = "secondary"
You can’t perform that action at this time.
0 commit comments