constants.ts 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. import { SelectOption } from 'components/common/Select/Select';
  2. import { ConfigurationParameters, ConsumerGroupState } from 'generated-sources';
  3. declare global {
  4. interface Window {
  5. basePath: string;
  6. }
  7. }
  8. export const BASE_PARAMS: ConfigurationParameters = {
  9. basePath: window.basePath || '',
  10. credentials: 'include',
  11. headers: {
  12. 'Content-Type': 'application/json',
  13. },
  14. };
  15. export const TOPIC_NAME_VALIDATION_PATTERN = /^[a-zA-Z0-9._-]+$/;
  16. export const SCHEMA_NAME_VALIDATION_PATTERN = /^[.,A-Za-z0-9_/-]+$/;
  17. export const TOPIC_CUSTOM_PARAMS_PREFIX = 'customParams';
  18. export const TOPIC_CUSTOM_PARAMS: Record<string, string> = {
  19. 'compression.type': 'producer',
  20. 'leader.replication.throttled.replicas': '',
  21. 'message.downconversion.enable': 'true',
  22. 'segment.jitter.ms': '0',
  23. 'flush.ms': '9223372036854775807',
  24. 'follower.replication.throttled.replicas': '',
  25. 'segment.bytes': '1073741824',
  26. 'flush.messages': '9223372036854775807',
  27. 'message.format.version': '2.3-IV1',
  28. 'file.delete.delay.ms': '60000',
  29. 'max.compaction.lag.ms': '9223372036854775807',
  30. 'min.compaction.lag.ms': '0',
  31. 'message.timestamp.type': 'CreateTime',
  32. preallocate: 'false',
  33. 'min.cleanable.dirty.ratio': '0.5',
  34. 'index.interval.bytes': '4096',
  35. 'unclean.leader.election.enable': 'true',
  36. 'retention.bytes': '-1',
  37. 'delete.retention.ms': '86400000',
  38. 'segment.ms': '604800000',
  39. 'message.timestamp.difference.max.ms': '9223372036854775807',
  40. 'segment.index.bytes': '10485760',
  41. };
  42. export const MILLISECONDS_IN_WEEK = 604_800_000;
  43. export const MILLISECONDS_IN_DAY = 86_400_000;
  44. export const MILLISECONDS_IN_SECOND = 1_000;
  45. export const NOT_SET = -1;
  46. export const BYTES_IN_GB = 1_073_741_824;
  47. export const BUILD_VERSION_PATTERN = /v\d.\d.\d/;
  48. export const PER_PAGE = 25;
  49. export const MESSAGES_PER_PAGE = '100';
  50. export const GIT_REPO_LINK = 'https://github.com/provectus/kafka-ui';
  51. export const GIT_REPO_LATEST_RELEASE_LINK =
  52. 'https://api.github.com/repos/provectus/kafka-ui/releases/latest';
  53. export const LOCAL_STORAGE_KEY_PREFIX = 'kafka-ui';
  54. export enum AsyncRequestStatus {
  55. initial = 'initial',
  56. pending = 'pending',
  57. fulfilled = 'fulfilled',
  58. rejected = 'rejected',
  59. }
  60. export const QUERY_REFETCH_OFF_OPTIONS = {
  61. refetchOnMount: false,
  62. refetchOnWindowFocus: false,
  63. refetchIntervalInBackground: false,
  64. };
  65. // Cluster Form Constants
  66. export const AUTH_OPTIONS: SelectOption[] = [
  67. { value: 'SASL/JAAS', label: 'SASL/JAAS' },
  68. { value: 'SASL/GSSAPI', label: 'SASL/GSSAPI' },
  69. { value: 'SASL/OAUTHBEARER', label: 'SASL/OAUTHBEARER' },
  70. { value: 'SASL/PLAIN', label: 'SASL/PLAIN' },
  71. { value: 'SASL/SCRAM-256', label: 'SASL/SCRAM-256' },
  72. { value: 'SASL/SCRAM-512', label: 'SASL/SCRAM-512' },
  73. { value: 'Delegation tokens', label: 'Delegation tokens' },
  74. { value: 'SASL/LDAP', label: 'SASL/LDAP' },
  75. { value: 'SASL/AWS IAM', label: 'SASL/AWS IAM' },
  76. { value: 'mTLS', label: 'mTLS' },
  77. ];
  78. export const SECURITY_PROTOCOL_OPTIONS: SelectOption[] = [
  79. { value: 'SASL_SSL', label: 'SASL_SSL' },
  80. { value: 'SASL_PLAINTEXT', label: 'SASL_PLAINTEXT' },
  81. ];
  82. export const METRICS_OPTIONS: SelectOption[] = [
  83. { value: 'JMX', label: 'JMX' },
  84. { value: 'PROMETHEUS', label: 'PROMETHEUS' },
  85. ];
  86. export const CONSUMER_GROUP_STATE_TOOLTIPS: Record<ConsumerGroupState, string> =
  87. {
  88. EMPTY: 'The group exists but has no members.',
  89. STABLE: 'Consumers are happily consuming and have assigned partitions.',
  90. PREPARING_REBALANCE:
  91. 'Something has changed, and the reassignment of partitions is required.',
  92. COMPLETING_REBALANCE: 'Partition reassignment is in progress.',
  93. DEAD: 'The group is going to be removed. It might be due to the inactivity, or the group is being migrated to different group coordinator.',
  94. UNKNOWN: '',
  95. } as const;