Просмотр исходного кода

Fix breadcrumbs behaviour for connectors (#1693)

Co-authored-by: Mau Rodriguez Morales <mrodriguezmorales@provectus.com>
Co-authored-by: Roman Zabaluev <rzabaluev@provectus.com>
Mau Rodríguez Morales 3 лет назад
Родитель
Сommit
c28ee0f08b

+ 11 - 1
kafka-ui-react-app/src/components/Connect/Connect.tsx

@@ -1,10 +1,12 @@
 import React from 'react';
-import { Switch } from 'react-router-dom';
+import { Switch, Redirect } from 'react-router-dom';
 import {
   clusterConnectorsPath,
+  clusterConnectsPath,
   clusterConnectorNewPath,
   clusterConnectConnectorPath,
   clusterConnectConnectorEditPath,
+  clusterConnectConnectorsPath,
 } from 'lib/paths';
 import { BreadcrumbRoute } from 'components/common/Breadcrumb/Breadcrumb.route';
 
@@ -43,6 +45,14 @@ const Connect: React.FC = () => (
         )}
         component={DetailsContainer}
       />
+      <Redirect
+        from={clusterConnectConnectorsPath(':clusterName', ':connectName')}
+        to={clusterConnectorsPath(':clusterName')}
+      />
+      <Redirect
+        from={`${clusterConnectsPath(':clusterName')}/:connectName`}
+        to={clusterConnectorsPath(':clusterName')}
+      />
     </Switch>
   </div>
 );

+ 1 - 1
kafka-ui-react-app/src/lib/paths.ts

@@ -85,7 +85,7 @@ export const clusterConnectorsPath = (clusterName: ClusterName) =>
   `${clusterPath(clusterName)}/connectors`;
 export const clusterConnectorNewPath = (clusterName: ClusterName) =>
   `${clusterConnectorsPath(clusterName)}/create-new`;
-const clusterConnectConnectorsPath = (
+export const clusterConnectConnectorsPath = (
   clusterName: ClusterName,
   connectName: ConnectName
 ) => `${clusterConnectsPath(clusterName)}/${connectName}/connectors`;