@perses-dev/prometheus-plugin 0.57.0-beta.0 → 0.57.0

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 (208) hide show
  1. package/__mf/js/{Prometheus.2bb892ab.js → Prometheus.9877d89e.js} +3 -3
  2. package/__mf/js/async/1728.531c96f9.js +1 -0
  3. package/__mf/js/async/3499.bef2e2e5.js +1 -0
  4. package/__mf/js/async/3652.6b591718.js +7 -0
  5. package/__mf/js/async/392.f1b4a590.js +2 -0
  6. package/__mf/js/async/425.1ec8867f.js +1 -0
  7. package/__mf/js/async/4657.f0c3ccd6.js +2 -0
  8. package/__mf/js/async/54.e6002704.js +22 -0
  9. package/__mf/js/async/5440.8ced5513.js +2 -0
  10. package/__mf/js/async/{5440.c13c3533.js.LICENSE.txt → 5440.8ced5513.js.LICENSE.txt} +3 -3
  11. package/__mf/js/async/9010.ca50fa9e.js +2 -0
  12. package/__mf/js/async/{9020.c19782f1.js → 9020.ebc1cad3.js} +1 -1
  13. package/__mf/js/async/{__federation_expose_PrometheusDatasource.6f63e147.js → __federation_expose_PrometheusDatasource.b97f9012.js} +1 -1
  14. package/__mf/js/async/{__federation_expose_PrometheusExplorer.584a073d.js → __federation_expose_PrometheusExplorer.eba3b416.js} +1 -1
  15. package/__mf/js/async/{__federation_expose_PrometheusLabelNamesVariable.40984a4d.js → __federation_expose_PrometheusLabelNamesVariable.bd38a89c.js} +1 -1
  16. package/__mf/js/async/{__federation_expose_PrometheusLabelValuesVariable.bd3eb00c.js → __federation_expose_PrometheusLabelValuesVariable.eb12e168.js} +1 -1
  17. package/__mf/js/async/{__federation_expose_PrometheusPromQLVariable.5cca8417.js → __federation_expose_PrometheusPromQLVariable.7ccb0601.js} +1 -1
  18. package/__mf/js/async/{__federation_expose_PrometheusTimeSeriesQuery.f59141f4.js → __federation_expose_PrometheusTimeSeriesQuery.08f11ea9.js} +1 -1
  19. package/__mf/js/{main.9617b605.js → main.78fc6444.js} +5 -5
  20. package/lib/bootstrap.js +1 -1
  21. package/lib/bootstrap.js.map +1 -1
  22. package/lib/cjs/bootstrap.js +1 -1
  23. package/lib/cjs/components/PromQLEditor.js +1 -1
  24. package/lib/cjs/components/TreeNode.js +1 -1
  25. package/lib/cjs/components/index.js +1 -1
  26. package/lib/cjs/components/promql/ast.js +1 -1
  27. package/lib/cjs/components/promql/format.js +1 -1
  28. package/lib/cjs/components/promql/functionSignatures.js +1 -1
  29. package/lib/cjs/components/promql/serialize.js +1 -1
  30. package/lib/cjs/components/promql/utils.js +1 -1
  31. package/lib/cjs/components/query.js +1 -1
  32. package/lib/cjs/env.d.js +1 -1
  33. package/lib/cjs/explore/PrometheusExplorer.js +1 -1
  34. package/lib/cjs/explore/PrometheusMetricsFinder/PrometheusMetricsFinder.js +1 -1
  35. package/lib/cjs/explore/PrometheusMetricsFinder/display/MetricChip.js +1 -1
  36. package/lib/cjs/explore/PrometheusMetricsFinder/display/list/MetricList.js +1 -1
  37. package/lib/cjs/explore/PrometheusMetricsFinder/filter/FilterInputs.js +1 -1
  38. package/lib/cjs/explore/PrometheusMetricsFinder/filter/FinderFilters.js +1 -1
  39. package/lib/cjs/explore/PrometheusMetricsFinder/index.js +1 -1
  40. package/lib/cjs/explore/PrometheusMetricsFinder/overview/MetricOverview.js +1 -1
  41. package/lib/cjs/explore/PrometheusMetricsFinder/overview/tabs/JobTab.js +1 -1
  42. package/lib/cjs/explore/PrometheusMetricsFinder/overview/tabs/OverviewTab.js +1 -1
  43. package/lib/cjs/explore/PrometheusMetricsFinder/overview/tabs/SimilarTab.js +1 -1
  44. package/lib/cjs/explore/PrometheusMetricsFinder/types.js +1 -1
  45. package/lib/cjs/explore/PrometheusMetricsFinder/utils.js +1 -1
  46. package/lib/cjs/explore/index.js +12 -0
  47. package/lib/cjs/getPluginModule.js +12 -0
  48. package/lib/cjs/index-federation.js +1 -1
  49. package/lib/cjs/index.js +12 -0
  50. package/lib/cjs/model/api-types.js +1 -1
  51. package/lib/cjs/model/index.js +1 -1
  52. package/lib/cjs/model/parse-sample-values.js +1 -1
  53. package/lib/cjs/model/prometheus-client.js +1 -1
  54. package/lib/cjs/model/prometheus-selectors.js +1 -1
  55. package/lib/cjs/model/time.js +1 -1
  56. package/lib/cjs/plugins/MatcherEditor.js +1 -1
  57. package/lib/cjs/plugins/PrometheusDatasourceEditor.js +1 -1
  58. package/lib/cjs/plugins/PrometheusLabelNamesVariable.js +12 -0
  59. package/lib/cjs/plugins/PrometheusLabelValuesVariable.js +12 -0
  60. package/lib/cjs/plugins/PrometheusPromQLVariable.js +12 -0
  61. package/lib/cjs/plugins/index.js +12 -0
  62. package/lib/cjs/plugins/prometheus-datasource.js +1 -1
  63. package/lib/cjs/plugins/prometheus-time-series-query/PrometheusTimeSeriesQuery.js +1 -1
  64. package/lib/cjs/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.js +1 -1
  65. package/lib/cjs/plugins/prometheus-time-series-query/get-time-series-data.js +1 -1
  66. package/lib/cjs/plugins/prometheus-time-series-query/index.js +1 -1
  67. package/lib/cjs/plugins/prometheus-time-series-query/query-editor-model.js +1 -1
  68. package/lib/cjs/plugins/prometheus-time-series-query/replace-prom-builtin-variables.js +1 -1
  69. package/lib/cjs/plugins/prometheus-time-series-query/time-series-query-model.js +1 -1
  70. package/lib/cjs/plugins/prometheus-variables.js +1 -1
  71. package/lib/cjs/plugins/test/setup-tests.js +1 -1
  72. package/lib/cjs/plugins/types.js +1 -1
  73. package/lib/cjs/plugins/variable.js +1 -1
  74. package/lib/cjs/setup-tests.js +1 -1
  75. package/lib/cjs/utils/index.js +1 -1
  76. package/lib/cjs/utils/utils.js +1 -1
  77. package/lib/components/PromQLEditor.js +1 -1
  78. package/lib/components/PromQLEditor.js.map +1 -1
  79. package/lib/components/TreeNode.js +1 -1
  80. package/lib/components/TreeNode.js.map +1 -1
  81. package/lib/components/index.js +1 -1
  82. package/lib/components/index.js.map +1 -1
  83. package/lib/components/promql/ast.js +1 -1
  84. package/lib/components/promql/ast.js.map +1 -1
  85. package/lib/components/promql/format.js +1 -1
  86. package/lib/components/promql/format.js.map +1 -1
  87. package/lib/components/promql/functionSignatures.js +1 -1
  88. package/lib/components/promql/functionSignatures.js.map +1 -1
  89. package/lib/components/promql/serialize.js +1 -1
  90. package/lib/components/promql/serialize.js.map +1 -1
  91. package/lib/components/promql/utils.js +1 -1
  92. package/lib/components/promql/utils.js.map +1 -1
  93. package/lib/components/query.js +1 -1
  94. package/lib/components/query.js.map +1 -1
  95. package/lib/env.d.js +1 -1
  96. package/lib/env.d.js.map +1 -1
  97. package/lib/explore/PrometheusExplorer.js +1 -1
  98. package/lib/explore/PrometheusExplorer.js.map +1 -1
  99. package/lib/explore/PrometheusMetricsFinder/PrometheusMetricsFinder.js +1 -1
  100. package/lib/explore/PrometheusMetricsFinder/PrometheusMetricsFinder.js.map +1 -1
  101. package/lib/explore/PrometheusMetricsFinder/display/MetricChip.js +1 -1
  102. package/lib/explore/PrometheusMetricsFinder/display/MetricChip.js.map +1 -1
  103. package/lib/explore/PrometheusMetricsFinder/display/list/MetricList.js +1 -1
  104. package/lib/explore/PrometheusMetricsFinder/display/list/MetricList.js.map +1 -1
  105. package/lib/explore/PrometheusMetricsFinder/filter/FilterInputs.js +1 -1
  106. package/lib/explore/PrometheusMetricsFinder/filter/FilterInputs.js.map +1 -1
  107. package/lib/explore/PrometheusMetricsFinder/filter/FinderFilters.js +1 -1
  108. package/lib/explore/PrometheusMetricsFinder/filter/FinderFilters.js.map +1 -1
  109. package/lib/explore/PrometheusMetricsFinder/index.js +1 -1
  110. package/lib/explore/PrometheusMetricsFinder/index.js.map +1 -1
  111. package/lib/explore/PrometheusMetricsFinder/overview/MetricOverview.js +1 -1
  112. package/lib/explore/PrometheusMetricsFinder/overview/MetricOverview.js.map +1 -1
  113. package/lib/explore/PrometheusMetricsFinder/overview/tabs/JobTab.js +1 -1
  114. package/lib/explore/PrometheusMetricsFinder/overview/tabs/JobTab.js.map +1 -1
  115. package/lib/explore/PrometheusMetricsFinder/overview/tabs/OverviewTab.js +1 -1
  116. package/lib/explore/PrometheusMetricsFinder/overview/tabs/OverviewTab.js.map +1 -1
  117. package/lib/explore/PrometheusMetricsFinder/overview/tabs/SimilarTab.js +1 -1
  118. package/lib/explore/PrometheusMetricsFinder/overview/tabs/SimilarTab.js.map +1 -1
  119. package/lib/explore/PrometheusMetricsFinder/types.js +1 -1
  120. package/lib/explore/PrometheusMetricsFinder/types.js.map +1 -1
  121. package/lib/explore/PrometheusMetricsFinder/utils.js +1 -1
  122. package/lib/explore/PrometheusMetricsFinder/utils.js.map +1 -1
  123. package/lib/explore/index.d.ts.map +1 -1
  124. package/lib/explore/index.js +12 -0
  125. package/lib/explore/index.js.map +1 -1
  126. package/lib/getPluginModule.d.ts.map +1 -1
  127. package/lib/getPluginModule.js +12 -0
  128. package/lib/getPluginModule.js.map +1 -1
  129. package/lib/index-federation.js +1 -1
  130. package/lib/index-federation.js.map +1 -1
  131. package/lib/index.d.ts.map +1 -1
  132. package/lib/index.js +12 -0
  133. package/lib/index.js.map +1 -1
  134. package/lib/model/api-types.js +1 -1
  135. package/lib/model/api-types.js.map +1 -1
  136. package/lib/model/index.js +1 -1
  137. package/lib/model/index.js.map +1 -1
  138. package/lib/model/parse-sample-values.js +1 -1
  139. package/lib/model/parse-sample-values.js.map +1 -1
  140. package/lib/model/prometheus-client.js +1 -1
  141. package/lib/model/prometheus-client.js.map +1 -1
  142. package/lib/model/prometheus-selectors.js +1 -1
  143. package/lib/model/prometheus-selectors.js.map +1 -1
  144. package/lib/model/time.js +1 -1
  145. package/lib/model/time.js.map +1 -1
  146. package/lib/plugins/MatcherEditor.js +1 -1
  147. package/lib/plugins/MatcherEditor.js.map +1 -1
  148. package/lib/plugins/PrometheusDatasourceEditor.js +1 -1
  149. package/lib/plugins/PrometheusDatasourceEditor.js.map +1 -1
  150. package/lib/plugins/PrometheusLabelNamesVariable.d.ts.map +1 -1
  151. package/lib/plugins/PrometheusLabelNamesVariable.js +12 -0
  152. package/lib/plugins/PrometheusLabelNamesVariable.js.map +1 -1
  153. package/lib/plugins/PrometheusLabelValuesVariable.d.ts.map +1 -1
  154. package/lib/plugins/PrometheusLabelValuesVariable.js +12 -0
  155. package/lib/plugins/PrometheusLabelValuesVariable.js.map +1 -1
  156. package/lib/plugins/PrometheusPromQLVariable.d.ts.map +1 -1
  157. package/lib/plugins/PrometheusPromQLVariable.js +12 -0
  158. package/lib/plugins/PrometheusPromQLVariable.js.map +1 -1
  159. package/lib/plugins/index.d.ts.map +1 -1
  160. package/lib/plugins/index.js +12 -0
  161. package/lib/plugins/index.js.map +1 -1
  162. package/lib/plugins/prometheus-datasource.js +1 -1
  163. package/lib/plugins/prometheus-datasource.js.map +1 -1
  164. package/lib/plugins/prometheus-time-series-query/PrometheusTimeSeriesQuery.js +1 -1
  165. package/lib/plugins/prometheus-time-series-query/PrometheusTimeSeriesQuery.js.map +1 -1
  166. package/lib/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.js +1 -1
  167. package/lib/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.js.map +1 -1
  168. package/lib/plugins/prometheus-time-series-query/get-time-series-data.js +1 -1
  169. package/lib/plugins/prometheus-time-series-query/get-time-series-data.js.map +1 -1
  170. package/lib/plugins/prometheus-time-series-query/index.js +1 -1
  171. package/lib/plugins/prometheus-time-series-query/index.js.map +1 -1
  172. package/lib/plugins/prometheus-time-series-query/query-editor-model.js +1 -1
  173. package/lib/plugins/prometheus-time-series-query/query-editor-model.js.map +1 -1
  174. package/lib/plugins/prometheus-time-series-query/replace-prom-builtin-variables.js +1 -1
  175. package/lib/plugins/prometheus-time-series-query/replace-prom-builtin-variables.js.map +1 -1
  176. package/lib/plugins/prometheus-time-series-query/time-series-query-model.js +1 -1
  177. package/lib/plugins/prometheus-time-series-query/time-series-query-model.js.map +1 -1
  178. package/lib/plugins/prometheus-variables.js +1 -1
  179. package/lib/plugins/prometheus-variables.js.map +1 -1
  180. package/lib/plugins/test/setup-tests.js +1 -1
  181. package/lib/plugins/test/setup-tests.js.map +1 -1
  182. package/lib/plugins/types.js +1 -1
  183. package/lib/plugins/types.js.map +1 -1
  184. package/lib/plugins/variable.js +1 -1
  185. package/lib/plugins/variable.js.map +1 -1
  186. package/lib/setup-tests.js +1 -1
  187. package/lib/setup-tests.js.map +1 -1
  188. package/lib/utils/index.js +1 -1
  189. package/lib/utils/index.js.map +1 -1
  190. package/lib/utils/utils.js +1 -1
  191. package/lib/utils/utils.js.map +1 -1
  192. package/mf-manifest.json +73 -73
  193. package/mf-stats.json +73 -73
  194. package/package.json +6 -6
  195. package/__mf/js/async/1490.7e5068f1.js +0 -22
  196. package/__mf/js/async/1728.af16c4ec.js +0 -1
  197. package/__mf/js/async/2984.7182c2f5.js +0 -1
  198. package/__mf/js/async/2999.1d8347df.js +0 -1
  199. package/__mf/js/async/3664.ba8b26b6.js +0 -2
  200. package/__mf/js/async/392.7cda691a.js +0 -2
  201. package/__mf/js/async/5440.c13c3533.js +0 -2
  202. package/__mf/js/async/5501.6166367c.js +0 -2
  203. package/__mf/js/async/6149.19799c37.js +0 -7
  204. /package/__mf/js/async/{6149.19799c37.js.LICENSE.txt → 3652.6b591718.js.LICENSE.txt} +0 -0
  205. /package/__mf/js/async/{392.7cda691a.js.LICENSE.txt → 392.f1b4a590.js.LICENSE.txt} +0 -0
  206. /package/__mf/js/async/{3664.ba8b26b6.js.LICENSE.txt → 4657.f0c3ccd6.js.LICENSE.txt} +0 -0
  207. /package/__mf/js/async/{1490.7e5068f1.js.LICENSE.txt → 54.e6002704.js.LICENSE.txt} +0 -0
  208. /package/__mf/js/async/{5501.6166367c.js.LICENSE.txt → 9010.ca50fa9e.js.LICENSE.txt} +0 -0
package/lib/cjs/env.d.js CHANGED
@@ -1,4 +1,4 @@
1
- // Copyright 2024 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,4 +1,4 @@
1
- // Copyright 2024 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,4 +1,4 @@
1
- // Copyright 2024 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,4 +1,4 @@
1
- // Copyright 2024 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,4 +1,4 @@
1
- // Copyright 2024 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,4 +1,4 @@
1
- // Copyright 2024 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,4 +1,4 @@
1
- // Copyright 2024 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,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,4 +1,4 @@
1
- // Copyright 2024 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,4 +1,4 @@
1
- // Copyright 2024 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,4 +1,4 @@
1
- // Copyright 2024 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,4 +1,4 @@
1
- // Copyright 2024 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,4 +1,4 @@
1
- // Copyright 2024 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,4 +1,4 @@
1
- // Copyright 2024 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,3 +1,15 @@
1
+ // Copyright The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the \"License\");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an \"AS IS\" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  "use strict";
2
14
  Object.defineProperty(exports, "__esModule", {
3
15
  value: true
@@ -1,3 +1,15 @@
1
+ // Copyright The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the \"License\");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an \"AS IS\" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  "use strict";
2
14
  Object.defineProperty(exports, "__esModule", {
3
15
  value: true
@@ -40,7 +40,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
40
40
  }
41
41
  return newObj;
42
42
  }
43
- // Copyright 2024 The Perses Authors
43
+ // Copyright The Perses Authors
44
44
  // Licensed under the Apache License, Version 2.0 (the "License");
45
45
  // you may not use this file except in compliance with the License.
46
46
  // You may obtain a copy of the License at
package/lib/cjs/index.js CHANGED
@@ -1,3 +1,15 @@
1
+ // Copyright The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the \"License\");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an \"AS IS\" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  "use strict";
2
14
  Object.defineProperty(exports, "__esModule", {
3
15
  value: true
@@ -1,4 +1,4 @@
1
- // Copyright 2025 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,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,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,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,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,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,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,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,3 +1,15 @@
1
+ // Copyright The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the \"License\");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an \"AS IS\" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  "use strict";
2
14
  Object.defineProperty(exports, "__esModule", {
3
15
  value: true
@@ -1,3 +1,15 @@
1
+ // Copyright The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the \"License\");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an \"AS IS\" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  "use strict";
2
14
  Object.defineProperty(exports, "__esModule", {
3
15
  value: true
@@ -1,3 +1,15 @@
1
+ // Copyright The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the \"License\");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an \"AS IS\" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  "use strict";
2
14
  Object.defineProperty(exports, "__esModule", {
3
15
  value: true
@@ -1,3 +1,15 @@
1
+ // Copyright The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the \"License\");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an \"AS IS\" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  "use strict";
2
14
  Object.defineProperty(exports, "__esModule", {
3
15
  value: true
@@ -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,4 +1,4 @@
1
- // Copyright 2024 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,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,4 +1,4 @@
1
- // Copyright 2025 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,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,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,4 +1,4 @@
1
- // Copyright 2024 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,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,4 +1,4 @@
1
- // Copyright 2024 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,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,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,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,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,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,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,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- // Copyright 2025 The Perses Authors
2
+ // Copyright The Perses Authors
3
3
  // Licensed under the Apache License, Version 2.0 (the "License");
4
4
  // you may not use this file except in compliance with the License.
5
5
  // You may obtain a copy of the License at
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/PromQLEditor.tsx"],"sourcesContent":["// Copyright 2025 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 CodeMirror, { ReactCodeMirrorProps } from '@uiw/react-codemirror';\nimport { PromQLExtension, CompleteConfiguration } from '@prometheus-io/codemirror-promql';\nimport { EditorView } from '@codemirror/view';\nimport { useTheme, CircularProgress, InputLabel, Stack, IconButton, Tooltip } from '@mui/material';\nimport FileTreeIcon from 'mdi-material-ui/FileTree';\nimport { ReactElement, useMemo, useState } from 'react';\nimport { ErrorAlert } from '@perses-dev/components';\nimport CloseIcon from 'mdi-material-ui/Close';\nimport { useReplaceVariablesInString } from '@perses-dev/plugin-system';\nimport { PrometheusDatasourceSelector } from '../model';\nimport { replacePromBuiltinVariables } from '../plugins/prometheus-time-series-query/replace-prom-builtin-variables';\nimport { useParseQuery } from './query';\nimport TreeNode from './TreeNode';\n\nconst treeViewStr = 'Tree View';\nconst treeViewOpenStr = 'Open ' + treeViewStr;\nconst treeViewCloseStr = 'Close ' + treeViewStr;\n\nexport type PromQLEditorProps = {\n completeConfig: CompleteConfiguration;\n datasource: PrometheusDatasourceSelector;\n isReadOnly?: boolean;\n treeViewMetadata?: {\n minStepMs: number;\n intervalMs: number;\n };\n} & Omit<ReactCodeMirrorProps, 'theme' | 'extensions'>;\n\nexport function PromQLEditor({\n completeConfig,\n datasource,\n isReadOnly,\n treeViewMetadata,\n ...rest\n}: PromQLEditorProps): ReactElement {\n const theme = useTheme();\n\n const isDarkMode = theme.palette.mode === 'dark';\n const [isTreeViewVisible, setTreeViewVisible] = useState(false);\n const readOnly = isReadOnly ?? false;\n\n const promQLExtension = useMemo(() => {\n return new PromQLExtension().activateLinter(false).setComplete(completeConfig).asExtension();\n }, [completeConfig]);\n\n let queryExpr = useReplaceVariablesInString(rest.value);\n if (queryExpr && treeViewMetadata) {\n const { minStepMs, intervalMs } = treeViewMetadata;\n queryExpr = replacePromBuiltinVariables(queryExpr, minStepMs, intervalMs);\n }\n\n const { data: parseQueryResponse, isLoading, error } = useParseQuery(queryExpr ?? '', datasource, isTreeViewVisible);\n\n const handleShowTreeView = (): void => {\n setTreeViewVisible(!isTreeViewVisible);\n };\n\n return (\n <Stack position=\"relative\">\n <InputLabel // reproduce the same kind of input label that regular MUI TextFields have\n shrink\n sx={{\n position: 'absolute',\n top: '-12px',\n left: '10px',\n padding: '0 4px',\n color: theme.palette.text.primary,\n zIndex: 1,\n }}\n >\n PromQL Expression\n </InputLabel>\n {/* TODO: We need to wait for this to be merged, then we need to add proper e2e for some scenarios */}\n <CodeMirror\n data-testid=\"promql_expression_editor\"\n {...rest}\n style={{ border: `1px solid ${theme.palette.divider}` }}\n theme={isDarkMode ? 'dark' : 'light'}\n readOnly={readOnly}\n basicSetup={{\n highlightActiveLine: false,\n highlightActiveLineGutter: false,\n foldGutter: false,\n }}\n extensions={[\n EditorView.lineWrapping,\n promQLExtension,\n EditorView.theme({\n '.cm-content': {\n paddingTop: '8px',\n paddingBottom: '8px',\n paddingRight: '40px', // offset for the tree view button\n },\n }),\n ]}\n placeholder=\"Example: sum(rate(http_requests_total[5m]))\"\n />\n {queryExpr && (\n <>\n <Tooltip title={isTreeViewVisible ? treeViewCloseStr : treeViewOpenStr}>\n <IconButton\n aria-label={isTreeViewVisible ? treeViewCloseStr : treeViewOpenStr}\n onClick={handleShowTreeView}\n sx={{ position: 'absolute', right: '5px', top: '5px' }}\n size=\"small\"\n key=\"tree-view-button\"\n >\n <FileTreeIcon sx={{ fontSize: '18px' }} />\n </IconButton>\n </Tooltip>\n {isTreeViewVisible && (\n <div style={{ border: `1px solid ${theme.palette.divider}`, position: 'relative' }}>\n <Tooltip title={treeViewCloseStr}>\n <IconButton\n aria-label={treeViewCloseStr}\n onClick={() => setTreeViewVisible(false)}\n sx={{ position: 'absolute', top: '5px', right: '5px' }}\n size=\"small\"\n key=\"tree-view-close-button\"\n >\n <CloseIcon sx={{ fontSize: '18px' }} />\n </IconButton>\n </Tooltip>\n {error ? (\n // Here the user is able to hide the error alert\n <ErrorAlert\n error={{\n name: `${treeViewStr} not available`,\n message: error.message,\n }}\n />\n ) : (\n <div\n style={{\n padding: `${theme.spacing(1.5)} ${theme.spacing(1.5)} 0 ${theme.spacing(1.5)}`, // let paddingBottom at 0 because nodes have margin-bottom\n overflowX: 'auto',\n backgroundColor: theme.palette.background.default,\n }}\n >\n {isLoading ? (\n <CircularProgress />\n ) : parseQueryResponse?.data ? (\n <TreeNode node={parseQueryResponse.data} reverse={false} childIdx={0} datasource={datasource} />\n ) : null}\n </div>\n )}\n </div>\n )}\n </>\n )}\n </Stack>\n );\n}\n"],"names":["CodeMirror","PromQLExtension","EditorView","useTheme","CircularProgress","InputLabel","Stack","IconButton","Tooltip","FileTreeIcon","useMemo","useState","ErrorAlert","CloseIcon","useReplaceVariablesInString","replacePromBuiltinVariables","useParseQuery","TreeNode","treeViewStr","treeViewOpenStr","treeViewCloseStr","PromQLEditor","completeConfig","datasource","isReadOnly","treeViewMetadata","rest","theme","isDarkMode","palette","mode","isTreeViewVisible","setTreeViewVisible","readOnly","promQLExtension","activateLinter","setComplete","asExtension","queryExpr","value","minStepMs","intervalMs","data","parseQueryResponse","isLoading","error","handleShowTreeView","position","shrink","sx","top","left","padding","color","text","primary","zIndex","data-testid","style","border","divider","basicSetup","highlightActiveLine","highlightActiveLineGutter","foldGutter","extensions","lineWrapping","paddingTop","paddingBottom","paddingRight","placeholder","title","aria-label","onClick","right","size","fontSize","div","name","message","spacing","overflowX","backgroundColor","background","default","node","reverse","childIdx"],"mappings":";AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;A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D,SAAS,IAAMzC,mBAAmB;oCAClCiB,IAAI;wCAAEF,UAAU;wCAAYG,KAAK;wCAAOwB,OAAO;oCAAM;oCACrDC,MAAK;8CAGL,cAAA,KAAC9D;wCAAUoC,IAAI;4CAAE2B,UAAU;wCAAO;;mCAF9B;;4BAKP/B,QACC,gDAAgD;0CAChD,KAACjC;gCACCiC,OAAO;oCACLiC,MAAM,GAAG5D,YAAY,cAAc,CAAC;oCACpC6D,SAASlC,MAAMkC,OAAO;gCACxB;+CAGF,KAACF;gCACCnB,OAAO;oCACLN,SAAS,GAAGzB,MAAMqD,OAAO,CAAC,KAAK,CAAC,EAAErD,MAAMqD,OAAO,CAAC,KAAK,GAAG,EAAErD,MAAMqD,OAAO,CAAC,MAAM;oCAC9EC,WAAW;oCACXC,iBAAiBvD,MAAME,OAAO,CAACsD,UAAU,CAACC,OAAO;gCACnD;0CAECxC,0BACC,KAACxC,wBACCuC,oBAAoBD,qBACtB,KAACzB;oCAASoE,MAAM1C,mBAAmBD,IAAI;oCAAE4C,SAAS;oCAAOC,UAAU;oCAAGhE,YAAYA;qCAChF;;;;;;;;AAStB"}
1
+ {"version":3,"sources":["../../../src/components/PromQLEditor.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 CodeMirror, { ReactCodeMirrorProps } from '@uiw/react-codemirror';\nimport { PromQLExtension, CompleteConfiguration } from '@prometheus-io/codemirror-promql';\nimport { EditorView } from '@codemirror/view';\nimport { useTheme, CircularProgress, InputLabel, Stack, IconButton, Tooltip } from '@mui/material';\nimport FileTreeIcon from 'mdi-material-ui/FileTree';\nimport { ReactElement, useMemo, useState } from 'react';\nimport { ErrorAlert } from '@perses-dev/components';\nimport CloseIcon from 'mdi-material-ui/Close';\nimport { useReplaceVariablesInString } from '@perses-dev/plugin-system';\nimport { PrometheusDatasourceSelector } from '../model';\nimport { replacePromBuiltinVariables } from '../plugins/prometheus-time-series-query/replace-prom-builtin-variables';\nimport { useParseQuery } from './query';\nimport TreeNode from './TreeNode';\n\nconst treeViewStr = 'Tree View';\nconst treeViewOpenStr = 'Open ' + treeViewStr;\nconst treeViewCloseStr = 'Close ' + treeViewStr;\n\nexport type PromQLEditorProps = {\n completeConfig: CompleteConfiguration;\n datasource: PrometheusDatasourceSelector;\n isReadOnly?: boolean;\n treeViewMetadata?: {\n minStepMs: number;\n intervalMs: number;\n };\n} & Omit<ReactCodeMirrorProps, 'theme' | 'extensions'>;\n\nexport function PromQLEditor({\n completeConfig,\n datasource,\n isReadOnly,\n treeViewMetadata,\n ...rest\n}: PromQLEditorProps): ReactElement {\n const theme = useTheme();\n\n const isDarkMode = theme.palette.mode === 'dark';\n const [isTreeViewVisible, setTreeViewVisible] = useState(false);\n const readOnly = isReadOnly ?? false;\n\n const promQLExtension = useMemo(() => {\n return new PromQLExtension().activateLinter(false).setComplete(completeConfig).asExtension();\n }, [completeConfig]);\n\n let queryExpr = useReplaceVariablesInString(rest.value);\n if (queryExpr && treeViewMetadata) {\n const { minStepMs, intervalMs } = treeViewMetadata;\n queryExpr = replacePromBuiltinVariables(queryExpr, minStepMs, intervalMs);\n }\n\n const { data: parseQueryResponse, isLoading, error } = useParseQuery(queryExpr ?? '', datasource, isTreeViewVisible);\n\n const handleShowTreeView = (): void => {\n setTreeViewVisible(!isTreeViewVisible);\n };\n\n return (\n <Stack position=\"relative\">\n <InputLabel // reproduce the same kind of input label that regular MUI TextFields have\n shrink\n sx={{\n position: 'absolute',\n top: '-12px',\n left: '10px',\n padding: '0 4px',\n color: theme.palette.text.primary,\n zIndex: 1,\n }}\n >\n PromQL Expression\n </InputLabel>\n {/* TODO: We need to wait for this to be merged, then we need to add proper e2e for some scenarios */}\n <CodeMirror\n data-testid=\"promql_expression_editor\"\n {...rest}\n style={{ border: `1px solid ${theme.palette.divider}` }}\n theme={isDarkMode ? 'dark' : 'light'}\n readOnly={readOnly}\n basicSetup={{\n highlightActiveLine: false,\n highlightActiveLineGutter: false,\n foldGutter: false,\n }}\n extensions={[\n EditorView.lineWrapping,\n promQLExtension,\n EditorView.theme({\n '.cm-content': {\n paddingTop: '8px',\n paddingBottom: '8px',\n paddingRight: '40px', // offset for the tree view button\n },\n }),\n ]}\n placeholder=\"Example: sum(rate(http_requests_total[5m]))\"\n />\n {queryExpr && (\n <>\n <Tooltip title={isTreeViewVisible ? treeViewCloseStr : treeViewOpenStr}>\n <IconButton\n aria-label={isTreeViewVisible ? treeViewCloseStr : treeViewOpenStr}\n onClick={handleShowTreeView}\n sx={{ position: 'absolute', right: '5px', top: '5px' }}\n size=\"small\"\n key=\"tree-view-button\"\n >\n <FileTreeIcon sx={{ fontSize: '18px' }} />\n </IconButton>\n </Tooltip>\n {isTreeViewVisible && (\n <div style={{ border: `1px solid ${theme.palette.divider}`, position: 'relative' }}>\n <Tooltip title={treeViewCloseStr}>\n <IconButton\n aria-label={treeViewCloseStr}\n onClick={() => setTreeViewVisible(false)}\n sx={{ position: 'absolute', top: '5px', right: '5px' }}\n size=\"small\"\n key=\"tree-view-close-button\"\n >\n <CloseIcon sx={{ fontSize: '18px' }} />\n </IconButton>\n </Tooltip>\n {error ? (\n // Here the user is able to hide the error alert\n <ErrorAlert\n error={{\n name: `${treeViewStr} not available`,\n message: error.message,\n }}\n />\n ) : (\n <div\n style={{\n padding: `${theme.spacing(1.5)} ${theme.spacing(1.5)} 0 ${theme.spacing(1.5)}`, // let paddingBottom at 0 because nodes have margin-bottom\n overflowX: 'auto',\n backgroundColor: theme.palette.background.default,\n }}\n >\n {isLoading ? (\n <CircularProgress />\n ) : parseQueryResponse?.data ? (\n <TreeNode node={parseQueryResponse.data} reverse={false} childIdx={0} datasource={datasource} />\n ) : null}\n </div>\n )}\n </div>\n )}\n </>\n )}\n </Stack>\n );\n}\n"],"names":["CodeMirror","PromQLExtension","EditorView","useTheme","CircularProgress","InputLabel","Stack","IconButton","Tooltip","FileTreeIcon","useMemo","useState","ErrorAlert","CloseIcon","useReplaceVariablesInString","replacePromBuiltinVariables","useParseQuery","TreeNode","treeViewStr","treeViewOpenStr","treeViewCloseStr","PromQLEditor","completeConfig","datasource","isReadOnly","treeViewMetadata","rest","theme","isDarkMode","palette","mode","isTreeViewVisible","setTreeViewVisible","readOnly","promQLExtension","activateLinter","setComplete","asExtension","queryExpr","value","minStepMs","intervalMs","data","parseQueryResponse","isLoading","error","handleShowTreeView","position","shrink","sx","top","left","padding","color","text","primary","zIndex","data-testid","style","border","divider","basicSetup","highlightActiveLine","highlightActiveLineGutter","foldGutter","extensions","lineWrapping","paddingTop","paddingBottom","paddingRight","placeholder","title","aria-label","onClick","right","size","fontSize","div","name","message","spacing","overflowX","backgroundColor","background","default","node","reverse","childIdx"],"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,OAAOA,gBAA0C,wBAAwB;AACzE,SAASC,eAAe,QAA+B,mCAAmC;AAC1F,SAASC,UAAU,QAAQ,mBAAmB;AAC9C,SAASC,QAAQ,EAAEC,gBAAgB,EAAEC,UAAU,EAAEC,KAAK,EAAEC,UAAU,EAAEC,OAAO,QAAQ,gBAAgB;AACnG,OAAOC,kBAAkB,2BAA2B;AACpD,SAAuBC,OAAO,EAAEC,QAAQ,QAAQ,QAAQ;AACxD,SAASC,UAAU,QAAQ,yBAAyB;AACpD,OAAOC,eAAe,wBAAwB;AAC9C,SAASC,2BAA2B,QAAQ,4BAA4B;AAExE,SAASC,2BAA2B,QA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;oCAC9EC,WAAW;oCACXC,iBAAiBvD,MAAME,OAAO,CAACsD,UAAU,CAACC,OAAO;gCACnD;0CAECxC,0BACC,KAACxC,wBACCuC,oBAAoBD,qBACtB,KAACzB;oCAASoE,MAAM1C,mBAAmBD,IAAI;oCAAE4C,SAAS;oCAAOC,UAAU;oCAAGhE,YAAYA;qCAChF;;;;;;;;AAStB"}
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- // Copyright 2025 The Perses Authors
2
+ // Copyright The Perses Authors
3
3
  // Licensed under the Apache License, Version 2.0 (the "License");
4
4
  // you may not use this file except in compliance with the License.
5
5
  // You may obtain a copy of the License at