@perses-dev/plugin-system 0.0.0-snapshot-scatterplot-fix-imports-95e1b59 → 0.0.0-snapshot-explorer-plugin-c4a7621

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 (400) hide show
  1. package/dist/cjs/components/DatasourceEditorForm/DatasourceEditorForm.js +82 -162
  2. package/dist/cjs/components/DatasourceSelect.js +8 -13
  3. package/dist/cjs/components/HTTPSettingsEditor/HTTPSettingsEditor.js +528 -0
  4. package/dist/cjs/components/{TimeSeriesQueryEditor → HTTPSettingsEditor}/index.js +2 -2
  5. package/dist/cjs/components/LegendOptionsEditor/LegendOptionsEditor.js +8 -7
  6. package/dist/cjs/components/MetricLabelInput/MetricLabelInput.js +41 -0
  7. package/dist/cjs/components/{TraceQueryEditor → MetricLabelInput}/index.js +2 -2
  8. package/dist/cjs/components/{TimeSeriesQueryEditor/TimeSeriesQueryEditor.js → MultiQueryEditor/MultiQueryEditor.js} +22 -18
  9. package/dist/cjs/components/{TimeSeriesQueryEditor/TimeSeriesQueryInput.js → MultiQueryEditor/QueryEditorContainer.js} +23 -11
  10. package/dist/cjs/{validation/duration.js → components/MultiQueryEditor/index.js} +14 -9
  11. package/dist/cjs/components/PanelSpecEditor/PanelSpecEditor.js +51 -59
  12. package/dist/cjs/components/PluginEditor/PluginEditor.js +16 -13
  13. package/dist/cjs/components/PluginEditor/plugin-editor-api.js +43 -32
  14. package/dist/cjs/components/PluginKindSelect/PluginKindSelect.js +55 -7
  15. package/dist/cjs/components/PluginRegistry/PluginRegistry.js +8 -9
  16. package/dist/cjs/components/PluginRegistry/plugin-indexes.js +17 -14
  17. package/dist/cjs/components/PluginSpecEditor/PluginSpecEditor.js +1 -1
  18. package/dist/cjs/components/ProjectSelect.js +5 -5
  19. package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +10 -71
  20. package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +391 -442
  21. package/dist/cjs/components/Variables/VariableEditorForm/VariablePreview.js +7 -7
  22. package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +6 -11
  23. package/dist/cjs/components/Variables/variable-model.js +26 -27
  24. package/dist/cjs/components/index.js +3 -1
  25. package/dist/cjs/context/ProjectStoreProvider.js +7 -4
  26. package/dist/cjs/context/ValidationProvider.js +69 -0
  27. package/dist/cjs/context/index.js +1 -0
  28. package/dist/cjs/index.js +1 -1
  29. package/dist/{components/TraceQueryEditor/index.js → cjs/model/explore.js} +4 -3
  30. package/dist/cjs/remote/PersesPlugin.types.js +16 -0
  31. package/dist/cjs/remote/PluginLoaderComponent.js +75 -0
  32. package/dist/cjs/remote/PluginRuntime.js +267 -0
  33. package/dist/cjs/{validation → remote}/index.js +2 -5
  34. package/dist/cjs/remote/remotePluginLoader.js +61 -0
  35. package/dist/cjs/runtime/DataQueriesProvider/DataQueriesProvider.js +18 -9
  36. package/dist/cjs/runtime/DataQueriesProvider/model.js +9 -8
  37. package/dist/cjs/runtime/QueryCountProvider.js +83 -0
  38. package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProvider.js +17 -4
  39. package/dist/cjs/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js +100 -0
  40. package/dist/cjs/runtime/TimeRangeProvider/index.js +2 -1
  41. package/dist/cjs/runtime/TimeRangeProvider/query-params.js +4 -7
  42. package/dist/cjs/runtime/UsageMetricsProvider.js +99 -0
  43. package/dist/cjs/runtime/builtin-variables.js +2 -2
  44. package/dist/cjs/runtime/datasources.js +23 -14
  45. package/dist/cjs/runtime/index.js +4 -2
  46. package/dist/cjs/runtime/plugin-registry.js +36 -24
  47. package/dist/cjs/runtime/time-series-queries.js +23 -28
  48. package/dist/cjs/runtime/trace-queries.js +6 -3
  49. package/dist/cjs/runtime/{template-variables.js → variables.js} +29 -47
  50. package/dist/cjs/stories/shared-utils/decorators/WithDataQueries.js +1 -1
  51. package/dist/cjs/stories/shared-utils/decorators/WithPluginRegistry.js +1 -67
  52. package/dist/cjs/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js +1 -1
  53. package/dist/cjs/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js +4 -4
  54. package/dist/cjs/stories/shared-utils/decorators/{WithPluginSystemTemplateVariables.js → WithPluginSystemVariables.js} +9 -9
  55. package/dist/cjs/stories/shared-utils/decorators/WithTimeRange.js +1 -1
  56. package/dist/cjs/stories/shared-utils/decorators/index.js +2 -2
  57. package/dist/cjs/test/mock-data.js +25 -4
  58. package/dist/cjs/test/render.js +2 -11
  59. package/dist/cjs/test/test-plugins/bert/index.js +20 -19
  60. package/dist/cjs/test-utils/mock-plugin-registry.js +10 -10
  61. package/dist/cjs/utils/variables.js +24 -24
  62. package/dist/components/CalculationSelector/CalculationSelector.d.ts +2 -1
  63. package/dist/components/CalculationSelector/CalculationSelector.d.ts.map +1 -1
  64. package/dist/components/CalculationSelector/CalculationSelector.js.map +1 -1
  65. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts +6 -5
  66. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts.map +1 -1
  67. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js +85 -165
  68. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js.map +1 -1
  69. package/dist/components/DatasourceSelect.d.ts +3 -2
  70. package/dist/components/DatasourceSelect.d.ts.map +1 -1
  71. package/dist/components/DatasourceSelect.js +8 -13
  72. package/dist/components/DatasourceSelect.js.map +1 -1
  73. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.d.ts +11 -0
  74. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.d.ts.map +1 -0
  75. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js +474 -0
  76. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js.map +1 -0
  77. package/dist/components/HTTPSettingsEditor/index.d.ts +2 -0
  78. package/dist/components/HTTPSettingsEditor/index.d.ts.map +1 -0
  79. package/dist/{validation/duration.js → components/HTTPSettingsEditor/index.js} +2 -4
  80. package/dist/components/HTTPSettingsEditor/index.js.map +1 -0
  81. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.d.ts +3 -1
  82. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.d.ts.map +1 -1
  83. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js +10 -9
  84. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js.map +1 -1
  85. package/dist/components/MetricLabelInput/MetricLabelInput.d.ts +7 -0
  86. package/dist/components/MetricLabelInput/MetricLabelInput.d.ts.map +1 -0
  87. package/dist/components/MetricLabelInput/MetricLabelInput.js +33 -0
  88. package/dist/components/MetricLabelInput/MetricLabelInput.js.map +1 -0
  89. package/dist/components/MetricLabelInput/index.d.ts +2 -0
  90. package/dist/components/MetricLabelInput/index.d.ts.map +1 -0
  91. package/dist/components/MetricLabelInput/index.js +15 -0
  92. package/dist/components/MetricLabelInput/index.js.map +1 -0
  93. package/dist/components/MultiQueryEditor/MultiQueryEditor.d.ts +17 -0
  94. package/dist/components/MultiQueryEditor/MultiQueryEditor.d.ts.map +1 -0
  95. package/dist/components/{TimeSeriesQueryEditor/TimeSeriesQueryEditor.js → MultiQueryEditor/MultiQueryEditor.js} +29 -18
  96. package/dist/components/MultiQueryEditor/MultiQueryEditor.js.map +1 -0
  97. package/dist/components/MultiQueryEditor/QueryEditorContainer.d.ts +29 -0
  98. package/dist/components/MultiQueryEditor/QueryEditorContainer.d.ts.map +1 -0
  99. package/dist/components/{TimeSeriesQueryEditor/TimeSeriesQueryInput.js → MultiQueryEditor/QueryEditorContainer.js} +33 -10
  100. package/dist/components/MultiQueryEditor/QueryEditorContainer.js.map +1 -0
  101. package/dist/components/MultiQueryEditor/index.d.ts +2 -0
  102. package/dist/components/MultiQueryEditor/index.d.ts.map +1 -0
  103. package/dist/components/MultiQueryEditor/index.js +15 -0
  104. package/dist/components/{TraceQueryEditor → MultiQueryEditor}/index.js.map +1 -1
  105. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts +2 -2
  106. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts.map +1 -1
  107. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js.map +1 -1
  108. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts +2 -2
  109. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts.map +1 -1
  110. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js.map +1 -1
  111. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.d.ts +3 -3
  112. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.d.ts.map +1 -1
  113. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js.map +1 -1
  114. package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts +5 -2
  115. package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts.map +1 -1
  116. package/dist/components/PanelSpecEditor/PanelSpecEditor.js +53 -61
  117. package/dist/components/PanelSpecEditor/PanelSpecEditor.js.map +1 -1
  118. package/dist/components/PluginEditor/PluginEditor.d.ts +2 -1
  119. package/dist/components/PluginEditor/PluginEditor.d.ts.map +1 -1
  120. package/dist/components/PluginEditor/PluginEditor.js +16 -13
  121. package/dist/components/PluginEditor/PluginEditor.js.map +1 -1
  122. package/dist/components/PluginEditor/plugin-editor-api.d.ts +15 -8
  123. package/dist/components/PluginEditor/plugin-editor-api.d.ts.map +1 -1
  124. package/dist/components/PluginEditor/plugin-editor-api.js +43 -32
  125. package/dist/components/PluginEditor/plugin-editor-api.js.map +1 -1
  126. package/dist/components/PluginKindSelect/PluginKindSelect.d.ts +10 -4
  127. package/dist/components/PluginKindSelect/PluginKindSelect.d.ts.map +1 -1
  128. package/dist/components/PluginKindSelect/PluginKindSelect.js +61 -10
  129. package/dist/components/PluginKindSelect/PluginKindSelect.js.map +1 -1
  130. package/dist/components/PluginRegistry/PluginRegistry.d.ts +2 -2
  131. package/dist/components/PluginRegistry/PluginRegistry.d.ts.map +1 -1
  132. package/dist/components/PluginRegistry/PluginRegistry.js +8 -9
  133. package/dist/components/PluginRegistry/PluginRegistry.js.map +1 -1
  134. package/dist/components/PluginRegistry/plugin-indexes.d.ts +4 -4
  135. package/dist/components/PluginRegistry/plugin-indexes.d.ts.map +1 -1
  136. package/dist/components/PluginRegistry/plugin-indexes.js +17 -14
  137. package/dist/components/PluginRegistry/plugin-indexes.js.map +1 -1
  138. package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts +5 -4
  139. package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts.map +1 -1
  140. package/dist/components/PluginSpecEditor/PluginSpecEditor.js +1 -1
  141. package/dist/components/PluginSpecEditor/PluginSpecEditor.js.map +1 -1
  142. package/dist/components/ProjectSelect.d.ts +2 -1
  143. package/dist/components/ProjectSelect.d.ts.map +1 -1
  144. package/dist/components/ProjectSelect.js +5 -5
  145. package/dist/components/ProjectSelect.js.map +1 -1
  146. package/dist/components/TimeRangeControls/TimeRangeControls.d.ts +3 -2
  147. package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -1
  148. package/dist/components/TimeRangeControls/TimeRangeControls.js +12 -70
  149. package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
  150. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts +4 -3
  151. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
  152. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +395 -446
  153. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
  154. package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts +3 -2
  155. package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts.map +1 -1
  156. package/dist/components/Variables/VariableEditorForm/VariablePreview.js +7 -7
  157. package/dist/components/Variables/VariableEditorForm/VariablePreview.js.map +1 -1
  158. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts +2 -2
  159. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts.map +1 -1
  160. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +6 -11
  161. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -1
  162. package/dist/components/Variables/variable-model.d.ts +2 -1
  163. package/dist/components/Variables/variable-model.d.ts.map +1 -1
  164. package/dist/components/Variables/variable-model.js +27 -28
  165. package/dist/components/Variables/variable-model.js.map +1 -1
  166. package/dist/components/index.d.ts +3 -1
  167. package/dist/components/index.d.ts.map +1 -1
  168. package/dist/components/index.js +3 -1
  169. package/dist/components/index.js.map +1 -1
  170. package/dist/context/ProjectStoreProvider.d.ts +4 -4
  171. package/dist/context/ProjectStoreProvider.d.ts.map +1 -1
  172. package/dist/context/ProjectStoreProvider.js +7 -4
  173. package/dist/context/ProjectStoreProvider.js.map +1 -1
  174. package/dist/context/ValidationProvider.d.ts +19 -0
  175. package/dist/context/ValidationProvider.d.ts.map +1 -0
  176. package/dist/context/ValidationProvider.js +52 -0
  177. package/dist/context/ValidationProvider.js.map +1 -0
  178. package/dist/context/index.d.ts +1 -0
  179. package/dist/context/index.d.ts.map +1 -1
  180. package/dist/context/index.js +1 -0
  181. package/dist/context/index.js.map +1 -1
  182. package/dist/context/query-params.d.ts.map +1 -1
  183. package/dist/context/query-params.js.map +1 -1
  184. package/dist/index.d.ts +1 -1
  185. package/dist/index.d.ts.map +1 -1
  186. package/dist/index.js +1 -1
  187. package/dist/index.js.map +1 -1
  188. package/dist/model/explore.d.ts +13 -0
  189. package/dist/model/explore.d.ts.map +1 -0
  190. package/dist/{validation/index.js → model/explore.js} +4 -6
  191. package/dist/model/explore.js.map +1 -0
  192. package/dist/model/legend.d.ts.map +1 -1
  193. package/dist/model/legend.js.map +1 -1
  194. package/dist/model/panels.d.ts +16 -4
  195. package/dist/model/panels.d.ts.map +1 -1
  196. package/dist/model/panels.js.map +1 -1
  197. package/dist/model/plugin-loading.js.map +1 -1
  198. package/dist/model/plugins.d.ts +31 -17
  199. package/dist/model/plugins.d.ts.map +1 -1
  200. package/dist/model/plugins.js.map +1 -1
  201. package/dist/model/time-series-queries.d.ts +2 -1
  202. package/dist/model/time-series-queries.d.ts.map +1 -1
  203. package/dist/model/time-series-queries.js.map +1 -1
  204. package/dist/remote/PersesPlugin.types.d.ts +7 -0
  205. package/dist/remote/PersesPlugin.types.d.ts.map +1 -0
  206. package/dist/remote/PersesPlugin.types.js +15 -0
  207. package/dist/remote/PersesPlugin.types.js.map +1 -0
  208. package/dist/remote/PluginLoaderComponent.d.ts +10 -0
  209. package/dist/remote/PluginLoaderComponent.d.ts.map +1 -0
  210. package/dist/remote/PluginLoaderComponent.js +67 -0
  211. package/dist/remote/PluginLoaderComponent.js.map +1 -0
  212. package/dist/remote/PluginRuntime.d.ts +11 -0
  213. package/dist/remote/PluginRuntime.d.ts.map +1 -0
  214. package/dist/remote/PluginRuntime.js +202 -0
  215. package/dist/remote/PluginRuntime.js.map +1 -0
  216. package/dist/remote/index.d.ts +3 -0
  217. package/dist/remote/index.d.ts.map +1 -0
  218. package/dist/{components/TimeSeriesQueryEditor → remote}/index.js +2 -1
  219. package/dist/remote/index.js.map +1 -0
  220. package/dist/remote/remotePluginLoader.d.ts +3 -0
  221. package/dist/remote/remotePluginLoader.d.ts.map +1 -0
  222. package/dist/remote/remotePluginLoader.js +53 -0
  223. package/dist/remote/remotePluginLoader.js.map +1 -0
  224. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts +2 -2
  225. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts.map +1 -1
  226. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js +18 -9
  227. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js.map +1 -1
  228. package/dist/runtime/DataQueriesProvider/model.d.ts +5 -6
  229. package/dist/runtime/DataQueriesProvider/model.d.ts.map +1 -1
  230. package/dist/runtime/DataQueriesProvider/model.js +9 -8
  231. package/dist/runtime/DataQueriesProvider/model.js.map +1 -1
  232. package/dist/runtime/QueryCountProvider.d.ts +9 -0
  233. package/dist/runtime/QueryCountProvider.d.ts.map +1 -0
  234. package/dist/{validation/datasource.js → runtime/QueryCountProvider.js} +14 -10
  235. package/dist/runtime/QueryCountProvider.js.map +1 -0
  236. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts +2 -2
  237. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts.map +1 -1
  238. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js +17 -4
  239. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js.map +1 -1
  240. package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.d.ts +2 -2
  241. package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.d.ts.map +1 -1
  242. package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.js.map +1 -1
  243. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.d.ts +32 -0
  244. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.d.ts.map +1 -0
  245. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js +82 -0
  246. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js.map +1 -0
  247. package/dist/runtime/TimeRangeProvider/index.d.ts +1 -0
  248. package/dist/runtime/TimeRangeProvider/index.d.ts.map +1 -1
  249. package/dist/runtime/TimeRangeProvider/index.js +2 -1
  250. package/dist/runtime/TimeRangeProvider/index.js.map +1 -1
  251. package/dist/runtime/TimeRangeProvider/query-params.d.ts.map +1 -1
  252. package/dist/runtime/TimeRangeProvider/query-params.js +4 -7
  253. package/dist/runtime/TimeRangeProvider/query-params.js.map +1 -1
  254. package/dist/runtime/TimeRangeProvider/refresh-interval.d.ts.map +1 -1
  255. package/dist/runtime/TimeRangeProvider/refresh-interval.js.map +1 -1
  256. package/dist/runtime/UsageMetricsProvider.d.ts +25 -0
  257. package/dist/runtime/UsageMetricsProvider.d.ts.map +1 -0
  258. package/dist/runtime/UsageMetricsProvider.js +77 -0
  259. package/dist/runtime/UsageMetricsProvider.js.map +1 -0
  260. package/dist/runtime/builtin-variables.d.ts +1 -1
  261. package/dist/runtime/builtin-variables.d.ts.map +1 -1
  262. package/dist/runtime/builtin-variables.js +2 -2
  263. package/dist/runtime/builtin-variables.js.map +1 -1
  264. package/dist/runtime/datasources.d.ts +5 -4
  265. package/dist/runtime/datasources.d.ts.map +1 -1
  266. package/dist/runtime/datasources.js +23 -14
  267. package/dist/runtime/datasources.js.map +1 -1
  268. package/dist/runtime/index.d.ts +3 -1
  269. package/dist/runtime/index.d.ts.map +1 -1
  270. package/dist/runtime/index.js +4 -2
  271. package/dist/runtime/index.js.map +1 -1
  272. package/dist/runtime/plugin-registry.d.ts +10 -10
  273. package/dist/runtime/plugin-registry.d.ts.map +1 -1
  274. package/dist/runtime/plugin-registry.js +36 -24
  275. package/dist/runtime/plugin-registry.js.map +1 -1
  276. package/dist/runtime/time-series-queries.d.ts +5 -4
  277. package/dist/runtime/time-series-queries.d.ts.map +1 -1
  278. package/dist/runtime/time-series-queries.js +23 -28
  279. package/dist/runtime/time-series-queries.js.map +1 -1
  280. package/dist/runtime/trace-queries.d.ts +4 -3
  281. package/dist/runtime/trace-queries.d.ts.map +1 -1
  282. package/dist/runtime/trace-queries.js +7 -4
  283. package/dist/runtime/trace-queries.js.map +1 -1
  284. package/dist/runtime/{template-variables.d.ts → variables.d.ts} +4 -4
  285. package/dist/runtime/variables.d.ts.map +1 -0
  286. package/dist/runtime/{template-variables.js → variables.js} +28 -45
  287. package/dist/runtime/variables.js.map +1 -0
  288. package/dist/stories/shared-utils/decorators/WithDataQueries.d.ts +2 -1
  289. package/dist/stories/shared-utils/decorators/WithDataQueries.d.ts.map +1 -1
  290. package/dist/stories/shared-utils/decorators/WithDataQueries.js +1 -1
  291. package/dist/stories/shared-utils/decorators/WithDataQueries.js.map +1 -1
  292. package/dist/stories/shared-utils/decorators/WithPluginRegistry.d.ts +2 -1
  293. package/dist/stories/shared-utils/decorators/WithPluginRegistry.d.ts.map +1 -1
  294. package/dist/stories/shared-utils/decorators/WithPluginRegistry.js +2 -22
  295. package/dist/stories/shared-utils/decorators/WithPluginRegistry.js.map +1 -1
  296. package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.d.ts +2 -1
  297. package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.d.ts.map +1 -1
  298. package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js +1 -1
  299. package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js.map +1 -1
  300. package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.d.ts +2 -1
  301. package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.d.ts.map +1 -1
  302. package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js +4 -4
  303. package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js.map +1 -1
  304. package/dist/stories/shared-utils/decorators/WithPluginSystemVariables.d.ts +13 -0
  305. package/dist/stories/shared-utils/decorators/WithPluginSystemVariables.d.ts.map +1 -0
  306. package/dist/stories/shared-utils/decorators/{WithPluginSystemTemplateVariables.js → WithPluginSystemVariables.js} +10 -10
  307. package/dist/stories/shared-utils/decorators/WithPluginSystemVariables.js.map +1 -0
  308. package/dist/stories/shared-utils/decorators/WithTimeRange.d.ts +2 -1
  309. package/dist/stories/shared-utils/decorators/WithTimeRange.d.ts.map +1 -1
  310. package/dist/stories/shared-utils/decorators/WithTimeRange.js +1 -1
  311. package/dist/stories/shared-utils/decorators/WithTimeRange.js.map +1 -1
  312. package/dist/stories/shared-utils/decorators/index.d.ts +1 -1
  313. package/dist/stories/shared-utils/decorators/index.d.ts.map +1 -1
  314. package/dist/stories/shared-utils/decorators/index.js +2 -2
  315. package/dist/stories/shared-utils/decorators/index.js.map +1 -1
  316. package/dist/test/mock-data.d.ts.map +1 -1
  317. package/dist/test/mock-data.js +25 -4
  318. package/dist/test/mock-data.js.map +1 -1
  319. package/dist/test/render.d.ts +3 -3
  320. package/dist/test/render.d.ts.map +1 -1
  321. package/dist/test/render.js +2 -11
  322. package/dist/test/render.js.map +1 -1
  323. package/dist/test/test-plugins/bert/index.d.ts.map +1 -1
  324. package/dist/test/test-plugins/bert/index.js +20 -19
  325. package/dist/test/test-plugins/bert/index.js.map +1 -1
  326. package/dist/test-utils/mock-plugin-registry.d.ts +5 -3
  327. package/dist/test-utils/mock-plugin-registry.d.ts.map +1 -1
  328. package/dist/test-utils/mock-plugin-registry.js +10 -10
  329. package/dist/test-utils/mock-plugin-registry.js.map +1 -1
  330. package/dist/utils/variables.d.ts +4 -4
  331. package/dist/utils/variables.d.ts.map +1 -1
  332. package/dist/utils/variables.js +19 -19
  333. package/dist/utils/variables.js.map +1 -1
  334. package/package.json +7 -6
  335. package/dist/cjs/components/TraceQueryEditor/TraceQueryEditor.js +0 -143
  336. package/dist/cjs/components/TraceQueryEditor/TraceQueryInput.js +0 -96
  337. package/dist/cjs/validation/datasource.js +0 -30
  338. package/dist/cjs/validation/resource.js +0 -24
  339. package/dist/cjs/validation/role.js +0 -86
  340. package/dist/cjs/validation/rolebinding.js +0 -55
  341. package/dist/cjs/validation/secret.js +0 -176
  342. package/dist/cjs/validation/user.js +0 -46
  343. package/dist/cjs/validation/variable.js +0 -48
  344. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.d.ts +0 -7
  345. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.d.ts.map +0 -1
  346. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js.map +0 -1
  347. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.d.ts +0 -12
  348. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.d.ts.map +0 -1
  349. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js.map +0 -1
  350. package/dist/components/TimeSeriesQueryEditor/index.d.ts +0 -2
  351. package/dist/components/TimeSeriesQueryEditor/index.d.ts.map +0 -1
  352. package/dist/components/TimeSeriesQueryEditor/index.js.map +0 -1
  353. package/dist/components/TraceQueryEditor/TraceQueryEditor.d.ts +0 -8
  354. package/dist/components/TraceQueryEditor/TraceQueryEditor.d.ts.map +0 -1
  355. package/dist/components/TraceQueryEditor/TraceQueryEditor.js +0 -130
  356. package/dist/components/TraceQueryEditor/TraceQueryEditor.js.map +0 -1
  357. package/dist/components/TraceQueryEditor/TraceQueryInput.d.ts +0 -12
  358. package/dist/components/TraceQueryEditor/TraceQueryInput.d.ts.map +0 -1
  359. package/dist/components/TraceQueryEditor/TraceQueryInput.js +0 -83
  360. package/dist/components/TraceQueryEditor/TraceQueryInput.js.map +0 -1
  361. package/dist/components/TraceQueryEditor/index.d.ts +0 -2
  362. package/dist/components/TraceQueryEditor/index.d.ts.map +0 -1
  363. package/dist/runtime/template-variables.d.ts.map +0 -1
  364. package/dist/runtime/template-variables.js.map +0 -1
  365. package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.d.ts +0 -12
  366. package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.d.ts.map +0 -1
  367. package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.js.map +0 -1
  368. package/dist/validation/datasource.d.ts +0 -19
  369. package/dist/validation/datasource.d.ts.map +0 -1
  370. package/dist/validation/datasource.js.map +0 -1
  371. package/dist/validation/duration.d.ts +0 -3
  372. package/dist/validation/duration.d.ts.map +0 -1
  373. package/dist/validation/duration.js.map +0 -1
  374. package/dist/validation/index.d.ts +0 -6
  375. package/dist/validation/index.d.ts.map +0 -1
  376. package/dist/validation/index.js.map +0 -1
  377. package/dist/validation/resource.d.ts +0 -3
  378. package/dist/validation/resource.d.ts.map +0 -1
  379. package/dist/validation/resource.js +0 -16
  380. package/dist/validation/resource.js.map +0 -1
  381. package/dist/validation/role.d.ts +0 -228
  382. package/dist/validation/role.d.ts.map +0 -1
  383. package/dist/validation/role.js +0 -67
  384. package/dist/validation/role.js.map +0 -1
  385. package/dist/validation/rolebinding.d.ts +0 -137
  386. package/dist/validation/rolebinding.d.ts.map +0 -1
  387. package/dist/validation/rolebinding.js +0 -47
  388. package/dist/validation/rolebinding.js.map +0 -1
  389. package/dist/validation/secret.d.ts +0 -964
  390. package/dist/validation/secret.d.ts.map +0 -1
  391. package/dist/validation/secret.js +0 -157
  392. package/dist/validation/secret.js.map +0 -1
  393. package/dist/validation/user.d.ts +0 -93
  394. package/dist/validation/user.d.ts.map +0 -1
  395. package/dist/validation/user.js +0 -38
  396. package/dist/validation/user.js.map +0 -1
  397. package/dist/validation/variable.d.ts +0 -96
  398. package/dist/validation/variable.d.ts.map +0 -1
  399. package/dist/validation/variable.js +0 -40
  400. package/dist/validation/variable.js.map +0 -1
@@ -0,0 +1,267 @@
1
+ /* eslint-disable @typescript-eslint/no-require-imports */ // Copyright 2024 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.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ function _export(target, all) {
18
+ for(var name in all)Object.defineProperty(target, name, {
19
+ enumerable: true,
20
+ get: all[name]
21
+ });
22
+ }
23
+ _export(exports, {
24
+ loadPlugin: function() {
25
+ return loadPlugin;
26
+ },
27
+ pluginRuntime: function() {
28
+ return pluginRuntime;
29
+ },
30
+ usePluginRuntime: function() {
31
+ return usePluginRuntime;
32
+ }
33
+ });
34
+ const _runtime = require("@module-federation/enhanced/runtime");
35
+ const _reactquery = /*#__PURE__*/ _interop_require_wildcard(require("@tanstack/react-query"));
36
+ const _react = /*#__PURE__*/ _interop_require_default(require("react"));
37
+ const _reactdom = /*#__PURE__*/ _interop_require_default(require("react-dom"));
38
+ const _reactrouterdom = /*#__PURE__*/ _interop_require_wildcard(require("react-router-dom"));
39
+ const _reacthookform = /*#__PURE__*/ _interop_require_wildcard(require("react-hook-form"));
40
+ function _interop_require_default(obj) {
41
+ return obj && obj.__esModule ? obj : {
42
+ default: obj
43
+ };
44
+ }
45
+ function _getRequireWildcardCache(nodeInterop) {
46
+ if (typeof WeakMap !== "function") return null;
47
+ var cacheBabelInterop = new WeakMap();
48
+ var cacheNodeInterop = new WeakMap();
49
+ return (_getRequireWildcardCache = function(nodeInterop) {
50
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
51
+ })(nodeInterop);
52
+ }
53
+ function _interop_require_wildcard(obj, nodeInterop) {
54
+ if (!nodeInterop && obj && obj.__esModule) {
55
+ return obj;
56
+ }
57
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
58
+ return {
59
+ default: obj
60
+ };
61
+ }
62
+ var cache = _getRequireWildcardCache(nodeInterop);
63
+ if (cache && cache.has(obj)) {
64
+ return cache.get(obj);
65
+ }
66
+ var newObj = {
67
+ __proto__: null
68
+ };
69
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
70
+ for(var key in obj){
71
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
72
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
73
+ if (desc && (desc.get || desc.set)) {
74
+ Object.defineProperty(newObj, key, desc);
75
+ } else {
76
+ newObj[key] = obj[key];
77
+ }
78
+ }
79
+ }
80
+ newObj.default = obj;
81
+ if (cache) {
82
+ cache.set(obj, newObj);
83
+ }
84
+ return newObj;
85
+ }
86
+ const pluginRuntime = (0, _runtime.init)({
87
+ name: '@perses/perses-ui-host',
88
+ remotes: [],
89
+ shared: {
90
+ react: {
91
+ version: _react.default.version,
92
+ lib: ()=>_react.default,
93
+ shareConfig: {
94
+ singleton: true,
95
+ requiredVersion: `^${_react.default.version}`
96
+ }
97
+ },
98
+ 'react-dom': {
99
+ version: '18.3.1',
100
+ lib: ()=>_reactdom.default,
101
+ shareConfig: {
102
+ singleton: true,
103
+ requiredVersion: `^18.3.1`
104
+ }
105
+ },
106
+ 'react-router-dom': {
107
+ version: '6.26.0',
108
+ lib: ()=>_reactrouterdom,
109
+ shareConfig: {
110
+ singleton: true,
111
+ requiredVersion: '^6.26.0'
112
+ }
113
+ },
114
+ '@tanstack/react-query': {
115
+ version: '4.36.1',
116
+ lib: ()=>_reactquery,
117
+ shareConfig: {
118
+ singleton: true,
119
+ requiredVersion: '^4.36.1'
120
+ }
121
+ },
122
+ 'react-hook-form': {
123
+ version: '7.52.2',
124
+ lib: ()=>_reacthookform,
125
+ shareConfig: {
126
+ singleton: true,
127
+ requiredVersion: '^7.52.2'
128
+ }
129
+ },
130
+ echarts: {
131
+ version: '5.5.0',
132
+ lib: ()=>require('echarts'),
133
+ shareConfig: {
134
+ singleton: true,
135
+ requiredVersion: '^5.5.0'
136
+ }
137
+ },
138
+ '@perses-dev/components': {
139
+ version: '0.50.0',
140
+ lib: ()=>require('@perses-dev/components'),
141
+ shareConfig: {
142
+ singleton: true,
143
+ requiredVersion: '^0.50.0'
144
+ }
145
+ },
146
+ '@perses-dev/plugin-system': {
147
+ version: '0.50.0',
148
+ lib: ()=>require('@perses-dev/plugin-system'),
149
+ shareConfig: {
150
+ singleton: true,
151
+ requiredVersion: '^0.50.0'
152
+ }
153
+ },
154
+ '@perses-dev/explore': {
155
+ version: '0.50.0',
156
+ lib: ()=>require('@perses-dev/explore'),
157
+ shareConfig: {
158
+ singleton: true,
159
+ requiredVersion: '^0.50.0'
160
+ }
161
+ },
162
+ '@perses-dev/dashboards': {
163
+ version: '0.50.0',
164
+ lib: ()=>require('@perses-dev/dashboards'),
165
+ shareConfig: {
166
+ singleton: true,
167
+ requiredVersion: '^0.50.0'
168
+ }
169
+ },
170
+ // Below are the shared modules that are used by the plugins, this can be part of the SDK
171
+ 'date-fns': {
172
+ version: '2.29.3',
173
+ lib: ()=>require('date-fns'),
174
+ shareConfig: {
175
+ singleton: true,
176
+ requiredVersion: '^2.29.3'
177
+ }
178
+ },
179
+ 'date-fns-tz': {
180
+ version: '1.3.8',
181
+ lib: ()=>require('date-fns-tz'),
182
+ shareConfig: {
183
+ singleton: true,
184
+ requiredVersion: '^1.3.8'
185
+ }
186
+ },
187
+ lodash: {
188
+ version: '4.17.21',
189
+ lib: ()=>require('lodash'),
190
+ shareConfig: {
191
+ singleton: true,
192
+ requiredVersion: '^4.17.21'
193
+ }
194
+ },
195
+ '@emotion/react': {
196
+ version: '11.11.3',
197
+ lib: ()=>require('@emotion/react'),
198
+ shareConfig: {
199
+ singleton: true,
200
+ requiredVersion: '^11.11.3'
201
+ }
202
+ },
203
+ '@emotion/styled': {
204
+ version: '11.11.0',
205
+ lib: ()=>require('@emotion/styled'),
206
+ shareConfig: {
207
+ singleton: true,
208
+ requiredVersion: '^11.11.0'
209
+ }
210
+ },
211
+ '@hookform/resolvers/zod': {
212
+ version: '3.3.4',
213
+ lib: ()=>require('@hookform/resolvers/zod'),
214
+ shareConfig: {
215
+ singleton: true,
216
+ requiredVersion: '^3.3.4'
217
+ }
218
+ },
219
+ 'use-resize-observer': {
220
+ version: '9.1.0',
221
+ lib: ()=>require('use-resize-observer'),
222
+ shareConfig: {
223
+ singleton: true,
224
+ requiredVersion: '^9.1.0'
225
+ }
226
+ },
227
+ 'mdi-material-ui': {
228
+ version: '7.4.0',
229
+ lib: ()=>require('mdi-material-ui'),
230
+ shareConfig: {
231
+ singleton: true,
232
+ requiredVersion: '^7.4.0'
233
+ }
234
+ },
235
+ immer: {
236
+ version: '9.0.15',
237
+ lib: ()=>require('immer'),
238
+ shareConfig: {
239
+ singleton: true,
240
+ requiredVersion: '^9.0.15'
241
+ }
242
+ }
243
+ }
244
+ });
245
+ const registerRemote = (name, baseURL)=>{
246
+ const existingRemote = pluginRuntime.options.remotes.find((remote)=>remote.name === name);
247
+ if (!existingRemote) {
248
+ const remoteEntryURL = baseURL ? `${baseURL}/${name}/mf-manifest.json` : `/plugins/${name}/mf-manifest.json`;
249
+ pluginRuntime.registerRemotes([
250
+ {
251
+ name,
252
+ entry: remoteEntryURL,
253
+ alias: name
254
+ }
255
+ ]);
256
+ }
257
+ };
258
+ const loadPlugin = async (moduleName, pluginName, baseURL)=>{
259
+ registerRemote(moduleName, baseURL);
260
+ return (0, _runtime.loadRemote)(`${moduleName}/${pluginName}`);
261
+ };
262
+ function usePluginRuntime({ plugin }) {
263
+ return {
264
+ pluginRuntime,
265
+ loadPlugin: ()=>loadPlugin(plugin.moduleName, plugin.name, plugin.baseURL)
266
+ };
267
+ }
@@ -14,11 +14,8 @@
14
14
  Object.defineProperty(exports, "__esModule", {
15
15
  value: true
16
16
  });
17
- _export_star(require("./datasource"), exports);
18
- _export_star(require("./duration"), exports);
19
- _export_star(require("./resource"), exports);
20
- _export_star(require("./secret"), exports);
21
- _export_star(require("./variable"), exports);
17
+ _export_star(require("./PluginLoaderComponent"), exports);
18
+ _export_star(require("./remotePluginLoader"), exports);
22
19
  function _export_star(from, to) {
23
20
  Object.keys(from).forEach(function(k) {
24
21
  if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
@@ -0,0 +1,61 @@
1
+ // Copyright 2024 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.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ Object.defineProperty(exports, "remotePluginLoader", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return remotePluginLoader;
21
+ }
22
+ });
23
+ const _PluginRuntime = require("./PluginRuntime");
24
+ const isPluginMetadata = (plugin)=>{
25
+ return typeof plugin === 'object' && plugin !== null && 'kind' in plugin && 'spec' in plugin && typeof plugin.spec === 'object' && plugin.spec !== null && 'name' in plugin.spec;
26
+ };
27
+ const isPluginModuleResource = (pluginModule)=>{
28
+ return typeof pluginModule === 'object' && pluginModule !== null && 'metadata' in pluginModule && 'spec' in pluginModule && typeof pluginModule.spec === 'object' && pluginModule.spec !== null && 'plugins' in pluginModule.spec && Array.isArray(pluginModule.spec.plugins) && pluginModule.spec.plugins.every(isPluginMetadata);
29
+ };
30
+ const remotePluginLoader = (baseURL)=>{
31
+ return {
32
+ getInstalledPlugins: async ()=>{
33
+ const pluginsResponse = await fetch(`${baseURL ? baseURL : ''}/api/v1/plugins`);
34
+ const plugins = await pluginsResponse.json();
35
+ let pluginModules = [];
36
+ if (Array.isArray(plugins)) {
37
+ pluginModules = plugins.filter(isPluginModuleResource);
38
+ } else {
39
+ console.error('RemotePluginLoader: Error loading plugins, response is not an array');
40
+ }
41
+ if (!pluginModules.length) {
42
+ console.error('RemotePluginLoader: No valid plugins found');
43
+ }
44
+ return pluginModules;
45
+ },
46
+ importPluginModule: async (resource)=>{
47
+ const pluginModuleName = resource.metadata.name;
48
+ const pluginModule = {};
49
+ for (const plugin of resource.spec.plugins){
50
+ const remotePluginModule = await (0, _PluginRuntime.loadPlugin)(pluginModuleName, plugin.spec.name);
51
+ const remotePlugin = remotePluginModule?.[plugin.spec.name];
52
+ if (remotePlugin) {
53
+ pluginModule[plugin.spec.name] = remotePlugin;
54
+ } else {
55
+ console.error(`RemotePluginLoader: Error loading plugin ${plugin.spec.name}`);
56
+ }
57
+ }
58
+ return pluginModule;
59
+ }
60
+ };
61
+ };
@@ -38,6 +38,7 @@ const _jsxruntime = require("react/jsx-runtime");
38
38
  const _react = require("react");
39
39
  const _timeseriesqueries = require("../time-series-queries");
40
40
  const _tracequeries = require("../trace-queries");
41
+ const _UsageMetricsProvider = require("../UsageMetricsProvider");
41
42
  const _model = require("./model");
42
43
  const DataQueriesContext = /*#__PURE__*/ (0, _react.createContext)(undefined);
43
44
  function useDataQueriesContext() {
@@ -50,15 +51,9 @@ function useDataQueriesContext() {
50
51
  function useDataQueries(queryType) {
51
52
  const ctx = useDataQueriesContext();
52
53
  // Filter the query results based on the specified query type
53
- const filteredQueryResults = ctx.queryResults.filter((queryResult)=>{
54
- var _queryResult_definition;
55
- return (queryResult === null || queryResult === void 0 ? void 0 : (_queryResult_definition = queryResult.definition) === null || _queryResult_definition === void 0 ? void 0 : _queryResult_definition.kind) === queryType;
56
- });
54
+ const filteredQueryResults = ctx.queryResults.filter((queryResult)=>queryResult?.definition?.kind === queryType);
57
55
  // Filter the errors based on the specified query type
58
- const filteredErrors = ctx.errors.filter((errors, index)=>{
59
- var _ctx_queryResults_index_definition, _ctx_queryResults_index;
60
- return ((_ctx_queryResults_index = ctx.queryResults[index]) === null || _ctx_queryResults_index === void 0 ? void 0 : (_ctx_queryResults_index_definition = _ctx_queryResults_index.definition) === null || _ctx_queryResults_index_definition === void 0 ? void 0 : _ctx_queryResults_index_definition.kind) === queryType;
61
- });
56
+ const filteredErrors = ctx.errors.filter((errors, index)=>ctx.queryResults[index]?.definition?.kind === queryType);
62
57
  // Create a new context object with the filtered results and errors
63
58
  const filteredCtx = {
64
59
  queryResults: filteredQueryResults,
@@ -82,6 +77,7 @@ function DataQueriesProvider(props) {
82
77
  }
83
78
  };
84
79
  });
80
+ const usageMetrics = (0, _UsageMetricsProvider.useUsageMetrics)();
85
81
  // Filter definitions for time series query and other future query plugins
86
82
  const timeSeriesQueries = queryDefinitions.filter((definition)=>definition.kind === 'TimeSeriesQuery');
87
83
  const timeSeriesResults = (0, _timeseriesqueries.useTimeSeriesQueries)(timeSeriesQueries, options, queryOptions);
@@ -99,6 +95,17 @@ function DataQueriesProvider(props) {
99
95
  ...(0, _model.transformQueryResults)(timeSeriesResults, timeSeriesQueries),
100
96
  ...(0, _model.transformQueryResults)(traceResults, traceQueries)
101
97
  ];
98
+ if (queryOptions?.enabled) {
99
+ for (const result of mergedQueryResults){
100
+ if (!result.isLoading && !result.isFetching && !result.error) {
101
+ usageMetrics.markQuery(result.definition, 'success');
102
+ } else if (result.error) {
103
+ usageMetrics.markQuery(result.definition, 'error');
104
+ } else {
105
+ usageMetrics.markQuery(result.definition, 'pending');
106
+ }
107
+ }
108
+ }
102
109
  return {
103
110
  queryResults: mergedQueryResults,
104
111
  isFetching: mergedQueryResults.some((result)=>result.isFetching),
@@ -111,7 +118,9 @@ function DataQueriesProvider(props) {
111
118
  timeSeriesResults,
112
119
  traceQueries,
113
120
  traceResults,
114
- refetchAll
121
+ refetchAll,
122
+ queryOptions?.enabled,
123
+ usageMetrics
115
124
  ]);
116
125
  return /*#__PURE__*/ (0, _jsxruntime.jsx)(DataQueriesContext.Provider, {
117
126
  value: ctx,
@@ -43,8 +43,12 @@ function transformQueryResults(results, definitions) {
43
43
  });
44
44
  }
45
45
  function useQueryType() {
46
- const { data: timeSeriesQueryPlugins, isLoading: isTimeSeriesQueryLoading } = (0, _pluginregistry.useListPluginMetadata)('TimeSeriesQuery');
47
- const { data: traceQueryPlugins, isLoading: isTraceQueryPluginLoading } = (0, _pluginregistry.useListPluginMetadata)('TraceQuery');
46
+ const { data: timeSeriesQueryPlugins, isLoading: isTimeSeriesQueryLoading } = (0, _pluginregistry.useListPluginMetadata)([
47
+ 'TimeSeriesQuery'
48
+ ]);
49
+ const { data: traceQueryPlugins, isLoading: isTraceQueryPluginLoading } = (0, _pluginregistry.useListPluginMetadata)([
50
+ 'TraceQuery'
51
+ ]);
48
52
  // For example, `map: {"TimeSeriesQuery":["PrometheusTimeSeriesQuery"],"TraceQuery":["TempoTraceQuery"]}`
49
53
  const queryTypeMap = (0, _react.useMemo)(()=>{
50
54
  const map = {
@@ -53,14 +57,12 @@ function useQueryType() {
53
57
  };
54
58
  if (timeSeriesQueryPlugins) {
55
59
  timeSeriesQueryPlugins.forEach((plugin)=>{
56
- var _map_plugin_pluginType;
57
- (_map_plugin_pluginType = map[plugin.pluginType]) === null || _map_plugin_pluginType === void 0 ? void 0 : _map_plugin_pluginType.push(plugin.kind);
60
+ map[plugin.kind]?.push(plugin.spec.name);
58
61
  });
59
62
  }
60
63
  if (traceQueryPlugins) {
61
64
  traceQueryPlugins.forEach((plugin)=>{
62
- var _map_plugin_pluginType;
63
- (_map_plugin_pluginType = map[plugin.pluginType]) === null || _map_plugin_pluginType === void 0 ? void 0 : _map_plugin_pluginType.push(plugin.kind);
65
+ map[plugin.kind]?.push(plugin.spec.name);
64
66
  });
65
67
  }
66
68
  return map;
@@ -82,8 +84,7 @@ function useQueryType() {
82
84
  return undefined;
83
85
  }
84
86
  for(const queryType in queryTypeMap){
85
- var _queryTypeMap_queryType;
86
- if ((_queryTypeMap_queryType = queryTypeMap[queryType]) === null || _queryTypeMap_queryType === void 0 ? void 0 : _queryTypeMap_queryType.includes(pluginKind)) {
87
+ if (queryTypeMap[queryType]?.includes(pluginKind)) {
87
88
  return queryType;
88
89
  }
89
90
  }
@@ -0,0 +1,83 @@
1
+ // Copyright 2024 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.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ function _export(target, all) {
18
+ for(var name in all)Object.defineProperty(target, name, {
19
+ enumerable: true,
20
+ get: all[name]
21
+ });
22
+ }
23
+ _export(exports, {
24
+ QueryCountProvider: function() {
25
+ return QueryCountProvider;
26
+ },
27
+ useQueryCountContext: function() {
28
+ return useQueryCountContext;
29
+ }
30
+ });
31
+ const _jsxruntime = require("react/jsx-runtime");
32
+ const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
33
+ function _getRequireWildcardCache(nodeInterop) {
34
+ if (typeof WeakMap !== "function") return null;
35
+ var cacheBabelInterop = new WeakMap();
36
+ var cacheNodeInterop = new WeakMap();
37
+ return (_getRequireWildcardCache = function(nodeInterop) {
38
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
39
+ })(nodeInterop);
40
+ }
41
+ function _interop_require_wildcard(obj, nodeInterop) {
42
+ if (!nodeInterop && obj && obj.__esModule) {
43
+ return obj;
44
+ }
45
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
46
+ return {
47
+ default: obj
48
+ };
49
+ }
50
+ var cache = _getRequireWildcardCache(nodeInterop);
51
+ if (cache && cache.has(obj)) {
52
+ return cache.get(obj);
53
+ }
54
+ var newObj = {
55
+ __proto__: null
56
+ };
57
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
58
+ for(var key in obj){
59
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
60
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
61
+ if (desc && (desc.get || desc.set)) {
62
+ Object.defineProperty(newObj, key, desc);
63
+ } else {
64
+ newObj[key] = obj[key];
65
+ }
66
+ }
67
+ }
68
+ newObj.default = obj;
69
+ if (cache) {
70
+ cache.set(obj, newObj);
71
+ }
72
+ return newObj;
73
+ }
74
+ const QueryCountContext = /*#__PURE__*/ (0, _react.createContext)(0);
75
+ const QueryCountProvider = ({ queryCount, children })=>{
76
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(QueryCountContext.Provider, {
77
+ value: queryCount,
78
+ children: children
79
+ });
80
+ };
81
+ const useQueryCountContext = ()=>{
82
+ return (0, _react.useContext)(QueryCountContext);
83
+ };
@@ -119,24 +119,37 @@ function TimeRangeProvider(props) {
119
119
  }, [
120
120
  setRefreshCounter
121
121
  ]);
122
+ const refreshIntervalInMs = (0, _refreshinterval.getRefreshIntervalInMs)(localRefreshInterval);
123
+ (0, _react.useEffect)(()=>{
124
+ if (refreshIntervalInMs > 0) {
125
+ const interval = setInterval(()=>{
126
+ refresh();
127
+ }, refreshIntervalInMs);
128
+ return ()=>clearInterval(interval);
129
+ }
130
+ }, [
131
+ refresh,
132
+ refreshIntervalInMs
133
+ ]);
122
134
  const ctx = (0, _react.useMemo)(()=>{
123
135
  const absoluteTimeRange = (0, _core.isRelativeTimeRange)(localTimeRange) ? (0, _core.toAbsoluteTimeRange)(localTimeRange) : localTimeRange;
124
136
  return {
125
137
  timeRange: localTimeRange,
126
- setTimeRange: setTimeRange !== null && setTimeRange !== void 0 ? setTimeRange : setLocalTimeRange,
138
+ setTimeRange: setTimeRange ?? setLocalTimeRange,
127
139
  absoluteTimeRange,
128
140
  refresh,
129
141
  refreshKey: `${absoluteTimeRange.start}:${absoluteTimeRange.end}:${localRefreshInterval}:${refreshCounter}`,
130
142
  refreshInterval: localRefreshInterval,
131
- refreshIntervalInMs: (0, _refreshinterval.getRefreshIntervalInMs)(localRefreshInterval),
132
- setRefreshInterval: setRefreshInterval !== null && setRefreshInterval !== void 0 ? setRefreshInterval : setLocalRefreshInterval
143
+ refreshIntervalInMs: refreshIntervalInMs,
144
+ setRefreshInterval: setRefreshInterval ?? setLocalRefreshInterval
133
145
  };
134
146
  }, [
135
147
  localTimeRange,
136
148
  setTimeRange,
137
149
  refresh,
138
- refreshCounter,
139
150
  localRefreshInterval,
151
+ refreshCounter,
152
+ refreshIntervalInMs,
140
153
  setRefreshInterval
141
154
  ]);
142
155
  return /*#__PURE__*/ (0, _jsxruntime.jsx)(TimeRangeContext.Provider, {
@@ -0,0 +1,100 @@
1
+ // Copyright 2024 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.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ function _export(target, all) {
18
+ for(var name in all)Object.defineProperty(target, name, {
19
+ enumerable: true,
20
+ get: all[name]
21
+ });
22
+ }
23
+ _export(exports, {
24
+ TimeRangeSettingsContext: function() {
25
+ return TimeRangeSettingsContext;
26
+ },
27
+ TimeRangeSettingsProvider: function() {
28
+ return TimeRangeSettingsProvider;
29
+ },
30
+ useShowCustomTimeRangeSetting: function() {
31
+ return useShowCustomTimeRangeSetting;
32
+ },
33
+ useTimeRangeOptionsSetting: function() {
34
+ return useTimeRangeOptionsSetting;
35
+ },
36
+ useTimeRangeSettings: function() {
37
+ return useTimeRangeSettings;
38
+ },
39
+ useTimeRangeSettingsContext: function() {
40
+ return useTimeRangeSettingsContext;
41
+ }
42
+ });
43
+ const _jsxruntime = require("react/jsx-runtime");
44
+ const _react = require("react");
45
+ const _components = require("@perses-dev/components");
46
+ const DEFAULT_OPTIONS = [
47
+ '5m',
48
+ '15m',
49
+ '30m',
50
+ '1h',
51
+ '6h',
52
+ '12h',
53
+ '24h',
54
+ '7d',
55
+ '14d'
56
+ ];
57
+ const defaultTimeRangeSettings = {
58
+ showCustom: true,
59
+ options: DEFAULT_OPTIONS.map((duration)=>(0, _components.buildRelativeTimeOption)(duration))
60
+ };
61
+ const TimeRangeSettingsContext = /*#__PURE__*/ (0, _react.createContext)(defaultTimeRangeSettings);
62
+ function useTimeRangeSettingsContext() {
63
+ const ctx = (0, _react.useContext)(TimeRangeSettingsContext);
64
+ if (ctx === undefined) {
65
+ throw new Error('No TimeRangeContext found. Did you forget a Provider?');
66
+ }
67
+ return ctx;
68
+ }
69
+ function useTimeRangeSettings() {
70
+ return useTimeRangeSettingsContext();
71
+ }
72
+ function useShowCustomTimeRangeSetting(override) {
73
+ const showCustomTimeRange = useTimeRangeSettings().showCustom;
74
+ if (override !== undefined) {
75
+ return override;
76
+ }
77
+ return showCustomTimeRange;
78
+ }
79
+ function useTimeRangeOptionsSetting(override) {
80
+ const showCustomTimeRange = useTimeRangeSettings().options;
81
+ if (override !== undefined) {
82
+ return override;
83
+ }
84
+ return showCustomTimeRange;
85
+ }
86
+ function TimeRangeSettingsProvider(props) {
87
+ const ctx = (0, _react.useMemo)(()=>{
88
+ return {
89
+ showCustom: props.showCustom === undefined ? defaultTimeRangeSettings.showCustom : props.showCustom,
90
+ options: props.options === undefined ? defaultTimeRangeSettings.options : props.options
91
+ };
92
+ }, [
93
+ props.showCustom,
94
+ props.options
95
+ ]);
96
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(TimeRangeSettingsContext.Provider, {
97
+ value: ctx,
98
+ children: props.children
99
+ });
100
+ }