testData.ts 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. import { LoadingState, VariableType } from '@grafana/data';
  2. export const multiOptionVar = {
  3. allValue: null,
  4. current: {
  5. value: ['A'],
  6. text: ['A'],
  7. selected: true,
  8. },
  9. rootStateKey: 'key',
  10. datasource: 'gdev-testdata',
  11. definition: '*',
  12. hide: 0,
  13. includeAll: true,
  14. multi: true,
  15. name: 'datacenter',
  16. options: [
  17. {
  18. text: 'All',
  19. value: '$__all',
  20. selected: false,
  21. },
  22. {
  23. text: 'A',
  24. value: 'A',
  25. selected: true,
  26. },
  27. {
  28. text: 'B',
  29. value: 'B',
  30. selected: true,
  31. },
  32. {
  33. text: 'C',
  34. value: 'C',
  35. selected: false,
  36. },
  37. ],
  38. query: {
  39. refId: 'gdev-testdata-datacenter-Variable-Query',
  40. query: '*',
  41. },
  42. refresh: 1,
  43. regex: '',
  44. skipUrlSync: false,
  45. sort: 0,
  46. tagValuesQuery: '',
  47. tags: [],
  48. tagsQuery: '',
  49. type: 'query' as VariableType,
  50. useTags: false,
  51. id: 'datacenter',
  52. global: false,
  53. index: 0,
  54. state: LoadingState.Done,
  55. error: null,
  56. description: null,
  57. };
  58. export const multiOptionAllSelectedVar = {
  59. allValue: null,
  60. current: {
  61. value: ['$__all'],
  62. text: ['All'],
  63. selected: true,
  64. },
  65. rootStateKey: 'key',
  66. datasource: 'gdev-testdata',
  67. definition: '$datacenter.$server.*',
  68. hide: 0,
  69. includeAll: true,
  70. multi: true,
  71. name: 'pod',
  72. options: [
  73. {
  74. text: 'All',
  75. value: '$__all',
  76. selected: true,
  77. },
  78. {
  79. text: 'AAA',
  80. value: 'AAA',
  81. selected: false,
  82. },
  83. {
  84. text: 'AAB',
  85. value: 'AAB',
  86. selected: false,
  87. },
  88. {
  89. text: 'AAC',
  90. value: 'AAC',
  91. selected: false,
  92. },
  93. ],
  94. query: {
  95. refId: 'gdev-testdata-pod-Variable-Query',
  96. query: '$datacenter.$server.*',
  97. },
  98. refresh: 1,
  99. regex: '',
  100. skipUrlSync: false,
  101. sort: 0,
  102. tagValuesQuery: '',
  103. tags: [],
  104. tagsQuery: '',
  105. type: 'query' as VariableType,
  106. useTags: false,
  107. id: 'pod',
  108. global: false,
  109. index: 2,
  110. state: LoadingState.Done,
  111. error: null,
  112. description: null,
  113. };
  114. export const optionVar = {
  115. current: {
  116. text: 'gdev-postgres',
  117. value: 'gdev-postgres',
  118. selected: false,
  119. },
  120. description: null,
  121. error: null,
  122. hide: 0,
  123. includeAll: true,
  124. label: 'Datasource',
  125. multi: false,
  126. name: 'datasource',
  127. options: [
  128. {
  129. text: 'All',
  130. value: '$__all',
  131. selected: false,
  132. },
  133. {
  134. text: 'gdev-postgres',
  135. value: 'gdev-postgres',
  136. selected: true,
  137. },
  138. {
  139. text: 'gdev-postgres-ds-tests',
  140. value: 'gdev-postgres-ds-tests',
  141. selected: false,
  142. },
  143. {
  144. text: 'PostgreSQL',
  145. value: 'PostgreSQL',
  146. selected: false,
  147. },
  148. ],
  149. query: 'postgres',
  150. refresh: 1,
  151. regex: '',
  152. skipUrlSync: false,
  153. type: 'datasource' as VariableType,
  154. id: 'datasource',
  155. global: false,
  156. index: 3,
  157. state: LoadingState.Done,
  158. };
  159. export const textBoxVariable = {
  160. current: {
  161. selected: true,
  162. text: 'test',
  163. value: 'test',
  164. },
  165. rootStateKey: 'key',
  166. description: null,
  167. error: null,
  168. hide: 0,
  169. name: 'text',
  170. options: [
  171. {
  172. selected: true,
  173. text: 'test',
  174. value: 'test',
  175. },
  176. ],
  177. query: 'test',
  178. skipUrlSync: false,
  179. type: 'textbox' as VariableType,
  180. originalQuery: 'test',
  181. id: 'test',
  182. global: false,
  183. index: 1,
  184. state: LoadingState.Done,
  185. };
  186. export const adHocVariable = {
  187. datasource: 'PostgreSQL',
  188. description: null,
  189. error: null,
  190. filters: [],
  191. hide: 0,
  192. label: 'Ad hoc',
  193. name: 'adhoc',
  194. skipUrlSync: false,
  195. type: 'adhoc' as VariableType,
  196. id: 'adhoc',
  197. global: false,
  198. index: 5,
  199. state: LoadingState.Done,
  200. };
  201. export const customVariable = {
  202. allValue: null,
  203. current: {
  204. selected: true,
  205. tags: [],
  206. text: ['1', '2'],
  207. value: ['1', '2'],
  208. },
  209. rootStateKey: 'key',
  210. description: null,
  211. error: null,
  212. hide: 0,
  213. includeAll: true,
  214. multi: true,
  215. name: 'custom',
  216. options: [
  217. {
  218. selected: false,
  219. text: 'All',
  220. value: '$__all',
  221. },
  222. {
  223. selected: true,
  224. text: '1',
  225. value: '1',
  226. },
  227. {
  228. selected: true,
  229. text: '2',
  230. value: '2',
  231. },
  232. {
  233. selected: false,
  234. text: '3',
  235. value: 'three',
  236. },
  237. {
  238. selected: false,
  239. text: '4',
  240. value: 'four',
  241. },
  242. ],
  243. query: '1,2,3 : three, 4 : four',
  244. queryValue: '',
  245. skipUrlSync: false,
  246. type: 'custom' as VariableType,
  247. id: 'custom',
  248. global: false,
  249. index: 4,
  250. state: LoadingState.Done,
  251. };
  252. export const variables = [multiOptionAllSelectedVar, multiOptionVar, optionVar, textBoxVariable, customVariable];