constants.ts 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. export enum CodeEnum {
  2. success = 'Success',
  3. error = 'Error',
  4. }
  5. export type CodeStatus = {
  6. error_code: CodeEnum;
  7. reason?: string;
  8. };
  9. // error msgs
  10. export const ERR_NO_COLLECTION = 'collection name is invalid';
  11. export const ERR_NO_ADDRESS = 'no address';
  12. export const ERR_NO_PARAM = 'no valid param';
  13. export const ERR_NO_ALIAS = 'no valid alias';
  14. // mock data
  15. export const mockAddress = '127.0.0.1';
  16. export const mockCollectionNames = [{ name: 'c1' }, { name: 'c2' }];
  17. export const mockCollections = [
  18. {
  19. name: 'c1',
  20. collectionID: 1,
  21. schema: {
  22. fields: [
  23. {
  24. name: 'vector_field',
  25. data_type: 'data_type',
  26. type_params: [
  27. {
  28. key: 'dim',
  29. value: '4',
  30. },
  31. ],
  32. },
  33. {
  34. is_primary_key: true,
  35. autoID: true,
  36. name: 'age',
  37. data_type: 'data_type',
  38. type_params: [] as any[],
  39. },
  40. ],
  41. description: 'mock schema description 1',
  42. },
  43. created_utc_timestamp: '123456',
  44. },
  45. {
  46. name: 'c2',
  47. collectionID: 2,
  48. schema: {
  49. fields: [
  50. {
  51. name: 'vector_field',
  52. data_type: 'data_type',
  53. type_params: [
  54. {
  55. key: 'dim',
  56. value: '4',
  57. },
  58. ],
  59. },
  60. {
  61. name: 'age',
  62. data_type: 'data_type',
  63. type_params: [] as any[],
  64. },
  65. ],
  66. description: 'mock schema description 2',
  67. },
  68. created_utc_timestamp: '1234567',
  69. },
  70. ];
  71. export const mockLoadedCollections = [
  72. {
  73. id: 1,
  74. name: 'c1',
  75. loadedPercentage: '100',
  76. },
  77. ];
  78. // index state is finished
  79. export const mockIndexState = [
  80. { collection_name: 'c1', state: 3 },
  81. { collection_name: 'c2', state: 2 },
  82. ];
  83. // mock results
  84. export const mockGetAllCollectionsData = [
  85. {
  86. collection_name: 'c2',
  87. schema: {
  88. fields: [
  89. {
  90. name: 'vector_field',
  91. data_type: 'data_type',
  92. type_params: [
  93. {
  94. key: 'dim',
  95. value: '4',
  96. },
  97. ],
  98. },
  99. {
  100. name: 'age',
  101. data_type: 'data_type',
  102. type_params: [] as any[],
  103. },
  104. ],
  105. description: 'mock schema description 2',
  106. },
  107. description: 'mock schema description 2',
  108. autoID: undefined as boolean,
  109. rowCount: 7,
  110. id: 2,
  111. loadedPercentage: '-1',
  112. createdTime: 1234567,
  113. index_status: 2,
  114. },
  115. {
  116. collection_name: 'c1',
  117. schema: {
  118. fields: [
  119. {
  120. name: 'vector_field',
  121. data_type: 'data_type',
  122. type_params: [
  123. {
  124. key: 'dim',
  125. value: '4',
  126. },
  127. ],
  128. },
  129. {
  130. is_primary_key: true,
  131. autoID: true,
  132. name: 'age',
  133. data_type: 'data_type',
  134. type_params: [] as any[],
  135. },
  136. ],
  137. description: 'mock schema description 1',
  138. },
  139. description: 'mock schema description 1',
  140. autoID: true,
  141. rowCount: 7,
  142. id: 1,
  143. loadedPercentage: '100',
  144. createdTime: 123456,
  145. index_status: 3,
  146. },
  147. ];
  148. export const mockLoadedCollectionsData = [
  149. {
  150. collection_name: 'c1',
  151. id: 1,
  152. rowCount: 7,
  153. },
  154. ];