From 0e4e8b74ae21172b18a59cf0776232adfa9b864e Mon Sep 17 00:00:00 2001 From: GneyHabub Date: Wed, 10 Mar 2021 21:47:14 +0300 Subject: [PATCH] Rename & rearrange --- .../src/components/Schemas/Details/Details.tsx | 6 +++--- .../components/Schemas/Details/__test__/Details.spec.tsx | 6 +++--- kafka-ui-react-app/src/components/Schemas/List/List.tsx | 6 +++--- .../src/components/Schemas/List/__test__/List.spec.tsx | 6 +++--- kafka-ui-react-app/src/components/Schemas/Schemas.tsx | 8 ++++---- .../src/components/Schemas/__test__/Schemas.spec.tsx | 1 + .../src/components/Topics/Details/Details.tsx | 6 +++--- kafka-ui-react-app/src/components/Topics/List/List.tsx | 6 +++--- .../src/components/Topics/List/__tests__/List.spec.tsx | 6 +++--- kafka-ui-react-app/src/components/Topics/Topics.tsx | 8 ++++---- .../src/components/contexts/ClusterContext.ts | 8 ++++++++ .../src/components/contexts/ReadOnlyContext.ts | 8 -------- .../src/redux/reducers/clusters/selectors.ts | 3 ++- 13 files changed, 40 insertions(+), 38 deletions(-) create mode 100644 kafka-ui-react-app/src/components/contexts/ClusterContext.ts delete mode 100644 kafka-ui-react-app/src/components/contexts/ReadOnlyContext.ts diff --git a/kafka-ui-react-app/src/components/Schemas/Details/Details.tsx b/kafka-ui-react-app/src/components/Schemas/Details/Details.tsx index a3c5b2e12b..e343c43ff9 100644 --- a/kafka-ui-react-app/src/components/Schemas/Details/Details.tsx +++ b/kafka-ui-react-app/src/components/Schemas/Details/Details.tsx @@ -2,11 +2,11 @@ import React from 'react'; import { SchemaSubject } from 'generated-sources'; import { ClusterName, SchemaName } from 'redux/interfaces'; import { clusterSchemasPath } from 'lib/paths'; +import ClusterContext from 'components/contexts/ClusterContext'; import Breadcrumb from '../../common/Breadcrumb/Breadcrumb'; import SchemaVersion from './SchemaVersion'; import LatestVersionItem from './LatestVersionItem'; import PageLoader from '../../common/PageLoader/PageLoader'; -import _ReadOnlyContext from '../../contexts/ReadOnlyContext'; export interface DetailsProps { schema: SchemaSubject; @@ -26,7 +26,7 @@ const Details: React.FC = ({ versions, isFetched, }) => { - const ReadOnlyContext = React.useContext(_ReadOnlyContext); + const { isReadOnly } = React.useContext(ClusterContext); React.useEffect(() => { fetchSchemaVersions(clusterName, schema.subject as SchemaName); }, [fetchSchemaVersions, clusterName]); @@ -56,7 +56,7 @@ const Details: React.FC = ({ - {!ReadOnlyContext.isReadOnly && ( + {!isReadOnly && (