Skip to content

Commit 5aa560f

Browse files
spartannsHaarolean
andauthored
FE: UX: Disable connector buttons in r/o mode (#608)
Co-authored-by: Roman Zabaluev <gpg@haarolean.dev>
1 parent e193ab0 commit 5aa560f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

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.OPERATE,

0 commit comments

Comments
 (0)