actions.ts 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import { createAsyncAction} from 'typesafe-actions';
  2. import { ActionType } from 'redux/actionType';
  3. import {
  4. Broker,
  5. BrokerMetrics,
  6. Cluster,
  7. Topic,
  8. TopicConfig,
  9. TopicDetails,
  10. TopicName,
  11. } from 'redux/interfaces';
  12. export const fetchBrokersAction = createAsyncAction(
  13. ActionType.GET_BROKERS__REQUEST,
  14. ActionType.GET_BROKERS__SUCCESS,
  15. ActionType.GET_BROKERS__FAILURE,
  16. )<undefined, Broker[], undefined>();
  17. export const fetchBrokerMetricsAction = createAsyncAction(
  18. ActionType.GET_BROKER_METRICS__REQUEST,
  19. ActionType.GET_BROKER_METRICS__SUCCESS,
  20. ActionType.GET_BROKER_METRICS__FAILURE,
  21. )<undefined, BrokerMetrics, undefined>();
  22. export const fetchClusterListAction = createAsyncAction(
  23. ActionType.GET_CLUSTERS__REQUEST,
  24. ActionType.GET_CLUSTERS__SUCCESS,
  25. ActionType.GET_CLUSTERS__FAILURE,
  26. )<undefined, Cluster[], undefined>();
  27. export const fetchTopicListAction = createAsyncAction(
  28. ActionType.GET_TOPICS__REQUEST,
  29. ActionType.GET_TOPICS__SUCCESS,
  30. ActionType.GET_TOPICS__FAILURE,
  31. )<undefined, Topic[], undefined>();
  32. export const fetchTopicDetailsAction = createAsyncAction(
  33. ActionType.GET_TOPIC_DETAILS__REQUEST,
  34. ActionType.GET_TOPIC_DETAILS__SUCCESS,
  35. ActionType.GET_TOPIC_DETAILS__FAILURE,
  36. )<undefined, { topicName: TopicName, details: TopicDetails }, undefined>();
  37. export const fetchTopicConfigAction = createAsyncAction(
  38. ActionType.GET_TOPIC_CONFIG__REQUEST,
  39. ActionType.GET_TOPIC_CONFIG__SUCCESS,
  40. ActionType.GET_TOPIC_CONFIG__FAILURE,
  41. )<undefined, { topicName: TopicName, config: TopicConfig[] }, undefined>();
  42. export const createTopicAction = createAsyncAction(
  43. ActionType.POST_TOPIC__REQUEST,
  44. ActionType.POST_TOPIC__SUCCESS,
  45. ActionType.POST_TOPIC__FAILURE,
  46. )<undefined, Topic, undefined>();