actions.ts 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. import { createAsyncAction } from 'typesafe-actions';
  2. import { TopicName, ConsumerGroupID } from 'redux/interfaces';
  3. import {
  4. Cluster,
  5. ClusterStats,
  6. ClusterMetrics,
  7. Broker,
  8. BrokerMetrics,
  9. Topic,
  10. TopicDetails,
  11. TopicConfig,
  12. TopicMessage,
  13. ConsumerGroup,
  14. ConsumerGroupDetails,
  15. SchemaSubject,
  16. } from 'generated-sources';
  17. export const fetchClusterStatsAction = createAsyncAction(
  18. 'GET_CLUSTER_STATUS__REQUEST',
  19. 'GET_CLUSTER_STATUS__SUCCESS',
  20. 'GET_CLUSTER_STATUS__FAILURE'
  21. )<undefined, ClusterStats, undefined>();
  22. export const fetchClusterMetricsAction = createAsyncAction(
  23. 'GET_CLUSTER_METRICS__REQUEST',
  24. 'GET_CLUSTER_METRICS__SUCCESS',
  25. 'GET_CLUSTER_METRICS__FAILURE'
  26. )<undefined, ClusterMetrics, undefined>();
  27. export const fetchBrokersAction = createAsyncAction(
  28. 'GET_BROKERS__REQUEST',
  29. 'GET_BROKERS__SUCCESS',
  30. 'GET_BROKERS__FAILURE'
  31. )<undefined, Broker[], undefined>();
  32. export const fetchBrokerMetricsAction = createAsyncAction(
  33. 'GET_BROKER_METRICS__REQUEST',
  34. 'GET_BROKER_METRICS__SUCCESS',
  35. 'GET_BROKER_METRICS__FAILURE'
  36. )<undefined, BrokerMetrics, undefined>();
  37. export const fetchClusterListAction = createAsyncAction(
  38. 'GET_CLUSTERS__REQUEST',
  39. 'GET_CLUSTERS__SUCCESS',
  40. 'GET_CLUSTERS__FAILURE'
  41. )<undefined, Cluster[], undefined>();
  42. export const fetchTopicsListAction = createAsyncAction(
  43. 'GET_TOPICS__REQUEST',
  44. 'GET_TOPICS__SUCCESS',
  45. 'GET_TOPICS__FAILURE'
  46. )<undefined, Topic[], undefined>();
  47. export const fetchTopicMessagesAction = createAsyncAction(
  48. 'GET_TOPIC_MESSAGES__REQUEST',
  49. 'GET_TOPIC_MESSAGES__SUCCESS',
  50. 'GET_TOPIC_MESSAGES__FAILURE'
  51. )<undefined, TopicMessage[], undefined>();
  52. export const fetchTopicDetailsAction = createAsyncAction(
  53. 'GET_TOPIC_DETAILS__REQUEST',
  54. 'GET_TOPIC_DETAILS__SUCCESS',
  55. 'GET_TOPIC_DETAILS__FAILURE'
  56. )<undefined, { topicName: TopicName; details: TopicDetails }, undefined>();
  57. export const fetchTopicConfigAction = createAsyncAction(
  58. 'GET_TOPIC_CONFIG__REQUEST',
  59. 'GET_TOPIC_CONFIG__SUCCESS',
  60. 'GET_TOPIC_CONFIG__FAILURE'
  61. )<undefined, { topicName: TopicName; config: TopicConfig[] }, undefined>();
  62. export const createTopicAction = createAsyncAction(
  63. 'POST_TOPIC__REQUEST',
  64. 'POST_TOPIC__SUCCESS',
  65. 'POST_TOPIC__FAILURE'
  66. )<undefined, Topic, undefined>();
  67. export const updateTopicAction = createAsyncAction(
  68. 'PATCH_TOPIC__REQUEST',
  69. 'PATCH_TOPIC__SUCCESS',
  70. 'PATCH_TOPIC__FAILURE'
  71. )<undefined, Topic, undefined>();
  72. export const fetchConsumerGroupsAction = createAsyncAction(
  73. 'GET_CONSUMER_GROUPS__REQUEST',
  74. 'GET_CONSUMER_GROUPS__SUCCESS',
  75. 'GET_CONSUMER_GROUPS__FAILURE'
  76. )<undefined, ConsumerGroup[], undefined>();
  77. export const fetchConsumerGroupDetailsAction = createAsyncAction(
  78. 'GET_CONSUMER_GROUP_DETAILS__REQUEST',
  79. 'GET_CONSUMER_GROUP_DETAILS__SUCCESS',
  80. 'GET_CONSUMER_GROUP_DETAILS__FAILURE'
  81. )<
  82. undefined,
  83. { consumerGroupID: ConsumerGroupID; details: ConsumerGroupDetails },
  84. undefined
  85. >();
  86. export const fetchSchemasByClusterNameAction = createAsyncAction(
  87. 'GET_CLUSTER_SCHEMAS__REQUEST',
  88. 'GET_CLUSTER_SCHEMAS__SUCCESS',
  89. 'GET_CLUSTER_SCHEMAS__FAILURE'
  90. )<undefined, SchemaSubject[], undefined>();