Skip to content

Commit 47b9dad

Browse files
fix: disable restart for followers and remove duplicate tooltip
1 parent 44dd3b4 commit 47b9dad

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/components/ButtonWithConfirmDialog/ButtonWithConfirmDialog.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ interface ButtonWithConfirmDialogProps<T, K> {
1515
retryButtonText?: string;
1616
buttonDisabled?: ButtonProps['disabled'];
1717
buttonView?: ButtonProps['view'];
18-
buttonTitle?: ButtonProps['title'];
1918
buttonClassName?: ButtonProps['className'];
2019
withPopover?: boolean;
2120
popoverContent?: PopoverProps['content'];
@@ -32,7 +31,6 @@ export function ButtonWithConfirmDialog<T, K>({
3231
retryButtonText,
3332
buttonDisabled = false,
3433
buttonView = 'action',
35-
buttonTitle,
3634
buttonClassName,
3735
withPopover = false,
3836
popoverContent,
@@ -71,7 +69,6 @@ export function ButtonWithConfirmDialog<T, K>({
7169
disabled={buttonDisabled}
7270
loading={!buttonDisabled && buttonLoading}
7371
className={buttonClassName}
74-
title={buttonTitle}
7572
>
7673
{children}
7774
</Button>
@@ -86,7 +83,7 @@ export function ButtonWithConfirmDialog<T, K>({
8683
placement={popoverPlacement}
8784
disabled={popoverDisabled}
8885
>
89-
{renderButton()}
86+
<span>{renderButton()}</span>
9087
</Popover>
9188
);
9289
}

src/containers/Tablets/TabletsTable.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ function getColumns({nodeId}: {nodeId?: string | number}) {
138138
}
139139

140140
function TabletActions(tablet: TTabletStateInfo) {
141-
const isDisabledRestart = tablet.State === ETabletState.Stopped;
141+
const isFollower = tablet.Leader === false;
142+
const isDisabledRestart = tablet.State === ETabletState.Stopped || isFollower;
142143
const isUserAllowedToMakeChanges = useIsUserAllowedToMakeChanges();
143144
const [killTablet] = tabletApi.useKillTabletMutation();
144145

@@ -150,7 +151,6 @@ function TabletActions(tablet: TTabletStateInfo) {
150151
return (
151152
<ButtonWithConfirmDialog
152153
buttonView="outlined"
153-
buttonTitle={i18n('dialog.kill-header')}
154154
dialogHeader={i18n('dialog.kill-header')}
155155
dialogText={i18n('dialog.kill-text')}
156156
onConfirmAction={() => {
@@ -159,9 +159,11 @@ function TabletActions(tablet: TTabletStateInfo) {
159159
buttonDisabled={isDisabledRestart || !isUserAllowedToMakeChanges}
160160
withPopover
161161
popoverContent={
162-
isUserAllowedToMakeChanges
163-
? i18n('dialog.kill-header')
164-
: i18n('controls.kill-not-allowed')
162+
isFollower
163+
? i18n('controls.kill-impossible-follower')
164+
: isUserAllowedToMakeChanges
165+
? i18n('dialog.kill-header')
166+
: i18n('controls.kill-not-allowed')
165167
}
166168
popoverPlacement={['right', 'bottom']}
167169
popoverDisabled={false}

src/containers/Tablets/i18n/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"dialog.kill-header": "Restart tablet",
1111
"dialog.kill-text": "The tablet will be restarted. Do you want to proceed?",
1212
"controls.kill-not-allowed": "You don't have enough rights to restart tablet",
13+
"controls.kill-impossible-follower": "It's impossible to restart a follower",
1314
"controls.search-placeholder": "Tablet ID",
1415
"controls.entities-count-label": "Tablets"
1516
}

0 commit comments

Comments
 (0)