diff --git a/kafka-ui-react-app/src/components/Topics/Details/Messages/MessagesTable.tsx b/kafka-ui-react-app/src/components/Topics/Details/Messages/MessagesTable.tsx index 5073673f86df28e231bc65dd4ba2716e03a3e7b6..e6e8e7bee17c31d6837f250996fd1e1b97f4e3e2 100644 --- a/kafka-ui-react-app/src/components/Topics/Details/Messages/MessagesTable.tsx +++ b/kafka-ui-react-app/src/components/Topics/Details/Messages/MessagesTable.tsx @@ -1,8 +1,6 @@ import React from 'react'; import { TopicMessage } from 'generated-sources'; -import CustomParamButton, { - CustomParamButtonType, -} from '../../shared/Form/CustomParams/CustomParamButton'; +import CustomParamButton from 'components/Topics/shared/Form/CustomParams/CustomParamButton'; import MessageItem from './MessageItem'; interface MessagesTableProp { @@ -44,7 +42,7 @@ const MessagesTable: React.FC = ({ messages, onNext }) => {
diff --git a/kafka-ui-react-app/src/components/Topics/shared/Form/CustomParams/CustomParamAction.tsx b/kafka-ui-react-app/src/components/Topics/shared/Form/CustomParams/CustomParamAction.tsx index c97c3f194db0c4987d41eff02e46daa2687fcce1..a6909024a9737d9b88a5eaad2f1eebceaa59d0b0 100644 --- a/kafka-ui-react-app/src/components/Topics/shared/Form/CustomParams/CustomParamAction.tsx +++ b/kafka-ui-react-app/src/components/Topics/shared/Form/CustomParams/CustomParamAction.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import CustomParamButton, { CustomParamButtonType } from './CustomParamButton'; +import CustomParamButton from './CustomParamButton'; interface Props { index: string; @@ -11,7 +11,7 @@ const CustomParamAction: React.FC = ({ index, onRemove }) => ( onRemove(index)} /> diff --git a/kafka-ui-react-app/src/components/Topics/shared/Form/CustomParams/CustomParamButton.tsx b/kafka-ui-react-app/src/components/Topics/shared/Form/CustomParams/CustomParamButton.tsx index 0276beabc10d2f8f1c694adfc8b7afe076736eb0..27e1f6dc60567526fd0d6d8f562dafe55012bec2 100644 --- a/kafka-ui-react-app/src/components/Topics/shared/Form/CustomParams/CustomParamButton.tsx +++ b/kafka-ui-react-app/src/components/Topics/shared/Form/CustomParams/CustomParamButton.tsx @@ -1,15 +1,9 @@ import React from 'react'; -export enum CustomParamButtonType { - plus = 'fa-plus', - minus = 'fa-minus', - chevronRight = 'fa-chevron-right', -} - interface Props { onClick: (event: React.MouseEvent) => void; className: string; - type: CustomParamButtonType; + type: 'fa-plus' | 'fa-minus' | 'fa-chevron-right'; btnText?: string; } diff --git a/kafka-ui-react-app/src/components/Topics/shared/Form/CustomParams/CustomParams.tsx b/kafka-ui-react-app/src/components/Topics/shared/Form/CustomParams/CustomParams.tsx index e11c3dbd636045cd6caf8aeca1d48dd30311561d..6f84a7b372de2c7ec497853b87f549ff97f1c746 100644 --- a/kafka-ui-react-app/src/components/Topics/shared/Form/CustomParams/CustomParams.tsx +++ b/kafka-ui-react-app/src/components/Topics/shared/Form/CustomParams/CustomParams.tsx @@ -7,7 +7,7 @@ import { TopicConfigByName, TopicConfigParams, } from 'redux/interfaces'; -import CustomParamButton, { CustomParamButtonType } from './CustomParamButton'; +import CustomParamButton from './CustomParamButton'; import CustomParamField from './CustomParamField'; export const INDEX_PREFIX = 'customParams'; @@ -79,7 +79,7 @@ const CustomParams: React.FC = ({ isSubmitting, config }) => {
diff --git a/kafka-ui-react-app/src/redux/actionType.ts b/kafka-ui-react-app/src/redux/actionType.ts deleted file mode 100644 index 7df9b142e06b833fb62a44d1e2b55b9ddb2489bd..0000000000000000000000000000000000000000 --- a/kafka-ui-react-app/src/redux/actionType.ts +++ /dev/null @@ -1,55 +0,0 @@ -enum ActionType { - GET_CLUSTERS__REQUEST = 'GET_CLUSTERS__REQUEST', - GET_CLUSTERS__SUCCESS = 'GET_CLUSTERS__SUCCESS', - GET_CLUSTERS__FAILURE = 'GET_CLUSTERS__FAILURE', - - GET_CLUSTER_STATS__REQUEST = 'GET_CLUSTER_STATUS__REQUEST', - GET_CLUSTER_STATS__SUCCESS = 'GET_CLUSTER_STATUS__SUCCESS', - GET_CLUSTER_STATS__FAILURE = 'GET_CLUSTER_STATUS__FAILURE', - - GET_CLUSTER_METRICS__REQUEST = 'GET_CLUSTER_METRICS__REQUEST', - GET_CLUSTER_METRICS__SUCCESS = 'GET_CLUSTER_METRICS__SUCCESS', - GET_CLUSTER_METRICS__FAILURE = 'GET_CLUSTER_METRICS__FAILURE', - - GET_BROKERS__REQUEST = 'GET_BROKERS__REQUEST', - GET_BROKERS__SUCCESS = 'GET_BROKERS__SUCCESS', - GET_BROKERS__FAILURE = 'GET_BROKERS__FAILURE', - - GET_BROKER_METRICS__REQUEST = 'GET_BROKER_METRICS__REQUEST', - GET_BROKER_METRICS__SUCCESS = 'GET_BROKER_METRICS__SUCCESS', - GET_BROKER_METRICS__FAILURE = 'GET_BROKER_METRICS__FAILURE', - - GET_TOPICS__REQUEST = 'GET_TOPICS__REQUEST', - GET_TOPICS__SUCCESS = 'GET_TOPICS__SUCCESS', - GET_TOPICS__FAILURE = 'GET_TOPICS__FAILURE', - - GET_TOPIC_MESSAGES__REQUEST = 'GET_TOPIC_MESSAGES__REQUEST', - GET_TOPIC_MESSAGES__SUCCESS = 'GET_TOPIC_MESSAGES__SUCCESS', - GET_TOPIC_MESSAGES__FAILURE = 'GET_TOPIC_MESSAGES__FAILURE', - - GET_TOPIC_DETAILS__REQUEST = 'GET_TOPIC_DETAILS__REQUEST', - GET_TOPIC_DETAILS__SUCCESS = 'GET_TOPIC_DETAILS__SUCCESS', - GET_TOPIC_DETAILS__FAILURE = 'GET_TOPIC_DETAILS__FAILURE', - - GET_TOPIC_CONFIG__REQUEST = 'GET_TOPIC_CONFIG__REQUEST', - GET_TOPIC_CONFIG__SUCCESS = 'GET_TOPIC_CONFIG__SUCCESS', - GET_TOPIC_CONFIG__FAILURE = 'GET_TOPIC_CONFIG__FAILURE', - - POST_TOPIC__REQUEST = 'POST_TOPIC__REQUEST', - POST_TOPIC__SUCCESS = 'POST_TOPIC__SUCCESS', - POST_TOPIC__FAILURE = 'POST_TOPIC__FAILURE', - - PATCH_TOPIC__REQUEST = 'PATCH_TOPIC__REQUEST', - PATCH_TOPIC__SUCCESS = 'PATCH_TOPIC__SUCCESS', - PATCH_TOPIC__FAILURE = 'PATCH_TOPIC__FAILURE', - - GET_CONSUMER_GROUPS__REQUEST = 'GET_CONSUMER_GROUPS__REQUEST', - GET_CONSUMER_GROUPS__SUCCESS = 'GET_CONSUMER_GROUPS__SUCCESS', - GET_CONSUMER_GROUPS__FAILURE = 'GET_CONSUMER_GROUPS__FAILURE', - - GET_CONSUMER_GROUP_DETAILS__REQUEST = 'GET_CONSUMER_GROUP_DETAILS__REQUEST', - GET_CONSUMER_GROUP_DETAILS__SUCCESS = 'GET_CONSUMER_GROUP_DETAILS__SUCCESS', - GET_CONSUMER_GROUP_DETAILS__FAILURE = 'GET_CONSUMER_GROUP_DETAILS__FAILURE', -} - -export default ActionType; diff --git a/kafka-ui-react-app/src/redux/actions/actions.ts b/kafka-ui-react-app/src/redux/actions/actions.ts index 679cbd93c1be9e19c8ac3bcf7f4e04ab190bee85..747c1e6365588846f0d55a355a5812667acbb2c2 100644 --- a/kafka-ui-react-app/src/redux/actions/actions.ts +++ b/kafka-ui-react-app/src/redux/actions/actions.ts @@ -1,5 +1,4 @@ import { createAsyncAction } from 'typesafe-actions'; -import ActionType from 'redux/actionType'; import { TopicName, ConsumerGroupID } from 'redux/interfaces'; import { @@ -17,81 +16,81 @@ import { } from 'generated-sources'; export const fetchClusterStatsAction = createAsyncAction( - ActionType.GET_CLUSTER_STATS__REQUEST, - ActionType.GET_CLUSTER_STATS__SUCCESS, - ActionType.GET_CLUSTER_STATS__FAILURE + 'GET_CLUSTER_STATUS__REQUEST', + 'GET_CLUSTER_STATUS__SUCCESS', + 'GET_CLUSTER_STATUS__FAILURE' )(); export const fetchClusterMetricsAction = createAsyncAction( - ActionType.GET_CLUSTER_METRICS__REQUEST, - ActionType.GET_CLUSTER_METRICS__SUCCESS, - ActionType.GET_CLUSTER_METRICS__FAILURE + 'GET_CLUSTER_METRICS__REQUEST', + 'GET_CLUSTER_METRICS__SUCCESS', + 'GET_CLUSTER_METRICS__FAILURE' )(); export const fetchBrokersAction = createAsyncAction( - ActionType.GET_BROKERS__REQUEST, - ActionType.GET_BROKERS__SUCCESS, - ActionType.GET_BROKERS__FAILURE + 'GET_BROKERS__REQUEST', + 'GET_BROKERS__SUCCESS', + 'GET_BROKERS__FAILURE' )(); export const fetchBrokerMetricsAction = createAsyncAction( - ActionType.GET_BROKER_METRICS__REQUEST, - ActionType.GET_BROKER_METRICS__SUCCESS, - ActionType.GET_BROKER_METRICS__FAILURE + 'GET_BROKER_METRICS__REQUEST', + 'GET_BROKER_METRICS__SUCCESS', + 'GET_BROKER_METRICS__FAILURE' )(); export const fetchClusterListAction = createAsyncAction( - ActionType.GET_CLUSTERS__REQUEST, - ActionType.GET_CLUSTERS__SUCCESS, - ActionType.GET_CLUSTERS__FAILURE + 'GET_CLUSTERS__REQUEST', + 'GET_CLUSTERS__SUCCESS', + 'GET_CLUSTERS__FAILURE' )(); export const fetchTopicsListAction = createAsyncAction( - ActionType.GET_TOPICS__REQUEST, - ActionType.GET_TOPICS__SUCCESS, - ActionType.GET_TOPICS__FAILURE + 'GET_TOPICS__REQUEST', + 'GET_TOPICS__SUCCESS', + 'GET_TOPICS__FAILURE' )(); export const fetchTopicMessagesAction = createAsyncAction( - ActionType.GET_TOPIC_MESSAGES__REQUEST, - ActionType.GET_TOPIC_MESSAGES__SUCCESS, - ActionType.GET_TOPIC_MESSAGES__FAILURE + 'GET_TOPIC_MESSAGES__REQUEST', + 'GET_TOPIC_MESSAGES__SUCCESS', + 'GET_TOPIC_MESSAGES__FAILURE' )(); export const fetchTopicDetailsAction = createAsyncAction( - ActionType.GET_TOPIC_DETAILS__REQUEST, - ActionType.GET_TOPIC_DETAILS__SUCCESS, - ActionType.GET_TOPIC_DETAILS__FAILURE + 'GET_TOPIC_DETAILS__REQUEST', + 'GET_TOPIC_DETAILS__SUCCESS', + 'GET_TOPIC_DETAILS__FAILURE' )(); export const fetchTopicConfigAction = createAsyncAction( - ActionType.GET_TOPIC_CONFIG__REQUEST, - ActionType.GET_TOPIC_CONFIG__SUCCESS, - ActionType.GET_TOPIC_CONFIG__FAILURE + 'GET_TOPIC_CONFIG__REQUEST', + 'GET_TOPIC_CONFIG__SUCCESS', + 'GET_TOPIC_CONFIG__FAILURE' )(); export const createTopicAction = createAsyncAction( - ActionType.POST_TOPIC__REQUEST, - ActionType.POST_TOPIC__SUCCESS, - ActionType.POST_TOPIC__FAILURE + 'POST_TOPIC__REQUEST', + 'POST_TOPIC__SUCCESS', + 'POST_TOPIC__FAILURE' )(); export const updateTopicAction = createAsyncAction( - ActionType.PATCH_TOPIC__REQUEST, - ActionType.PATCH_TOPIC__SUCCESS, - ActionType.PATCH_TOPIC__FAILURE + 'PATCH_TOPIC__REQUEST', + 'PATCH_TOPIC__SUCCESS', + 'PATCH_TOPIC__FAILURE' )(); export const fetchConsumerGroupsAction = createAsyncAction( - ActionType.GET_CONSUMER_GROUPS__REQUEST, - ActionType.GET_CONSUMER_GROUPS__SUCCESS, - ActionType.GET_CONSUMER_GROUPS__FAILURE + 'GET_CONSUMER_GROUPS__REQUEST', + 'GET_CONSUMER_GROUPS__SUCCESS', + 'GET_CONSUMER_GROUPS__FAILURE' )(); export const fetchConsumerGroupDetailsAction = createAsyncAction( - ActionType.GET_CONSUMER_GROUP_DETAILS__REQUEST, - ActionType.GET_CONSUMER_GROUP_DETAILS__SUCCESS, - ActionType.GET_CONSUMER_GROUP_DETAILS__FAILURE + 'GET_CONSUMER_GROUP_DETAILS__REQUEST', + 'GET_CONSUMER_GROUP_DETAILS__SUCCESS', + 'GET_CONSUMER_GROUP_DETAILS__FAILURE' )< undefined, { consumerGroupID: ConsumerGroupID; details: ConsumerGroupDetails }, diff --git a/kafka-ui-react-app/src/redux/interfaces/index.ts b/kafka-ui-react-app/src/redux/interfaces/index.ts index 8a54d01f25f3664a58318e9802fdc07b28a4d8f2..56055cbed7ed4ecef32480711eaf5444959b5c4e 100644 --- a/kafka-ui-react-app/src/redux/interfaces/index.ts +++ b/kafka-ui-react-app/src/redux/interfaces/index.ts @@ -16,13 +16,6 @@ export * from './broker'; export * from './consumerGroup'; export * from './loader'; -export enum FetchStatus { - notFetched = 'notFetched', - fetching = 'fetching', - fetched = 'fetched', - errorFetching = 'errorFetching', -} - export interface RootState { topics: TopicsState; clusters: ClusterState; diff --git a/kafka-ui-react-app/src/redux/interfaces/loader.ts b/kafka-ui-react-app/src/redux/interfaces/loader.ts index 559a5e01febfccab1780ec6843189a2c836b1956..048e695e7669bfb34e16d9c116fb6b30709f938a 100644 --- a/kafka-ui-react-app/src/redux/interfaces/loader.ts +++ b/kafka-ui-react-app/src/redux/interfaces/loader.ts @@ -1,5 +1,3 @@ -import { FetchStatus } from 'redux/interfaces/index'; - export interface LoaderState { - [key: string]: FetchStatus; + [key: string]: 'notFetched' | 'fetching' | 'fetched' | 'errorFetching'; } diff --git a/kafka-ui-react-app/src/redux/reducers/brokers/reducer.ts b/kafka-ui-react-app/src/redux/reducers/brokers/reducer.ts index cab60d2e252b3e3134cebd96bd16f221c9f50f11..3df9597129cd972cfc9fa1aeb254fefeed8fcec1 100644 --- a/kafka-ui-react-app/src/redux/reducers/brokers/reducer.ts +++ b/kafka-ui-react-app/src/redux/reducers/brokers/reducer.ts @@ -1,6 +1,5 @@ import { Action, BrokersState, ZooKeeperStatus } from 'redux/interfaces'; import { ClusterStats } from 'generated-sources'; -import ActionType from 'redux/actionType'; export const initialState: BrokersState = { items: [], @@ -36,14 +35,14 @@ const updateBrokerSegmentSize = ( const reducer = (state = initialState, action: Action): BrokersState => { switch (action.type) { - case ActionType.GET_BROKERS__REQUEST: + case 'GET_BROKERS__REQUEST': return initialState; - case ActionType.GET_BROKERS__SUCCESS: + case 'GET_BROKERS__SUCCESS': return { ...state, items: action.payload, }; - case ActionType.GET_CLUSTER_STATS__SUCCESS: + case 'GET_CLUSTER_STATUS__SUCCESS': return updateBrokerSegmentSize(state, action.payload); default: return state; diff --git a/kafka-ui-react-app/src/redux/reducers/brokers/selectors.ts b/kafka-ui-react-app/src/redux/reducers/brokers/selectors.ts index eab6d08b50cfdef1a3d229f6517c8dfee9c5eb31..3c6ef947dd4b145914094146634f58ff31f4d96c 100644 --- a/kafka-ui-react-app/src/redux/reducers/brokers/selectors.ts +++ b/kafka-ui-react-app/src/redux/reducers/brokers/selectors.ts @@ -1,5 +1,5 @@ import { createSelector } from 'reselect'; -import { RootState, FetchStatus, BrokersState } from 'redux/interfaces'; +import { RootState, BrokersState } from 'redux/interfaces'; import { createFetchingSelector } from 'redux/reducers/loader/selectors'; const brokersState = ({ brokers }: RootState): BrokersState => brokers; @@ -8,7 +8,7 @@ const getBrokerListFetchingStatus = createFetchingSelector('GET_BROKERS'); export const getIsBrokerListFetched = createSelector( getBrokerListFetchingStatus, - (status) => status === FetchStatus.fetched + (status) => status === 'fetched' ); export const getBrokerCount = createSelector( diff --git a/kafka-ui-react-app/src/redux/reducers/clusters/reducer.ts b/kafka-ui-react-app/src/redux/reducers/clusters/reducer.ts index 9ce79b7bdec55dba7b9f7ce31b50fb9b44217a8f..10de9654ffbe26c7b02213ac8b13fe9f69310bbf 100644 --- a/kafka-ui-react-app/src/redux/reducers/clusters/reducer.ts +++ b/kafka-ui-react-app/src/redux/reducers/clusters/reducer.ts @@ -1,12 +1,11 @@ import { Action } from 'redux/interfaces'; import { Cluster } from 'generated-sources'; -import ActionType from 'redux/actionType'; export const initialState: Cluster[] = []; const reducer = (state = initialState, action: Action): Cluster[] => { switch (action.type) { - case ActionType.GET_CLUSTERS__SUCCESS: + case 'GET_CLUSTERS__SUCCESS': return action.payload; default: return state; diff --git a/kafka-ui-react-app/src/redux/reducers/clusters/selectors.ts b/kafka-ui-react-app/src/redux/reducers/clusters/selectors.ts index 592e8ccae9856e59f66d7efa35bdaaa4604db52c..22bab57baa03ef1df4515038e2c221e67297c392 100644 --- a/kafka-ui-react-app/src/redux/reducers/clusters/selectors.ts +++ b/kafka-ui-react-app/src/redux/reducers/clusters/selectors.ts @@ -1,5 +1,5 @@ import { createSelector } from 'reselect'; -import { RootState, FetchStatus } from 'redux/interfaces'; +import { RootState } from 'redux/interfaces'; import { createFetchingSelector } from 'redux/reducers/loader/selectors'; import { Cluster, ServerStatus } from 'generated-sources'; @@ -9,7 +9,7 @@ const getClusterListFetchingStatus = createFetchingSelector('GET_CLUSTERS'); export const getIsClusterListFetched = createSelector( getClusterListFetchingStatus, - (status) => status === FetchStatus.fetched + (status) => status === 'fetched' ); export const getClusterList = createSelector( diff --git a/kafka-ui-react-app/src/redux/reducers/consumerGroups/reducer.ts b/kafka-ui-react-app/src/redux/reducers/consumerGroups/reducer.ts index 6776dbcc5865b3ff90e03fa0fdfb4027cdac0e07..c2cb51865022b33fa86d62ea5b4a444a3100f517 100644 --- a/kafka-ui-react-app/src/redux/reducers/consumerGroups/reducer.ts +++ b/kafka-ui-react-app/src/redux/reducers/consumerGroups/reducer.ts @@ -1,6 +1,5 @@ import { Action, ConsumerGroupsState } from 'redux/interfaces'; import { ConsumerGroup } from 'generated-sources'; -import ActionType from 'redux/actionType'; export const initialState: ConsumerGroupsState = { byID: {}, @@ -34,9 +33,9 @@ const updateConsumerGroupsList = ( const reducer = (state = initialState, action: Action): ConsumerGroupsState => { switch (action.type) { - case ActionType.GET_CONSUMER_GROUPS__SUCCESS: + case 'GET_CONSUMER_GROUPS__SUCCESS': return updateConsumerGroupsList(state, action.payload); - case ActionType.GET_CONSUMER_GROUP_DETAILS__SUCCESS: + case 'GET_CONSUMER_GROUP_DETAILS__SUCCESS': return { ...state, byID: { diff --git a/kafka-ui-react-app/src/redux/reducers/consumerGroups/selectors.ts b/kafka-ui-react-app/src/redux/reducers/consumerGroups/selectors.ts index 0e298084d6f2d2f6a2a43659abce674a763cfa32..86459fc6d5e36e77a5ba906d394bea6cef7e9d9a 100644 --- a/kafka-ui-react-app/src/redux/reducers/consumerGroups/selectors.ts +++ b/kafka-ui-react-app/src/redux/reducers/consumerGroups/selectors.ts @@ -1,5 +1,5 @@ import { createSelector } from 'reselect'; -import { RootState, FetchStatus } from 'redux/interfaces'; +import { RootState } from 'redux/interfaces'; import { createFetchingSelector } from 'redux/reducers/loader/selectors'; import { ConsumerGroupID, @@ -24,12 +24,12 @@ const getConsumerGroupDetailsFetchingStatus = createFetchingSelector( export const getIsConsumerGroupsListFetched = createSelector( getConsumerGroupsListFetchingStatus, - (status) => status === FetchStatus.fetched + (status) => status === 'fetched' ); export const getIsConsumerGroupDetailsFetched = createSelector( getConsumerGroupDetailsFetchingStatus, - (status) => status === FetchStatus.fetched + (status) => status === 'fetched' ); export const getConsumerGroupsList = createSelector( diff --git a/kafka-ui-react-app/src/redux/reducers/loader/reducer.ts b/kafka-ui-react-app/src/redux/reducers/loader/reducer.ts index e847decd3ff26277f25f9566cf5967d015786b87..37892542fae31cf309a68410fa832d20bfeac6e2 100644 --- a/kafka-ui-react-app/src/redux/reducers/loader/reducer.ts +++ b/kafka-ui-react-app/src/redux/reducers/loader/reducer.ts @@ -1,4 +1,4 @@ -import { FetchStatus, Action, LoaderState } from 'redux/interfaces'; +import { Action, LoaderState } from 'redux/interfaces'; export const initialState: LoaderState = {}; @@ -15,17 +15,17 @@ const reducer = (state = initialState, action: Action): LoaderState => { case 'REQUEST': return { ...state, - [requestName]: FetchStatus.fetching, + [requestName]: 'fetching', }; case 'SUCCESS': return { ...state, - [requestName]: FetchStatus.fetched, + [requestName]: 'fetched', }; case 'FAILURE': return { ...state, - [requestName]: FetchStatus.errorFetching, + [requestName]: 'errorFetching', }; default: return state; diff --git a/kafka-ui-react-app/src/redux/reducers/loader/selectors.ts b/kafka-ui-react-app/src/redux/reducers/loader/selectors.ts index c43355b577878db69e34bb56a03d6f53165cfca7..fcab9e731dec1e8179bf6442b2da6609f2332b52 100644 --- a/kafka-ui-react-app/src/redux/reducers/loader/selectors.ts +++ b/kafka-ui-react-app/src/redux/reducers/loader/selectors.ts @@ -1,4 +1,4 @@ -import { RootState, FetchStatus } from 'redux/interfaces'; +import { RootState } from 'redux/interfaces'; export const createFetchingSelector = (action: string) => (state: RootState) => - state.loader[action] || FetchStatus.notFetched; + state.loader[action] || 'notFetched'; diff --git a/kafka-ui-react-app/src/redux/reducers/topics/reducer.ts b/kafka-ui-react-app/src/redux/reducers/topics/reducer.ts index 6a11485172434883712bc898e9db0c0aed2544d5..d457e9de7ff9e51056b3e6d28b66e2265728f25d 100644 --- a/kafka-ui-react-app/src/redux/reducers/topics/reducer.ts +++ b/kafka-ui-react-app/src/redux/reducers/topics/reducer.ts @@ -1,7 +1,6 @@ import { v4 } from 'uuid'; import { Topic, TopicMessage } from 'generated-sources'; import { Action, TopicsState } from 'redux/interfaces'; -import ActionType from 'redux/actionType'; export const initialState: TopicsState = { byName: {}, @@ -68,9 +67,9 @@ const transformTopicMessages = ( const reducer = (state = initialState, action: Action): TopicsState => { switch (action.type) { - case ActionType.GET_TOPICS__SUCCESS: + case 'GET_TOPICS__SUCCESS': return updateTopicList(state, action.payload); - case ActionType.GET_TOPIC_DETAILS__SUCCESS: + case 'GET_TOPIC_DETAILS__SUCCESS': return { ...state, byName: { @@ -81,9 +80,9 @@ const reducer = (state = initialState, action: Action): TopicsState => { }, }, }; - case ActionType.GET_TOPIC_MESSAGES__SUCCESS: + case 'GET_TOPIC_MESSAGES__SUCCESS': return transformTopicMessages(state, action.payload); - case ActionType.GET_TOPIC_CONFIG__SUCCESS: + case 'GET_TOPIC_CONFIG__SUCCESS': return { ...state, byName: { @@ -97,7 +96,7 @@ const reducer = (state = initialState, action: Action): TopicsState => { }, }, }; - case ActionType.POST_TOPIC__SUCCESS: + case 'POST_TOPIC__SUCCESS': return addToTopicList(state, action.payload); default: return state; diff --git a/kafka-ui-react-app/src/redux/reducers/topics/selectors.ts b/kafka-ui-react-app/src/redux/reducers/topics/selectors.ts index f215821f0e7ea4d986803ae7eb65e0f1236e2623..b767c80432ee0cc6c8ebccc61afcc4a8fa5dd5c7 100644 --- a/kafka-ui-react-app/src/redux/reducers/topics/selectors.ts +++ b/kafka-ui-react-app/src/redux/reducers/topics/selectors.ts @@ -2,7 +2,6 @@ import { createSelector } from 'reselect'; import { RootState, TopicName, - FetchStatus, TopicsState, TopicConfigByName, } from 'redux/interfaces'; @@ -29,32 +28,32 @@ const getTopicUpdateStatus = createFetchingSelector('PATCH_TOPIC'); export const getIsTopicListFetched = createSelector( getTopicListFetchingStatus, - (status) => status === FetchStatus.fetched + (status) => status === 'fetched' ); export const getIsTopicDetailsFetched = createSelector( getTopicDetailsFetchingStatus, - (status) => status === FetchStatus.fetched + (status) => status === 'fetched' ); export const getIsTopicMessagesFetched = createSelector( getTopicMessagesFetchingStatus, - (status) => status === FetchStatus.fetched + (status) => status === 'fetched' ); export const getTopicConfigFetched = createSelector( getTopicConfigFetchingStatus, - (status) => status === FetchStatus.fetched + (status) => status === 'fetched' ); export const getTopicCreated = createSelector( getTopicCreationStatus, - (status) => status === FetchStatus.fetched + (status) => status === 'fetched' ); export const getTopicUpdated = createSelector( getTopicUpdateStatus, - (status) => status === FetchStatus.fetched + (status) => status === 'fetched' ); export const getTopicList = createSelector(