Skip to content

Commit 32df6dc

Browse files
committed
fix: remove old dropdown item
2 parents dfcb65e + 1835be4 commit 32df6dc

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { type FC, useState } from 'react';
1+
import React, { type FC, useState, useContext } from 'react';
22
import { useConfirm } from 'lib/hooks/useConfirm';
33
import { type CellContext } from '@tanstack/react-table';
44
import { type BrokerConfig } from 'generated-sources';
@@ -7,6 +7,7 @@ import {
77
UpdateBrokerConfigCallback,
88
} from 'components/Brokers/Broker/Configs/lib/types';
99
import { getConfigUnit } from 'components/Brokers/Broker/Configs/lib/utils';
10+
import ClusterContext from 'components/contexts/ClusterContext';
1011

1112
import InputCellViewMode from './InputCellViewMode';
1213
import InputCellEditMode from './InputCellEditMode';
@@ -19,13 +20,7 @@ export interface InputCellProps
1920
const InputCell: FC<InputCellProps> = ({ row, onUpdate }) => {
2021
const [isEdit, setIsEdit] = useState(false);
2122
const confirm = useConfirm();
22-
const {
23-
name,
24-
source,
25-
value: initialValue,
26-
isSensitive,
27-
isReadOnly,
28-
} = row.original;
23+
const { name, source, value: initialValue, isSensitive } = row.original;
2924

3025
const handleSave = (newValue: string) => {
3126
if (newValue !== initialValue) {
@@ -38,6 +33,7 @@ const InputCell: FC<InputCellProps> = ({ row, onUpdate }) => {
3833

3934
const isDynamic = source === 'DYNAMIC_BROKER_CONFIG';
4035
const configUnit = getConfigUnit(name);
36+
const { isReadOnly } = useContext(ClusterContext);
4137

4238
return isEdit ? (
4339
<InputCellEditMode

frontend/src/components/Connect/List/ActionsCell.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import React, { useContext } from 'react';
22
import {
33
Action,
44
ConnectorAction,
@@ -18,12 +18,14 @@ import {
1818
import { useConfirm } from 'lib/hooks/useConfirm';
1919
import { useIsMutating } from '@tanstack/react-query';
2020
import { ActionDropdownItem } from 'components/common/ActionComponent';
21+
import ClusterContext from 'components/contexts/ClusterContext';
2122

2223
const ActionsCell: React.FC<CellContext<FullConnectorInfo, unknown>> = ({
2324
row,
2425
}) => {
2526
const { connect, name, status } = row.original;
2627
const { clusterName } = useAppParams<ClusterNameRoute>();
28+
const { isReadOnly } = useContext(ClusterContext);
2729
const mutationsNumber = useIsMutating();
2830
const isMutating = mutationsNumber > 0;
2931
const confirm = useConfirm();
@@ -123,7 +125,7 @@ const ActionsCell: React.FC<CellContext<FullConnectorInfo, unknown>> = ({
123125
)}
124126
<ActionDropdownItem
125127
onClick={restartConnectorHandler}
126-
disabled={isMutating}
128+
disabled={isMutating || isReadOnly}
127129
permission={{
128130
resource: ResourceType.CONNECT,
129131
action: Action.RESTART,

0 commit comments

Comments
 (0)