@@ -25,6 +25,10 @@ import {useIsUserAllowedToMakeChanges} from '../../utils/hooks/useIsUserAllowedT
2525
2626import i18n from './i18n' ;
2727
28+ function isFollowerTablet ( state : TTabletStateInfo ) {
29+ return state . Leader === false ;
30+ }
31+
2832function getColumns ( { nodeId} : { nodeId ?: string | number } ) {
2933 const columns : DataTableColumn < TTabletStateInfo & { fqdn ?: string } > [ ] = [
3034 {
@@ -34,7 +38,7 @@ function getColumns({nodeId}: {nodeId?: string | number}) {
3438 return i18n ( 'Type' ) ;
3539 } ,
3640 render : ( { row} ) => {
37- const isFollower = row . Leader === false ;
41+ const isFollower = isFollowerTablet ( row ) ;
3842 return (
3943 < span >
4044 { row . Type } { isFollower ? < Text color = "secondary" > follower</ Text > : '' }
@@ -138,7 +142,7 @@ function getColumns({nodeId}: {nodeId?: string | number}) {
138142}
139143
140144function TabletActions ( tablet : TTabletStateInfo ) {
141- const isFollower = tablet . Leader === false ;
145+ const isFollower = isFollowerTablet ( tablet ) ;
142146 const isDisabledRestart = tablet . State === ETabletState . Stopped || isFollower ;
143147 const isUserAllowedToMakeChanges = useIsUserAllowedToMakeChanges ( ) ;
144148 const [ killTablet ] = tabletApi . useKillTabletMutation ( ) ;
@@ -148,6 +152,16 @@ function TabletActions(tablet: TTabletStateInfo) {
148152 return null ;
149153 }
150154
155+ let popoverContent : React . ReactNode ;
156+
157+ if ( isFollower ) {
158+ popoverContent = i18n ( 'controls.kill-impossible-follower' ) ;
159+ } else if ( ! isUserAllowedToMakeChanges ) {
160+ popoverContent = i18n ( 'controls.kill-not-allowed' ) ;
161+ } else {
162+ popoverContent = i18n ( 'dialog.kill-header' ) ;
163+ }
164+
151165 return (
152166 < ButtonWithConfirmDialog
153167 buttonView = "outlined"
@@ -158,13 +172,7 @@ function TabletActions(tablet: TTabletStateInfo) {
158172 } }
159173 buttonDisabled = { isDisabledRestart || ! isUserAllowedToMakeChanges }
160174 withPopover
161- popoverContent = {
162- isFollower
163- ? i18n ( 'controls.kill-impossible-follower' )
164- : isUserAllowedToMakeChanges
165- ? i18n ( 'dialog.kill-header' )
166- : i18n ( 'controls.kill-not-allowed' )
167- }
175+ popoverContent = { popoverContent }
168176 popoverPlacement = { [ 'right' , 'bottom' ] }
169177 popoverDisabled = { false }
170178 >
0 commit comments