[CHORE] Get rid of redundant ActionType enum
This commit is contained in:
parent
ba4e1748ee
commit
384c0a5d17
6 changed files with 50 additions and 110 deletions
|
@ -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;
|
|
@ -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'
|
||||
)<undefined, ClusterStats, undefined>();
|
||||
|
||||
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'
|
||||
)<undefined, ClusterMetrics, undefined>();
|
||||
|
||||
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'
|
||||
)<undefined, Broker[], undefined>();
|
||||
|
||||
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'
|
||||
)<undefined, BrokerMetrics, undefined>();
|
||||
|
||||
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'
|
||||
)<undefined, Cluster[], undefined>();
|
||||
|
||||
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'
|
||||
)<undefined, Topic[], undefined>();
|
||||
|
||||
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'
|
||||
)<undefined, TopicMessage[], undefined>();
|
||||
|
||||
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'
|
||||
)<undefined, { topicName: TopicName; details: TopicDetails }, undefined>();
|
||||
|
||||
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'
|
||||
)<undefined, { topicName: TopicName; config: TopicConfig[] }, undefined>();
|
||||
|
||||
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'
|
||||
)<undefined, Topic, undefined>();
|
||||
|
||||
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'
|
||||
)<undefined, Topic, undefined>();
|
||||
|
||||
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'
|
||||
)<undefined, ConsumerGroup[], undefined>();
|
||||
|
||||
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 },
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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: {
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue