@perses-dev/prometheus-plugin 0.56.0 → 0.57.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (316) hide show
  1. package/__mf/js/Prometheus.3cac2d10.js +6 -0
  2. package/__mf/js/async/1233.0ab88b51.js +1 -0
  3. package/__mf/js/async/1324.ce01eced.js +1 -0
  4. package/__mf/js/async/1432.0c3e4ed0.js +1 -0
  5. package/__mf/js/async/1605.dc180cb8.js +110 -0
  6. package/__mf/js/async/1616.7587ce79.js +1 -0
  7. package/__mf/js/async/1728.46efbfb8.js +1 -0
  8. package/__mf/js/async/1969.372d36b8.js +1 -0
  9. package/__mf/js/async/2043.d0fbb886.js +2 -0
  10. package/__mf/js/async/2186.e58838a5.js +38 -0
  11. package/__mf/js/async/2506.1e336b3b.js +1 -0
  12. package/__mf/js/async/3184.6b4ad42e.js +1 -0
  13. package/__mf/js/async/3499.bef2e2e5.js +1 -0
  14. package/__mf/js/async/3652.fc1e5f95.js +7 -0
  15. package/__mf/js/async/392.7cda691a.js +2 -0
  16. package/__mf/js/async/3963.5fef6ffb.js +1 -0
  17. package/__mf/js/async/3996.69a9c1dc.js +1 -0
  18. package/__mf/js/async/{1964.1d168a86.js → 4121.828d661d.js} +2 -2
  19. package/__mf/js/async/425.1ec8867f.js +1 -0
  20. package/__mf/js/async/4626.173e602a.js +1 -0
  21. package/__mf/js/async/4657.e3d53a21.js +2 -0
  22. package/__mf/js/async/4987.c12b89cb.js +1 -0
  23. package/__mf/js/async/{8930.700a5439.js → 5002.e4f54e8e.js} +1 -1
  24. package/__mf/js/async/5071.e1c33fa7.js +1 -0
  25. package/__mf/js/async/529.2303b01b.js +1 -0
  26. package/__mf/js/async/54.f6f480ef.js +22 -0
  27. package/__mf/js/async/5440.8ced5513.js +2 -0
  28. package/__mf/js/async/{6377.c40920f2.js.LICENSE.txt → 5440.8ced5513.js.LICENSE.txt} +3 -3
  29. package/__mf/js/async/{5214.0fca84ed.js → 5587.4d72fc35.js} +1 -1
  30. package/__mf/js/async/5763.4ba478ff.js +1 -0
  31. package/__mf/js/async/5922.d1619ac1.js +1 -0
  32. package/__mf/js/async/6274.478a68f8.js +2 -0
  33. package/__mf/js/async/6283.181cb622.js +2 -0
  34. package/__mf/js/async/6969.b959b6f8.js +1 -0
  35. package/__mf/js/async/{4062.06f48b93.js → 7177.205c9aaf.js} +1 -1
  36. package/__mf/js/async/7192.d835931b.js +1 -0
  37. package/__mf/js/async/7894.9c5245d7.js +1 -0
  38. package/__mf/js/async/7968.6ac0ce96.js +1 -0
  39. package/__mf/js/async/7978.9532d5b8.js +1 -0
  40. package/__mf/js/async/8356.789e1dfb.js +1 -0
  41. package/__mf/js/async/8470.9b14a625.js +2 -0
  42. package/__mf/js/async/873.448eab23.js +1 -0
  43. package/__mf/js/async/8888.59eb50a2.js +1 -0
  44. package/__mf/js/async/9010.15208552.js +2 -0
  45. package/__mf/js/async/9020.662dc353.js +1 -0
  46. package/__mf/js/async/9184.43a8d927.js +1 -0
  47. package/__mf/js/async/9235.36c3cd8c.js +1 -0
  48. package/__mf/js/async/9351.715f25c3.js +1 -0
  49. package/__mf/js/async/941.53b13124.js +2 -0
  50. package/__mf/js/async/9518.38e38a33.js +1 -0
  51. package/__mf/js/async/9588.9081c7de.js +1 -0
  52. package/__mf/js/async/9605.a92ec9c1.js +1 -0
  53. package/__mf/js/async/9836.00da6086.js +1 -0
  54. package/__mf/js/async/__federation_expose_PrometheusDatasource.caac7bfc.js +1 -0
  55. package/__mf/js/async/__federation_expose_PrometheusExplorer.22434cd0.js +1 -0
  56. package/__mf/js/async/__federation_expose_PrometheusLabelNamesVariable.087a9360.js +1 -0
  57. package/__mf/js/async/__federation_expose_PrometheusLabelValuesVariable.f9135d9a.js +1 -0
  58. package/__mf/js/async/__federation_expose_PrometheusPromQLVariable.d3f9f4b7.js +1 -0
  59. package/__mf/js/async/__federation_expose_PrometheusTimeSeriesQuery.95a9abcc.js +1 -0
  60. package/__mf/js/main.8eeb4292.js +6 -0
  61. package/lib/bootstrap.js +2 -2
  62. package/lib/bootstrap.js.map +1 -1
  63. package/lib/cjs/bootstrap.js +1 -1
  64. package/lib/cjs/components/PromQLEditor.js +5 -8
  65. package/lib/cjs/components/TreeNode.js +1 -1
  66. package/lib/cjs/components/index.js +1 -1
  67. package/lib/cjs/components/promql/ast.js +11 -11
  68. package/lib/cjs/components/promql/format.js +4 -4
  69. package/lib/cjs/components/promql/functionSignatures.js +1 -1
  70. package/lib/cjs/components/promql/serialize.js +1 -1
  71. package/lib/cjs/components/promql/utils.js +6 -6
  72. package/lib/cjs/components/query.js +4 -4
  73. package/lib/cjs/env.d.js +1 -1
  74. package/lib/cjs/explore/PrometheusExplorer.js +11 -7
  75. package/lib/cjs/explore/PrometheusMetricsFinder/PrometheusMetricsFinder.js +5 -5
  76. package/lib/cjs/explore/PrometheusMetricsFinder/display/MetricChip.js +1 -1
  77. package/lib/cjs/explore/PrometheusMetricsFinder/display/list/MetricList.js +4 -4
  78. package/lib/cjs/explore/PrometheusMetricsFinder/filter/FilterInputs.js +5 -5
  79. package/lib/cjs/explore/PrometheusMetricsFinder/filter/FinderFilters.js +1 -1
  80. package/lib/cjs/explore/PrometheusMetricsFinder/index.js +1 -1
  81. package/lib/cjs/explore/PrometheusMetricsFinder/overview/MetricOverview.js +4 -4
  82. package/lib/cjs/explore/PrometheusMetricsFinder/overview/tabs/JobTab.js +5 -5
  83. package/lib/cjs/explore/PrometheusMetricsFinder/overview/tabs/OverviewTab.js +5 -5
  84. package/lib/cjs/explore/PrometheusMetricsFinder/overview/tabs/SimilarTab.js +1 -1
  85. package/lib/cjs/explore/PrometheusMetricsFinder/types.js +1 -1
  86. package/lib/cjs/explore/PrometheusMetricsFinder/utils.js +6 -6
  87. package/lib/cjs/explore/index.js +12 -0
  88. package/lib/cjs/getPluginModule.js +12 -0
  89. package/lib/cjs/index-federation.js +12 -12
  90. package/lib/cjs/index.js +12 -0
  91. package/lib/cjs/model/api-types.js +1 -1
  92. package/lib/cjs/model/index.js +1 -1
  93. package/lib/cjs/model/parse-sample-values.js +4 -4
  94. package/lib/cjs/model/prometheus-client.js +30 -20
  95. package/lib/cjs/model/prometheus-selectors.js +6 -6
  96. package/lib/cjs/model/time.js +5 -5
  97. package/lib/cjs/plugins/MatcherEditor.js +1 -1
  98. package/lib/cjs/plugins/PrometheusDatasourceEditor.js +176 -3
  99. package/lib/cjs/plugins/PrometheusLabelNamesVariable.js +12 -0
  100. package/lib/cjs/plugins/PrometheusLabelValuesVariable.js +12 -0
  101. package/lib/cjs/plugins/PrometheusPromQLVariable.js +12 -0
  102. package/lib/cjs/plugins/index.js +12 -0
  103. package/lib/cjs/plugins/prometheus-datasource.js +18 -10
  104. package/lib/cjs/plugins/prometheus-time-series-query/PrometheusTimeSeriesQuery.js +1 -1
  105. package/lib/cjs/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.js +37 -2
  106. package/lib/cjs/plugins/prometheus-time-series-query/get-time-series-data.js +1 -1
  107. package/lib/cjs/plugins/prometheus-time-series-query/index.js +1 -1
  108. package/lib/cjs/plugins/prometheus-time-series-query/query-editor-model.js +5 -5
  109. package/lib/cjs/plugins/prometheus-time-series-query/replace-prom-builtin-variables.js +1 -1
  110. package/lib/cjs/plugins/prometheus-time-series-query/time-series-query-model.js +1 -1
  111. package/lib/cjs/plugins/prometheus-variables.js +53 -34
  112. package/lib/cjs/plugins/test/setup-tests.js +1 -1
  113. package/lib/cjs/plugins/types.js +1 -1
  114. package/lib/cjs/plugins/variable.js +1 -1
  115. package/lib/cjs/setup-tests.js +1 -1
  116. package/lib/cjs/utils/index.js +1 -1
  117. package/lib/cjs/utils/utils.js +5 -5
  118. package/lib/components/PromQLEditor.d.ts +5 -1
  119. package/lib/components/PromQLEditor.d.ts.map +1 -1
  120. package/lib/components/PromQLEditor.js +6 -9
  121. package/lib/components/PromQLEditor.js.map +1 -1
  122. package/lib/components/TreeNode.js +2 -2
  123. package/lib/components/TreeNode.js.map +1 -1
  124. package/lib/components/index.js +1 -1
  125. package/lib/components/index.js.map +1 -1
  126. package/lib/components/promql/ast.js +1 -1
  127. package/lib/components/promql/ast.js.map +1 -1
  128. package/lib/components/promql/format.js +2 -2
  129. package/lib/components/promql/format.js.map +1 -1
  130. package/lib/components/promql/functionSignatures.js +1 -1
  131. package/lib/components/promql/functionSignatures.js.map +1 -1
  132. package/lib/components/promql/serialize.js +1 -1
  133. package/lib/components/promql/serialize.js.map +1 -1
  134. package/lib/components/promql/utils.js +1 -1
  135. package/lib/components/promql/utils.js.map +1 -1
  136. package/lib/components/query.js +1 -1
  137. package/lib/components/query.js.map +1 -1
  138. package/lib/env.d.js +1 -1
  139. package/lib/env.d.js.map +1 -1
  140. package/lib/explore/PrometheusExplorer.d.ts.map +1 -1
  141. package/lib/explore/PrometheusExplorer.js +11 -7
  142. package/lib/explore/PrometheusExplorer.js.map +1 -1
  143. package/lib/explore/PrometheusMetricsFinder/PrometheusMetricsFinder.js +2 -2
  144. package/lib/explore/PrometheusMetricsFinder/PrometheusMetricsFinder.js.map +1 -1
  145. package/lib/explore/PrometheusMetricsFinder/display/MetricChip.js +2 -2
  146. package/lib/explore/PrometheusMetricsFinder/display/MetricChip.js.map +1 -1
  147. package/lib/explore/PrometheusMetricsFinder/display/list/MetricList.js +2 -2
  148. package/lib/explore/PrometheusMetricsFinder/display/list/MetricList.js.map +1 -1
  149. package/lib/explore/PrometheusMetricsFinder/filter/FilterInputs.js +2 -2
  150. package/lib/explore/PrometheusMetricsFinder/filter/FilterInputs.js.map +1 -1
  151. package/lib/explore/PrometheusMetricsFinder/filter/FinderFilters.js +2 -2
  152. package/lib/explore/PrometheusMetricsFinder/filter/FinderFilters.js.map +1 -1
  153. package/lib/explore/PrometheusMetricsFinder/index.js +1 -1
  154. package/lib/explore/PrometheusMetricsFinder/index.js.map +1 -1
  155. package/lib/explore/PrometheusMetricsFinder/overview/MetricOverview.js +2 -2
  156. package/lib/explore/PrometheusMetricsFinder/overview/MetricOverview.js.map +1 -1
  157. package/lib/explore/PrometheusMetricsFinder/overview/tabs/JobTab.js +1 -1
  158. package/lib/explore/PrometheusMetricsFinder/overview/tabs/JobTab.js.map +1 -1
  159. package/lib/explore/PrometheusMetricsFinder/overview/tabs/OverviewTab.js +1 -1
  160. package/lib/explore/PrometheusMetricsFinder/overview/tabs/OverviewTab.js.map +1 -1
  161. package/lib/explore/PrometheusMetricsFinder/overview/tabs/SimilarTab.js +1 -1
  162. package/lib/explore/PrometheusMetricsFinder/overview/tabs/SimilarTab.js.map +1 -1
  163. package/lib/explore/PrometheusMetricsFinder/types.js +1 -1
  164. package/lib/explore/PrometheusMetricsFinder/types.js.map +1 -1
  165. package/lib/explore/PrometheusMetricsFinder/utils.js +1 -1
  166. package/lib/explore/PrometheusMetricsFinder/utils.js.map +1 -1
  167. package/lib/explore/index.d.ts.map +1 -1
  168. package/lib/explore/index.js +12 -0
  169. package/lib/explore/index.js.map +1 -1
  170. package/lib/getPluginModule.d.ts.map +1 -1
  171. package/lib/getPluginModule.js +12 -0
  172. package/lib/getPluginModule.js.map +1 -1
  173. package/lib/index-federation.js +1 -1
  174. package/lib/index-federation.js.map +1 -1
  175. package/lib/index.d.ts.map +1 -1
  176. package/lib/index.js +12 -0
  177. package/lib/index.js.map +1 -1
  178. package/lib/model/api-types.js +1 -1
  179. package/lib/model/api-types.js.map +1 -1
  180. package/lib/model/index.js +1 -1
  181. package/lib/model/index.js.map +1 -1
  182. package/lib/model/parse-sample-values.js +1 -1
  183. package/lib/model/parse-sample-values.js.map +1 -1
  184. package/lib/model/prometheus-client.d.ts +1 -0
  185. package/lib/model/prometheus-client.d.ts.map +1 -1
  186. package/lib/model/prometheus-client.js +20 -10
  187. package/lib/model/prometheus-client.js.map +1 -1
  188. package/lib/model/prometheus-selectors.js +1 -1
  189. package/lib/model/prometheus-selectors.js.map +1 -1
  190. package/lib/model/time.js +1 -1
  191. package/lib/model/time.js.map +1 -1
  192. package/lib/plugins/MatcherEditor.js +2 -2
  193. package/lib/plugins/MatcherEditor.js.map +1 -1
  194. package/lib/plugins/PrometheusDatasourceEditor.d.ts.map +1 -1
  195. package/lib/plugins/PrometheusDatasourceEditor.js +136 -4
  196. package/lib/plugins/PrometheusDatasourceEditor.js.map +1 -1
  197. package/lib/plugins/PrometheusLabelNamesVariable.d.ts.map +1 -1
  198. package/lib/plugins/PrometheusLabelNamesVariable.js +12 -0
  199. package/lib/plugins/PrometheusLabelNamesVariable.js.map +1 -1
  200. package/lib/plugins/PrometheusLabelValuesVariable.d.ts.map +1 -1
  201. package/lib/plugins/PrometheusLabelValuesVariable.js +12 -0
  202. package/lib/plugins/PrometheusLabelValuesVariable.js.map +1 -1
  203. package/lib/plugins/PrometheusPromQLVariable.d.ts.map +1 -1
  204. package/lib/plugins/PrometheusPromQLVariable.js +12 -0
  205. package/lib/plugins/PrometheusPromQLVariable.js.map +1 -1
  206. package/lib/plugins/index.d.ts.map +1 -1
  207. package/lib/plugins/index.js +12 -0
  208. package/lib/plugins/index.js.map +1 -1
  209. package/lib/plugins/prometheus-datasource.js +18 -10
  210. package/lib/plugins/prometheus-datasource.js.map +1 -1
  211. package/lib/plugins/prometheus-time-series-query/PrometheusTimeSeriesQuery.js +1 -1
  212. package/lib/plugins/prometheus-time-series-query/PrometheusTimeSeriesQuery.js.map +1 -1
  213. package/lib/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.d.ts.map +1 -1
  214. package/lib/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.js +40 -5
  215. package/lib/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.js.map +1 -1
  216. package/lib/plugins/prometheus-time-series-query/get-time-series-data.d.ts.map +1 -1
  217. package/lib/plugins/prometheus-time-series-query/get-time-series-data.js +1 -1
  218. package/lib/plugins/prometheus-time-series-query/get-time-series-data.js.map +1 -1
  219. package/lib/plugins/prometheus-time-series-query/index.js +1 -1
  220. package/lib/plugins/prometheus-time-series-query/index.js.map +1 -1
  221. package/lib/plugins/prometheus-time-series-query/query-editor-model.js +1 -1
  222. package/lib/plugins/prometheus-time-series-query/query-editor-model.js.map +1 -1
  223. package/lib/plugins/prometheus-time-series-query/replace-prom-builtin-variables.js +1 -1
  224. package/lib/plugins/prometheus-time-series-query/replace-prom-builtin-variables.js.map +1 -1
  225. package/lib/plugins/prometheus-time-series-query/time-series-query-model.js +1 -1
  226. package/lib/plugins/prometheus-time-series-query/time-series-query-model.js.map +1 -1
  227. package/lib/plugins/prometheus-variables.d.ts.map +1 -1
  228. package/lib/plugins/prometheus-variables.js +48 -29
  229. package/lib/plugins/prometheus-variables.js.map +1 -1
  230. package/lib/plugins/test/setup-tests.js +1 -1
  231. package/lib/plugins/test/setup-tests.js.map +1 -1
  232. package/lib/plugins/types.d.ts +1 -0
  233. package/lib/plugins/types.d.ts.map +1 -1
  234. package/lib/plugins/types.js +1 -1
  235. package/lib/plugins/types.js.map +1 -1
  236. package/lib/plugins/variable.js +1 -1
  237. package/lib/plugins/variable.js.map +1 -1
  238. package/lib/setup-tests.js +1 -1
  239. package/lib/setup-tests.js.map +1 -1
  240. package/lib/utils/index.js +1 -1
  241. package/lib/utils/index.js.map +1 -1
  242. package/lib/utils/utils.js +1 -1
  243. package/lib/utils/utils.js.map +1 -1
  244. package/mf-manifest.json +270 -255
  245. package/mf-stats.json +276 -259
  246. package/package.json +7 -7
  247. package/__mf/js/Prometheus.4d0d5812.js +0 -5
  248. package/__mf/js/async/1339.194207db.js +0 -1
  249. package/__mf/js/async/1441.c735f7dd.js +0 -1
  250. package/__mf/js/async/1576.8eac7ce9.js +0 -1
  251. package/__mf/js/async/212.5fcca998.js +0 -1
  252. package/__mf/js/async/2292.57d8fd0d.js +0 -2
  253. package/__mf/js/async/3224.b63f87bf.js +0 -1
  254. package/__mf/js/async/3507.f1653337.js +0 -101
  255. package/__mf/js/async/3749.3ecd9372.js +0 -1
  256. package/__mf/js/async/3863.7192dfdf.js +0 -2
  257. package/__mf/js/async/3960.3eedafbd.js +0 -2
  258. package/__mf/js/async/3980.0b0d272c.js +0 -2
  259. package/__mf/js/async/4075.dab1b7b8.js +0 -1
  260. package/__mf/js/async/4238.c48b1950.js +0 -1
  261. package/__mf/js/async/4421.1fcb466e.js +0 -1
  262. package/__mf/js/async/4535.f24704ea.js +0 -1
  263. package/__mf/js/async/4557.f3eb9456.js +0 -2
  264. package/__mf/js/async/4576.f42daf99.js +0 -1
  265. package/__mf/js/async/4665.cad36935.js +0 -1
  266. package/__mf/js/async/4676.b7a22f90.js +0 -22
  267. package/__mf/js/async/5257.ce463cb7.js +0 -1
  268. package/__mf/js/async/5409.955ffd51.js +0 -1
  269. package/__mf/js/async/5614.cce8ba96.js +0 -1
  270. package/__mf/js/async/5724.794828e3.js +0 -1
  271. package/__mf/js/async/5774.a3fae698.js +0 -1
  272. package/__mf/js/async/5790.a9b31ca8.js +0 -1
  273. package/__mf/js/async/58.1c9a8daa.js +0 -2
  274. package/__mf/js/async/5981.eb502d27.js +0 -2
  275. package/__mf/js/async/6292.2afe0c6d.js +0 -1
  276. package/__mf/js/async/6341.20eccf91.js +0 -7
  277. package/__mf/js/async/6377.c40920f2.js +0 -2
  278. package/__mf/js/async/6770.7099bb3b.js +0 -1
  279. package/__mf/js/async/684.4495f632.js +0 -1
  280. package/__mf/js/async/694.8462a746.js +0 -1
  281. package/__mf/js/async/7272.6fa2f127.js +0 -1
  282. package/__mf/js/async/7376.2e948f2b.js +0 -1
  283. package/__mf/js/async/738.a1ffff79.js +0 -1
  284. package/__mf/js/async/7740.a8777825.js +0 -1
  285. package/__mf/js/async/8045.7f554a45.js +0 -10
  286. package/__mf/js/async/8164.bb3d3363.js +0 -1
  287. package/__mf/js/async/8216.e689c178.js +0 -1
  288. package/__mf/js/async/8488.cbbe542b.js +0 -1
  289. package/__mf/js/async/8587.40df6f5c.js +0 -1
  290. package/__mf/js/async/8706.89677575.js +0 -1
  291. package/__mf/js/async/9010.bdb2ef97.js +0 -1
  292. package/__mf/js/async/9173.915b80af.js +0 -2
  293. package/__mf/js/async/9550.642ce5ad.js +0 -38
  294. package/__mf/js/async/9817.70eae424.js +0 -1
  295. package/__mf/js/async/__federation_expose_PrometheusDatasource.45ee94e2.js +0 -1
  296. package/__mf/js/async/__federation_expose_PrometheusExplorer.b8e555e1.js +0 -1
  297. package/__mf/js/async/__federation_expose_PrometheusLabelNamesVariable.00dfb1dd.js +0 -1
  298. package/__mf/js/async/__federation_expose_PrometheusLabelValuesVariable.956ef2d0.js +0 -1
  299. package/__mf/js/async/__federation_expose_PrometheusPromQLVariable.59f2d170.js +0 -1
  300. package/__mf/js/async/__federation_expose_PrometheusTimeSeriesQuery.d7143352.js +0 -1
  301. package/__mf/js/main.afc2ee60.js +0 -5
  302. /package/__mf/css/async/{1339.d3010b86.css → 1233.d3010b86.css} +0 -0
  303. /package/__mf/css/async/{1576.d3010b86.css → 1324.d3010b86.css} +0 -0
  304. /package/__mf/css/async/{4576.d3010b86.css → 9518.d3010b86.css} +0 -0
  305. /package/__mf/js/async/{8045.7f554a45.js.LICENSE.txt → 1605.dc180cb8.js.LICENSE.txt} +0 -0
  306. /package/__mf/js/async/{2292.57d8fd0d.js.LICENSE.txt → 2043.d0fbb886.js.LICENSE.txt} +0 -0
  307. /package/__mf/js/async/{6341.20eccf91.js.LICENSE.txt → 3652.fc1e5f95.js.LICENSE.txt} +0 -0
  308. /package/__mf/js/async/{5981.eb502d27.js.LICENSE.txt → 392.7cda691a.js.LICENSE.txt} +0 -0
  309. /package/__mf/js/async/{1964.1d168a86.js.LICENSE.txt → 4121.828d661d.js.LICENSE.txt} +0 -0
  310. /package/__mf/js/async/{58.1c9a8daa.js.LICENSE.txt → 4657.e3d53a21.js.LICENSE.txt} +0 -0
  311. /package/__mf/js/async/{4676.b7a22f90.js.LICENSE.txt → 54.f6f480ef.js.LICENSE.txt} +0 -0
  312. /package/__mf/js/async/{3960.3eedafbd.js.LICENSE.txt → 6274.478a68f8.js.LICENSE.txt} +0 -0
  313. /package/__mf/js/async/{3980.0b0d272c.js.LICENSE.txt → 6283.181cb622.js.LICENSE.txt} +0 -0
  314. /package/__mf/js/async/{9173.915b80af.js.LICENSE.txt → 8470.9b14a625.js.LICENSE.txt} +0 -0
  315. /package/__mf/js/async/{4557.f3eb9456.js.LICENSE.txt → 9010.15208552.js.LICENSE.txt} +0 -0
  316. /package/__mf/js/async/{3863.7192dfdf.js.LICENSE.txt → 941.53b13124.js.LICENSE.txt} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/plugins/prometheus-time-series-query/replace-prom-builtin-variables.ts"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { replaceVariable } from '@perses-dev/plugin-system';\nimport { formatDuration, msToPrometheusDuration } from '@perses-dev/core';\n\n/*\n * Replace variable placeholders in a PromQL query\n\n * @param query The base promQL expression that contains variable placeholders\n * @param minStepMs the lower bound of the interval between data points, in milliseconds\n * @param intervalMs the actual interval between data points, in milliseconds\n * \n * @returns a PromQL expression with variable placeholders replaced by their values\n */\nexport function replacePromBuiltinVariables(query: string, minStepMs: number, intervalMs: number): string {\n let updatedQuery = replaceVariable(query, '__interval_ms', intervalMs.toString());\n updatedQuery = replaceVariable(updatedQuery, '__interval', formatDuration(msToPrometheusDuration(intervalMs)));\n\n // The $__rate_interval variable is meant to be used with the rate() promQL function.\n // It is defined as max($__interval + Min step, 4 * Min step)\n const rateIntervalMs = Math.max(intervalMs + minStepMs, 4 * minStepMs);\n updatedQuery = replaceVariable(\n updatedQuery,\n '__rate_interval',\n formatDuration(msToPrometheusDuration(rateIntervalMs))\n );\n\n return updatedQuery;\n}\n"],"names":["replaceVariable","formatDuration","msToPrometheusDuration","replacePromBuiltinVariables","query","minStepMs","intervalMs","updatedQuery","toString","rateIntervalMs","Math","max"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,eAAe,QAAQ,4BAA4B;AAC5D,SAASC,cAAc,EAAEC,sBAAsB,QAAQ,mBAAmB;AAE1E;;;;;;;;CAQC,GACD,OAAO,SAASC,4BAA4BC,KAAa,EAAEC,SAAiB,EAAEC,UAAkB;IAC9F,IAAIC,eAAeP,gBAAgBI,OAAO,iBAAiBE,WAAWE,QAAQ;IAC9ED,eAAeP,gBAAgBO,cAAc,cAAcN,eAAeC,uBAAuBI;IAEjG,qFAAqF;IACrF,6DAA6D;IAC7D,MAAMG,iBAAiBC,KAAKC,GAAG,CAACL,aAAaD,WAAW,IAAIA;IAC5DE,eAAeP,gBACbO,cACA,mBACAN,eAAeC,uBAAuBO;IAGxC,OAAOF;AACT"}
1
+ {"version":3,"sources":["../../../../src/plugins/prometheus-time-series-query/replace-prom-builtin-variables.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { replaceVariable } from '@perses-dev/plugin-system';\nimport { formatDuration, msToPrometheusDuration } from '@perses-dev/core';\n\n/*\n * Replace variable placeholders in a PromQL query\n\n * @param query The base promQL expression that contains variable placeholders\n * @param minStepMs the lower bound of the interval between data points, in milliseconds\n * @param intervalMs the actual interval between data points, in milliseconds\n * \n * @returns a PromQL expression with variable placeholders replaced by their values\n */\nexport function replacePromBuiltinVariables(query: string, minStepMs: number, intervalMs: number): string {\n let updatedQuery = replaceVariable(query, '__interval_ms', intervalMs.toString());\n updatedQuery = replaceVariable(updatedQuery, '__interval', formatDuration(msToPrometheusDuration(intervalMs)));\n\n // The $__rate_interval variable is meant to be used with the rate() promQL function.\n // It is defined as max($__interval + Min step, 4 * Min step)\n const rateIntervalMs = Math.max(intervalMs + minStepMs, 4 * minStepMs);\n updatedQuery = replaceVariable(\n updatedQuery,\n '__rate_interval',\n formatDuration(msToPrometheusDuration(rateIntervalMs))\n );\n\n return updatedQuery;\n}\n"],"names":["replaceVariable","formatDuration","msToPrometheusDuration","replacePromBuiltinVariables","query","minStepMs","intervalMs","updatedQuery","toString","rateIntervalMs","Math","max"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,eAAe,QAAQ,4BAA4B;AAC5D,SAASC,cAAc,EAAEC,sBAAsB,QAAQ,mBAAmB;AAE1E;;;;;;;;CAQC,GACD,OAAO,SAASC,4BAA4BC,KAAa,EAAEC,SAAiB,EAAEC,UAAkB;IAC9F,IAAIC,eAAeP,gBAAgBI,OAAO,iBAAiBE,WAAWE,QAAQ;IAC9ED,eAAeP,gBAAgBO,cAAc,cAAcN,eAAeC,uBAAuBI;IAEjG,qFAAqF;IACrF,6DAA6D;IAC7D,MAAMG,iBAAiBC,KAAKC,GAAG,CAACL,aAAaD,WAAW,IAAIA;IAC5DE,eAAeP,gBACbO,cACA,mBACAN,eAAeC,uBAAuBO;IAGxC,OAAOF;AACT"}
@@ -1,4 +1,4 @@
1
- // Copyright 2023 The Perses Authors
1
+ // Copyright The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/plugins/prometheus-time-series-query/time-series-query-model.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { DurationString } from '@perses-dev/core';\nimport { DatasourceSelectValue } from '@perses-dev/plugin-system';\nimport { PrometheusDatasourceSelector } from '../../model';\n\n/**\n * The spec/options for the PrometheusTimeSeriesQuery plugin.\n */\nexport interface PrometheusTimeSeriesQuerySpec {\n query: string;\n seriesNameFormat?: string;\n minStep?: DurationString;\n resolution?: number;\n datasource?: DatasourceSelectValue<PrometheusDatasourceSelector>;\n}\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAMjC;;CAEC,GACD,WAMC"}
1
+ {"version":3,"sources":["../../../../src/plugins/prometheus-time-series-query/time-series-query-model.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { DurationString } from '@perses-dev/core';\nimport { DatasourceSelectValue } from '@perses-dev/plugin-system';\nimport { PrometheusDatasourceSelector } from '../../model';\n\n/**\n * The spec/options for the PrometheusTimeSeriesQuery plugin.\n */\nexport interface PrometheusTimeSeriesQuerySpec {\n query: string;\n seriesNameFormat?: string;\n minStep?: DurationString;\n resolution?: number;\n datasource?: DatasourceSelectValue<PrometheusDatasourceSelector>;\n}\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAMjC;;CAEC,GACD,WAMC"}
@@ -1 +1 @@
1
- {"version":3,"file":"prometheus-variables.d.ts","sourceRoot":"","sources":["../../../src/plugins/prometheus-variables.tsx"],"names":[],"mappings":"AAaA,OAAO,EAIL,kBAAkB,EAGlB,cAAc,EACf,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,YAAY,EAAyB,MAAM,OAAO,CAAC;AAE5D,OAAO,EAIL,UAAU,EAIV,UAAU,EACX,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,mCAAmC,EACnC,oCAAoC,EACpC,+BAA+B,EAChC,MAAM,SAAS,CAAC;AAEjB,wBAAgB,mCAAmC,CACjD,KAAK,EAAE,kBAAkB,CAAC,oCAAoC,CAAC,GAC9D,YAAY,CA0Dd;AAED,wBAAgB,kCAAkC,CAChD,KAAK,EAAE,kBAAkB,CAAC,mCAAmC,CAAC,GAC7D,YAAY,CA6Cd;AAED,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,kBAAkB,CAAC,+BAA+B,CAAC,GACzD,YAAY,CA0Ed;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAS/E;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAS/E;AAED;;GAEG;AACH,eAAO,MAAM,4BAA4B,GAAI,SAAS,MAAM,EAAE,KAAG,cAAc,EAM9E,CAAC"}
1
+ {"version":3,"file":"prometheus-variables.d.ts","sourceRoot":"","sources":["../../../src/plugins/prometheus-variables.tsx"],"names":[],"mappings":"AAaA,OAAO,EAIL,kBAAkB,EAGlB,cAAc,EACf,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,YAAY,EAAwC,MAAM,OAAO,CAAC;AAE3E,OAAO,EAIL,UAAU,EAIV,UAAU,EACX,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,mCAAmC,EACnC,oCAAoC,EACpC,+BAA+B,EAChC,MAAM,SAAS,CAAC;AAEjB,wBAAgB,mCAAmC,CACjD,KAAK,EAAE,kBAAkB,CAAC,oCAAoC,CAAC,GAC9D,YAAY,CA6Ed;AAED,wBAAgB,kCAAkC,CAChD,KAAK,EAAE,kBAAkB,CAAC,mCAAmC,CAAC,GAC7D,YAAY,CAuDd;AAED,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,kBAAkB,CAAC,+BAA+B,CAAC,GACzD,YAAY,CAsFd;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAS/E;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAS/E;AAED;;GAEG;AACH,eAAO,MAAM,4BAA4B,GAAI,SAAS,MAAM,EAAE,KAAG,cAAc,EAM9E,CAAC"}
@@ -1,4 +1,5 @@
1
- // Copyright 2024 The Perses Authors
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ // Copyright The Perses Authors
2
3
  // Licensed under the Apache License, Version 2.0 (the "License");
3
4
  // you may not use this file except in compliance with the License.
4
5
  // You may obtain a copy of the License at
@@ -10,19 +11,16 @@
10
11
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
12
  // See the License for the specific language governing permissions and
12
13
  // limitations under the License.
13
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
14
  import { FormControl, Stack, TextField } from '@mui/material';
15
15
  import { DatasourceSelect, isVariableDatasource, useDatasourceClient, useDatasourceSelectValueToSelector } from '@perses-dev/plugin-system';
16
16
  import { produce } from 'immer';
17
- import { useCallback, useState } from 'react';
17
+ import { useCallback } from 'react';
18
18
  import { PromQLEditor } from '../components';
19
19
  import { DEFAULT_PROM, isDefaultPromSelector, isPrometheusDatasourceSelector, PROM_DATASOURCE_KIND } from '../model';
20
20
  import { MatcherEditor } from './MatcherEditor';
21
21
  export function PrometheusLabelValuesVariableEditor(props) {
22
22
  const { onChange, value, value: { datasource } } = props;
23
23
  const selectedDatasource = datasource ?? DEFAULT_PROM;
24
- const [labelValue, setLabelValue] = useState(props.value.labelName);
25
- const [matchersValues, setMatchersValues] = useState(props.value.matchers ?? []);
26
24
  const handleDatasourceChange = useCallback((next)=>{
27
25
  if (isVariableDatasource(next) || isPrometheusDatasourceSelector(next)) {
28
26
  onChange(produce(value, (draft)=>{
@@ -37,11 +35,21 @@ export function PrometheusLabelValuesVariableEditor(props) {
37
35
  value
38
36
  ]);
39
37
  const handleLabelChange = useCallback((e)=>{
40
- setLabelValue(e.target.value);
41
- }, []);
42
- const handleMatchEditorsChange = useCallback((e)=>{
43
- setMatchersValues(e);
44
- }, []);
38
+ onChange(produce(value, (draft)=>{
39
+ draft.labelName = e.target.value;
40
+ }));
41
+ }, [
42
+ onChange,
43
+ value
44
+ ]);
45
+ const handleMatchEditorsChange = useCallback((matchers)=>{
46
+ onChange(produce(value, (draft)=>{
47
+ draft.matchers = matchers;
48
+ }));
49
+ }, [
50
+ onChange,
51
+ value
52
+ ]);
45
53
  return /*#__PURE__*/ _jsxs(Stack, {
46
54
  spacing: 2,
47
55
  children: [
@@ -59,14 +67,16 @@ export function PrometheusLabelValuesVariableEditor(props) {
59
67
  /*#__PURE__*/ _jsx(TextField, {
60
68
  label: "Label Name",
61
69
  required: true,
62
- value: labelValue,
70
+ value: props.value.labelName,
63
71
  onChange: handleLabelChange,
64
- InputProps: {
65
- readOnly: props.isReadonly
72
+ slotProps: {
73
+ input: {
74
+ readOnly: props.isReadonly
75
+ }
66
76
  }
67
77
  }),
68
78
  /*#__PURE__*/ _jsx(MatcherEditor, {
69
- matchers: matchersValues,
79
+ matchers: props.value.matchers ?? [],
70
80
  onChange: handleMatchEditorsChange,
71
81
  isReadonly: props.isReadonly
72
82
  })
@@ -76,7 +86,6 @@ export function PrometheusLabelValuesVariableEditor(props) {
76
86
  export function PrometheusLabelNamesVariableEditor(props) {
77
87
  const { onChange, value, value: { datasource } } = props;
78
88
  const selectedDatasource = datasource ?? DEFAULT_PROM;
79
- const [matchersValues, setMatchersValues] = useState(props.value.matchers ?? []);
80
89
  const handleDatasourceChange = useCallback((next)=>{
81
90
  if (isVariableDatasource(next) || isPrometheusDatasourceSelector(next)) {
82
91
  onChange(produce(value, (draft)=>{
@@ -90,9 +99,14 @@ export function PrometheusLabelNamesVariableEditor(props) {
90
99
  onChange,
91
100
  value
92
101
  ]);
93
- const handleMatchEditorChange = useCallback((e)=>{
94
- setMatchersValues(e);
95
- }, []);
102
+ const handleMatchEditorChange = useCallback((matchers)=>{
103
+ onChange(produce(value, (draft)=>{
104
+ draft.matchers = matchers;
105
+ }));
106
+ }, [
107
+ onChange,
108
+ value
109
+ ]);
96
110
  return /*#__PURE__*/ _jsxs(Stack, {
97
111
  spacing: 2,
98
112
  children: [
@@ -108,7 +122,7 @@ export function PrometheusLabelNamesVariableEditor(props) {
108
122
  })
109
123
  }),
110
124
  /*#__PURE__*/ _jsx(MatcherEditor, {
111
- matchers: matchersValues,
125
+ matchers: props.value.matchers ?? [],
112
126
  isReadonly: props.isReadonly,
113
127
  onChange: handleMatchEditorChange
114
128
  })
@@ -121,7 +135,6 @@ export function PrometheusPromQLVariableEditor(props) {
121
135
  const selectedDatasource = useDatasourceSelectValueToSelector(datasourceSelectValue, PROM_DATASOURCE_KIND);
122
136
  const { data: client } = useDatasourceClient(selectedDatasource);
123
137
  const promURL = client?.options.datasourceUrl;
124
- const [labelValue, setLabelValue] = useState(props.value.labelName);
125
138
  const handleDatasourceChange = useCallback((next)=>{
126
139
  if (isVariableDatasource(next) || isPrometheusDatasourceSelector(next)) {
127
140
  onChange(produce(value, (draft)=>{
@@ -136,17 +149,21 @@ export function PrometheusPromQLVariableEditor(props) {
136
149
  onChange
137
150
  ]);
138
151
  const handleOnBlurPromQlChange = useCallback((e)=>{
139
- onChange({
140
- ...value,
141
- expr: e.target.textContent ?? ''
142
- });
152
+ onChange(produce(value, (draft)=>{
153
+ draft.expr = e.target.textContent ?? '';
154
+ }));
143
155
  }, [
144
156
  onChange,
145
157
  value
146
158
  ]);
147
159
  const handleLabelNameChange = useCallback((e)=>{
148
- setLabelValue(e.target.value);
149
- }, []);
160
+ onChange(produce(value, (draft)=>{
161
+ draft.labelName = e.target.value;
162
+ }));
163
+ }, [
164
+ onChange,
165
+ value
166
+ ]);
150
167
  return /*#__PURE__*/ _jsxs(Stack, {
151
168
  spacing: 2,
152
169
  children: [
@@ -176,9 +193,11 @@ export function PrometheusPromQLVariableEditor(props) {
176
193
  /*#__PURE__*/ _jsx(TextField, {
177
194
  label: "Label Name",
178
195
  required: true,
179
- value: labelValue,
180
- InputProps: {
181
- readOnly: props.isReadonly
196
+ value: props.value.labelName,
197
+ slotProps: {
198
+ input: {
199
+ readOnly: props.isReadonly
200
+ }
182
201
  },
183
202
  onChange: handleLabelNameChange
184
203
  })
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/plugins/prometheus-variables.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport { FormControl, Stack, TextField } from '@mui/material';\nimport {\n DatasourceSelect,\n DatasourceSelectProps,\n isVariableDatasource,\n OptionsEditorProps,\n useDatasourceClient,\n useDatasourceSelectValueToSelector,\n VariableOption,\n} from '@perses-dev/plugin-system';\nimport { produce } from 'immer';\nimport { ReactElement, useCallback, useState } from 'react';\nimport { PromQLEditor } from '../components';\nimport {\n DEFAULT_PROM,\n isDefaultPromSelector,\n isPrometheusDatasourceSelector,\n MatrixData,\n PROM_DATASOURCE_KIND,\n PrometheusClient,\n PrometheusDatasourceSelector,\n VectorData,\n} from '../model';\nimport { MatcherEditor } from './MatcherEditor';\nimport {\n PrometheusLabelNamesVariableOptions,\n PrometheusLabelValuesVariableOptions,\n PrometheusPromQLVariableOptions,\n} from './types';\n\nexport function PrometheusLabelValuesVariableEditor(\n props: OptionsEditorProps<PrometheusLabelValuesVariableOptions>\n): ReactElement {\n const {\n onChange,\n value,\n value: { datasource },\n } = props;\n const selectedDatasource = datasource ?? DEFAULT_PROM;\n const [labelValue, setLabelValue] = useState(props.value.labelName);\n const [matchersValues, setMatchersValues] = useState(props.value.matchers ?? []);\n const handleDatasourceChange: DatasourceSelectProps['onChange'] = useCallback(\n (next) => {\n if (isVariableDatasource(next) || isPrometheusDatasourceSelector(next)) {\n onChange(\n produce(value, (draft) => {\n // If they're using the default, just omit the datasource prop (i.e. set to undefined)\n draft.datasource = !isVariableDatasource(next) && isDefaultPromSelector(next) ? undefined : next;\n })\n );\n return;\n }\n\n throw new Error('Got unexpected non-Prometheus datasource selector');\n },\n [onChange, value]\n );\n\n const handleLabelChange = useCallback((e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {\n setLabelValue(e.target.value);\n }, []);\n\n const handleMatchEditorsChange = useCallback((e: string[]) => {\n setMatchersValues(e);\n }, []);\n\n return (\n <Stack spacing={2}>\n <FormControl margin=\"dense\">\n <DatasourceSelect\n datasourcePluginKind=\"PrometheusDatasource\"\n value={selectedDatasource}\n onChange={handleDatasourceChange}\n readOnly={props.isReadonly}\n labelId=\"prom-datasource-label\"\n label=\"Prometheus Datasource\"\n />\n </FormControl>\n <TextField\n label=\"Label Name\"\n required\n value={labelValue}\n onChange={handleLabelChange}\n InputProps={{\n readOnly: props.isReadonly,\n }}\n />\n <MatcherEditor matchers={matchersValues} onChange={handleMatchEditorsChange} isReadonly={props.isReadonly} />\n </Stack>\n );\n}\n\nexport function PrometheusLabelNamesVariableEditor(\n props: OptionsEditorProps<PrometheusLabelNamesVariableOptions>\n): ReactElement {\n const {\n onChange,\n value,\n value: { datasource },\n } = props;\n\n const selectedDatasource = datasource ?? DEFAULT_PROM;\n const [matchersValues, setMatchersValues] = useState(props.value.matchers ?? []);\n const handleDatasourceChange: DatasourceSelectProps['onChange'] = useCallback(\n (next) => {\n if (isVariableDatasource(next) || isPrometheusDatasourceSelector(next)) {\n onChange(\n produce(value, (draft) => {\n // If they're using the default, just omit the datasource prop (i.e. set to undefined)\n draft.datasource = !isVariableDatasource(next) && isDefaultPromSelector(next) ? undefined : next;\n })\n );\n return;\n }\n\n throw new Error('Got unexpected non-Prometheus datasource selector');\n },\n [onChange, value]\n );\n\n const handleMatchEditorChange = useCallback((e: string[]) => {\n setMatchersValues(e);\n }, []);\n\n return (\n <Stack spacing={2}>\n <FormControl margin=\"dense\">\n <DatasourceSelect\n datasourcePluginKind=\"PrometheusDatasource\"\n value={selectedDatasource}\n onChange={handleDatasourceChange}\n disabled={props.isReadonly}\n labelId=\"prom-datasource-label\"\n label=\"Prometheus Datasource\"\n />\n </FormControl>\n <MatcherEditor matchers={matchersValues} isReadonly={props.isReadonly} onChange={handleMatchEditorChange} />\n </Stack>\n );\n}\n\nexport function PrometheusPromQLVariableEditor(\n props: OptionsEditorProps<PrometheusPromQLVariableOptions>\n): ReactElement {\n const {\n onChange,\n value,\n value: { datasource },\n } = props;\n const datasourceSelectValue = datasource ?? DEFAULT_PROM;\n const selectedDatasource = useDatasourceSelectValueToSelector(\n datasourceSelectValue,\n PROM_DATASOURCE_KIND\n ) as PrometheusDatasourceSelector;\n\n const { data: client } = useDatasourceClient<PrometheusClient>(selectedDatasource);\n const promURL = client?.options.datasourceUrl;\n const [labelValue, setLabelValue] = useState(props.value.labelName);\n const handleDatasourceChange: DatasourceSelectProps['onChange'] = useCallback(\n (next) => {\n if (isVariableDatasource(next) || isPrometheusDatasourceSelector(next)) {\n onChange(\n produce(value, (draft) => {\n // If they're using the default, just omit the datasource prop (i.e. set to undefined)\n draft.datasource = !isVariableDatasource(next) && isDefaultPromSelector(next) ? undefined : next;\n })\n );\n return;\n }\n\n throw new Error('Got unexpected non-Prometheus datasource selector');\n },\n [value, onChange]\n );\n\n const handleOnBlurPromQlChange = useCallback(\n (e: React.FocusEvent<HTMLDivElement, Element>) => {\n onChange({ ...value, expr: e.target.textContent ?? '' });\n },\n [onChange, value]\n );\n\n const handleLabelNameChange = useCallback((e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {\n setLabelValue(e.target.value);\n }, []);\n\n return (\n <Stack spacing={2}>\n <FormControl margin=\"dense\">\n <DatasourceSelect\n datasourcePluginKind={PROM_DATASOURCE_KIND}\n value={datasourceSelectValue}\n onChange={handleDatasourceChange}\n labelId=\"prom-datasource-label\"\n label=\"Prometheus Datasource\"\n disabled={props.isReadonly}\n />\n </FormControl>\n <PromQLEditor\n completeConfig={{ remote: { url: promURL } }}\n value={value.expr}\n datasource={selectedDatasource}\n onBlur={handleOnBlurPromQlChange}\n readOnly={props.isReadonly}\n width=\"100%\"\n />\n <TextField\n label=\"Label Name\"\n required\n value={labelValue}\n InputProps={{\n readOnly: props.isReadonly,\n }}\n onChange={handleLabelNameChange}\n />\n </Stack>\n );\n}\n\nexport function capturingMatrix(matrix: MatrixData, labelName: string): string[] {\n const captured = new Set<string>();\n for (const sample of matrix.result) {\n const value = sample.metric[labelName];\n if (value !== undefined) {\n captured.add(value);\n }\n }\n return Array.from(captured.values());\n}\n\nexport function capturingVector(vector: VectorData, labelName: string): string[] {\n const captured = new Set<string>();\n for (const sample of vector.result) {\n const value = sample.metric[labelName];\n if (value !== undefined) {\n captured.add(value);\n }\n }\n return Array.from(captured.values());\n}\n\n/**\n * Takes a list of strings and returns a list of VariableOptions\n */\nexport const stringArrayToVariableOptions = (values?: string[]): VariableOption[] => {\n if (!values) return [];\n return values.map((value) => ({\n value,\n label: value,\n }));\n};\n"],"names":["FormControl","Stack","TextField","DatasourceSelect","isVariableDatasource","useDatasourceClient","useDatasourceSelectValueToSelector","produce","useCallback","useState","PromQLEditor","DEFAULT_PROM","isDefaultPromSelector","isPrometheusDatasourceSelector","PROM_DATASOURCE_KIND","MatcherEditor","PrometheusLabelValuesVariableEditor","props","onChange","value","datasource","selectedDatasource","labelValue","setLabelValue","labelName","matchersValues","setMatchersValues","matchers","handleDatasourceChange","next","draft","undefined","Error","handleLabelChange","e","target","handleMatchEditorsChange","spacing","margin","datasourcePluginKind","readOnly","isReadonly","labelId","label","required","InputProps","PrometheusLabelNamesVariableEditor","handleMatchEditorChange","disabled","PrometheusPromQLVariableEditor","datasourceSelectValue","data","client","promURL","options","datasourceUrl","handleOnBlurPromQlChange","expr","textContent","handleLabelNameChange","completeConfig","remote","url","onBlur","width","capturingMatrix","matrix","captured","Set","sample","result","metric","add","Array","from","values","capturingVector","vector","stringArrayToVariableOptions","map"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AACjC,SAASA,WAAW,EAAEC,KAAK,EAAE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AAM;;0BAER,KAAC9D;gBACCyC,OAAM;gBACNC,QAAQ;gBACRzB,OAAOG;gBACPuB,YAAY;oBACVL,UAAUvB,MAAMwB,UAAU;gBAC5B;gBACAvB,UAAUyC;;;;AAIlB;AAEA,OAAO,SAASM,gBAAgBC,MAAkB,EAAE1C,SAAiB;IACnE,MAAM2C,WAAW,IAAIC;IACrB,KAAK,MAAMC,UAAUH,OAAOI,MAAM,CAAE;QAClC,MAAMnD,QAAQkD,OAAOE,MAAM,CAAC/C,UAAU;QACtC,IAAIL,UAAUY,WAAW;YACvBoC,SAASK,GAAG,CAACrD;QACf;IACF;IACA,OAAOsD,MAAMC,IAAI,CAACP,SAASQ,MAAM;AACnC;AAEA,OAAO,SAASC,gBAAgBC,MAAkB,EAAErD,SAAiB;IACnE,MAAM2C,WAAW,IAAIC;IACrB,KAAK,MAAMC,UAAUQ,OAAOP,MAAM,CAAE;QAClC,MAAMnD,QAAQkD,OAAOE,MAAM,CAAC/C,UAAU;QACtC,IAAIL,UAAUY,WAAW;YACvBoC,SAASK,GAAG,CAACrD;QACf;IACF;IACA,OAAOsD,MAAMC,IAAI,CAACP,SAASQ,MAAM;AACnC;AAEA;;CAEC,GACD,OAAO,MAAMG,+BAA+B,CAACH;IAC3C,IAAI,CAACA,QAAQ,OAAO,EAAE;IACtB,OAAOA,OAAOI,GAAG,CAAC,CAAC5D,QAAW,CAAA;YAC5BA;YACAwB,OAAOxB;QACT,CAAA;AACF,EAAE"}
1
+ {"version":3,"sources":["../../../src/plugins/prometheus-variables.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport { FormControl, Stack, TextField } from '@mui/material';\nimport {\n DatasourceSelect,\n DatasourceSelectProps,\n isVariableDatasource,\n OptionsEditorProps,\n useDatasourceClient,\n useDatasourceSelectValueToSelector,\n VariableOption,\n} from '@perses-dev/plugin-system';\nimport { produce } from 'immer';\nimport { ReactElement, useCallback, ChangeEvent, FocusEvent } from 'react';\nimport { PromQLEditor } from '../components';\nimport {\n DEFAULT_PROM,\n isDefaultPromSelector,\n isPrometheusDatasourceSelector,\n MatrixData,\n PROM_DATASOURCE_KIND,\n PrometheusClient,\n PrometheusDatasourceSelector,\n VectorData,\n} from '../model';\nimport { MatcherEditor } from './MatcherEditor';\nimport {\n PrometheusLabelNamesVariableOptions,\n PrometheusLabelValuesVariableOptions,\n PrometheusPromQLVariableOptions,\n} from './types';\n\nexport function PrometheusLabelValuesVariableEditor(\n props: OptionsEditorProps<PrometheusLabelValuesVariableOptions>\n): ReactElement {\n const {\n onChange,\n value,\n value: { datasource },\n } = props;\n const selectedDatasource = datasource ?? DEFAULT_PROM;\n\n const handleDatasourceChange: DatasourceSelectProps['onChange'] = useCallback(\n (next) => {\n if (isVariableDatasource(next) || isPrometheusDatasourceSelector(next)) {\n onChange(\n produce(value, (draft) => {\n // If they're using the default, just omit the datasource prop (i.e. set to undefined)\n draft.datasource = !isVariableDatasource(next) && isDefaultPromSelector(next) ? undefined : next;\n })\n );\n return;\n }\n\n throw new Error('Got unexpected non-Prometheus datasource selector');\n },\n [onChange, value]\n );\n\n const handleLabelChange = useCallback(\n (e: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {\n onChange(\n produce(value, (draft) => {\n draft.labelName = e.target.value;\n })\n );\n },\n [onChange, value]\n );\n\n const handleMatchEditorsChange = useCallback(\n (matchers: string[]) => {\n onChange(\n produce(value, (draft) => {\n draft.matchers = matchers;\n })\n );\n },\n [onChange, value]\n );\n\n return (\n <Stack spacing={2}>\n <FormControl margin=\"dense\">\n <DatasourceSelect\n datasourcePluginKind=\"PrometheusDatasource\"\n value={selectedDatasource}\n onChange={handleDatasourceChange}\n readOnly={props.isReadonly}\n labelId=\"prom-datasource-label\"\n label=\"Prometheus Datasource\"\n />\n </FormControl>\n <TextField\n label=\"Label Name\"\n required\n value={props.value.labelName}\n onChange={handleLabelChange}\n slotProps={{\n input: {\n readOnly: props.isReadonly,\n },\n }}\n />\n <MatcherEditor\n matchers={props.value.matchers ?? []}\n onChange={handleMatchEditorsChange}\n isReadonly={props.isReadonly}\n />\n </Stack>\n );\n}\n\nexport function PrometheusLabelNamesVariableEditor(\n props: OptionsEditorProps<PrometheusLabelNamesVariableOptions>\n): ReactElement {\n const {\n onChange,\n value,\n value: { datasource },\n } = props;\n\n const selectedDatasource = datasource ?? DEFAULT_PROM;\n const handleDatasourceChange: DatasourceSelectProps['onChange'] = useCallback(\n (next) => {\n if (isVariableDatasource(next) || isPrometheusDatasourceSelector(next)) {\n onChange(\n produce(value, (draft) => {\n // If they're using the default, just omit the datasource prop (i.e. set to undefined)\n draft.datasource = !isVariableDatasource(next) && isDefaultPromSelector(next) ? undefined : next;\n })\n );\n return;\n }\n\n throw new Error('Got unexpected non-Prometheus datasource selector');\n },\n [onChange, value]\n );\n\n const handleMatchEditorChange = useCallback(\n (matchers: string[]) => {\n onChange(\n produce(value, (draft) => {\n draft.matchers = matchers;\n })\n );\n },\n [onChange, value]\n );\n\n return (\n <Stack spacing={2}>\n <FormControl margin=\"dense\">\n <DatasourceSelect\n datasourcePluginKind=\"PrometheusDatasource\"\n value={selectedDatasource}\n onChange={handleDatasourceChange}\n disabled={props.isReadonly}\n labelId=\"prom-datasource-label\"\n label=\"Prometheus Datasource\"\n />\n </FormControl>\n <MatcherEditor\n matchers={props.value.matchers ?? []}\n isReadonly={props.isReadonly}\n onChange={handleMatchEditorChange}\n />\n </Stack>\n );\n}\n\nexport function PrometheusPromQLVariableEditor(\n props: OptionsEditorProps<PrometheusPromQLVariableOptions>\n): ReactElement {\n const {\n onChange,\n value,\n value: { datasource },\n } = props;\n const datasourceSelectValue = datasource ?? DEFAULT_PROM;\n const selectedDatasource = useDatasourceSelectValueToSelector(\n datasourceSelectValue,\n PROM_DATASOURCE_KIND\n ) as PrometheusDatasourceSelector;\n\n const { data: client } = useDatasourceClient<PrometheusClient>(selectedDatasource);\n const promURL = client?.options.datasourceUrl;\n const handleDatasourceChange: DatasourceSelectProps['onChange'] = useCallback(\n (next) => {\n if (isVariableDatasource(next) || isPrometheusDatasourceSelector(next)) {\n onChange(\n produce(value, (draft) => {\n // If they're using the default, just omit the datasource prop (i.e. set to undefined)\n draft.datasource = !isVariableDatasource(next) && isDefaultPromSelector(next) ? undefined : next;\n })\n );\n return;\n }\n\n throw new Error('Got unexpected non-Prometheus datasource selector');\n },\n [value, onChange]\n );\n\n const handleOnBlurPromQlChange = useCallback(\n (e: FocusEvent<HTMLDivElement>) => {\n onChange(\n produce(value, (draft) => {\n draft.expr = e.target.textContent ?? '';\n })\n );\n },\n [onChange, value]\n );\n\n const handleLabelNameChange = useCallback(\n (e: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {\n onChange(\n produce(value, (draft) => {\n draft.labelName = e.target.value;\n })\n );\n },\n [onChange, value]\n );\n\n return (\n <Stack spacing={2}>\n <FormControl margin=\"dense\">\n <DatasourceSelect\n datasourcePluginKind={PROM_DATASOURCE_KIND}\n value={datasourceSelectValue}\n onChange={handleDatasourceChange}\n labelId=\"prom-datasource-label\"\n label=\"Prometheus Datasource\"\n disabled={props.isReadonly}\n />\n </FormControl>\n <PromQLEditor\n completeConfig={{ remote: { url: promURL } }}\n value={value.expr}\n datasource={selectedDatasource}\n onBlur={handleOnBlurPromQlChange}\n readOnly={props.isReadonly}\n width=\"100%\"\n />\n <TextField\n label=\"Label Name\"\n required\n value={props.value.labelName}\n slotProps={{\n input: {\n readOnly: props.isReadonly,\n },\n }}\n onChange={handleLabelNameChange}\n />\n </Stack>\n );\n}\n\nexport function capturingMatrix(matrix: MatrixData, labelName: string): string[] {\n const captured = new Set<string>();\n for (const sample of matrix.result) {\n const value = sample.metric[labelName];\n if (value !== undefined) {\n captured.add(value);\n }\n }\n return Array.from(captured.values());\n}\n\nexport function capturingVector(vector: VectorData, labelName: string): string[] {\n const captured = new Set<string>();\n for (const sample of vector.result) {\n const value = sample.metric[labelName];\n if (value !== undefined) {\n captured.add(value);\n }\n }\n return Array.from(captured.values());\n}\n\n/**\n * Takes a list of strings and returns a list of VariableOptions\n */\nexport const stringArrayToVariableOptions = (values?: string[]): VariableOption[] => {\n if (!values) return [];\n return values.map((value) => ({\n value,\n label: value,\n }));\n};\n"],"names":["FormControl","Stack","TextField","DatasourceSelect","isVariableDatasource","useDatasourceClient","useDatasourceSelectValueToSelector","produce","useCallback","PromQLEditor","DEFAULT_PROM","isDefaultPromSelector","isPrometheusDatasourceSelector","PROM_DATASOURCE_KIND","MatcherEditor","PrometheusLabelValuesVariableEditor","props","onChange","value","datasource","selectedDatasource","handleDatasourceChange","next","draft","undefined","Error","handleLabelChange","e","labelName","target","handleMatchEditorsChange","matchers","spacing","margin","datasourcePluginKind","readOnly","isReadonly","labelId","label","required","slotProps","input","PrometheusLabelNamesVariableEditor","handleMatchEditorChange","disabled","PrometheusPromQLVariableEditor","datasourceSelectValue","data","client","promURL","options","datasourceUrl","handleOnBlurPromQlChange","expr","textContent","handleLabelNameChange","completeConfig","remote","url","onBlur","width","capturingMatrix","matrix","captured","Set","sample","result","metric","add","Array","from","values","capturingVector","vector","stringArrayToVariableOptions","map"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AACjC,SAASA,WAAW,EAAEC,KAAK,EAAEC,SAAS,QAAQ,gBAAgB;AAC9D,SACEC,gBAAgB,EAEhBC,oBAAoB,EAEpBC,mBAAmB,EACnBC,kCAAkC,QAE7B,4BAA4B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gBAC5BY,WAAW;oBACTC,OAAO;wBACLN,UAAUnB,MAAMoB,UAAU;oBAC5B;gBACF;gBACAnB,UAAUsC;;;;AAIlB;AAEA,OAAO,SAASM,gBAAgBC,MAAkB,EAAElC,SAAiB;IACnE,MAAMmC,WAAW,IAAIC;IACrB,KAAK,MAAMC,UAAUH,OAAOI,MAAM,CAAE;QAClC,MAAMhD,QAAQ+C,OAAOE,MAAM,CAACvC,UAAU;QACtC,IAAIV,UAAUM,WAAW;YACvBuC,SAASK,GAAG,CAAClD;QACf;IACF;IACA,OAAOmD,MAAMC,IAAI,CAACP,SAASQ,MAAM;AACnC;AAEA,OAAO,SAASC,gBAAgBC,MAAkB,EAAE7C,SAAiB;IACnE,MAAMmC,WAAW,IAAIC;IACrB,KAAK,MAAMC,UAAUQ,OAAOP,MAAM,CAAE;QAClC,MAAMhD,QAAQ+C,OAAOE,MAAM,CAACvC,UAAU;QACtC,IAAIV,UAAUM,WAAW;YACvBuC,SAASK,GAAG,CAAClD;QACf;IACF;IACA,OAAOmD,MAAMC,IAAI,CAACP,SAASQ,MAAM;AACnC;AAEA;;CAEC,GACD,OAAO,MAAMG,+BAA+B,CAACH;IAC3C,IAAI,CAACA,QAAQ,OAAO,EAAE;IACtB,OAAOA,OAAOI,GAAG,CAAC,CAACzD,QAAW,CAAA;YAC5BA;YACAoB,OAAOpB;QACT,CAAA;AACF,EAAE"}
@@ -1,4 +1,4 @@
1
- // Copyright 2023 The Perses Authors
1
+ // Copyright The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/plugins/test/setup-tests.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport '@testing-library/jest-dom/extend-expect';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,OAAO,0CAA0C"}
1
+ {"version":3,"sources":["../../../../src/plugins/test/setup-tests.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport '@testing-library/jest-dom/extend-expect';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,OAAO,0CAA0C"}
@@ -6,6 +6,7 @@ export interface PrometheusDatasourceSpec {
6
6
  directUrl?: string;
7
7
  proxy?: HTTPProxy;
8
8
  scrapeInterval?: DurationString;
9
+ queryParams?: Record<string, string>;
9
10
  }
10
11
  export interface PrometheusVariableOptionsBase {
11
12
  datasource?: DatasourceSelectValue<PrometheusDatasourceSelector>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/plugins/types.ts"],"names":[],"mappings":"AAaA,OAA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EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACtC;AAED,MAAM,WAAW,6BAA6B;IAC5C,UAAU,CAAC,EAAE,qBAAqB,CAAC,4BAA4B,CAAC,CAAC;CAClE;AAED,MAAM,MAAM,mCAAmC,GAAG,6BAA6B,GAAG;IAChF,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,oCAAoC,GAAG,6BAA6B,GAAG;IACjF,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG,6BAA6B,GAAG;IAE5E,IAAI,EAAE,MAAM,CAAC;IAGb,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC"}
@@ -1,4 +1,4 @@
1
- // Copyright 2023 The Perses Authors
1
+ // Copyright The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/plugins/types.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { DurationString, HTTPProxy } from '@perses-dev/core';\nimport { DatasourceSelectValue } from '@perses-dev/plugin-system';\nimport { PrometheusDatasourceSelector } from '../model';\n\nexport const DEFAULT_SCRAPE_INTERVAL: DurationString = '1m';\n\nexport interface PrometheusDatasourceSpec {\n directUrl?: string;\n proxy?: HTTPProxy;\n scrapeInterval?: DurationString; // default to 1m\n}\n\nexport interface PrometheusVariableOptionsBase {\n datasource?: DatasourceSelectValue<PrometheusDatasourceSelector>;\n}\n\nexport type PrometheusLabelNamesVariableOptions = PrometheusVariableOptionsBase & {\n matchers?: string[];\n};\n\nexport type PrometheusLabelValuesVariableOptions = PrometheusVariableOptionsBase & {\n labelName: string;\n matchers?: string[];\n};\n\nexport type PrometheusPromQLVariableOptions = PrometheusVariableOptionsBase & {\n // expr is the PromQL expression.\n expr: string;\n // labelName is the name of the label that will be used after the PromQL query is performed to select the label value.\n // Note: This field is not part of the Prometheus API.\n labelName: string;\n};\n"],"names":["DEFAULT_SCRAPE_INTERVAL"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAMjC,OAAO,MAAMA,0BAA0C,KAAK"}
1
+ {"version":3,"sources":["../../../src/plugins/types.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { DurationString, HTTPProxy } from '@perses-dev/core';\nimport { DatasourceSelectValue } from '@perses-dev/plugin-system';\nimport { PrometheusDatasourceSelector } from '../model';\n\nexport const DEFAULT_SCRAPE_INTERVAL: DurationString = '1m';\n\nexport interface PrometheusDatasourceSpec {\n directUrl?: string;\n proxy?: HTTPProxy;\n scrapeInterval?: DurationString; // default to 1m\n queryParams?: Record<string, string>;\n}\n\nexport interface PrometheusVariableOptionsBase {\n datasource?: DatasourceSelectValue<PrometheusDatasourceSelector>;\n}\n\nexport type PrometheusLabelNamesVariableOptions = PrometheusVariableOptionsBase & {\n matchers?: string[];\n};\n\nexport type PrometheusLabelValuesVariableOptions = PrometheusVariableOptionsBase & {\n labelName: string;\n matchers?: string[];\n};\n\nexport type PrometheusPromQLVariableOptions = PrometheusVariableOptionsBase & {\n // expr is the PromQL expression.\n expr: string;\n // labelName is the name of the label that will be used after the PromQL query is performed to select the label value.\n // Note: This field is not part of the Prometheus API.\n labelName: string;\n};\n"],"names":["DEFAULT_SCRAPE_INTERVAL"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAMjC,OAAO,MAAMA,0BAA0C,KAAK"}
@@ -1,4 +1,4 @@
1
- // Copyright 2023 The Perses Authors
1
+ // Copyright The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/plugins/variable.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { VariablePlugin, VariableOption, OptionsEditorProps } from '@perses-dev/plugin-system';\nimport { Autocomplete, TextField } from '@mui/material';\nimport { ReactElement } from 'react';\n\ntype StaticListOption = string | VariableOption;\n\ntype StaticListVariableOptions = {\n values: StaticListOption[];\n};\n\nfunction StaticListVariableOptionEditor(props: OptionsEditorProps<StaticListVariableOptions>): ReactElement {\n const value = props.value.values.map((v) => {\n if (typeof v === 'string') {\n return v;\n } else {\n return v.value;\n }\n });\n\n const onChange = (__: unknown, value: string[]): void => {\n props.onChange({\n values: value.map((v) => {\n return { value: v, label: v };\n }),\n });\n };\n\n return (\n <div>\n <Autocomplete\n onPaste={(e) => {\n // Append new values on paste\n const v = e.clipboardData.getData('text/plain');\n if (v) {\n const values = v.split(',');\n onChange(null, value.concat(values));\n e.preventDefault();\n }\n }}\n multiple\n value={value}\n onChange={onChange}\n options={[]}\n freeSolo\n clearOnBlur\n readOnly={props.isReadonly}\n renderInput={(params) => (\n <TextField\n {...params}\n label=\"Values\"\n placeholder=\"Values\"\n helperText='Type new value then press \"Enter\" to add.'\n />\n )}\n />\n </div>\n );\n}\n\nexport const StaticListVariable: VariablePlugin<StaticListVariableOptions> = {\n getVariableOptions: async (spec) => {\n const values = spec.values?.map((v) => {\n if (typeof v === 'string') {\n return { label: v, value: v };\n }\n return v;\n });\n return {\n data: values,\n };\n },\n dependsOn: () => {\n return { variables: [] };\n },\n OptionsEditorComponent: StaticListVariableOptionEditor,\n createInitialOptions: () => ({ values: [] }),\n};\n"],"names":["Autocomplete","TextField","StaticListVariableOptionEditor","props","value","values","map","v","onChange","__","label","div","onPaste","e","clipboardData","getData","split","concat","preventDefault","multiple","options","freeSolo","clearOnBlur","readOnly","isReadonly","renderInput","params","placeholder","helperText","StaticListVariable","getVariableOptions","spec","data","dependsOn","variables","OptionsEditorComponent","createInitialOptions"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAGjC,SAASA,YAAY,EAAEC,SAAS,QAAQ,gBAAgB;AASxD,SAASC,+BAA+BC,KAAoD;IAC1F,MAAMC,QAAQD,MAAMC,KAAK,CAACC,MAAM,CAACC,GAAG,CAAC,CAACC;QACpC,IAAI,OAAOA,MAAM,UAAU;YACzB,OAAOA;QACT,OAAO;YACL,OAAOA,EAAEH,KAAK;QAChB;IACF;IAEA,MAAMI,WAAW,CAACC,IAAaL;QAC7BD,MAAMK,QAAQ,CAAC;YACbH,QAAQD,MAAME,GAAG,CAAC,CAACC;gBACjB,OAAO;oBAAEH,OAAOG;oBAAGG,OAAOH;gBAAE;YAC9B;QACF;IACF;IAEA,qBACE,KAACI;kBACC,cAAA,KAACX;YACCY,SAAS,CAACC;gBACR,6BAA6B;gBAC7B,MAAMN,IAAIM,EAAEC,aAAa,CAACC,OAAO,CAAC;gBAClC,IAAIR,GAAG;oBACL,MAAMF,SAASE,EAAES,KAAK,CAAC;oBACvBR,SAAS,MAAMJ,MAAMa,MAAM,CAACZ;oBAC5BQ,EAAEK,cAAc;gBAClB;YACF;YACAC,QAAQ;YACRf,OAAOA;YACPI,UAAUA;YACVY,SAAS,EAAE;YACXC,QAAQ;YACRC,WAAW;YACXC,UAAUpB,MAAMqB,UAAU;YAC1BC,aAAa,CAACC,uBACZ,KAACzB;oBACE,GAAGyB,MAAM;oBACVhB,OAAM;oBACNiB,aAAY;oBACZC,YAAW;;;;AAMvB;AAEA,OAAO,MAAMC,qBAAgE;IAC3EC,oBAAoB,OAAOC;QACzB,MAAM1B,SAAS0B,KAAK1B,MAAM,EAAEC,IAAI,CAACC;YAC/B,IAAI,OAAOA,MAAM,UAAU;gBACzB,OAAO;oBAAEG,OAAOH;oBAAGH,OAAOG;gBAAE;YAC9B;YACA,OAAOA;QACT;QACA,OAAO;YACLyB,MAAM3B;QACR;IACF;IACA4B,WAAW;QACT,OAAO;YAAEC,WAAW,EAAE;QAAC;IACzB;IACAC,wBAAwBjC;IACxBkC,sBAAsB,IAAO,CAAA;YAAE/B,QAAQ,EAAE;QAAC,CAAA;AAC5C,EAAE"}
1
+ {"version":3,"sources":["../../../src/plugins/variable.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { VariablePlugin, VariableOption, OptionsEditorProps } from '@perses-dev/plugin-system';\nimport { Autocomplete, TextField } from '@mui/material';\nimport { ReactElement } from 'react';\n\ntype StaticListOption = string | VariableOption;\n\ntype StaticListVariableOptions = {\n values: StaticListOption[];\n};\n\nfunction StaticListVariableOptionEditor(props: OptionsEditorProps<StaticListVariableOptions>): ReactElement {\n const value = props.value.values.map((v) => {\n if (typeof v === 'string') {\n return v;\n } else {\n return v.value;\n }\n });\n\n const onChange = (__: unknown, value: string[]): void => {\n props.onChange({\n values: value.map((v) => {\n return { value: v, label: v };\n }),\n });\n };\n\n return (\n <div>\n <Autocomplete\n onPaste={(e) => {\n // Append new values on paste\n const v = e.clipboardData.getData('text/plain');\n if (v) {\n const values = v.split(',');\n onChange(null, value.concat(values));\n e.preventDefault();\n }\n }}\n multiple\n value={value}\n onChange={onChange}\n options={[]}\n freeSolo\n clearOnBlur\n readOnly={props.isReadonly}\n renderInput={(params) => (\n <TextField\n {...params}\n label=\"Values\"\n placeholder=\"Values\"\n helperText='Type new value then press \"Enter\" to add.'\n />\n )}\n />\n </div>\n );\n}\n\nexport const StaticListVariable: VariablePlugin<StaticListVariableOptions> = {\n getVariableOptions: async (spec) => {\n const values = spec.values?.map((v) => {\n if (typeof v === 'string') {\n return { label: v, value: v };\n }\n return v;\n });\n return {\n data: values,\n };\n },\n dependsOn: () => {\n return { variables: [] };\n },\n OptionsEditorComponent: StaticListVariableOptionEditor,\n createInitialOptions: () => ({ values: [] }),\n};\n"],"names":["Autocomplete","TextField","StaticListVariableOptionEditor","props","value","values","map","v","onChange","__","label","div","onPaste","e","clipboardData","getData","split","concat","preventDefault","multiple","options","freeSolo","clearOnBlur","readOnly","isReadonly","renderInput","params","placeholder","helperText","StaticListVariable","getVariableOptions","spec","data","dependsOn","variables","OptionsEditorComponent","createInitialOptions"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAGjC,SAASA,YAAY,EAAEC,SAAS,QAAQ,gBAAgB;AASxD,SAASC,+BAA+BC,KAAoD;IAC1F,MAAMC,QAAQD,MAAMC,KAAK,CAACC,MAAM,CAACC,GAAG,CAAC,CAACC;QACpC,IAAI,OAAOA,MAAM,UAAU;YACzB,OAAOA;QACT,OAAO;YACL,OAAOA,EAAEH,KAAK;QAChB;IACF;IAEA,MAAMI,WAAW,CAACC,IAAaL;QAC7BD,MAAMK,QAAQ,CAAC;YACbH,QAAQD,MAAME,GAAG,CAAC,CAACC;gBACjB,OAAO;oBAAEH,OAAOG;oBAAGG,OAAOH;gBAAE;YAC9B;QACF;IACF;IAEA,qBACE,KAACI;kBACC,cAAA,KAACX;YACCY,SAAS,CAACC;gBACR,6BAA6B;gBAC7B,MAAMN,IAAIM,EAAEC,aAAa,CAACC,OAAO,CAAC;gBAClC,IAAIR,GAAG;oBACL,MAAMF,SAASE,EAAES,KAAK,CAAC;oBACvBR,SAAS,MAAMJ,MAAMa,MAAM,CAACZ;oBAC5BQ,EAAEK,cAAc;gBAClB;YACF;YACAC,QAAQ;YACRf,OAAOA;YACPI,UAAUA;YACVY,SAAS,EAAE;YACXC,QAAQ;YACRC,WAAW;YACXC,UAAUpB,MAAMqB,UAAU;YAC1BC,aAAa,CAACC,uBACZ,KAACzB;oBACE,GAAGyB,MAAM;oBACVhB,OAAM;oBACNiB,aAAY;oBACZC,YAAW;;;;AAMvB;AAEA,OAAO,MAAMC,qBAAgE;IAC3EC,oBAAoB,OAAOC;QACzB,MAAM1B,SAAS0B,KAAK1B,MAAM,EAAEC,IAAI,CAACC;YAC/B,IAAI,OAAOA,MAAM,UAAU;gBACzB,OAAO;oBAAEG,OAAOH;oBAAGH,OAAOG;gBAAE;YAC9B;YACA,OAAOA;QACT;QACA,OAAO;YACLyB,MAAM3B;QACR;IACF;IACA4B,WAAW;QACT,OAAO;YAAEC,WAAW,EAAE;QAAC;IACzB;IACAC,wBAAwBjC;IACxBkC,sBAAsB,IAAO,CAAA;YAAE/B,QAAQ,EAAE;QAAC,CAAA;AAC5C,EAAE"}
@@ -1,4 +1,4 @@
1
- // Copyright 2023 The Perses Authors
1
+ // Copyright The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/setup-tests.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport '@testing-library/jest-dom';\n\n// Always mock e-charts during tests since we don't have a proper canvas in jsdom\njest.mock('echarts/core');\n"],"names":["jest","mock"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,OAAO,4BAA4B;AAEnC,iFAAiF;AACjFA,KAAKC,IAAI,CAAC"}
1
+ {"version":3,"sources":["../../src/setup-tests.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport '@testing-library/jest-dom';\n\n// Always mock e-charts during tests since we don't have a proper canvas in jsdom\njest.mock('echarts/core');\n"],"names":["jest","mock"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,OAAO,4BAA4B;AAEnC,iFAAiF;AACjFA,KAAKC,IAAI,CAAC"}
@@ -1,4 +1,4 @@
1
- // Copyright 2023 The Perses Authors
1
+ // Copyright The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/utils/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './utils';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,UAAU"}
1
+ {"version":3,"sources":["../../../src/utils/index.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './utils';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,UAAU"}
@@ -1,4 +1,4 @@
1
- // Copyright 2023 The Perses Authors
1
+ // Copyright The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/utils/utils.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Metric } from '../model/api-types';\n\n/**\n * Types for metric labels, used in seriesNameFormat implementation\n */\nexport type SeriesLabels = Record<string, string>;\n\n/*\n * Formatter used for series name display in legends and tooltips.\n * Regex replaces label {{ name }} with resolved label value.\n * If no resolved value, return empty string instead of the token inside double curly braces.\n */\nexport function formatSeriesName(inputFormat: string, seriesLabels: SeriesLabels): string {\n const resolveLabelsRegex = /\\{\\{\\s*(.+?)\\s*\\}\\}/g;\n return inputFormat.replace(resolveLabelsRegex, (_match, token) => {\n const resolvedValue = seriesLabels[token] ?? '';\n return resolvedValue;\n });\n}\n\n/*\n * Stringifies object of labels into valid PromQL for querying metric by label\n */\nfunction stringifyPrometheusMetricLabels(labels: { [key: string]: unknown }, removeExprWrap?: boolean): string {\n const labelStrings: string[] = [];\n Object.keys(labels)\n .sort()\n .forEach((labelName) => {\n const labelValue = labels[labelName];\n if (labelValue !== undefined) {\n if (removeExprWrap) {\n labelStrings.push(`\"${labelName}\":\"${labelValue}\"`);\n } else {\n labelStrings.push(`${labelName}=\"${labelValue}\"`);\n }\n }\n });\n return `{${labelStrings.join(',')}}`;\n}\n\n/*\n * Metric labels formatter which checks for __name__ and outputs valid PromQL for series name\n */\nexport function getUniqueKeyForPrometheusResult(\n metricLabels: {\n [key: string]: string;\n },\n { removeExprWrap }: { removeExprWrap?: boolean } = {}\n): string {\n const metricNameKey = '__name__';\n if (Object.prototype.hasOwnProperty.call(metricLabels, metricNameKey)) {\n const stringifiedLabels = stringifyPrometheusMetricLabels(\n {\n ...metricLabels,\n [metricNameKey]: undefined,\n },\n removeExprWrap\n );\n if (removeExprWrap) {\n return `${stringifiedLabels}`;\n } else {\n return `${metricLabels[metricNameKey]}${stringifiedLabels}`;\n }\n }\n return stringifyPrometheusMetricLabels(metricLabels, removeExprWrap);\n}\n\n/*\n * Determine human-readable series name to be used in legend and tooltip\n */\nexport function getFormattedPrometheusSeriesName(\n query: string,\n metric: Metric,\n formatter?: string\n): {\n name: string;\n formattedName: string;\n} {\n // Name the series after the metric labels by default.\n const name = getUniqueKeyForPrometheusResult(metric);\n\n // Query editor allows you to define an optional seriesNameFormat property.\n // This controls the regex used to customize legend and tooltip display.\n const formattedName = formatter ? formatSeriesName(formatter, metric) : name;\n return { name, formattedName };\n}\n"],"names":["formatSeriesName","inputFormat","seriesLabels","resolveLabelsRegex","replace","_match","token","resolvedValue","stringifyPrometheusMetricLabels","labels","removeExprWrap","labelStrings","Object","keys","sort","forEach","labelName","labelValue","undefined","push","join","getUniqueKeyForPrometheusResult","metricLabels","metricNameKey","prototype","hasOwnProperty","call","stringifiedLabels","getFormattedPrometheusSeriesName","query","metric","formatter","name","formattedName"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AASjC;;;;CAIC,GACD,OAAO,SAASA,iBAAiBC,WAAmB,EAAEC,YAA0B;IAC9E,MAAMC,qBAAqB;IAC3B,OAAOF,YAAYG,OAAO,CAACD,oBAAoB,CAACE,QAAQC;QACtD,MAAMC,gBAAgBL,YAAY,CAACI,MAAM,IAAI;QAC7C,OAAOC;IACT;AACF;AAEA;;CAEC,GACD,SAASC,gCAAgCC,MAAkC,EAAEC,cAAwB;IACnG,MAAMC,eAAyB,EAAE;IACjCC,OAAOC,IAAI,CAACJ,QACTK,IAAI,GACJC,OAAO,CAAC,CAACC;QACR,MAAMC,aAAaR,MAAM,CAACO,UAAU;QACpC,IAAIC,eAAeC,WAAW;YAC5B,IAAIR,gBAAgB;gBAClBC,aAAaQ,IAAI,CAAC,CAAC,CAAC,EAAEH,UAAU,GAAG,EAAEC,WAAW,CAAC,CAAC;YACpD,OAAO;gBACLN,aAAaQ,IAAI,CAAC,GAAGH,UAAU,EAAE,EAAEC,WAAW,CAAC,CAAC;YAClD;QACF;IACF;IACF,OAAO,CAAC,CAAC,EAAEN,aAAaS,IAAI,CAAC,KAAK,CAAC,CAAC;AACtC;AAEA;;CAEC,GACD,OAAO,SAASC,gCACdC,YAEC,EACD,EAAEZ,cAAc,EAAgC,GAAG,CAAC,CAAC;IAErD,MAAMa,gBAAgB;IACtB,IAAIX,OAAOY,SAAS,CAACC,cAAc,CAACC,IAAI,CAACJ,cAAcC,gBAAgB;QACrE,MAAMI,oBAAoBnB,gCACxB;YACE,GAAGc,YAAY;YACf,CAACC,cAAc,EAAEL;QACnB,GACAR;QAEF,IAAIA,gBAAgB;YAClB,OAAO,GAAGiB,mBAAmB;QAC/B,OAAO;YACL,OAAO,GAAGL,YAAY,CAACC,cAAc,GAAGI,mBAAmB;QAC7D;IACF;IACA,OAAOnB,gCAAgCc,cAAcZ;AACvD;AAEA;;CAEC,GACD,OAAO,SAASkB,iCACdC,KAAa,EACbC,MAAc,EACdC,SAAkB;IAKlB,sDAAsD;IACtD,MAAMC,OAAOX,gCAAgCS;IAE7C,2EAA2E;IAC3E,wEAAwE;IACxE,MAAMG,gBAAgBF,YAAY/B,iBAAiB+B,WAAWD,UAAUE;IACxE,OAAO;QAAEA;QAAMC;IAAc;AAC/B"}
1
+ {"version":3,"sources":["../../../src/utils/utils.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Metric } from '../model/api-types';\n\n/**\n * Types for metric labels, used in seriesNameFormat implementation\n */\nexport type SeriesLabels = Record<string, string>;\n\n/*\n * Formatter used for series name display in legends and tooltips.\n * Regex replaces label {{ name }} with resolved label value.\n * If no resolved value, return empty string instead of the token inside double curly braces.\n */\nexport function formatSeriesName(inputFormat: string, seriesLabels: SeriesLabels): string {\n const resolveLabelsRegex = /\\{\\{\\s*(.+?)\\s*\\}\\}/g;\n return inputFormat.replace(resolveLabelsRegex, (_match, token) => {\n const resolvedValue = seriesLabels[token] ?? '';\n return resolvedValue;\n });\n}\n\n/*\n * Stringifies object of labels into valid PromQL for querying metric by label\n */\nfunction stringifyPrometheusMetricLabels(labels: { [key: string]: unknown }, removeExprWrap?: boolean): string {\n const labelStrings: string[] = [];\n Object.keys(labels)\n .sort()\n .forEach((labelName) => {\n const labelValue = labels[labelName];\n if (labelValue !== undefined) {\n if (removeExprWrap) {\n labelStrings.push(`\"${labelName}\":\"${labelValue}\"`);\n } else {\n labelStrings.push(`${labelName}=\"${labelValue}\"`);\n }\n }\n });\n return `{${labelStrings.join(',')}}`;\n}\n\n/*\n * Metric labels formatter which checks for __name__ and outputs valid PromQL for series name\n */\nexport function getUniqueKeyForPrometheusResult(\n metricLabels: {\n [key: string]: string;\n },\n { removeExprWrap }: { removeExprWrap?: boolean } = {}\n): string {\n const metricNameKey = '__name__';\n if (Object.prototype.hasOwnProperty.call(metricLabels, metricNameKey)) {\n const stringifiedLabels = stringifyPrometheusMetricLabels(\n {\n ...metricLabels,\n [metricNameKey]: undefined,\n },\n removeExprWrap\n );\n if (removeExprWrap) {\n return `${stringifiedLabels}`;\n } else {\n return `${metricLabels[metricNameKey]}${stringifiedLabels}`;\n }\n }\n return stringifyPrometheusMetricLabels(metricLabels, removeExprWrap);\n}\n\n/*\n * Determine human-readable series name to be used in legend and tooltip\n */\nexport function getFormattedPrometheusSeriesName(\n query: string,\n metric: Metric,\n formatter?: string\n): {\n name: string;\n formattedName: string;\n} {\n // Name the series after the metric labels by default.\n const name = getUniqueKeyForPrometheusResult(metric);\n\n // Query editor allows you to define an optional seriesNameFormat property.\n // This controls the regex used to customize legend and tooltip display.\n const formattedName = formatter ? formatSeriesName(formatter, metric) : name;\n return { name, formattedName };\n}\n"],"names":["formatSeriesName","inputFormat","seriesLabels","resolveLabelsRegex","replace","_match","token","resolvedValue","stringifyPrometheusMetricLabels","labels","removeExprWrap","labelStrings","Object","keys","sort","forEach","labelName","labelValue","undefined","push","join","getUniqueKeyForPrometheusResult","metricLabels","metricNameKey","prototype","hasOwnProperty","call","stringifiedLabels","getFormattedPrometheusSeriesName","query","metric","formatter","name","formattedName"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AASjC;;;;CAIC,GACD,OAAO,SAASA,iBAAiBC,WAAmB,EAAEC,YAA0B;IAC9E,MAAMC,qBAAqB;IAC3B,OAAOF,YAAYG,OAAO,CAACD,oBAAoB,CAACE,QAAQC;QACtD,MAAMC,gBAAgBL,YAAY,CAACI,MAAM,IAAI;QAC7C,OAAOC;IACT;AACF;AAEA;;CAEC,GACD,SAASC,gCAAgCC,MAAkC,EAAEC,cAAwB;IACnG,MAAMC,eAAyB,EAAE;IACjCC,OAAOC,IAAI,CAACJ,QACTK,IAAI,GACJC,OAAO,CAAC,CAACC;QACR,MAAMC,aAAaR,MAAM,CAACO,UAAU;QACpC,IAAIC,eAAeC,WAAW;YAC5B,IAAIR,gBAAgB;gBAClBC,aAAaQ,IAAI,CAAC,CAAC,CAAC,EAAEH,UAAU,GAAG,EAAEC,WAAW,CAAC,CAAC;YACpD,OAAO;gBACLN,aAAaQ,IAAI,CAAC,GAAGH,UAAU,EAAE,EAAEC,WAAW,CAAC,CAAC;YAClD;QACF;IACF;IACF,OAAO,CAAC,CAAC,EAAEN,aAAaS,IAAI,CAAC,KAAK,CAAC,CAAC;AACtC;AAEA;;CAEC,GACD,OAAO,SAASC,gCACdC,YAEC,EACD,EAAEZ,cAAc,EAAgC,GAAG,CAAC,CAAC;IAErD,MAAMa,gBAAgB;IACtB,IAAIX,OAAOY,SAAS,CAACC,cAAc,CAACC,IAAI,CAACJ,cAAcC,gBAAgB;QACrE,MAAMI,oBAAoBnB,gCACxB;YACE,GAAGc,YAA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