-
-
Couldn't load subscription status.
- Fork 193
FE: UX: Impl Kafka Connect overview #1232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 13 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
9f37767
FE: Clusters as separated page
Vixtir e02e902
FE: Move cluster and connetors under kafka connect
Vixtir 3c5b70d
FE: Fix active element
Vixtir c57b75b
FE: Use api query
Vixtir 60a0553
FE: Add tests for kafka connect connectors
Vixtir 2955d91
FE: fix linting
Vixtir 8d0e0f7
E2E: Change KAFKA_CONNECT_LIST_URL
Vixtir 9b2c377
E2E: Change MenuItem for kafka_connect
Vixtir bc93bb7
E2E: Add click connectors step
Vixtir 91f34e0
Merge branch 'main' into issue/445-fe2
Vixtir f53f1f4
FE: fix statistics computing
Vixtir 181fa4e
Merge branch 'main' into issue/445-fe2
germanosin 4d9b6d7
FE: Add version to kafka connect->clusters overview
Vixtir 62bf073
FE: Reuse text var in TasksCell component
Vixtir 643f4c2
Merge branch 'main' into issue/445-fe2
Vixtir File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import React from 'react'; | ||
| import { useConnects } from 'lib/hooks/api/kafkaConnect'; | ||
| import useAppParams from 'lib/hooks/useAppParams'; | ||
| import { ClusterNameRoute } from 'lib/paths'; | ||
|
|
||
| import ClustersStatistics from './ui/Statistics/Statistics'; | ||
| import List from './ui/List/List'; | ||
|
|
||
| const KafkaConnectClustersPage = () => { | ||
| const { clusterName } = useAppParams<ClusterNameRoute>(); | ||
| const { data: connects, isLoading } = useConnects(clusterName, true); | ||
| return ( | ||
| <> | ||
| <ClustersStatistics connects={connects ?? []} isLoading={isLoading} /> | ||
| <List connects={connects ?? []} /> | ||
| </> | ||
| ); | ||
| }; | ||
|
|
||
| export default KafkaConnectClustersPage; |
26 changes: 26 additions & 0 deletions
26
frontend/src/components/Connect/Clusters/ui/List/Cells/ConnectorsCell.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import AlertBadge from 'components/common/AlertBadge/AlertBadge'; | ||
| import { Connect } from 'generated-sources'; | ||
| import React from 'react'; | ||
|
|
||
| type Props = { connect: Connect }; | ||
| const ConnectorsCell = ({ connect }: Props) => { | ||
| const count = connect.connectorsCount ?? 0; | ||
| const failedCount = connect.failedConnectorsCount ?? 0; | ||
| const text = `${count - failedCount}/${count}`; | ||
|
|
||
| if (count === 0) { | ||
| return null; | ||
| } | ||
|
|
||
| if (failedCount > 0) { | ||
| return ( | ||
| <AlertBadge> | ||
| <AlertBadge.Content content={text} /> | ||
| <AlertBadge.Icon /> | ||
| </AlertBadge> | ||
| ); | ||
| } | ||
|
|
||
| return text; | ||
| }; | ||
| export default ConnectorsCell; |
9 changes: 9 additions & 0 deletions
9
frontend/src/components/Connect/Clusters/ui/List/Cells/NameCell.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import { CellContext } from '@tanstack/react-table'; | ||
| import { Connect } from 'generated-sources'; | ||
| import React from 'react'; | ||
|
|
||
| type Props = CellContext<Connect, string>; | ||
| const NameCell = ({ getValue }: Props) => { | ||
| return <div>{getValue()}</div>; | ||
| }; | ||
| export default NameCell; |
30 changes: 30 additions & 0 deletions
30
frontend/src/components/Connect/Clusters/ui/List/Cells/TasksCell.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| import AlertBadge from 'components/common/AlertBadge/AlertBadge'; | ||
| import { Connect } from 'generated-sources'; | ||
| import React from 'react'; | ||
|
|
||
| type Props = { connect: Connect }; | ||
| const TasksCell = ({ connect }: Props) => { | ||
| const count = connect.tasksCount ?? 0; | ||
| const failedCount = connect.failedTasksCount ?? 0; | ||
| const text = `${count - failedCount}/${count}`; | ||
|
|
||
| if (!count) { | ||
| return null; | ||
| } | ||
|
|
||
| if (failedCount > 0) { | ||
| return ( | ||
| <AlertBadge> | ||
| <AlertBadge.Content content={text} /> | ||
| <AlertBadge.Icon /> | ||
| </AlertBadge> | ||
| ); | ||
| } | ||
|
|
||
| return ( | ||
| <div> | ||
| {count - failedCount}/{count} | ||
| </div> | ||
| ); | ||
| }; | ||
| export default TasksCell; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| import React from 'react'; | ||
| import { Connect } from 'generated-sources'; | ||
| import Table from 'components/common/NewTable'; | ||
| import useAppParams from 'lib/hooks/useAppParams'; | ||
| import { ClusterName } from 'lib/interfaces/cluster'; | ||
| import { useNavigate } from 'react-router-dom'; | ||
| import { clusterConnectorsPath } from 'lib/paths'; | ||
| import { createColumnHelper } from '@tanstack/react-table'; | ||
|
|
||
| import ConnectorsCell from './Cells/ConnectorsCell'; | ||
| import NameCell from './Cells/NameCell'; | ||
| import TasksCell from './Cells/TasksCell'; | ||
|
|
||
| const helper = createColumnHelper<Connect>(); | ||
| export const columns = [ | ||
| helper.accessor('name', { cell: NameCell, size: 600 }), | ||
| helper.accessor('version', { | ||
| header: 'Version', | ||
| cell: ({ getValue }) => getValue(), | ||
| enableSorting: true, | ||
| }), | ||
| helper.display({ | ||
| header: 'Connectors', | ||
| id: 'connectors', | ||
| cell: (props) => <ConnectorsCell connect={props.row.original} />, | ||
| size: 100, | ||
| }), | ||
| helper.display({ | ||
| header: 'Running tasks', | ||
| id: 'tasks', | ||
| cell: (props) => <TasksCell connect={props.row.original} />, | ||
| size: 100, | ||
| }), | ||
| ]; | ||
|
|
||
| interface Props { | ||
| connects: Connect[]; | ||
| } | ||
| const List = ({ connects }: Props) => { | ||
| const navigate = useNavigate(); | ||
| const { clusterName } = useAppParams<{ clusterName: ClusterName }>(); | ||
|
|
||
| return ( | ||
| <Table | ||
| data={connects} | ||
| columns={columns} | ||
| onRowClick={({ original: { name } }) => { | ||
| navigate(`${clusterConnectorsPath(clusterName)}?connect=${name}`); | ||
| }} | ||
| emptyMessage="No kafka connect clusters" | ||
| enableSorting | ||
| /> | ||
| ); | ||
| }; | ||
|
|
||
| export default List; |
35 changes: 35 additions & 0 deletions
35
frontend/src/components/Connect/Clusters/ui/Statistics/Statistics.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import React, { useMemo } from 'react'; | ||
| import { Connect } from 'generated-sources'; | ||
| import * as Statistics from 'components/common/Statistics'; | ||
|
|
||
| import { computeStatistic } from './models/computeStatistics'; | ||
|
|
||
| type Props = { connects: Connect[]; isLoading: boolean }; | ||
| const ClustersStatistics = ({ connects, isLoading }: Props) => { | ||
| const statistic = useMemo(() => { | ||
| return computeStatistic(connects); | ||
| }, [connects]); | ||
| return ( | ||
| <Statistics.Container> | ||
| <Statistics.Item | ||
| title="Clusters" | ||
| count={statistic.clustersCount} | ||
| isLoading={isLoading} | ||
| /> | ||
| <Statistics.Item | ||
| title="Connectors" | ||
| count={statistic.connectorsCount} | ||
| warningCount={statistic.failedConnectorsCount} | ||
| isLoading={isLoading} | ||
| /> | ||
| <Statistics.Item | ||
| title="Tasks" | ||
| count={statistic.tasksCount} | ||
| warningCount={statistic.failedTasksCount} | ||
| isLoading={isLoading} | ||
| /> | ||
| </Statistics.Container> | ||
| ); | ||
| }; | ||
|
|
||
| export default ClustersStatistics; |
31 changes: 31 additions & 0 deletions
31
frontend/src/components/Connect/Clusters/ui/Statistics/models/computeStatistics.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import { Connect } from 'generated-sources'; | ||
|
|
||
| interface Statistic { | ||
| clustersCount: number; | ||
| connectorsCount: number; | ||
| failedConnectorsCount: number; | ||
| tasksCount: number; | ||
| failedTasksCount: number; | ||
| } | ||
| export const computeStatistic = (connects: Connect[]): Statistic => { | ||
| const clustersCount = connects.length; | ||
| let connectorsCount = 0; | ||
| let failedConnectorsCount = 0; | ||
| let tasksCount = 0; | ||
| let failedTasksCount = 0; | ||
|
|
||
| connects.forEach((connect) => { | ||
| connectorsCount += connect.connectorsCount ?? 0; | ||
| failedConnectorsCount += connect.failedConnectorsCount ?? 0; | ||
| tasksCount += connect.tasksCount ?? 0; | ||
| failedTasksCount += connect.failedTasksCount ?? 0; | ||
| }); | ||
|
|
||
| return { | ||
| clustersCount, | ||
| connectorsCount, | ||
| failedConnectorsCount, | ||
| tasksCount, | ||
| failedTasksCount, | ||
| }; | ||
| }; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.