From 6a1053b2f49fdd6c3403dd64e5d5813f011e1b45 Mon Sep 17 00:00:00 2001 From: Mgrdich <46796009+Mgrdich@users.noreply.github.com> Date: Mon, 21 Mar 2022 21:00:11 +0400 Subject: [PATCH] Fixed frontend routing (#1745) * Revert "Issue-1184: fix logo link and remove redundant path segment "ui" (#1658)" This reverts commit b08e22915d5d5c18d6a576fbe119ad44599db0d5. * changing them dashboard logo from an anchor tag to a react-router dom link * Dashboard element redirect to the same place --- kafka-ui-react-app/src/components/App.tsx | 8 ++++++-- .../src/components/Cluster/Cluster.tsx | 4 ++-- .../Cluster/__tests__/Cluster.spec.tsx | 2 +- .../__snapshots__/Actions.spec.tsx.snap | 12 ++++++------ .../__snapshots__/Details.spec.tsx.snap | 16 ++++++++-------- .../Connect/__tests__/Connect.spec.tsx | 2 +- .../components/ConsumerGroups/ConsumerGroups.tsx | 6 +++--- .../components/KsqlDb/__test__/KsqlDb.spec.tsx | 2 +- .../__test__/__snapshots__/KsqlDb.spec.tsx.snap | 4 ++-- .../Topics/List/__tests__/List.spec.tsx | 4 ++-- .../components/Topics/Topic/Details/Details.tsx | 15 +++++++++------ .../src/components/Topics/Topic/Topic.tsx | 6 +++--- .../Breadcrumb/__tests__/Breadcrumb.spec.tsx | 8 ++++---- .../src/lib/__test__/paths.spec.ts | 4 +++- kafka-ui-react-app/src/lib/paths.ts | 2 +- 15 files changed, 52 insertions(+), 43 deletions(-) diff --git a/kafka-ui-react-app/src/components/App.tsx b/kafka-ui-react-app/src/components/App.tsx index 9d7acc2a1b..bfc6e65f1b 100644 --- a/kafka-ui-react-app/src/components/App.tsx +++ b/kafka-ui-react-app/src/components/App.tsx @@ -86,8 +86,12 @@ const App: React.FC = () => { /> {areClustersFulfilled ? ( - - + + ) : ( diff --git a/kafka-ui-react-app/src/components/Cluster/Cluster.tsx b/kafka-ui-react-app/src/components/Cluster/Cluster.tsx index fd060f57cf..54538de4a7 100644 --- a/kafka-ui-react-app/src/components/Cluster/Cluster.tsx +++ b/kafka-ui-react-app/src/components/Cluster/Cluster.tsx @@ -99,8 +99,8 @@ const Cluster: React.FC = () => { /> )} diff --git a/kafka-ui-react-app/src/components/Cluster/__tests__/Cluster.spec.tsx b/kafka-ui-react-app/src/components/Cluster/__tests__/Cluster.spec.tsx index 575b02a28a..cb26131eef 100644 --- a/kafka-ui-react-app/src/components/Cluster/__tests__/Cluster.spec.tsx +++ b/kafka-ui-react-app/src/components/Cluster/__tests__/Cluster.spec.tsx @@ -29,7 +29,7 @@ jest.mock('components/KsqlDb/KsqlDb', () => () =>
KsqlDb
); describe('Cluster', () => { const renderComponent = (pathname: string) => render( - + , { pathname, store } diff --git a/kafka-ui-react-app/src/components/Connect/Details/Actions/__tests__/__snapshots__/Actions.spec.tsx.snap b/kafka-ui-react-app/src/components/Connect/Details/Actions/__tests__/__snapshots__/Actions.spec.tsx.snap index fa7c98dc99..2d1cd9580c 100644 --- a/kafka-ui-react-app/src/components/Connect/Details/Actions/__tests__/__snapshots__/Actions.spec.tsx.snap +++ b/kafka-ui-react-app/src/components/Connect/Details/Actions/__tests__/__snapshots__/Actions.spec.tsx.snap @@ -145,7 +145,7 @@ exports[`Actions view matches snapshot 1`] = ` {!isReadOnly && !isInternal && ( - + } right> @@ -200,22 +203,22 @@ const Details: React.FC = ({ diff --git a/kafka-ui-react-app/src/components/Topics/Topic/Topic.tsx b/kafka-ui-react-app/src/components/Topics/Topic/Topic.tsx index e2180b9d39..3b821658d2 100644 --- a/kafka-ui-react-app/src/components/Topics/Topic/Topic.tsx +++ b/kafka-ui-react-app/src/components/Topics/Topic/Topic.tsx @@ -35,16 +35,16 @@ const Topic: React.FC = ({ diff --git a/kafka-ui-react-app/src/components/common/Breadcrumb/__tests__/Breadcrumb.spec.tsx b/kafka-ui-react-app/src/components/common/Breadcrumb/__tests__/Breadcrumb.spec.tsx index b0d67d72a1..2012305ef0 100644 --- a/kafka-ui-react-app/src/components/common/Breadcrumb/__tests__/Breadcrumb.spec.tsx +++ b/kafka-ui-react-app/src/components/common/Breadcrumb/__tests__/Breadcrumb.spec.tsx @@ -4,11 +4,11 @@ import { BreadcrumbProvider } from 'components/common/Breadcrumb/Breadcrumb.prov import { BreadcrumbRoute } from 'components/common/Breadcrumb/Breadcrumb.route'; import { render } from 'lib/testHelpers'; -const createTopicPath = '/clusters/local/topics/create-new'; -const createTopicRoutePath = '/clusters/:clusterName/topics/create-new'; +const createTopicPath = '/ui/clusters/local/topics/create-new'; +const createTopicRoutePath = '/ui/clusters/:clusterName/topics/create-new'; -const topicPath = '/clusters/secondLocal/topics/topic-name'; -const topicRoutePath = '/clusters/:clusterName/topics/:topicName'; +const topicPath = '/ui/clusters/secondLocal/topics/topic-name'; +const topicRoutePath = '/ui/clusters/:clusterName/topics/:topicName'; describe('Breadcrumb component', () => { const setupComponent = (pathname: string, routePath: string) => diff --git a/kafka-ui-react-app/src/lib/__test__/paths.spec.ts b/kafka-ui-react-app/src/lib/__test__/paths.spec.ts index 96deab97e4..3103114233 100644 --- a/kafka-ui-react-app/src/lib/__test__/paths.spec.ts +++ b/kafka-ui-react-app/src/lib/__test__/paths.spec.ts @@ -15,7 +15,9 @@ describe('Paths', () => { ); }); it('clusterPath', () => { - expect(paths.clusterPath(clusterName)).toEqual(`/clusters/${clusterName}`); + expect(paths.clusterPath(clusterName)).toEqual( + `/ui/clusters/${clusterName}` + ); }); it('clusterBrokersPath', () => { expect(paths.clusterBrokersPath(clusterName)).toEqual( diff --git a/kafka-ui-react-app/src/lib/paths.ts b/kafka-ui-react-app/src/lib/paths.ts index 9aec5dc358..efa8fda48a 100644 --- a/kafka-ui-react-app/src/lib/paths.ts +++ b/kafka-ui-react-app/src/lib/paths.ts @@ -12,7 +12,7 @@ export const gitCommitPath = (commit: string) => `${GIT_REPO_LINK}/commit/${commit}`; export const clusterPath = (clusterName: ClusterName) => - `/clusters/${clusterName}`; + `/ui/clusters/${clusterName}`; // Brokers export const clusterBrokersPath = (clusterName: ClusterName) =>