Skip to content

Commit 8affd42

Browse files
Leshe4kaLeshe4ka
andauthored
FE: Navigation to brokers page from dashboard (#1350)
Co-authored-by: Leshe4ka <[email protected]>
1 parent ff1376d commit 8affd42

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

frontend/src/components/Dashboard/ClusterTableActionsCell.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,17 @@ const ClusterTableActionsCell: React.FC<Props> = ({ row }) => {
1818
);
1919
}, [data]);
2020

21+
const handleClick = (e: React.MouseEvent) => {
22+
e.stopPropagation();
23+
};
24+
2125
return (
2226
<ActionCanButton
2327
buttonType="secondary"
2428
buttonSize="S"
2529
to={clusterConfigPath(name)}
2630
canDoAction={hasPermissions}
31+
onClick={handleClick}
2732
>
2833
Configure
2934
</ActionCanButton>

frontend/src/components/Dashboard/Dashboard.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,23 @@ import { Tag } from 'components/common/Tag/Tag.styled';
55
import Switch from 'components/common/Switch/Switch';
66
import { useClusters } from 'lib/hooks/api/clusters';
77
import { Cluster, ResourceType, ServerStatus } from 'generated-sources';
8-
import { ColumnDef } from '@tanstack/react-table';
8+
import { ColumnDef, Row } from '@tanstack/react-table';
99
import Table, { SizeCell } from 'components/common/NewTable';
1010
import useBoolean from 'lib/hooks/useBoolean';
11-
import { clusterNewConfigPath } from 'lib/paths';
11+
import { clusterBrokersPath, clusterNewConfigPath } from 'lib/paths';
1212
import { GlobalSettingsContext } from 'components/contexts/GlobalSettingsContext';
1313
import { ActionCanButton } from 'components/common/ActionComponent';
1414
import { useGetUserInfo } from 'lib/hooks/api/roles';
1515
import { useLocalStoragePersister } from 'components/common/NewTable/ColumnResizer/lib';
16+
import { useNavigate } from 'react-router-dom';
1617

1718
import * as S from './Dashboard.styled';
1819
import ClusterName from './ClusterName';
1920
import ClusterTableActionsCell from './ClusterTableActionsCell';
2021

2122
const Dashboard: React.FC = () => {
2223
const { data } = useGetUserInfo();
24+
const navigate = useNavigate();
2325
const clusters = useClusters();
2426
const { value: showOfflineOnly, toggle } = useBoolean(false);
2527
const appInfo = React.useContext(GlobalSettingsContext);
@@ -92,6 +94,10 @@ const Dashboard: React.FC = () => {
9294

9395
const columnSizingPersister = useLocalStoragePersister('KafkaConnect');
9496

97+
const onRowClick = (row: Row<Cluster>) => {
98+
navigate(clusterBrokersPath(row.original.name));
99+
};
100+
95101
return (
96102
<>
97103
<PageHeading text="Dashboard" />
@@ -128,6 +134,7 @@ const Dashboard: React.FC = () => {
128134
)}
129135
</S.Toolbar>
130136
<Table
137+
onRowClick={onRowClick}
131138
columns={columns}
132139
data={config?.list}
133140
enableSorting

frontend/src/components/Nav/ClusterMenu/__tests__/ClusterMenu.spec.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ describe('ClusterMenu', () => {
2828
const getKafkaConnect = () => screen.getByTitle('Kafka Connect');
2929
const getCluster = () => screen.getByText(onlineClusterPayload.name);
3030

31-
// Хелпер для клика по шеврону - ищем SVG с шевроном
3231
const clickChevron = async () => {
3332
const chevronSvg = document.querySelector('svg[viewBox="0 0 10 6"]');
3433
if (chevronSvg) {

0 commit comments

Comments
 (0)