|
@@ -1,29 +1,70 @@
|
|
import React from 'react';
|
|
import React from 'react';
|
|
import { useSelector } from 'react-redux';
|
|
import { useSelector } from 'react-redux';
|
|
import { Switch, Route, Redirect, useParams } from 'react-router-dom';
|
|
import { Switch, Route, Redirect, useParams } from 'react-router-dom';
|
|
-import BrokersContainer from 'components/Brokers/BrokersContainer';
|
|
|
|
|
|
+import { ClusterFeaturesEnum } from 'generated-sources';
|
|
|
|
+import {
|
|
|
|
+ getClustersFeatures,
|
|
|
|
+ getClustersReadonlyStatus,
|
|
|
|
+} from 'redux/reducers/clusters/selectors';
|
|
|
|
+import {
|
|
|
|
+ clusterBrokersPath,
|
|
|
|
+ clusterConnectorsPath,
|
|
|
|
+ clusterConsumerGroupsPath,
|
|
|
|
+ clusterSchemasPath,
|
|
|
|
+ clusterTopicsPath,
|
|
|
|
+} from 'lib/paths';
|
|
import Topics from 'components/Topics/Topics';
|
|
import Topics from 'components/Topics/Topics';
|
|
-import ConsumersGroupsContainer from 'components/ConsumerGroups/ConsumersGroupsContainer';
|
|
|
|
import Schemas from 'components/Schemas/Schemas';
|
|
import Schemas from 'components/Schemas/Schemas';
|
|
-import { getClustersReadonlyStatus } from 'redux/reducers/clusters/selectors';
|
|
|
|
|
|
+import Connect from 'components/Connect/Connect';
|
|
import ClusterContext from 'components/contexts/ClusterContext';
|
|
import ClusterContext from 'components/contexts/ClusterContext';
|
|
|
|
+import BrokersContainer from 'components/Brokers/BrokersContainer';
|
|
|
|
+import ConsumersGroupsContainer from 'components/ConsumerGroups/ConsumersGroupsContainer';
|
|
|
|
|
|
const Cluster: React.FC = () => {
|
|
const Cluster: React.FC = () => {
|
|
const { clusterName } = useParams<{ clusterName: string }>();
|
|
const { clusterName } = useParams<{ clusterName: string }>();
|
|
const isReadOnly = useSelector(getClustersReadonlyStatus(clusterName));
|
|
const isReadOnly = useSelector(getClustersReadonlyStatus(clusterName));
|
|
|
|
+ const features = useSelector(getClustersFeatures(clusterName));
|
|
|
|
+
|
|
|
|
+ const hasKafkaConnectConfigured = features.includes(
|
|
|
|
+ ClusterFeaturesEnum.KAFKA_CONNECT
|
|
|
|
+ );
|
|
|
|
+ const hasSchemaRegistryConfigured = features.includes(
|
|
|
|
+ ClusterFeaturesEnum.SCHEMA_REGISTRY
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ const contextValue = React.useMemo(
|
|
|
|
+ () => ({
|
|
|
|
+ isReadOnly,
|
|
|
|
+ hasKafkaConnectConfigured,
|
|
|
|
+ hasSchemaRegistryConfigured,
|
|
|
|
+ }),
|
|
|
|
+ [features]
|
|
|
|
+ );
|
|
|
|
+
|
|
return (
|
|
return (
|
|
- <ClusterContext.Provider value={{ isReadOnly }}>
|
|
|
|
|
|
+ <ClusterContext.Provider value={contextValue}>
|
|
<Switch>
|
|
<Switch>
|
|
<Route
|
|
<Route
|
|
- path="/ui/clusters/:clusterName/brokers"
|
|
|
|
|
|
+ path={clusterBrokersPath(':clusterName')}
|
|
component={BrokersContainer}
|
|
component={BrokersContainer}
|
|
/>
|
|
/>
|
|
- <Route path="/ui/clusters/:clusterName/topics" component={Topics} />
|
|
|
|
|
|
+ <Route path={clusterTopicsPath(':clusterName')} component={Topics} />
|
|
<Route
|
|
<Route
|
|
- path="/ui/clusters/:clusterName/consumer-groups"
|
|
|
|
|
|
+ path={clusterConsumerGroupsPath(':clusterName')}
|
|
component={ConsumersGroupsContainer}
|
|
component={ConsumersGroupsContainer}
|
|
/>
|
|
/>
|
|
- <Route path="/ui/clusters/:clusterName/schemas" component={Schemas} />
|
|
|
|
|
|
+ {hasSchemaRegistryConfigured && (
|
|
|
|
+ <Route
|
|
|
|
+ path={clusterSchemasPath(':clusterName')}
|
|
|
|
+ component={Schemas}
|
|
|
|
+ />
|
|
|
|
+ )}
|
|
|
|
+ {hasKafkaConnectConfigured && (
|
|
|
|
+ <Route
|
|
|
|
+ path={clusterConnectorsPath(':clusterName')}
|
|
|
|
+ component={Connect}
|
|
|
|
+ />
|
|
|
|
+ )}
|
|
<Redirect
|
|
<Redirect
|
|
from="/ui/clusters/:clusterName"
|
|
from="/ui/clusters/:clusterName"
|
|
to="/ui/clusters/:clusterName/brokers"
|
|
to="/ui/clusters/:clusterName/brokers"
|