actions.ts 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. import { createAction, createAsyncAction } from 'typesafe-actions';
  2. import { FailurePayload, TopicName, TopicsState } from 'redux/interfaces';
  3. import {
  4. TopicColumnsToSort,
  5. Topic,
  6. TopicMessageSchema,
  7. } from 'generated-sources';
  8. export const fetchTopicsListAction = createAsyncAction(
  9. 'GET_TOPICS__REQUEST',
  10. 'GET_TOPICS__SUCCESS',
  11. 'GET_TOPICS__FAILURE'
  12. )<undefined, TopicsState, undefined>();
  13. export const clearMessagesTopicAction = createAsyncAction(
  14. 'CLEAR_TOPIC_MESSAGES__REQUEST',
  15. 'CLEAR_TOPIC_MESSAGES__SUCCESS',
  16. 'CLEAR_TOPIC_MESSAGES__FAILURE'
  17. )<undefined, undefined, { alert?: FailurePayload }>();
  18. export const fetchTopicDetailsAction = createAsyncAction(
  19. 'GET_TOPIC_DETAILS__REQUEST',
  20. 'GET_TOPIC_DETAILS__SUCCESS',
  21. 'GET_TOPIC_DETAILS__FAILURE'
  22. )<undefined, TopicsState, undefined>();
  23. export const fetchTopicConfigAction = createAsyncAction(
  24. 'GET_TOPIC_CONFIG__REQUEST',
  25. 'GET_TOPIC_CONFIG__SUCCESS',
  26. 'GET_TOPIC_CONFIG__FAILURE'
  27. )<undefined, TopicsState, undefined>();
  28. export const createTopicAction = createAsyncAction(
  29. 'POST_TOPIC__REQUEST',
  30. 'POST_TOPIC__SUCCESS',
  31. 'POST_TOPIC__FAILURE'
  32. )<undefined, TopicsState, { alert?: FailurePayload }>();
  33. export const updateTopicAction = createAsyncAction(
  34. 'PATCH_TOPIC__REQUEST',
  35. 'PATCH_TOPIC__SUCCESS',
  36. 'PATCH_TOPIC__FAILURE'
  37. )<undefined, TopicsState, undefined>();
  38. export const deleteTopicAction = createAsyncAction(
  39. 'DELETE_TOPIC__REQUEST',
  40. 'DELETE_TOPIC__SUCCESS',
  41. 'DELETE_TOPIC__FAILURE',
  42. 'DELETE_TOPIC__CANCEL'
  43. )<undefined, TopicName, undefined, undefined>();
  44. export const recreateTopicAction = createAsyncAction(
  45. 'RECREATE_TOPIC__REQUEST',
  46. 'RECREATE_TOPIC__SUCCESS',
  47. 'RECREATE_TOPIC__FAILURE',
  48. 'RECREATE_TOPIC__CANCEL'
  49. )<undefined, Topic, undefined, undefined>();
  50. export const dismissAlert = createAction('DISMISS_ALERT')<string>();
  51. export const setTopicsSearchAction =
  52. createAction('SET_TOPICS_SEARCH')<string>();
  53. export const setTopicsOrderByAction = createAction(
  54. 'SET_TOPICS_ORDER_BY'
  55. )<TopicColumnsToSort>();
  56. export const fetchTopicConsumerGroupsAction = createAsyncAction(
  57. 'GET_TOPIC_CONSUMER_GROUPS__REQUEST',
  58. 'GET_TOPIC_CONSUMER_GROUPS__SUCCESS',
  59. 'GET_TOPIC_CONSUMER_GROUPS__FAILURE'
  60. )<undefined, TopicsState, undefined>();
  61. export const fetchTopicMessageSchemaAction = createAsyncAction(
  62. 'GET_TOPIC_SCHEMA__REQUEST',
  63. 'GET_TOPIC_SCHEMA__SUCCESS',
  64. 'GET_TOPIC_SCHEMA__FAILURE'
  65. )<
  66. undefined,
  67. { topicName: string; schema: TopicMessageSchema },
  68. { alert?: FailurePayload }
  69. >();
  70. export const updateTopicPartitionsCountAction = createAsyncAction(
  71. 'UPDATE_PARTITIONS__REQUEST',
  72. 'UPDATE_PARTITIONS__SUCCESS',
  73. 'UPDATE_PARTITIONS__FAILURE'
  74. )<undefined, undefined, { alert?: FailurePayload }>();
  75. export const updateTopicReplicationFactorAction = createAsyncAction(
  76. 'UPDATE_REPLICATION_FACTOR__REQUEST',
  77. 'UPDATE_REPLICATION_FACTOR__SUCCESS',
  78. 'UPDATE_REPLICATION_FACTOR__FAILURE'
  79. )<undefined, undefined, { alert?: FailurePayload }>();