Skip to content

Commit 461fff7

Browse files
FE: RBAC problem for broker settings
Co-authored-by: German Osin <german.osin@gmail.com>
1 parent e223f91 commit 461fff7

File tree

2 files changed

+19
-18
lines changed

2 files changed

+19
-18
lines changed

frontend/src/components/Brokers/Broker/Configs/TableComponents/InputCell/InputCellViewMode.tsx

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import React, { type FC } from 'react';
2-
import { Button } from 'components/common/Button/Button';
32
import EditIcon from 'components/common/Icons/EditIcon';
43
import type { ConfigUnit } from 'components/Brokers/Broker/Configs/lib/types';
5-
import Tooltip from 'components/common/Tooltip/Tooltip';
64
import { getConfigDisplayValue } from 'components/Brokers/Broker/Configs/lib/utils';
5+
import { ActionButton } from 'components/common/ActionComponent';
6+
import { Action, ResourceType } from 'generated-sources';
7+
import { getDefaultActionMessage } from 'components/common/ActionComponent/ActionComponent';
78

89
import * as S from './styled';
910

@@ -35,22 +36,22 @@ const InputCellViewMode: FC<InputCellViewModeProps> = ({
3536
<S.Value $isDynamic={isDynamic} title={title}>
3637
{displayValue}
3738
</S.Value>
38-
<Tooltip
39-
value={
40-
<Button
41-
buttonType="primary"
42-
buttonSize="S"
43-
aria-label="editAction"
44-
onClick={onEdit}
45-
disabled={isReadOnly}
46-
>
47-
<EditIcon /> Edit
48-
</Button>
39+
<ActionButton
40+
buttonType="primary"
41+
buttonSize="S"
42+
aria-label="editAction"
43+
onClick={onEdit}
44+
disabled={isReadOnly}
45+
message={
46+
isReadOnly ? 'Property is read-only' : getDefaultActionMessage()
4947
}
50-
showTooltip={isReadOnly}
51-
content="Property is read-only"
52-
placement="left"
53-
/>
48+
permission={{
49+
resource: ResourceType.CLUSTERCONFIG,
50+
action: Action.EDIT,
51+
}}
52+
>
53+
<EditIcon /> Edit
54+
</ActionButton>
5455
</S.ValueWrapper>
5556
);
5657
};

frontend/src/components/common/ActionComponent/ActionButton/ActionCanButton/ActionCanButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const ActionButton: React.FC<Props> = ({
2121
const isDisabled = !canDoAction;
2222

2323
const { x, y, refs, strategy, open } = useActionTooltip(
24-
isDisabled,
24+
isDisabled || disabled,
2525
placement
2626
);
2727

0 commit comments

Comments
 (0)