@perses-dev/plugin-system 0.55.0-beta.2 → 0.55.0-beta.6

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 (563) hide show
  1. package/dist/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.d.ts +3 -3
  2. package/dist/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.d.ts.map +1 -1
  3. package/dist/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.js +11 -11
  4. package/dist/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.js.map +1 -1
  5. package/dist/components/Annotations/AnnotationEditorForm/AnnotationPreview.d.ts +3 -3
  6. package/dist/components/Annotations/AnnotationEditorForm/AnnotationPreview.d.ts.map +1 -1
  7. package/dist/components/Annotations/AnnotationEditorForm/AnnotationPreview.js +6 -6
  8. package/dist/components/Annotations/AnnotationEditorForm/AnnotationPreview.js.map +1 -1
  9. package/dist/components/Annotations/AnnotationEditorForm/index.js +1 -1
  10. package/dist/components/Annotations/AnnotationEditorForm/index.js.map +1 -1
  11. package/dist/components/Annotations/index.js +2 -2
  12. package/dist/components/Annotations/index.js.map +1 -1
  13. package/dist/components/CalculationSelector/CalculationSelector.d.ts +2 -2
  14. package/dist/components/CalculationSelector/CalculationSelector.d.ts.map +1 -1
  15. package/dist/components/CalculationSelector/CalculationSelector.js +2 -2
  16. package/dist/components/CalculationSelector/CalculationSelector.js.map +1 -1
  17. package/dist/components/CalculationSelector/index.js +1 -1
  18. package/dist/components/CalculationSelector/index.js.map +1 -1
  19. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts +3 -2
  20. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts.map +1 -1
  21. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js +10 -9
  22. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js.map +1 -1
  23. package/dist/components/DatasourceEditorForm/index.js +1 -1
  24. package/dist/components/DatasourceEditorForm/index.js.map +1 -1
  25. package/dist/components/DatasourceSelect/DatasourceSelect.d.ts +4 -4
  26. package/dist/components/DatasourceSelect/DatasourceSelect.d.ts.map +1 -1
  27. package/dist/components/DatasourceSelect/DatasourceSelect.js +7 -7
  28. package/dist/components/DatasourceSelect/DatasourceSelect.js.map +1 -1
  29. package/dist/components/DatasourceSelect/index.js +1 -1
  30. package/dist/components/DatasourceSelect/index.js.map +1 -1
  31. package/dist/components/DatasourceTestConnectionButton/DatasourceTestConnectionButton.d.ts +8 -0
  32. package/dist/components/DatasourceTestConnectionButton/DatasourceTestConnectionButton.d.ts.map +1 -0
  33. package/dist/components/DatasourceTestConnectionButton/DatasourceTestConnectionButton.js +45 -0
  34. package/dist/components/DatasourceTestConnectionButton/DatasourceTestConnectionButton.js.map +1 -0
  35. package/dist/components/DatasourceTestConnectionButton/index.d.ts +2 -0
  36. package/dist/components/DatasourceTestConnectionButton/index.d.ts.map +1 -0
  37. package/dist/{cjs/model/alerts-queries.js → components/DatasourceTestConnectionButton/index.js} +3 -4
  38. package/dist/components/DatasourceTestConnectionButton/index.js.map +1 -0
  39. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.d.ts +3 -2
  40. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.d.ts.map +1 -1
  41. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js +54 -29
  42. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js.map +1 -1
  43. package/dist/components/HTTPSettingsEditor/index.js +1 -1
  44. package/dist/components/HTTPSettingsEditor/index.js.map +1 -1
  45. package/dist/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.d.ts +1 -1
  46. package/dist/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.d.ts.map +1 -1
  47. package/dist/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.js +24 -24
  48. package/dist/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.js.map +1 -1
  49. package/dist/components/ItemSelectionActionsOptionsEditor/index.js +1 -1
  50. package/dist/components/ItemSelectionActionsOptionsEditor/index.js.map +1 -1
  51. package/dist/components/LayoutEditor/LayoutEditor.d.ts +16 -0
  52. package/dist/components/LayoutEditor/LayoutEditor.d.ts.map +1 -0
  53. package/dist/components/LayoutEditor/LayoutEditor.js +115 -0
  54. package/dist/components/LayoutEditor/LayoutEditor.js.map +1 -0
  55. package/dist/components/LayoutEditor/RepeatLayoutPreview.d.ts +7 -0
  56. package/dist/components/LayoutEditor/RepeatLayoutPreview.d.ts.map +1 -0
  57. package/dist/components/LayoutEditor/RepeatLayoutPreview.js +92 -0
  58. package/dist/components/LayoutEditor/RepeatLayoutPreview.js.map +1 -0
  59. package/dist/components/LayoutEditor/RepeatVariableEditor.d.ts +18 -0
  60. package/dist/components/LayoutEditor/RepeatVariableEditor.d.ts.map +1 -0
  61. package/dist/components/LayoutEditor/RepeatVariableEditor.js +168 -0
  62. package/dist/components/LayoutEditor/RepeatVariableEditor.js.map +1 -0
  63. package/dist/components/LayoutEditor/index.d.ts +4 -0
  64. package/dist/components/LayoutEditor/index.d.ts.map +1 -0
  65. package/dist/{cjs/model/explore.js → components/LayoutEditor/index.js} +5 -4
  66. package/dist/components/LayoutEditor/index.js.map +1 -0
  67. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.d.ts +2 -2
  68. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.d.ts.map +1 -1
  69. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js +5 -5
  70. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js.map +1 -1
  71. package/dist/components/LegendOptionsEditor/index.js +1 -1
  72. package/dist/components/LegendOptionsEditor/index.js.map +1 -1
  73. package/dist/components/LinksEditor/LinksEditor.d.ts +3 -3
  74. package/dist/components/LinksEditor/LinksEditor.d.ts.map +1 -1
  75. package/dist/components/LinksEditor/LinksEditor.js +6 -6
  76. package/dist/components/LinksEditor/LinksEditor.js.map +1 -1
  77. package/dist/components/LinksEditor/index.js +1 -1
  78. package/dist/components/LinksEditor/index.js.map +1 -1
  79. package/dist/components/MetricLabelInput/MetricLabelInput.d.ts +1 -1
  80. package/dist/components/MetricLabelInput/MetricLabelInput.d.ts.map +1 -1
  81. package/dist/components/MetricLabelInput/MetricLabelInput.js +2 -2
  82. package/dist/components/MetricLabelInput/MetricLabelInput.js.map +1 -1
  83. package/dist/components/MetricLabelInput/index.js +1 -1
  84. package/dist/components/MetricLabelInput/index.js.map +1 -1
  85. package/dist/components/MultiQueryEditor/MultiQueryEditor.d.ts +3 -4
  86. package/dist/components/MultiQueryEditor/MultiQueryEditor.d.ts.map +1 -1
  87. package/dist/components/MultiQueryEditor/MultiQueryEditor.js +12 -9
  88. package/dist/components/MultiQueryEditor/MultiQueryEditor.js.map +1 -1
  89. package/dist/components/MultiQueryEditor/QueryEditorContainer.d.ts +3 -4
  90. package/dist/components/MultiQueryEditor/QueryEditorContainer.d.ts.map +1 -1
  91. package/dist/components/MultiQueryEditor/QueryEditorContainer.js +14 -14
  92. package/dist/components/MultiQueryEditor/QueryEditorContainer.js.map +1 -1
  93. package/dist/components/MultiQueryEditor/index.js +2 -2
  94. package/dist/components/MultiQueryEditor/index.js.map +1 -1
  95. package/dist/components/MultiQueryEditor/utils.d.ts +1 -1
  96. package/dist/components/MultiQueryEditor/utils.d.ts.map +1 -1
  97. package/dist/components/MultiQueryEditor/utils.js.map +1 -1
  98. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts +1 -1
  99. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts.map +1 -1
  100. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js +4 -4
  101. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js.map +1 -1
  102. package/dist/components/OptionsEditorRadios/index.js +1 -1
  103. package/dist/components/OptionsEditorRadios/index.js.map +1 -1
  104. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts +1 -1
  105. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts.map +1 -1
  106. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js +1 -1
  107. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js.map +1 -1
  108. package/dist/components/OptionsEditorTabPanel/index.js +1 -1
  109. package/dist/components/OptionsEditorTabPanel/index.js.map +1 -1
  110. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.d.ts +1 -1
  111. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.d.ts.map +1 -1
  112. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js +4 -4
  113. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js.map +1 -1
  114. package/dist/components/OptionsEditorTabs/index.js +1 -1
  115. package/dist/components/OptionsEditorTabs/index.js.map +1 -1
  116. package/dist/components/PanelSpecEditor/PanelAnnotationsEditor.d.ts +2 -2
  117. package/dist/components/PanelSpecEditor/PanelAnnotationsEditor.d.ts.map +1 -1
  118. package/dist/components/PanelSpecEditor/PanelAnnotationsEditor.js +9 -9
  119. package/dist/components/PanelSpecEditor/PanelAnnotationsEditor.js.map +1 -1
  120. package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts +7 -5
  121. package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts.map +1 -1
  122. package/dist/components/PanelSpecEditor/PanelSpecEditor.js +19 -10
  123. package/dist/components/PanelSpecEditor/PanelSpecEditor.js.map +1 -1
  124. package/dist/components/PanelSpecEditor/index.js +1 -1
  125. package/dist/components/PanelSpecEditor/index.js.map +1 -1
  126. package/dist/components/PluginEditor/PluginEditor.d.ts +2 -2
  127. package/dist/components/PluginEditor/PluginEditor.d.ts.map +1 -1
  128. package/dist/components/PluginEditor/PluginEditor.js +10 -9
  129. package/dist/components/PluginEditor/PluginEditor.js.map +1 -1
  130. package/dist/components/PluginEditor/index.js +2 -2
  131. package/dist/components/PluginEditor/index.js.map +1 -1
  132. package/dist/components/PluginEditor/plugin-editor-api.d.ts +4 -3
  133. package/dist/components/PluginEditor/plugin-editor-api.d.ts.map +1 -1
  134. package/dist/components/PluginEditor/plugin-editor-api.js +4 -4
  135. package/dist/components/PluginEditor/plugin-editor-api.js.map +1 -1
  136. package/dist/components/PluginKindSelect/PluginKindSelect.d.ts +3 -4
  137. package/dist/components/PluginKindSelect/PluginKindSelect.d.ts.map +1 -1
  138. package/dist/components/PluginKindSelect/PluginKindSelect.js +4 -4
  139. package/dist/components/PluginKindSelect/PluginKindSelect.js.map +1 -1
  140. package/dist/components/PluginKindSelect/index.js +1 -1
  141. package/dist/components/PluginKindSelect/index.js.map +1 -1
  142. package/dist/components/PluginRegistry/PluginRegistry.d.ts +2 -2
  143. package/dist/components/PluginRegistry/PluginRegistry.d.ts.map +1 -1
  144. package/dist/components/PluginRegistry/PluginRegistry.js +5 -5
  145. package/dist/components/PluginRegistry/PluginRegistry.js.map +1 -1
  146. package/dist/components/PluginRegistry/getPluginSearchHelper.d.ts +2 -2
  147. package/dist/components/PluginRegistry/getPluginSearchHelper.d.ts.map +1 -1
  148. package/dist/components/PluginRegistry/getPluginSearchHelper.js +2 -2
  149. package/dist/components/PluginRegistry/getPluginSearchHelper.js.map +1 -1
  150. package/dist/components/PluginRegistry/index.js +1 -1
  151. package/dist/components/PluginRegistry/index.js.map +1 -1
  152. package/dist/components/PluginRegistry/plugin-indexes.d.ts +2 -1
  153. package/dist/components/PluginRegistry/plugin-indexes.d.ts.map +1 -1
  154. package/dist/components/PluginRegistry/plugin-indexes.js +3 -3
  155. package/dist/components/PluginRegistry/plugin-indexes.js.map +1 -1
  156. package/dist/components/PluginSpecEditor/DatasourceSpecEditor.d.ts +10 -0
  157. package/dist/components/PluginSpecEditor/DatasourceSpecEditor.d.ts.map +1 -0
  158. package/dist/components/PluginSpecEditor/DatasourceSpecEditor.js +62 -0
  159. package/dist/components/PluginSpecEditor/DatasourceSpecEditor.js.map +1 -0
  160. package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts +5 -4
  161. package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts.map +1 -1
  162. package/dist/components/PluginSpecEditor/PluginSpecEditor.js +19 -5
  163. package/dist/components/PluginSpecEditor/PluginSpecEditor.js.map +1 -1
  164. package/dist/components/PluginSpecEditor/index.js +1 -1
  165. package/dist/components/PluginSpecEditor/index.js.map +1 -1
  166. package/dist/components/SelectionOptionsEditor/SelectionOptionsEditor.d.ts +1 -1
  167. package/dist/components/SelectionOptionsEditor/SelectionOptionsEditor.d.ts.map +1 -1
  168. package/dist/components/SelectionOptionsEditor/SelectionOptionsEditor.js +3 -3
  169. package/dist/components/SelectionOptionsEditor/SelectionOptionsEditor.js.map +1 -1
  170. package/dist/components/SelectionOptionsEditor/index.js +1 -1
  171. package/dist/components/SelectionOptionsEditor/index.js.map +1 -1
  172. package/dist/components/TimeRangeControls/TimeRangeControls.d.ts +2 -2
  173. package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -1
  174. package/dist/components/TimeRangeControls/TimeRangeControls.js +13 -14
  175. package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
  176. package/dist/components/TimeRangeControls/index.js +1 -1
  177. package/dist/components/TimeRangeControls/index.js.map +1 -1
  178. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts +3 -3
  179. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
  180. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +11 -11
  181. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
  182. package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts +2 -2
  183. package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts.map +1 -1
  184. package/dist/components/Variables/VariableEditorForm/VariablePreview.js +7 -7
  185. package/dist/components/Variables/VariableEditorForm/VariablePreview.js.map +1 -1
  186. package/dist/components/Variables/VariableEditorForm/index.js +3 -3
  187. package/dist/components/Variables/VariableEditorForm/index.js.map +1 -1
  188. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts +2 -2
  189. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts.map +1 -1
  190. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -1
  191. package/dist/components/Variables/index.js +2 -2
  192. package/dist/components/Variables/index.js.map +1 -1
  193. package/dist/components/Variables/variable-model.d.ts +4 -4
  194. package/dist/components/Variables/variable-model.d.ts.map +1 -1
  195. package/dist/components/Variables/variable-model.js +3 -3
  196. package/dist/components/Variables/variable-model.js.map +1 -1
  197. package/dist/components/index.d.ts +2 -0
  198. package/dist/components/index.d.ts.map +1 -1
  199. package/dist/components/index.js +21 -19
  200. package/dist/components/index.js.map +1 -1
  201. package/dist/constants/index.d.ts +1 -0
  202. package/dist/constants/index.d.ts.map +1 -1
  203. package/dist/constants/index.js +2 -1
  204. package/dist/constants/index.js.map +1 -1
  205. package/dist/constants/repeat.d.ts +3 -0
  206. package/dist/constants/repeat.d.ts.map +1 -0
  207. package/dist/{cjs/model/datasource.js → constants/repeat.js} +4 -4
  208. package/dist/constants/repeat.js.map +1 -0
  209. package/dist/context/ValidationProvider.d.ts +5 -5
  210. package/dist/context/ValidationProvider.d.ts.map +1 -1
  211. package/dist/context/ValidationProvider.js +5 -5
  212. package/dist/context/ValidationProvider.js.map +1 -1
  213. package/dist/context/index.js +1 -1
  214. package/dist/context/index.js.map +1 -1
  215. package/dist/index.js +9 -9
  216. package/dist/index.js.map +1 -1
  217. package/dist/model/alerts-queries.d.ts +4 -4
  218. package/dist/model/alerts-queries.d.ts.map +1 -1
  219. package/dist/model/alerts-queries.js.map +1 -1
  220. package/dist/model/annotations.d.ts +3 -3
  221. package/dist/model/annotations.d.ts.map +1 -1
  222. package/dist/model/annotations.js.map +1 -1
  223. package/dist/model/calculations.d.ts +1 -1
  224. package/dist/model/calculations.d.ts.map +1 -1
  225. package/dist/model/calculations.js.map +1 -1
  226. package/dist/model/datasource.d.ts +10 -3
  227. package/dist/model/datasource.d.ts.map +1 -1
  228. package/dist/model/datasource.js +1 -1
  229. package/dist/model/datasource.js.map +1 -1
  230. package/dist/model/explore.d.ts +2 -3
  231. package/dist/model/explore.d.ts.map +1 -1
  232. package/dist/model/explore.js.map +1 -1
  233. package/dist/model/index.d.ts +1 -0
  234. package/dist/model/index.d.ts.map +1 -1
  235. package/dist/model/index.js +17 -16
  236. package/dist/model/index.js.map +1 -1
  237. package/dist/model/json-queries.d.ts +29 -0
  238. package/dist/model/json-queries.d.ts.map +1 -0
  239. package/dist/{cjs/model/annotations.js → model/json-queries.js} +5 -4
  240. package/dist/model/json-queries.js.map +1 -0
  241. package/dist/model/legend.d.ts +2 -2
  242. package/dist/model/legend.d.ts.map +1 -1
  243. package/dist/model/legend.js +2 -2
  244. package/dist/model/legend.js.map +1 -1
  245. package/dist/model/log-queries.d.ts +3 -3
  246. package/dist/model/log-queries.d.ts.map +1 -1
  247. package/dist/model/log-queries.js.map +1 -1
  248. package/dist/model/panels.d.ts +13 -4
  249. package/dist/model/panels.d.ts.map +1 -1
  250. package/dist/model/panels.js.map +1 -1
  251. package/dist/model/plugin-base.d.ts +3 -3
  252. package/dist/model/plugin-base.d.ts.map +1 -1
  253. package/dist/model/plugin-base.js.map +1 -1
  254. package/dist/model/plugin-loading.d.ts +1 -1
  255. package/dist/model/plugin-loading.d.ts.map +1 -1
  256. package/dist/model/plugin-loading.js +1 -1
  257. package/dist/model/plugin-loading.js.map +1 -1
  258. package/dist/model/plugins.d.ts +15 -13
  259. package/dist/model/plugins.d.ts.map +1 -1
  260. package/dist/model/plugins.js.map +1 -1
  261. package/dist/model/profile-queries.d.ts +4 -4
  262. package/dist/model/profile-queries.d.ts.map +1 -1
  263. package/dist/model/profile-queries.js.map +1 -1
  264. package/dist/model/silences-queries.d.ts +4 -4
  265. package/dist/model/silences-queries.d.ts.map +1 -1
  266. package/dist/model/silences-queries.js.map +1 -1
  267. package/dist/model/time-series-queries.d.ts +4 -4
  268. package/dist/model/time-series-queries.d.ts.map +1 -1
  269. package/dist/model/time-series-queries.js.map +1 -1
  270. package/dist/model/trace-queries.d.ts +4 -4
  271. package/dist/model/trace-queries.d.ts.map +1 -1
  272. package/dist/model/trace-queries.js.map +1 -1
  273. package/dist/model/variables.d.ts +7 -3
  274. package/dist/model/variables.d.ts.map +1 -1
  275. package/dist/model/variables.js +1 -3
  276. package/dist/model/variables.js.map +1 -1
  277. package/dist/remote/PluginLoaderComponent.d.ts +1 -2
  278. package/dist/remote/PluginLoaderComponent.d.ts.map +1 -1
  279. package/dist/remote/PluginLoaderComponent.js +2 -2
  280. package/dist/remote/PluginLoaderComponent.js.map +1 -1
  281. package/dist/remote/PluginRuntime.d.ts +2 -2
  282. package/dist/remote/PluginRuntime.d.ts.map +1 -1
  283. package/dist/remote/PluginRuntime.js +18 -26
  284. package/dist/remote/PluginRuntime.js.map +1 -1
  285. package/dist/remote/index.js +2 -2
  286. package/dist/remote/index.js.map +1 -1
  287. package/dist/remote/remotePluginLoader.d.ts +2 -2
  288. package/dist/remote/remotePluginLoader.d.ts.map +1 -1
  289. package/dist/remote/remotePluginLoader.js +3 -3
  290. package/dist/remote/remotePluginLoader.js.map +1 -1
  291. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts +3 -3
  292. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts.map +1 -1
  293. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js +20 -12
  294. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js.map +1 -1
  295. package/dist/runtime/DataQueriesProvider/index.js +2 -2
  296. package/dist/runtime/DataQueriesProvider/index.js.map +1 -1
  297. package/dist/runtime/DataQueriesProvider/model.d.ts +3 -3
  298. package/dist/runtime/DataQueriesProvider/model.d.ts.map +1 -1
  299. package/dist/runtime/DataQueriesProvider/model.js.map +1 -1
  300. package/dist/runtime/RouterProvider.d.ts +2 -1
  301. package/dist/runtime/RouterProvider.d.ts.map +1 -1
  302. package/dist/runtime/RouterProvider.js +3 -3
  303. package/dist/runtime/RouterProvider.js.map +1 -1
  304. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts +3 -2
  305. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts.map +1 -1
  306. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js +22 -8
  307. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js.map +1 -1
  308. package/dist/runtime/TimeRangeProvider/TimeRangeProviders.d.ts +3 -2
  309. package/dist/runtime/TimeRangeProvider/TimeRangeProviders.d.ts.map +1 -1
  310. package/dist/runtime/TimeRangeProvider/TimeRangeProviders.js +5 -5
  311. package/dist/runtime/TimeRangeProvider/TimeRangeProviders.js.map +1 -1
  312. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.d.ts +9 -2
  313. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.d.ts.map +1 -1
  314. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js +16 -3
  315. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js.map +1 -1
  316. package/dist/runtime/TimeRangeProvider/index.js +4 -4
  317. package/dist/runtime/TimeRangeProvider/index.js.map +1 -1
  318. package/dist/runtime/TimeRangeProvider/query-params.d.ts +3 -3
  319. package/dist/runtime/TimeRangeProvider/query-params.d.ts.map +1 -1
  320. package/dist/runtime/TimeRangeProvider/query-params.js +4 -4
  321. package/dist/runtime/TimeRangeProvider/query-params.js.map +1 -1
  322. package/dist/runtime/TimeRangeProvider/refresh-interval.d.ts +1 -1
  323. package/dist/runtime/TimeRangeProvider/refresh-interval.d.ts.map +1 -1
  324. package/dist/runtime/TimeRangeProvider/refresh-interval.js +2 -2
  325. package/dist/runtime/TimeRangeProvider/refresh-interval.js.map +1 -1
  326. package/dist/runtime/UsageMetricsProvider.d.ts +3 -3
  327. package/dist/runtime/UsageMetricsProvider.d.ts.map +1 -1
  328. package/dist/runtime/UsageMetricsProvider.js +3 -3
  329. package/dist/runtime/UsageMetricsProvider.js.map +1 -1
  330. package/dist/runtime/alerts-queries.d.ts +2 -2
  331. package/dist/runtime/alerts-queries.d.ts.map +1 -1
  332. package/dist/runtime/alerts-queries.js +5 -5
  333. package/dist/runtime/alerts-queries.js.map +1 -1
  334. package/dist/runtime/annotations.d.ts +2 -2
  335. package/dist/runtime/annotations.d.ts.map +1 -1
  336. package/dist/runtime/annotations.js +6 -6
  337. package/dist/runtime/annotations.js.map +1 -1
  338. package/dist/runtime/builtin-variables.d.ts +2 -3
  339. package/dist/runtime/builtin-variables.d.ts.map +1 -1
  340. package/dist/runtime/builtin-variables.js +1 -1
  341. package/dist/runtime/builtin-variables.js.map +1 -1
  342. package/dist/runtime/datasources.d.ts +2 -3
  343. package/dist/runtime/datasources.d.ts.map +1 -1
  344. package/dist/runtime/datasources.js +2 -2
  345. package/dist/runtime/datasources.js.map +1 -1
  346. package/dist/runtime/index.d.ts +1 -0
  347. package/dist/runtime/index.d.ts.map +1 -1
  348. package/dist/runtime/index.js +16 -15
  349. package/dist/runtime/index.js.map +1 -1
  350. package/dist/runtime/item-actions.d.ts +3 -3
  351. package/dist/runtime/item-actions.d.ts.map +1 -1
  352. package/dist/runtime/item-actions.js +2 -2
  353. package/dist/runtime/item-actions.js.map +1 -1
  354. package/dist/runtime/json-queries.d.ts +11 -0
  355. package/dist/runtime/json-queries.d.ts.map +1 -0
  356. package/dist/runtime/json-queries.js +58 -0
  357. package/dist/runtime/json-queries.js.map +1 -0
  358. package/dist/runtime/log-queries.d.ts +3 -3
  359. package/dist/runtime/log-queries.d.ts.map +1 -1
  360. package/dist/runtime/log-queries.js +5 -5
  361. package/dist/runtime/log-queries.js.map +1 -1
  362. package/dist/runtime/plugin-registry.d.ts +3 -4
  363. package/dist/runtime/plugin-registry.d.ts.map +1 -1
  364. package/dist/runtime/plugin-registry.js +2 -2
  365. package/dist/runtime/plugin-registry.js.map +1 -1
  366. package/dist/runtime/profile-queries.d.ts +2 -2
  367. package/dist/runtime/profile-queries.d.ts.map +1 -1
  368. package/dist/runtime/profile-queries.js +4 -4
  369. package/dist/runtime/profile-queries.js.map +1 -1
  370. package/dist/runtime/silences-queries.d.ts +2 -2
  371. package/dist/runtime/silences-queries.d.ts.map +1 -1
  372. package/dist/runtime/silences-queries.js +5 -5
  373. package/dist/runtime/silences-queries.js.map +1 -1
  374. package/dist/runtime/time-series-queries.d.ts +3 -3
  375. package/dist/runtime/time-series-queries.d.ts.map +1 -1
  376. package/dist/runtime/time-series-queries.js +6 -6
  377. package/dist/runtime/time-series-queries.js.map +1 -1
  378. package/dist/runtime/trace-queries.d.ts +2 -2
  379. package/dist/runtime/trace-queries.d.ts.map +1 -1
  380. package/dist/runtime/trace-queries.js +6 -6
  381. package/dist/runtime/trace-queries.js.map +1 -1
  382. package/dist/runtime/utils.d.ts +1 -1
  383. package/dist/runtime/utils.d.ts.map +1 -1
  384. package/dist/runtime/utils.js.map +1 -1
  385. package/dist/runtime/variables.d.ts +1 -2
  386. package/dist/runtime/variables.d.ts.map +1 -1
  387. package/dist/runtime/variables.js +4 -4
  388. package/dist/runtime/variables.js.map +1 -1
  389. package/dist/schema/index.js +1 -1
  390. package/dist/schema/index.js.map +1 -1
  391. package/dist/schema/panel.d.ts +2 -2
  392. package/dist/schema/panel.d.ts.map +1 -1
  393. package/dist/schema/panel.js +18 -4
  394. package/dist/schema/panel.js.map +1 -1
  395. package/dist/test/index.js +2 -2
  396. package/dist/test/index.js.map +1 -1
  397. package/dist/test/mock-data.d.ts +2 -1
  398. package/dist/test/mock-data.d.ts.map +1 -1
  399. package/dist/test/mock-data.js +6 -0
  400. package/dist/test/mock-data.js.map +1 -1
  401. package/dist/test/render-hook.d.ts +2 -2
  402. package/dist/test/render-hook.d.ts.map +1 -1
  403. package/dist/test/render-hook.js +2 -2
  404. package/dist/test/render-hook.js.map +1 -1
  405. package/dist/test/render.d.ts +3 -3
  406. package/dist/test/render.d.ts.map +1 -1
  407. package/dist/test/render.js +3 -3
  408. package/dist/test/render.js.map +1 -1
  409. package/dist/test/setup-tests.d.ts +1 -1
  410. package/dist/test/setup-tests.d.ts.map +1 -1
  411. package/dist/test/setup-tests.js +3 -2
  412. package/dist/test/setup-tests.js.map +1 -1
  413. package/dist/test/test-plugins/bert/index.d.ts +3 -3
  414. package/dist/test/test-plugins/bert/index.d.ts.map +1 -1
  415. package/dist/test/test-plugins/bert/index.js.map +1 -1
  416. package/dist/test/test-plugins/ernie/index.d.ts +7 -1
  417. package/dist/test/test-plugins/ernie/index.d.ts.map +1 -1
  418. package/dist/test/test-plugins/ernie/index.js +58 -1
  419. package/dist/test/test-plugins/ernie/index.js.map +1 -1
  420. package/dist/test/test-plugins/index.d.ts +1 -1
  421. package/dist/test/test-plugins/index.d.ts.map +1 -1
  422. package/dist/test/test-plugins/index.js +5 -5
  423. package/dist/test/test-plugins/index.js.map +1 -1
  424. package/dist/test/utils.d.ts +2 -2
  425. package/dist/test/utils.d.ts.map +1 -1
  426. package/dist/test/utils.js +5 -5
  427. package/dist/test/utils.js.map +1 -1
  428. package/dist/test-utils/index.js +1 -1
  429. package/dist/test-utils/index.js.map +1 -1
  430. package/dist/test-utils/mock-plugin-registry.d.ts +2 -2
  431. package/dist/test-utils/mock-plugin-registry.d.ts.map +1 -1
  432. package/dist/test-utils/mock-plugin-registry.js +1 -1
  433. package/dist/test-utils/mock-plugin-registry.js.map +1 -1
  434. package/dist/utils/csv-export.d.ts.map +1 -1
  435. package/dist/utils/csv-export.js +1 -1
  436. package/dist/utils/csv-export.js.map +1 -1
  437. package/dist/utils/event.js +1 -1
  438. package/dist/utils/index.js +3 -3
  439. package/dist/utils/index.js.map +1 -1
  440. package/dist/utils/variables.js +1 -1
  441. package/package.json +11 -11
  442. package/dist/cjs/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.js +0 -283
  443. package/dist/cjs/components/Annotations/AnnotationEditorForm/AnnotationPreview.js +0 -197
  444. package/dist/cjs/components/Annotations/AnnotationEditorForm/index.js +0 -30
  445. package/dist/cjs/components/Annotations/constants.js +0 -23
  446. package/dist/cjs/components/Annotations/index.js +0 -31
  447. package/dist/cjs/components/CalculationSelector/CalculationSelector.js +0 -49
  448. package/dist/cjs/components/CalculationSelector/index.js +0 -30
  449. package/dist/cjs/components/DatasourceEditorForm/DatasourceEditorForm.js +0 -270
  450. package/dist/cjs/components/DatasourceEditorForm/index.js +0 -30
  451. package/dist/cjs/components/DatasourceSelect/DatasourceSelect.js +0 -266
  452. package/dist/cjs/components/DatasourceSelect/index.js +0 -30
  453. package/dist/cjs/components/HTTPSettingsEditor/HTTPSettingsEditor.js +0 -568
  454. package/dist/cjs/components/HTTPSettingsEditor/index.js +0 -30
  455. package/dist/cjs/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.js +0 -1175
  456. package/dist/cjs/components/ItemSelectionActionsOptionsEditor/index.js +0 -30
  457. package/dist/cjs/components/LegendOptionsEditor/LegendOptionsEditor.js +0 -211
  458. package/dist/cjs/components/LegendOptionsEditor/index.js +0 -30
  459. package/dist/cjs/components/LinksEditor/LinksEditor.js +0 -162
  460. package/dist/cjs/components/LinksEditor/index.js +0 -30
  461. package/dist/cjs/components/MetricLabelInput/MetricLabelInput.js +0 -41
  462. package/dist/cjs/components/MetricLabelInput/index.js +0 -30
  463. package/dist/cjs/components/MultiQueryEditor/MultiQueryEditor.js +0 -159
  464. package/dist/cjs/components/MultiQueryEditor/QueryEditorContainer.js +0 -250
  465. package/dist/cjs/components/MultiQueryEditor/index.js +0 -31
  466. package/dist/cjs/components/MultiQueryEditor/utils.js +0 -36
  467. package/dist/cjs/components/OptionsEditorRadios/OptionsEditorRadios.js +0 -69
  468. package/dist/cjs/components/OptionsEditorRadios/index.js +0 -30
  469. package/dist/cjs/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js +0 -39
  470. package/dist/cjs/components/OptionsEditorTabPanel/index.js +0 -30
  471. package/dist/cjs/components/OptionsEditorTabs/OptionsEditorTabs.js +0 -61
  472. package/dist/cjs/components/OptionsEditorTabs/index.js +0 -30
  473. package/dist/cjs/components/PanelSpecEditor/PanelAnnotationsEditor.js +0 -246
  474. package/dist/cjs/components/PanelSpecEditor/PanelSpecEditor.js +0 -135
  475. package/dist/cjs/components/PanelSpecEditor/index.js +0 -30
  476. package/dist/cjs/components/PluginEditor/PluginEditor.js +0 -98
  477. package/dist/cjs/components/PluginEditor/index.js +0 -31
  478. package/dist/cjs/components/PluginEditor/plugin-editor-api.js +0 -136
  479. package/dist/cjs/components/PluginKindSelect/PluginKindSelect.js +0 -109
  480. package/dist/cjs/components/PluginKindSelect/index.js +0 -30
  481. package/dist/cjs/components/PluginRegistry/PluginRegistry.js +0 -86
  482. package/dist/cjs/components/PluginRegistry/getPluginSearchHelper.js +0 -92
  483. package/dist/cjs/components/PluginRegistry/index.js +0 -30
  484. package/dist/cjs/components/PluginRegistry/plugin-indexes.js +0 -88
  485. package/dist/cjs/components/PluginSpecEditor/PluginSpecEditor.js +0 -55
  486. package/dist/cjs/components/PluginSpecEditor/index.js +0 -30
  487. package/dist/cjs/components/SelectionOptionsEditor/SelectionOptionsEditor.js +0 -43
  488. package/dist/cjs/components/SelectionOptionsEditor/index.js +0 -30
  489. package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +0 -236
  490. package/dist/cjs/components/TimeRangeControls/index.js +0 -30
  491. package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +0 -613
  492. package/dist/cjs/components/Variables/VariableEditorForm/VariablePreview.js +0 -193
  493. package/dist/cjs/components/Variables/VariableEditorForm/index.js +0 -32
  494. package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +0 -143
  495. package/dist/cjs/components/Variables/index.js +0 -31
  496. package/dist/cjs/components/Variables/variable-model.js +0 -211
  497. package/dist/cjs/components/index.js +0 -48
  498. package/dist/cjs/constants/index.js +0 -30
  499. package/dist/cjs/constants/user-interface-text.js +0 -32
  500. package/dist/cjs/context/ValidationProvider.js +0 -77
  501. package/dist/cjs/context/index.js +0 -30
  502. package/dist/cjs/index.js +0 -38
  503. package/dist/cjs/model/calculations.js +0 -178
  504. package/dist/cjs/model/index.js +0 -45
  505. package/dist/cjs/model/legend.js +0 -111
  506. package/dist/cjs/model/log-queries.js +0 -16
  507. package/dist/cjs/model/log-volume-utils.js +0 -124
  508. package/dist/cjs/model/panels.js +0 -16
  509. package/dist/cjs/model/plugin-base.js +0 -16
  510. package/dist/cjs/model/plugin-loading.js +0 -56
  511. package/dist/cjs/model/plugins.js +0 -26
  512. package/dist/cjs/model/profile-queries.js +0 -16
  513. package/dist/cjs/model/silences-queries.js +0 -16
  514. package/dist/cjs/model/time-series-queries.js +0 -26
  515. package/dist/cjs/model/trace-queries.js +0 -16
  516. package/dist/cjs/model/variables.js +0 -16
  517. package/dist/cjs/remote/PersesPlugin.types.js +0 -16
  518. package/dist/cjs/remote/PluginLoaderComponent.js +0 -87
  519. package/dist/cjs/remote/PluginRuntime.js +0 -331
  520. package/dist/cjs/remote/index.js +0 -31
  521. package/dist/cjs/remote/remotePluginLoader.js +0 -101
  522. package/dist/cjs/runtime/DataQueriesProvider/DataQueriesProvider.js +0 -154
  523. package/dist/cjs/runtime/DataQueriesProvider/index.js +0 -31
  524. package/dist/cjs/runtime/DataQueriesProvider/model.js +0 -34
  525. package/dist/cjs/runtime/RouterProvider.js +0 -114
  526. package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProvider.js +0 -201
  527. package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProviders.js +0 -66
  528. package/dist/cjs/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js +0 -113
  529. package/dist/cjs/runtime/TimeRangeProvider/index.js +0 -33
  530. package/dist/cjs/runtime/TimeRangeProvider/query-params.js +0 -250
  531. package/dist/cjs/runtime/TimeRangeProvider/refresh-interval.js +0 -30
  532. package/dist/cjs/runtime/UsageMetricsProvider.js +0 -102
  533. package/dist/cjs/runtime/alerts-queries.js +0 -101
  534. package/dist/cjs/runtime/annotations.js +0 -148
  535. package/dist/cjs/runtime/builtin-variables.js +0 -81
  536. package/dist/cjs/runtime/datasources.js +0 -80
  537. package/dist/cjs/runtime/index.js +0 -44
  538. package/dist/cjs/runtime/item-actions.js +0 -302
  539. package/dist/cjs/runtime/log-queries.js +0 -76
  540. package/dist/cjs/runtime/plugin-registry.js +0 -135
  541. package/dist/cjs/runtime/profile-queries.js +0 -73
  542. package/dist/cjs/runtime/silences-queries.js +0 -101
  543. package/dist/cjs/runtime/time-series-queries.js +0 -165
  544. package/dist/cjs/runtime/trace-queries.js +0 -106
  545. package/dist/cjs/runtime/utils.js +0 -39
  546. package/dist/cjs/runtime/variables.js +0 -160
  547. package/dist/cjs/schema/index.js +0 -30
  548. package/dist/cjs/schema/panel.js +0 -42
  549. package/dist/cjs/test/index.js +0 -31
  550. package/dist/cjs/test/mock-data.js +0 -357
  551. package/dist/cjs/test/render-hook.js +0 -31
  552. package/dist/cjs/test/render.js +0 -31
  553. package/dist/cjs/test/setup-tests.js +0 -20
  554. package/dist/cjs/test/test-plugins/bert/index.js +0 -99
  555. package/dist/cjs/test/test-plugins/ernie/index.js +0 -92
  556. package/dist/cjs/test/test-plugins/index.js +0 -81
  557. package/dist/cjs/test/utils.js +0 -58
  558. package/dist/cjs/test-utils/index.js +0 -30
  559. package/dist/cjs/test-utils/mock-plugin-registry.js +0 -81
  560. package/dist/cjs/utils/csv-export.js +0 -248
  561. package/dist/cjs/utils/event.js +0 -30
  562. package/dist/cjs/utils/index.js +0 -32
  563. package/dist/cjs/utils/variables.js +0 -44
@@ -11,17 +11,17 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
11
11
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  // See the License for the specific language governing permissions and
13
13
  // limitations under the License.
14
- import { useCallback, useState } from 'react';
15
- import { Box, Typography, Switch, TextField, Grid, FormControlLabel, MenuItem, Stack, Divider } from '@mui/material';
16
- import { DiscardChangesConfirmationDialog, ErrorAlert, ErrorBoundary, FormActions, getSubmitText, getTitleAction } from '@perses-dev/components';
17
- import { Controller, FormProvider, useForm, useFormContext, useWatch } from 'react-hook-form';
18
- import { zodResolver } from '@hookform/resolvers/zod';
19
- import { useQueryClient } from '@tanstack/react-query';
20
- import { PluginEditor } from '../../PluginEditor';
21
- import { useValidationSchemas } from '../../../context';
22
- import { VARIABLE_TYPES } from '../variable-model';
23
- import { VariableListPreview, VariablePreview } from './VariablePreview';
24
- import { SORT_METHODS } from './variable-editor-form-model';
14
+ import { zodResolver } from "@hookform/resolvers/zod";
15
+ import { Box, Typography, Switch, TextField, Grid, FormControlLabel, MenuItem, Stack, Divider } from "@mui/material";
16
+ import { DiscardChangesConfirmationDialog, ErrorAlert, ErrorBoundary, FormActions, getSubmitText, getTitleAction } from "@perses-dev/components";
17
+ import { useQueryClient } from "@tanstack/react-query";
18
+ import { useCallback, useState } from "react";
19
+ import { Controller, FormProvider, useForm, useFormContext, useWatch } from "react-hook-form";
20
+ import { useValidationSchemas } from "../../../context/index.js";
21
+ import { PluginEditor } from "../../PluginEditor/index.js";
22
+ import { VARIABLE_TYPES } from "../variable-model.js";
23
+ import { SORT_METHODS } from "./variable-editor-form-model.js";
24
+ import { VariableListPreview, VariablePreview } from "./VariablePreview.js";
25
25
  function FallbackPreview() {
26
26
  return /*#__PURE__*/ _jsx("div", {
27
27
  children: "Error previewing values"
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/Variables/VariableEditorForm/VariableEditorForm.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 { DispatchWithoutAction, ReactElement, useCallback, useState } from 'react';\nimport { Box, Typography, Switch, TextField, Grid, FormControlLabel, MenuItem, Stack, Divider } from '@mui/material';\nimport { VariableDefinition, ListVariableDefinition } from '@perses-dev/spec';\n\nimport {\n DiscardChangesConfirmationDialog,\n ErrorAlert,\n ErrorBoundary,\n FormActions,\n getSubmitText,\n getTitleAction,\n} from '@perses-dev/components';\nimport { Control, Controller, FormProvider, SubmitHandler, useForm, useFormContext, useWatch } from 'react-hook-form';\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport { useQueryClient } from '@tanstack/react-query';\nimport { Action } from '@perses-dev/client';\nimport { PluginEditor } from '../../PluginEditor';\nimport { useValidationSchemas } from '../../../context';\nimport { VARIABLE_TYPES } from '../variable-model';\nimport { VariableListPreview, VariablePreview } from './VariablePreview';\nimport { SORT_METHODS, SortMethodName } from './variable-editor-form-model';\n\nfunction FallbackPreview(): ReactElement {\n return <div>Error previewing values</div>;\n}\n\ninterface KindVariableEditorFormProps {\n action: Action;\n control: Control<VariableDefinition>;\n}\n\nfunction TextVariableEditorForm({ action, control }: KindVariableEditorFormProps): ReactElement {\n return (\n <>\n <Typography py={1} variant=\"subtitle1\">\n Text Options\n </Typography>\n <Stack spacing={2}>\n <Controller\n control={control}\n name=\"spec.value\"\n render={({ field, fieldState }) => (\n <>\n <Box>\n <VariablePreview values={[field.value]} />\n </Box>\n <TextField\n {...field}\n label=\"Value\"\n InputLabelProps={{ shrink: action === 'read' ? true : undefined }}\n InputProps={{\n readOnly: action === 'read',\n }}\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n value={field.value ?? ''}\n onChange={(event) => {\n field.onChange(event);\n }}\n />\n </>\n )}\n />\n <Controller\n control={control}\n name=\"spec.constant\"\n render={({ field }) => (\n <FormControlLabel\n label=\"Constant\"\n control={\n <Switch\n {...field}\n checked={!!field.value}\n readOnly={action === 'read'}\n value={field.value ?? false}\n onChange={(event) => {\n if (action === 'read') return; // ReadOnly prop is not blocking user interaction...\n field.onChange(event);\n }}\n />\n }\n />\n )}\n />\n </Stack>\n </>\n );\n}\n\nfunction ListVariableEditorForm({ action, control }: KindVariableEditorFormProps): ReactElement {\n const form = useFormContext<VariableDefinition>();\n const queryClient = useQueryClient();\n\n const values = form.getValues() as ListVariableDefinition;\n /* We use `previewDefinition` to explicitly update the spec\n * that will be used for preview when running query. The reason why we do this is to avoid\n * having to re-fetch the values when the user is still editing the spec.\n * Using structuredClone to not have reference issues with nested objects.\n */\n const [previewDefinition, setPreviewDefinition] = useState(structuredClone(values));\n\n const handleRunQuery = useCallback(async () => {\n if (JSON.stringify(previewDefinition) === JSON.stringify(values)) {\n await queryClient.invalidateQueries({ queryKey: ['variable', previewDefinition] });\n } else {\n setPreviewDefinition(structuredClone(values));\n }\n }, [previewDefinition, queryClient, values]);\n\n const plugin = useWatch<VariableDefinition, 'spec.plugin'>({ control, name: 'spec.plugin' });\n const kind = plugin?.kind;\n const pluginSpec = plugin?.spec;\n\n const _allowAllValue = useWatch<VariableDefinition, 'spec.allowAllValue'>({\n control: control,\n name: 'spec.allowAllValue',\n });\n\n const _customAllValue = useWatch<VariableDefinition, 'spec.customAllValue'>({\n control: control,\n name: 'spec.customAllValue',\n });\n\n const sortMethod = useWatch<VariableDefinition, 'spec.sort'>({\n control: control,\n name: 'spec.sort',\n }) as SortMethodName;\n\n // When variable kind is selected we need to provide default values\n // TODO: check if react-hook-form has a better way to do this\n if (values.spec.allowAllValue === undefined) {\n form.setValue('spec.allowAllValue', false);\n }\n\n if (values.spec.allowMultiple === undefined) {\n form.setValue('spec.allowMultiple', false);\n }\n\n if (!values.spec.plugin) {\n form.setValue('spec.plugin', { kind: 'StaticListVariable', spec: {} });\n }\n\n if (!values.spec.sort) {\n form.setValue('spec.sort', 'none');\n }\n\n return (\n <>\n <Typography py={1} variant=\"subtitle1\">\n List Options\n </Typography>\n <Stack spacing={2} mb={2}>\n <Box>\n <ErrorBoundary FallbackComponent={FallbackPreview} resetKeys={[previewDefinition]}>\n <VariableListPreview sortMethod={sortMethod} definition={previewDefinition} />\n </ErrorBoundary>\n </Box>\n <Stack>\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <Controller\n control={control}\n name=\"spec.plugin\"\n render={({ field }) => {\n return (\n <PluginEditor\n withRunQueryButton\n width=\"100%\"\n pluginTypes={['Variable']}\n pluginKindLabel=\"Source\"\n value={{\n selection: {\n type: 'Variable',\n kind: kind ?? 'StaticListVariable',\n },\n spec: pluginSpec ?? {},\n }}\n isReadonly={action === 'read'}\n onChange={(v) => {\n field.onChange({ kind: v.selection.kind, spec: v.spec });\n }}\n onRunQuery={handleRunQuery}\n />\n );\n }}\n />\n </ErrorBoundary>\n </Stack>\n\n <Stack>\n <Controller\n control={control}\n name=\"spec.capturingRegexp\"\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n label=\"Capturing Regexp Filter\"\n InputLabelProps={{ shrink: action === 'read' ? true : undefined }}\n InputProps={{\n readOnly: action === 'read',\n }}\n error={!!fieldState.error}\n value={field.value ?? ''}\n onChange={(event) => {\n if (event.target.value === '') {\n field.onChange(undefined);\n } else {\n field.onChange(event);\n }\n }}\n helperText={\n fieldState.error?.message\n ? fieldState.error.message\n : 'Optional, if you want to filter on captured result.'\n }\n />\n )}\n />\n </Stack>\n\n <Stack>\n <Controller\n control={control}\n name=\"spec.sort\"\n render={({ field, fieldState }) => (\n <TextField\n select\n {...field}\n fullWidth\n label=\"Sort\"\n InputLabelProps={{ shrink: action === 'read' ? true : undefined }}\n InputProps={{\n readOnly: action === 'read',\n }}\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n value={field.value ?? 'none'}\n onChange={(event) => {\n field.onChange(event);\n }}\n >\n {Object.keys(SORT_METHODS).map((key) => {\n if (!SORT_METHODS[key as SortMethodName]) return null;\n const { label } = SORT_METHODS[key as SortMethodName];\n return (\n <MenuItem key={key} value={key}>\n {label}\n </MenuItem>\n );\n })}\n </TextField>\n )}\n />\n </Stack>\n </Stack>\n\n <Divider />\n\n <Typography py={1} variant=\"subtitle1\">\n Dropdown Options\n </Typography>\n <Stack spacing=\"2\">\n <Stack>\n <Controller\n control={control}\n name=\"spec.allowMultiple\"\n render={({ field }) => (\n <FormControlLabel\n label=\"Allow Multiple Values\"\n control={\n <Switch\n {...field}\n checked={!!field.value}\n readOnly={action === 'read'}\n value={field.value ?? false}\n onChange={(event) => {\n if (action === 'read') return; // ReadOnly prop is not blocking user interaction...\n field.onChange(event);\n }}\n />\n }\n />\n )}\n />\n <Typography variant=\"caption\">Enables multiple values to be selected at the same time</Typography>\n </Stack>\n <Stack>\n <Controller\n control={control}\n name=\"spec.allowAllValue\"\n render={({ field }) => (\n <FormControlLabel\n label=\"Allow All option\"\n control={\n <Switch\n {...field}\n checked={!!field.value}\n readOnly={action === 'read'}\n value={field.value ?? false}\n onChange={(event) => {\n if (action === 'read') return; // ReadOnly prop is not blocking user interaction...\n field.onChange(event);\n }}\n />\n }\n />\n )}\n />\n <Typography mb={1} variant=\"caption\">\n Enables an option to include all variable values\n </Typography>\n {_allowAllValue && (\n <Stack spacing={1}>\n <FormControlLabel\n label=\"Use Custom All Value\"\n control={\n <Switch\n checked={_customAllValue !== undefined}\n readOnly={action === 'read'}\n onChange={(event) => {\n if (action === 'read') return;\n const isEnabled = event.target.checked;\n if (isEnabled) {\n form.setValue('spec.customAllValue', '');\n } else {\n form.setValue('spec.customAllValue', undefined);\n }\n }}\n />\n }\n />\n <Typography variant=\"caption\" sx={{ mt: -0.5 }}>\n Enable to set a custom value when &quot;All&quot; is selected\n </Typography>\n {_customAllValue !== undefined && (\n <Controller\n control={control}\n name=\"spec.customAllValue\"\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n fullWidth\n label=\"Custom All Value\"\n InputLabelProps={{ shrink: action === 'read' ? true : undefined }}\n InputProps={{\n readOnly: action === 'read',\n }}\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n value={field.value ?? ''}\n onChange={(event) => {\n field.onChange(event.target.value || '');\n }}\n />\n )}\n />\n )}\n </Stack>\n )}\n </Stack>\n </Stack>\n </>\n );\n}\n\ninterface VariableEditorFormProps {\n initialVariableDefinition: VariableDefinition;\n action: Action;\n isDraft: boolean;\n isReadonly?: boolean;\n onActionChange?: (action: Action) => void;\n onSave: (def: VariableDefinition) => void;\n onClose: () => void;\n onDelete?: DispatchWithoutAction;\n}\n\nexport function VariableEditorForm({\n initialVariableDefinition,\n action,\n isDraft,\n isReadonly,\n onActionChange,\n onSave,\n onClose,\n onDelete,\n}: VariableEditorFormProps): ReactElement {\n const [isDiscardDialogOpened, setDiscardDialogOpened] = useState<boolean>(false);\n const titleAction = getTitleAction(action, isDraft);\n const submitText = getSubmitText(action, isDraft);\n\n const { variableEditorSchema } = useValidationSchemas();\n const form = useForm<VariableDefinition>({\n resolver: zodResolver(variableEditorSchema),\n mode: 'onBlur',\n defaultValues: initialVariableDefinition,\n });\n\n const kind = useWatch({ control: form.control, name: 'kind' });\n\n function clearFormData(data: VariableDefinition): VariableDefinition {\n const result = { ...data };\n if (\n result.spec.display?.name === undefined &&\n result.spec.display?.description === undefined &&\n result.spec.display?.hidden === undefined\n ) {\n delete result.spec.display;\n }\n return result;\n }\n\n const processForm: SubmitHandler<VariableDefinition> = (data: VariableDefinition) => {\n // reset display attributes to undefined when empty, because we don't want to save empty strings\n onSave(clearFormData(data));\n };\n\n // When user click on cancel, several possibilities:\n // - create action: ask for discard approval\n // - update action: ask for discard approval if changed\n // - read action: don´t ask for discard approval\n function handleCancel(): void {\n if (JSON.stringify(initialVariableDefinition) !== JSON.stringify(clearFormData(form.getValues()))) {\n setDiscardDialogOpened(true);\n } else {\n onClose();\n }\n }\n\n return (\n <FormProvider {...form}>\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n padding: (theme) => theme.spacing(1, 2),\n borderBottom: (theme) => `1px solid ${theme.palette.divider}`,\n }}\n >\n <Typography variant=\"h2\">{titleAction} Variable</Typography>\n <FormActions\n action={action}\n submitText={submitText}\n isReadonly={isReadonly}\n isValid={form.formState.isValid}\n onActionChange={onActionChange}\n onSubmit={form.handleSubmit(processForm)}\n onDelete={onDelete}\n onCancel={handleCancel}\n />\n </Box>\n <Box padding={2} sx={{ overflowY: 'scroll' }}>\n <Grid container spacing={2} mb={2}>\n <Grid item xs={8}>\n <Controller\n control={form.control}\n name=\"spec.name\"\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n required\n fullWidth\n label=\"Name\"\n InputLabelProps={{ shrink: action === 'read' ? true : undefined }}\n InputProps={{\n disabled: action === 'update' && !isDraft,\n readOnly: action === 'read',\n }}\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n value={field.value ?? ''}\n onChange={(event) => {\n field.onChange(event);\n }}\n />\n )}\n />\n </Grid>\n <Grid item xs={4}>\n <Controller\n control={form.control}\n name=\"spec.display.name\"\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n fullWidth\n label=\"Display Label\"\n InputLabelProps={{ shrink: action === 'read' ? true : undefined }}\n InputProps={{\n readOnly: action === 'read',\n }}\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n value={field.value ?? ''}\n onChange={(event) => {\n field.onChange(event);\n }}\n />\n )}\n />\n </Grid>\n <Grid item xs={8}>\n <Controller\n control={form.control}\n name=\"spec.display.description\"\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n fullWidth\n label=\"Description\"\n InputLabelProps={{ shrink: action === 'read' ? true : undefined }}\n InputProps={{\n readOnly: action === 'read',\n }}\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n value={field.value ?? ''}\n onChange={(event) => {\n field.onChange(event);\n }}\n />\n )}\n />\n </Grid>\n <Grid item xs={4}>\n <Controller\n control={form.control}\n name=\"kind\"\n render={({ field, fieldState }) => (\n <TextField\n select\n {...field}\n fullWidth\n label=\"Type\"\n InputLabelProps={{ shrink: action === 'read' ? true : undefined }}\n InputProps={{\n readOnly: action === 'read',\n }}\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n value={field.value ?? 'TextVariable'}\n onChange={(event) => {\n field.onChange(event);\n }}\n >\n {VARIABLE_TYPES.map((v) => (\n <MenuItem key={v.kind} value={v.kind}>\n {v.label}\n </MenuItem>\n ))}\n </TextField>\n )}\n />\n </Grid>\n </Grid>\n\n <Divider />\n\n {kind === 'TextVariable' && (\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <TextVariableEditorForm action={action} control={form.control} />\n </ErrorBoundary>\n )}\n {kind === 'ListVariable' && (\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <ListVariableEditorForm action={action} control={form.control} />\n </ErrorBoundary>\n )}\n </Box>\n <DiscardChangesConfirmationDialog\n description=\"Are you sure you want to discard these changes? Changes cannot be recovered.\"\n isOpen={isDiscardDialogOpened}\n onCancel={() => {\n setDiscardDialogOpened(false);\n }}\n onDiscardChanges={() => {\n setDiscardDialogOpened(false);\n onClose();\n }}\n />\n </FormProvider>\n );\n}\n"],"names":["useCallback","useState","Box","Typography","Switch","TextField","Grid","FormControlLabel","MenuItem","Stack","Divider","DiscardChangesConfirmationDialog","ErrorAlert","ErrorBoundary","FormActions","getSubmitText","getTitleAction","Controller","FormProvider","useForm","useFormContext","useWatch","zodResolver","useQueryClient","PluginEditor","useValidationSchemas","VARIABLE_TYPES","VariableListPreview","VariablePreview","SORT_METHODS","FallbackPreview","div","TextVariableEditorForm","action","control","py","variant","spacing","name","render","field","fieldState","values","value","label","InputLabelProps","shrink","undefined","InputProps","readOnly","error","helperText","message","onChange","event","checked","ListVariableEditorForm","form","queryClient","getValues","previewDefinition","setPreviewDefinition","structuredClone","handleRunQuery","JSON","stringify","invalidateQueries","queryKey","plugin","kind","pluginSpec","spec","_allowAllValue","_customAllValue","sortMethod","allowAllValue","setValue","allowMultiple","sort","mb","FallbackComponent","resetKeys","definition","withRunQueryButton","width","pluginTypes","pluginKindLabel","selection","type","isReadonly","v","onRunQuery","target","select","fullWidth","Object","keys","map","key","isEnabled","sx","mt","VariableEditorForm","initialVariableDefinition","isDraft","onActionChange","onSave","onClose","onDelete","isDiscardDialogOpened","setDiscardDialogOpened","titleAction","submitText","variableEditorSchema","resolver","mode","defaultValues","clearFormData","data","result","display","description","hidden","processForm","handleCancel","alignItems","padding","theme","borderBottom","palette","divider","isValid","formState","onSubmit","handleSubmit","onCancel","overflowY","container","item","xs","required","disabled","isOpen","onDiscardChanges"],"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,SAA8CA,WAAW,EAAEC,QAAQ,QAAQ,QAAQ;AACnF,SAASC,GAAG,EAAEC,UAAU,EAAEC,MAAM,EAAEC,SAAS,EAAEC,IAAI,EAAEC,gBAAgB,EAAEC,QAAQ,EAAEC,KAAK,EAAEC,OAAO,QAAQ,gBAAgB;AAGrH,SACEC,gCAAgC,EAChCC,UAAU,EACVC,aAAa,EACbC,WAAW,EACXC,aAAa,EACbC,cAAc,QACT,yBAAyB;AAChC,SAAkBC,UAAU,EAAEC,YAAY,EAAiBC,OAAO,EAAEC,cAAc,EAAEC,QAAQ,QAAQ,kBAAkB;AACtH,SAASC,WAAW,QAAQ,0BAA0B;AACtD,SAASC,cAAc,QAAQ,wBAAwB;AAEvD,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SAASC,oBAAoB,QAAQ,mBAAmB;AACxD,SAASC,cAAc,QAAQ,oBAAoB;AACnD,SAASC,mBAAmB,EAAEC,eAAe,QAAQ,oBAAoB;AACzE,SAASC,YAAY,QAAwB,+BAA+B;AAE5E,SAASC;IACP,qBAAO,KAACC;kBAAI;;AACd;AAOA,SAASC,uBAAuB,EAAEC,MAAM,EAAEC,OAAO,EAA+B;IAC9E,qBACE;;0BACE,KAAC/B;gBAAWgC,IAAI;gBAAGC,SAAQ;0BAAY;;0BAGvC,MAAC3B;gBAAM4B,SAAS;;kCACd,KAACpB;wBACCiB,SAASA;wBACTI,MAAK;wBACLC,QAAQ,CAAC,EAAEC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qB,EAAE9C,KAAK;mDADK8C,EAAErB,IAAI;;;;;;kCAUjC,KAAC3D;oBAEA2D,SAAS,gCACR,KAACxD;wBAAcmE,mBAAmBpE;kCAChC,cAAA,KAACoB;4BAAuBC,QAAQA;4BAAQC,SAASuB,KAAKvB,OAAO;;;oBAGhEmC,SAAS,gCACR,KAACxD;wBAAcmE,mBAAmBpE;kCAChC,cAAA,KAAC4C;4BAAuBvB,QAAQA;4BAAQC,SAASuB,KAAKvB,OAAO;;;;;0BAInE,KAACvB;gBACC8G,aAAY;gBACZqB,QAAQjC;gBACR0B,UAAU;oBACRzB,uBAAuB;gBACzB;gBACAiC,kBAAkB;oBAChBjC,uBAAuB;oBACvBH;gBACF;;;;AAIR"}
1
+ {"version":3,"sources":["../../../../src/components/Variables/VariableEditorForm/VariableEditorForm.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 { zodResolver } from '@hookform/resolvers/zod';\nimport { Box, Typography, Switch, TextField, Grid, FormControlLabel, MenuItem, Stack, Divider } from '@mui/material';\nimport type { Action } from '@perses-dev/client';\nimport {\n DiscardChangesConfirmationDialog,\n ErrorAlert,\n ErrorBoundary,\n FormActions,\n getSubmitText,\n getTitleAction,\n} from '@perses-dev/components';\nimport type { VariableDefinition, ListVariableDefinition } from '@perses-dev/spec';\nimport { useQueryClient } from '@tanstack/react-query';\nimport type { DispatchWithoutAction, ReactElement } from 'react';\nimport { useCallback, useState } from 'react';\nimport type { Control, SubmitHandler } from 'react-hook-form';\nimport { Controller, FormProvider, useForm, useFormContext, useWatch } from 'react-hook-form';\n\nimport { useValidationSchemas } from '../../../context';\nimport { PluginEditor } from '../../PluginEditor';\nimport { VARIABLE_TYPES } from '../variable-model';\nimport type { SortMethodName } from './variable-editor-form-model';\nimport { SORT_METHODS } from './variable-editor-form-model';\nimport { VariableListPreview, VariablePreview } from './VariablePreview';\n\nfunction FallbackPreview(): ReactElement {\n return <div>Error previewing values</div>;\n}\n\ninterface KindVariableEditorFormProps {\n action: Action;\n control: Control<VariableDefinition>;\n}\n\nfunction TextVariableEditorForm({ action, control }: KindVariableEditorFormProps): ReactElement {\n return (\n <>\n <Typography py={1} variant=\"subtitle1\">\n Text Options\n </Typography>\n <Stack spacing={2}>\n <Controller\n control={control}\n name=\"spec.value\"\n render={({ field, fieldState }) => (\n <>\n <Box>\n <VariablePreview values={[field.value]} />\n </Box>\n <TextField\n {...field}\n label=\"Value\"\n InputLabelProps={{ shrink: action === 'read' ? true : undefined }}\n InputProps={{\n readOnly: action === 'read',\n }}\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n value={field.value ?? ''}\n onChange={(event) => {\n field.onChange(event);\n }}\n />\n </>\n )}\n />\n <Controller\n control={control}\n name=\"spec.constant\"\n render={({ field }) => (\n <FormControlLabel\n label=\"Constant\"\n control={\n <Switch\n {...field}\n checked={!!field.value}\n readOnly={action === 'read'}\n value={field.value ?? false}\n onChange={(event) => {\n if (action === 'read') return; // ReadOnly prop is not blocking user interaction...\n field.onChange(event);\n }}\n />\n }\n />\n )}\n />\n </Stack>\n </>\n );\n}\n\nfunction ListVariableEditorForm({ action, control }: KindVariableEditorFormProps): ReactElement {\n const form = useFormContext<VariableDefinition>();\n const queryClient = useQueryClient();\n\n const values = form.getValues() as ListVariableDefinition;\n /* We use `previewDefinition` to explicitly update the spec\n * that will be used for preview when running query. The reason why we do this is to avoid\n * having to re-fetch the values when the user is still editing the spec.\n * Using structuredClone to not have reference issues with nested objects.\n */\n const [previewDefinition, setPreviewDefinition] = useState(structuredClone(values));\n\n const handleRunQuery = useCallback(async () => {\n if (JSON.stringify(previewDefinition) === JSON.stringify(values)) {\n await queryClient.invalidateQueries({ queryKey: ['variable', previewDefinition] });\n } else {\n setPreviewDefinition(structuredClone(values));\n }\n }, [previewDefinition, queryClient, values]);\n\n const plugin = useWatch<VariableDefinition, 'spec.plugin'>({ control, name: 'spec.plugin' });\n const kind = plugin?.kind;\n const pluginSpec = plugin?.spec;\n\n const _allowAllValue = useWatch<VariableDefinition, 'spec.allowAllValue'>({\n control: control,\n name: 'spec.allowAllValue',\n });\n\n const _customAllValue = useWatch<VariableDefinition, 'spec.customAllValue'>({\n control: control,\n name: 'spec.customAllValue',\n });\n\n const sortMethod = useWatch<VariableDefinition, 'spec.sort'>({\n control: control,\n name: 'spec.sort',\n }) as SortMethodName;\n\n // When variable kind is selected we need to provide default values\n // TODO: check if react-hook-form has a better way to do this\n if (values.spec.allowAllValue === undefined) {\n form.setValue('spec.allowAllValue', false);\n }\n\n if (values.spec.allowMultiple === undefined) {\n form.setValue('spec.allowMultiple', false);\n }\n\n if (!values.spec.plugin) {\n form.setValue('spec.plugin', { kind: 'StaticListVariable', spec: {} });\n }\n\n if (!values.spec.sort) {\n form.setValue('spec.sort', 'none');\n }\n\n return (\n <>\n <Typography py={1} variant=\"subtitle1\">\n List Options\n </Typography>\n <Stack spacing={2} mb={2}>\n <Box>\n <ErrorBoundary FallbackComponent={FallbackPreview} resetKeys={[previewDefinition]}>\n <VariableListPreview sortMethod={sortMethod} definition={previewDefinition} />\n </ErrorBoundary>\n </Box>\n <Stack>\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <Controller\n control={control}\n name=\"spec.plugin\"\n render={({ field }) => {\n return (\n <PluginEditor\n withRunQueryButton\n width=\"100%\"\n pluginTypes={['Variable']}\n pluginKindLabel=\"Source\"\n value={{\n selection: {\n type: 'Variable',\n kind: kind ?? 'StaticListVariable',\n },\n spec: pluginSpec ?? {},\n }}\n isReadonly={action === 'read'}\n onChange={(v) => {\n field.onChange({ kind: v.selection.kind, spec: v.spec });\n }}\n onRunQuery={handleRunQuery}\n />\n );\n }}\n />\n </ErrorBoundary>\n </Stack>\n\n <Stack>\n <Controller\n control={control}\n name=\"spec.capturingRegexp\"\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n label=\"Capturing Regexp Filter\"\n InputLabelProps={{ shrink: action === 'read' ? true : undefined }}\n InputProps={{\n readOnly: action === 'read',\n }}\n error={!!fieldState.error}\n value={field.value ?? ''}\n onChange={(event) => {\n if (event.target.value === '') {\n field.onChange(undefined);\n } else {\n field.onChange(event);\n }\n }}\n helperText={\n fieldState.error?.message\n ? fieldState.error.message\n : 'Optional, if you want to filter on captured result.'\n }\n />\n )}\n />\n </Stack>\n\n <Stack>\n <Controller\n control={control}\n name=\"spec.sort\"\n render={({ field, fieldState }) => (\n <TextField\n select\n {...field}\n fullWidth\n label=\"Sort\"\n InputLabelProps={{ shrink: action === 'read' ? true : undefined }}\n InputProps={{\n readOnly: action === 'read',\n }}\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n value={field.value ?? 'none'}\n onChange={(event) => {\n field.onChange(event);\n }}\n >\n {Object.keys(SORT_METHODS).map((key) => {\n if (!SORT_METHODS[key as SortMethodName]) return null;\n const { label } = SORT_METHODS[key as SortMethodName];\n return (\n <MenuItem key={key} value={key}>\n {label}\n </MenuItem>\n );\n })}\n </TextField>\n )}\n />\n </Stack>\n </Stack>\n\n <Divider />\n\n <Typography py={1} variant=\"subtitle1\">\n Dropdown Options\n </Typography>\n <Stack spacing=\"2\">\n <Stack>\n <Controller\n control={control}\n name=\"spec.allowMultiple\"\n render={({ field }) => (\n <FormControlLabel\n label=\"Allow Multiple Values\"\n control={\n <Switch\n {...field}\n checked={!!field.value}\n readOnly={action === 'read'}\n value={field.value ?? false}\n onChange={(event) => {\n if (action === 'read') return; // ReadOnly prop is not blocking user interaction...\n field.onChange(event);\n }}\n />\n }\n />\n )}\n />\n <Typography variant=\"caption\">Enables multiple values to be selected at the same time</Typography>\n </Stack>\n <Stack>\n <Controller\n control={control}\n name=\"spec.allowAllValue\"\n render={({ field }) => (\n <FormControlLabel\n label=\"Allow All option\"\n control={\n <Switch\n {...field}\n checked={!!field.value}\n readOnly={action === 'read'}\n value={field.value ?? false}\n onChange={(event) => {\n if (action === 'read') return; // ReadOnly prop is not blocking user interaction...\n field.onChange(event);\n }}\n />\n }\n />\n )}\n />\n <Typography mb={1} variant=\"caption\">\n Enables an option to include all variable values\n </Typography>\n {_allowAllValue && (\n <Stack spacing={1}>\n <FormControlLabel\n label=\"Use Custom All Value\"\n control={\n <Switch\n checked={_customAllValue !== undefined}\n readOnly={action === 'read'}\n onChange={(event) => {\n if (action === 'read') return;\n const isEnabled = event.target.checked;\n if (isEnabled) {\n form.setValue('spec.customAllValue', '');\n } else {\n form.setValue('spec.customAllValue', undefined);\n }\n }}\n />\n }\n />\n <Typography variant=\"caption\" sx={{ mt: -0.5 }}>\n Enable to set a custom value when &quot;All&quot; is selected\n </Typography>\n {_customAllValue !== undefined && (\n <Controller\n control={control}\n name=\"spec.customAllValue\"\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n fullWidth\n label=\"Custom All Value\"\n InputLabelProps={{ shrink: action === 'read' ? true : undefined }}\n InputProps={{\n readOnly: action === 'read',\n }}\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n value={field.value ?? ''}\n onChange={(event) => {\n field.onChange(event.target.value || '');\n }}\n />\n )}\n />\n )}\n </Stack>\n )}\n </Stack>\n </Stack>\n </>\n );\n}\n\ninterface VariableEditorFormProps {\n initialVariableDefinition: VariableDefinition;\n action: Action;\n isDraft: boolean;\n isReadonly?: boolean;\n onActionChange?: (action: Action) => void;\n onSave: (def: VariableDefinition) => void;\n onClose: () => void;\n onDelete?: DispatchWithoutAction;\n}\n\nexport function VariableEditorForm({\n initialVariableDefinition,\n action,\n isDraft,\n isReadonly,\n onActionChange,\n onSave,\n onClose,\n onDelete,\n}: VariableEditorFormProps): ReactElement {\n const [isDiscardDialogOpened, setDiscardDialogOpened] = useState<boolean>(false);\n const titleAction = getTitleAction(action, isDraft);\n const submitText = getSubmitText(action, isDraft);\n\n const { variableEditorSchema } = useValidationSchemas();\n const form = useForm<VariableDefinition>({\n resolver: zodResolver(variableEditorSchema),\n mode: 'onBlur',\n defaultValues: initialVariableDefinition,\n });\n\n const kind = useWatch({ control: form.control, name: 'kind' });\n\n function clearFormData(data: VariableDefinition): VariableDefinition {\n const result = { ...data };\n if (\n result.spec.display?.name === undefined &&\n result.spec.display?.description === undefined &&\n result.spec.display?.hidden === undefined\n ) {\n delete result.spec.display;\n }\n return result;\n }\n\n const processForm: SubmitHandler<VariableDefinition> = (data: VariableDefinition) => {\n // reset display attributes to undefined when empty, because we don't want to save empty strings\n onSave(clearFormData(data));\n };\n\n // When user click on cancel, several possibilities:\n // - create action: ask for discard approval\n // - update action: ask for discard approval if changed\n // - read action: don´t ask for discard approval\n function handleCancel(): void {\n if (JSON.stringify(initialVariableDefinition) !== JSON.stringify(clearFormData(form.getValues()))) {\n setDiscardDialogOpened(true);\n } else {\n onClose();\n }\n }\n\n return (\n <FormProvider {...form}>\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n padding: (theme) => theme.spacing(1, 2),\n borderBottom: (theme) => `1px solid ${theme.palette.divider}`,\n }}\n >\n <Typography variant=\"h2\">{titleAction} Variable</Typography>\n <FormActions\n action={action}\n submitText={submitText}\n isReadonly={isReadonly}\n isValid={form.formState.isValid}\n onActionChange={onActionChange}\n onSubmit={form.handleSubmit(processForm)}\n onDelete={onDelete}\n onCancel={handleCancel}\n />\n </Box>\n <Box padding={2} sx={{ overflowY: 'scroll' }}>\n <Grid container spacing={2} mb={2}>\n <Grid item xs={8}>\n <Controller\n control={form.control}\n name=\"spec.name\"\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n required\n fullWidth\n label=\"Name\"\n InputLabelProps={{ shrink: action === 'read' ? true : undefined }}\n InputProps={{\n disabled: action === 'update' && !isDraft,\n readOnly: action === 'read',\n }}\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n value={field.value ?? ''}\n onChange={(event) => {\n field.onChange(event);\n }}\n />\n )}\n />\n </Grid>\n <Grid item xs={4}>\n <Controller\n control={form.control}\n name=\"spec.display.name\"\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n fullWidth\n label=\"Display Label\"\n InputLabelProps={{ shrink: action === 'read' ? true : undefined }}\n InputProps={{\n readOnly: action === 'read',\n }}\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n value={field.value ?? ''}\n onChange={(event) => {\n field.onChange(event);\n }}\n />\n )}\n />\n </Grid>\n <Grid item xs={8}>\n <Controller\n control={form.control}\n name=\"spec.display.description\"\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n fullWidth\n label=\"Description\"\n InputLabelProps={{ shrink: action === 'read' ? true : undefined }}\n InputProps={{\n readOnly: action === 'read',\n }}\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n value={field.value ?? ''}\n onChange={(event) => {\n field.onChange(event);\n }}\n />\n )}\n />\n </Grid>\n <Grid item xs={4}>\n <Controller\n control={form.control}\n name=\"kind\"\n render={({ field, fieldState }) => (\n <TextField\n select\n {...field}\n fullWidth\n label=\"Type\"\n InputLabelProps={{ shrink: action === 'read' ? true : undefined }}\n InputProps={{\n readOnly: action === 'read',\n }}\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n value={field.value ?? 'TextVariable'}\n onChange={(event) => {\n field.onChange(event);\n }}\n >\n {VARIABLE_TYPES.map((v) => (\n <MenuItem key={v.kind} value={v.kind}>\n {v.label}\n </MenuItem>\n ))}\n </TextField>\n )}\n />\n </Grid>\n </Grid>\n\n <Divider />\n\n {kind === 'TextVariable' && (\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <TextVariableEditorForm action={action} control={form.control} />\n </ErrorBoundary>\n )}\n {kind === 'ListVariable' && (\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <ListVariableEditorForm action={action} control={form.control} />\n </ErrorBoundary>\n )}\n </Box>\n <DiscardChangesConfirmationDialog\n description=\"Are you sure you want to discard these changes? Changes cannot be recovered.\"\n isOpen={isDiscardDialogOpened}\n onCancel={() => {\n setDiscardDialogOpened(false);\n }}\n onDiscardChanges={() => {\n setDiscardDialogOpened(false);\n onClose();\n }}\n />\n </FormProvider>\n );\n}\n"],"names":["zodResolver","Box","Typography","Switch","TextField","Grid","FormControlLabel","MenuItem","Stack","Divider","DiscardChangesConfirmationDialog","ErrorAlert","ErrorBoundary","FormActions","getSubmitText","getTitleAction","useQueryClient","useCallback","useState","Controller","FormProvider","useForm","useFormContext","useWatch","useValidationSchemas","PluginEditor","VARIABLE_TYPES","SORT_METHODS","VariableListPreview","VariablePreview","FallbackPreview","div","TextVariableEditorForm","action","control","py","variant","spacing","name","render","field","fieldState","values","value","label","InputLabelProps","shrink","undefined","InputProps","readOnly","error","helperText","message","onChange","event","checked","ListVariableEditorForm","form","queryClient","getValues","previewDefinition","setPreviewDefinition","structuredClone","handleRunQuery","JSON","stringify","invalidateQueries","queryKey","plugin","kind","pluginSpec","spec","_allowAllValue","_customAllValue","sortMethod","allowAllValue","setValue","allowMultiple","sort","mb","FallbackComponent","resetKeys","definition","withRunQueryButton","width","pluginTypes","pluginKindLabel","selection","type","isReadonly","v","onRunQuery","target","select","fullWidth","Object","keys","map","key","isEnabled","sx","mt","VariableEditorForm","initialVariableDefinition","isDraft","onActionChange","onSave","onClose","onDelete","isDiscardDialogOpened","setDiscardDialogOpened","titleAction","submitText","variableEditorSchema","resolver","mode","defaultValues","clearFormData","data","result","display","description","hidden","processForm","handleCancel","alignItems","padding","theme","borderBottom","palette","divider","isValid","formState","onSubmit","handleSubmit","onCancel","overflowY","container","item","xs","required","disabled","isOpen","onDiscardChanges"],"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,iCAAi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gBACR0B,UAAU;oBACRzB,uBAAuB;gBACzB;gBACAiC,kBAAkB;oBAChBjC,uBAAuB;oBACvBH;gBACF;;;;AAIR"}
@@ -1,5 +1,5 @@
1
- import { ReactElement } from 'react';
2
- import { ListVariableDefinition } from '@perses-dev/spec';
1
+ import type { ListVariableDefinition } from '@perses-dev/spec';
2
+ import type { ReactElement } from 'react';
3
3
  import { SORT_METHODS } from './variable-editor-form-model';
4
4
  interface VariablePreviewProps {
5
5
  values?: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"VariablePreview.d.ts","sourceRoot":"","sources":["../../../../src/components/Variables/VariableEditorForm/VariablePreview.tsx"],"names":[],"mappings":"AAaA,OAAc,EAAE,YAAY,EAAqB,MAAM,OAAO,CAAC;AAI/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAG1D,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAI5D,UAAU,oBAAoB;IAC5B,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,YAAY,CA4DzE;AAED,UAAU,wBAAwB;IAChC,UAAU,EAAE,sBAAsB,CAAC;IACnC,UAAU,CAAC,EAAE,MAAM,OAAO,YAAY,CAAC;CACxC;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,GAAG,YAAY,CAmBjF"}
1
+ {"version":3,"file":"VariablePreview.d.ts","sourceRoot":"","sources":["../../../../src/components/Variables/VariableEditorForm/VariablePreview.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAK1C,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAI5D,UAAU,oBAAoB;IAC5B,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,YAAY,CA4DzE;AAED,UAAU,wBAAwB;IAChC,UAAU,EAAE,sBAAsB,CAAC;IACnC,UAAU,CAAC,EAAE,MAAM,OAAO,YAAY,CAAC;CACxC;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,GAAG,YAAY,CAmBjF"}
@@ -11,13 +11,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
11
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  // See the License for the specific language governing permissions and
13
13
  // limitations under the License.
14
- import React, { useMemo, useState } from 'react';
15
- import { Alert, Box, Card, Chip, CircularProgress, IconButton, Stack, Typography } from '@mui/material';
16
- import { InfoTooltip, useSnackbar } from '@perses-dev/components';
17
- import Clipboard from 'mdi-material-ui/ClipboardOutline';
18
- import { TOOLTIP_TEXT } from '../../../constants';
19
- import { useListVariablePluginValues } from '../variable-model';
20
- import { SORT_METHODS } from './variable-editor-form-model';
14
+ import { Alert, Box, Card, Chip, CircularProgress, IconButton, Stack, Typography } from "@mui/material";
15
+ import { InfoTooltip, useSnackbar } from "@perses-dev/components";
16
+ import Clipboard from "mdi-material-ui/ClipboardOutline";
17
+ import React, { useMemo, useState } from "react";
18
+ import { TOOLTIP_TEXT } from "../../../constants/index.js";
19
+ import { useListVariablePluginValues } from "../variable-model.js";
20
+ import { SORT_METHODS } from "./variable-editor-form-model.js";
21
21
  const DEFAULT_MAX_PREVIEW_VALUES = 50;
22
22
  export function VariablePreview(props) {
23
23
  const { values, isLoading, error } = props;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/Variables/VariableEditorForm/VariablePreview.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 React, { ReactElement, useMemo, useState } from 'react';\nimport { Alert, Box, Card, Chip, CircularProgress, IconButton, Stack, Typography } from '@mui/material';\nimport { InfoTooltip, useSnackbar } from '@perses-dev/components';\nimport Clipboard from 'mdi-material-ui/ClipboardOutline';\nimport { ListVariableDefinition } from '@perses-dev/spec';\nimport { TOOLTIP_TEXT } from '../../../constants';\nimport { useListVariablePluginValues } from '../variable-model';\nimport { SORT_METHODS } from './variable-editor-form-model';\n\nconst DEFAULT_MAX_PREVIEW_VALUES = 50;\n\ninterface VariablePreviewProps {\n values?: string[];\n isLoading?: boolean;\n error?: string;\n}\n\nexport function VariablePreview(props: VariablePreviewProps): ReactElement {\n const { values, isLoading, error } = props;\n const [maxValues, setMaxValues] = useState<number | undefined>(DEFAULT_MAX_PREVIEW_VALUES);\n const { infoSnackbar } = useSnackbar();\n const showAll = (): void => {\n setMaxValues(undefined);\n };\n let notShown = 0;\n\n if (values && values?.length > 0 && maxValues) {\n notShown = values.length - maxValues;\n }\n\n const variablePreviewState = useMemo((): ReactElement | null => {\n if (isLoading) {\n return (\n <Stack width=\"100%\" sx={{ alignItems: 'center', justifyContent: 'center' }}>\n <CircularProgress />\n </Stack>\n );\n } else if (error) {\n return <Alert severity=\"error\">{error}</Alert>;\n } else if (!values?.length) {\n return <Alert severity=\"info\">No results</Alert>;\n }\n return null;\n }, [error, isLoading, values]);\n\n return (\n <Box>\n <Stack direction=\"row\" spacing={1} alignItems=\"center\" mb={1}>\n <Typography variant=\"h4\">Preview Values</Typography>\n <InfoTooltip description={TOOLTIP_TEXT.copyVariableValues}>\n <IconButton\n onClick={async () => {\n if (values?.length) {\n await navigator.clipboard.writeText(values.map((value) => value).join(', '));\n infoSnackbar('Preview values copied to clipboard!');\n }\n }}\n size=\"small\"\n >\n <Clipboard />\n </IconButton>\n </InfoTooltip>\n </Stack>\n <Card variant=\"outlined\">\n <Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 1, m: 2 }}>\n {variablePreviewState}\n {values\n ?.slice(0, maxValues)\n .filter((val) => val)\n .map((val, index) => (\n <Chip size=\"small\" key={index} label={val} />\n ))}\n {notShown > 0 && <Chip onClick={showAll} variant=\"outlined\" size=\"small\" label={`+${notShown} more`} />}\n </Box>\n </Card>\n </Box>\n );\n}\n\ninterface VariableListPreviewProps {\n definition: ListVariableDefinition;\n sortMethod?: keyof typeof SORT_METHODS;\n}\n\nexport function VariableListPreview(props: VariableListPreviewProps): ReactElement {\n const { definition, sortMethod } = props;\n const { data, isFetching, error } = useListVariablePluginValues(definition);\n const errorMessage = (error as Error)?.message;\n\n const result = !sortMethod || sortMethod === 'none' || !data ? data : SORT_METHODS[sortMethod].sort(data);\n\n const variablePreview = useMemo(\n () => (\n <VariablePreview\n values={result?.map((val) => val.label || val.value)}\n isLoading={isFetching}\n error={errorMessage}\n />\n ),\n [errorMessage, isFetching, result]\n );\n\n return variablePreview;\n}\n"],"names":["React","useMemo","useState","Alert","Box","Card","Chip","CircularProgress","IconButton","Stack","Typography","InfoTooltip","useSnackbar","Clipboard","TOOLTIP_TEXT","useListVariablePluginValues","SORT_METHODS","DEFAULT_MAX_PREVIEW_VALUES","VariablePreview","props","values","isLoading","error","maxValues","setMaxValues","infoSnackbar","showAll","undefined","notShown","length","variablePreviewState","width","sx","alignItems","justifyContent","severity","direction","spacing","mb","variant","description","copyVariableValues","onClick","navigator","clipboard","writeText","map","value","join","size","display","flexWrap","gap","m","slice","filter","val","index","label","VariableListPreview","definition","sortMethod","data","isFetching","errorMessage","message","result","sort","variablePreview"],"mappings":";AAAA,+BAA+B;AA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B,IAAI,CAACU,MAAQA,IAAIE,KAAK,IAAIF,IAAIT,KAAK;YACnD1B,WAAW0C;YACXzC,OAAO0C;YAGX;QAACA;QAAcD;QAAYG;KAAO;IAGpC,OAAOE;AACT"}
1
+ {"version":3,"sources":["../../../../src/components/Variables/VariableEditorForm/VariablePreview.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 { Alert, Box, Card, Chip, CircularProgress, IconButton, Stack, Typography } from '@mui/material';\nimport { InfoTooltip, useSnackbar } from '@perses-dev/components';\nimport type { ListVariableDefinition } from '@perses-dev/spec';\nimport Clipboard from 'mdi-material-ui/ClipboardOutline';\nimport type { ReactElement } from 'react';\nimport React, { useMemo, useState } from 'react';\n\nimport { TOOLTIP_TEXT } from '../../../constants';\nimport { useListVariablePluginValues } from '../variable-model';\nimport { SORT_METHODS } from './variable-editor-form-model';\n\nconst DEFAULT_MAX_PREVIEW_VALUES = 50;\n\ninterface VariablePreviewProps {\n values?: string[];\n isLoading?: boolean;\n error?: string;\n}\n\nexport function VariablePreview(props: VariablePreviewProps): ReactElement {\n const { values, isLoading, error } = props;\n const [maxValues, setMaxValues] = useState<number | undefined>(DEFAULT_MAX_PREVIEW_VALUES);\n const { infoSnackbar } = useSnackbar();\n const showAll = (): void => {\n setMaxValues(undefined);\n };\n let notShown = 0;\n\n if (values && values?.length > 0 && maxValues) {\n notShown = values.length - maxValues;\n }\n\n const variablePreviewState = useMemo((): ReactElement | null => {\n if (isLoading) {\n return (\n <Stack width=\"100%\" sx={{ alignItems: 'center', justifyContent: 'center' }}>\n <CircularProgress />\n </Stack>\n );\n } else if (error) {\n return <Alert severity=\"error\">{error}</Alert>;\n } else if (!values?.length) {\n return <Alert severity=\"info\">No results</Alert>;\n }\n return null;\n }, [error, isLoading, values]);\n\n return (\n <Box>\n <Stack direction=\"row\" spacing={1} alignItems=\"center\" mb={1}>\n <Typography variant=\"h4\">Preview Values</Typography>\n <InfoTooltip description={TOOLTIP_TEXT.copyVariableValues}>\n <IconButton\n onClick={async () => {\n if (values?.length) {\n await navigator.clipboard.writeText(values.map((value) => value).join(', '));\n infoSnackbar('Preview values copied to clipboard!');\n }\n }}\n size=\"small\"\n >\n <Clipboard />\n </IconButton>\n </InfoTooltip>\n </Stack>\n <Card variant=\"outlined\">\n <Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 1, m: 2 }}>\n {variablePreviewState}\n {values\n ?.slice(0, maxValues)\n .filter((val) => val)\n .map((val, index) => (\n <Chip size=\"small\" key={index} label={val} />\n ))}\n {notShown > 0 && <Chip onClick={showAll} variant=\"outlined\" size=\"small\" label={`+${notShown} more`} />}\n </Box>\n </Card>\n </Box>\n );\n}\n\ninterface VariableListPreviewProps {\n definition: ListVariableDefinition;\n sortMethod?: keyof typeof SORT_METHODS;\n}\n\nexport function VariableListPreview(props: VariableListPreviewProps): ReactElement {\n const { definition, sortMethod } = props;\n const { data, isFetching, error } = useListVariablePluginValues(definition);\n const errorMessage = (error as Error)?.message;\n\n const result = !sortMethod || sortMethod === 'none' || !data ? data : SORT_METHODS[sortMethod].sort(data);\n\n const variablePreview = useMemo(\n () => (\n <VariablePreview\n values={result?.map((val) => val.label || val.value)}\n isLoading={isFetching}\n error={errorMessage}\n />\n ),\n [errorMessage, isFetching, result],\n );\n\n return variablePreview;\n}\n"],"names":["Alert","Box","Card","Chip","CircularProgress","IconButton","Stack","Typography","InfoTooltip","useSnackbar","Clipboard","React","useMemo","useState","TOOLTIP_TEXT","useListVariablePluginValues","SORT_METHODS","DEFAULT_MAX_PREVIEW_VALUES","VariablePreview","props","values","isLoading","error","maxValues","setMaxValues","infoSnackbar","showAll","undefined","notShown","length","variablePreviewState","width","sx","alignItems","justifyContent","severity","direction","spacing","mb","variant","description","copyVariableValues","onClick","navigator","clipboard","writeText","map","value","join","size","display","flexWrap","gap","m","slice","filter","val","index","label","VariableListPreview","definition","sortMethod","data","isFetching","errorMessage","message","result","sort","variablePreview"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,KAAK,EAAEC,GAAG,EAAEC,IAAI,EAAEC,IAAI,EAAEC,gBAAgB,EAAEC,UAAU,EAAEC,KAAK,EAAEC,UAAU,QAAQ,gBAAgB;AACxG,SAASC,WAAW,EAAEC,WAAW,QAAQ,yBAAyB;AAElE,OAAOC,eAAe,mCAAmC;AAEzD,OAAOC,SAASC,OAAO,EAAEC,QAAQ,QAAQ,QAAQ;AAEjD,SAASC,YAAY,QAAQ,8BAAqB;AAClD,SAASC,2BAA2B,QAAQ,uBAAoB;AAChE,SAASC,YAAY,QAAQ,kCAA+B;AAE5D,MAAMC,6BAA6B;AAQnC,OAAO,SAASC,gBAAgBC,KAA2B;IACzD,MAAM,EAAEC,MAAM,EAAEC,SAAS,EAAEC,KAAK,EAAE,GAAGH;IACrC,MAAM,CAACI,WAAWC,aAAa,GAAGX,SAA6BI;IAC/D,MAAM,EAAEQ,YAAY,EAAE,GAAGhB;IACzB,MAAMiB,UAAU;QACdF,aAAaG;IACf;IACA,IAAIC,WAAW;IAEf,IAAIR,UAAUA,QAAQS,SAAS,KAAKN,WAAW;QAC7CK,WAAWR,OAAOS,MAAM,GAAGN;IAC7B;IAEA,MAAMO,uBAAuBlB,QAAQ;QACnC,IAAIS,WAAW;YACb,qBACE,KAACf;gBAAMyB,OAAM;gBAAOC,IAAI;oBAAEC,YAAY;oBAAUC,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K,EAAE,GAAGP,4BAA4B6C;IAChE,MAAMI,eAAgB1C,OAAiB2C;IAEvC,MAAMC,SAAS,CAACL,cAAcA,eAAe,UAAU,CAACC,OAAOA,OAAO9C,YAAY,CAAC6C,WAAW,CAACM,IAAI,CAACL;IAEpG,MAAMM,kBAAkBxD,QACtB,kBACE,KAACM;YACCE,QAAQ8C,QAAQpB,IAAI,CAACU,MAAQA,IAAIE,KAAK,IAAIF,IAAIT,KAAK;YACnD1B,WAAW0C;YACXzC,OAAO0C;YAGX;QAACA;QAAcD;QAAYG;KAAO;IAGpC,OAAOE;AACT"}
@@ -10,8 +10,8 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- export * from './VariableEditorForm';
14
- export * from './VariablePreview';
15
- export * from './variable-editor-form-model';
13
+ export * from "./VariableEditorForm.js";
14
+ export * from "./VariablePreview.js";
15
+ export * from "./variable-editor-form-model.js";
16
16
 
17
17
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/Variables/VariableEditorForm/index.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './VariableEditorForm';\nexport * from './VariablePreview';\nexport * from './variable-editor-form-model';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,uBAAuB;AACrC,cAAc,oBAAoB;AAClC,cAAc,+BAA+B"}
1
+ {"version":3,"sources":["../../../../src/components/Variables/VariableEditorForm/index.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './VariableEditorForm';\nexport * from './VariablePreview';\nexport * from './variable-editor-form-model';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,0BAAuB;AACrC,cAAc,uBAAoB;AAClC,cAAc,kCAA+B"}
@@ -1,5 +1,5 @@
1
- import { ListVariableSpec, TextVariableSpec, VariableDefinition } from '@perses-dev/spec';
2
- import { VariableOption } from '../../../model';
1
+ import type { ListVariableSpec, TextVariableSpec, VariableDefinition } from '@perses-dev/spec';
2
+ import type { VariableOption } from '../../../model';
3
3
  export type SortMethodName = 'none' | 'alphabetical-asc' | 'alphabetical-desc' | 'numerical-asc' | 'numerical-desc' | 'alphabetical-ci-asc' | 'alphabetical-ci-desc';
4
4
  export declare const SORT_METHODS: Record<SortMethodName, {
5
5
  label: string;
@@ -1 +1 @@
1
- {"version":3,"file":"variable-editor-form-model.d.ts","sourceRoot":"","sources":["../../../../src/components/Variables/VariableEditorForm/variable-editor-form-model.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,gBAAgB,EAA0B,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAClH,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,MAAM,MAAM,cAAc,GACtB,MAAM,GACN,kBAAkB,GAClB,mBAAmB,GACnB,eAAe,GACf,gBAAgB,GAChB,qBAAqB,GACrB,sBAAsB,CAAC;AAE3B,eAAO,MAAM,YAAY,EAAE,MAAM,CAC/B,cAAc,EACd;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,CAAC,KAAK,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,CAAA;CAAE,CA4CvE,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,cAAc,GAAG,cAAc,GAAG,iBAAiB,CAAC;IAC1D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,IAAI,CAAC,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IAC/D,kBAAkB,EAAE,IAAI,CAAC,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;CAChE,CAAC;AAEF,wBAAgB,eAAe,CAAC,yBAAyB,EAAE,kBAAkB,GAAG,mBAAmB,CAkClG;AAED,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,mBAAmB,GAAG,kBAAkB,CAgC7F"}
1
+ {"version":3,"file":"variable-editor-form-model.d.ts","sourceRoot":"","sources":["../../../../src/components/Variables/VariableEditorForm/variable-editor-form-model.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,gBAAgB,EAA0B,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEvH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,MAAM,MAAM,cAAc,GACtB,MAAM,GACN,kBAAkB,GAClB,mBAAmB,GACnB,eAAe,GACf,gBAAgB,GAChB,qBAAqB,GACrB,sBAAsB,CAAC;AAE3B,eAAO,MAAM,YAAY,EAAE,MAAM,CAC/B,cAAc,EACd;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,CAAC,KAAK,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,CAAA;CAAE,CA4CvE,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,cAAc,GAAG,cAAc,GAAG,iBAAiB,CAAC;IAC1D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,IAAI,CAAC,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IAC/D,kBAAkB,EAAE,IAAI,CAAC,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;CAChE,CAAC;AAEF,wBAAgB,eAAe,CAAC,yBAAyB,EAAE,kBAAkB,GAAG,mBAAmB,CAkClG;AAED,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,mBAAmB,GAAG,kBAAkB,CAgC7F"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/Variables/VariableEditorForm/variable-editor-form-model.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ListVariableSpec, TextVariableDefinition, TextVariableSpec, VariableDefinition } from '@perses-dev/spec';\nimport { VariableOption } from '../../../model';\n\nexport type SortMethodName =\n | 'none'\n | 'alphabetical-asc'\n | 'alphabetical-desc'\n | 'numerical-asc'\n | 'numerical-desc'\n | 'alphabetical-ci-asc'\n | 'alphabetical-ci-desc';\n\nexport const SORT_METHODS: Record<\n SortMethodName,\n { label: string; sort: (input: VariableOption[]) => VariableOption[] }\n> = {\n none: {\n label: 'None',\n sort: (input: VariableOption[]): VariableOption[] => {\n return input.slice();\n },\n },\n 'alphabetical-asc': {\n label: 'Alphabetical, asc',\n sort: (input: VariableOption[]): VariableOption[] => {\n return input.slice().sort((a, b) => (a.label > b.label ? 1 : -1));\n },\n },\n 'alphabetical-desc': {\n label: 'Alphabetical, desc',\n sort: (input: VariableOption[]): VariableOption[] => {\n return input.slice().sort((a, b) => (a.label > b.label ? -1 : 1));\n },\n },\n 'numerical-asc': {\n label: 'Numerical, asc',\n sort: (input: VariableOption[]): VariableOption[] => {\n return input.slice().sort((a, b) => (parseInt(a.label) > parseInt(b.label) ? 1 : -1));\n },\n },\n 'numerical-desc': {\n label: 'Numerical, desc',\n sort: (input: VariableOption[]): VariableOption[] => {\n return input.slice().sort((a, b) => (parseInt(a.label) < parseInt(b.label) ? 1 : -1));\n },\n },\n 'alphabetical-ci-asc': {\n label: 'Alphabetical, case-insensitive, asc',\n sort: (input: VariableOption[]): VariableOption[] => {\n return input.slice().sort((a, b) => (a.label.toLowerCase() > b.label.toLowerCase() ? 1 : -1));\n },\n },\n 'alphabetical-ci-desc': {\n label: 'Alphabetical, case-insensitive, desc',\n sort: (input: VariableOption[]): VariableOption[] => {\n return input.slice().sort((a, b) => (a.label.toLowerCase() > b.label.toLowerCase() ? -1 : 1));\n },\n },\n};\n\nexport type VariableEditorState = {\n name: string;\n title?: string;\n kind: 'TextVariable' | 'ListVariable' | 'BuiltinVariable';\n description?: string;\n listVariableFields: Omit<ListVariableSpec, 'name' | 'display'>;\n textVariableFields: Omit<TextVariableSpec, 'name' | 'display'>;\n};\n\nexport function getInitialState(initialVariableDefinition: VariableDefinition): VariableEditorState {\n const textVariableFields: Omit<TextVariableSpec, 'name' | 'display'> = {\n value: (initialVariableDefinition as TextVariableDefinition).spec.value ?? '',\n constant: (initialVariableDefinition as TextVariableDefinition).spec.constant ?? false,\n };\n\n const listVariableFields: Omit<ListVariableSpec, 'name' | 'display'> = {\n allowMultiple: false,\n allowAllValue: false,\n customAllValue: undefined,\n capturingRegexp: undefined,\n sort: undefined,\n plugin: {\n kind: '',\n spec: {},\n },\n };\n if (initialVariableDefinition.kind === 'ListVariable') {\n listVariableFields.allowMultiple = initialVariableDefinition.spec.allowMultiple ?? false;\n listVariableFields.allowAllValue = initialVariableDefinition.spec.allowAllValue ?? false;\n listVariableFields.customAllValue = initialVariableDefinition.spec.customAllValue;\n listVariableFields.capturingRegexp = initialVariableDefinition.spec.capturingRegexp;\n listVariableFields.sort = initialVariableDefinition.spec.sort;\n listVariableFields.plugin = initialVariableDefinition.spec.plugin;\n }\n\n return {\n name: initialVariableDefinition.spec.name,\n title: initialVariableDefinition.spec.display?.name ?? '',\n kind: initialVariableDefinition.kind,\n description: initialVariableDefinition.spec.display?.description ?? '',\n listVariableFields,\n textVariableFields,\n };\n}\n\nexport function getVariableDefinitionFromState(state: VariableEditorState): VariableDefinition {\n const { name, title, kind, description } = state;\n\n const display = { name: title, description: description };\n\n if (kind === 'TextVariable') {\n return {\n kind,\n spec: {\n name,\n display,\n ...state.textVariableFields,\n },\n };\n }\n\n if (kind === 'ListVariable') {\n return {\n kind,\n spec: {\n name,\n display,\n allowMultiple: state.listVariableFields.allowMultiple,\n allowAllValue: state.listVariableFields.allowAllValue,\n customAllValue: state.listVariableFields.customAllValue,\n capturingRegexp: state.listVariableFields.capturingRegexp,\n sort: state.listVariableFields.sort,\n plugin: state.listVariableFields.plugin,\n },\n };\n }\n throw new Error(`Unknown variable kind: ${kind}`);\n}\n"],"names":["SORT_METHODS","none","label","sort","input","slice","a","b","parseInt","toLowerCase","getInitialState","initialVariableDefinition","textVariableFields","value","spec","constant","listVariableFields","allowMultiple","allowAllValue","customAllValue","undefined","capturingRegexp","plugin","kind","name","title","display","description","getVariableDefinitionFromState","state","Error"],"mappings":"A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E;IAE3C,MAAMH,UAAU;QAAEF,MAAMC;QAAOE,aAAaA;IAAY;IAExD,IAAIJ,SAAS,gBAAgB;QAC3B,OAAO;YACLA;YACAT,MAAM;gBACJU;gBACAE;gBACA,GAAGG,MAAMjB,kBAAkB;YAC7B;QACF;IACF;IAEA,IAAIW,SAAS,gBAAgB;QAC3B,OAAO;YACLA;YACAT,MAAM;gBACJU;gBACAE;gBACAT,eAAeY,MAAMb,kBAAkB,CAACC,aAAa;gBACrDC,eAAeW,MAAMb,kBAAkB,CAACE,aAAa;gBACrDC,gBAAgBU,MAAMb,kBAAkB,CAACG,cAAc;gBACvDE,iBAAiBQ,MAAMb,kBAAkB,CAACK,eAAe;gBACzDlB,MAAM0B,MAAMb,kBAAkB,CAACb,IAAI;gBACnCmB,QAAQO,MAAMb,kBAAkB,CAACM,MAAM;YACzC;QACF;IACF;IACA,MAAM,IAAIQ,MAAM,CAAC,uBAAuB,EAAEP,MAAM;AAClD"}
1
+ {"version":3,"sources":["../../../../src/components/Variables/VariableEditorForm/variable-editor-form-model.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { ListVariableSpec, TextVariableDefinition, TextVariableSpec, VariableDefinition } from '@perses-dev/spec';\n\nimport type { VariableOption } from '../../../model';\n\nexport type SortMethodName =\n | 'none'\n | 'alphabetical-asc'\n | 'alphabetical-desc'\n | 'numerical-asc'\n | 'numerical-desc'\n | 'alphabetical-ci-asc'\n | 'alphabetical-ci-desc';\n\nexport const SORT_METHODS: Record<\n SortMethodName,\n { label: string; sort: (input: VariableOption[]) => VariableOption[] }\n> = {\n none: {\n label: 'None',\n sort: (input: VariableOption[]): VariableOption[] => {\n return input.slice();\n },\n },\n 'alphabetical-asc': {\n label: 'Alphabetical, asc',\n sort: (input: VariableOption[]): VariableOption[] => {\n return input.slice().sort((a, b) => (a.label > b.label ? 1 : -1));\n },\n },\n 'alphabetical-desc': {\n label: 'Alphabetical, desc',\n sort: (input: VariableOption[]): VariableOption[] => {\n return input.slice().sort((a, b) => (a.label > b.label ? -1 : 1));\n },\n },\n 'numerical-asc': {\n label: 'Numerical, asc',\n sort: (input: VariableOption[]): VariableOption[] => {\n return input.slice().sort((a, b) => (parseInt(a.label) > parseInt(b.label) ? 1 : -1));\n },\n },\n 'numerical-desc': {\n label: 'Numerical, desc',\n sort: (input: VariableOption[]): VariableOption[] => {\n return input.slice().sort((a, b) => (parseInt(a.label) < parseInt(b.label) ? 1 : -1));\n },\n },\n 'alphabetical-ci-asc': {\n label: 'Alphabetical, case-insensitive, asc',\n sort: (input: VariableOption[]): VariableOption[] => {\n return input.slice().sort((a, b) => (a.label.toLowerCase() > b.label.toLowerCase() ? 1 : -1));\n },\n },\n 'alphabetical-ci-desc': {\n label: 'Alphabetical, case-insensitive, desc',\n sort: (input: VariableOption[]): VariableOption[] => {\n return input.slice().sort((a, b) => (a.label.toLowerCase() > b.label.toLowerCase() ? -1 : 1));\n },\n },\n};\n\nexport type VariableEditorState = {\n name: string;\n title?: string;\n kind: 'TextVariable' | 'ListVariable' | 'BuiltinVariable';\n description?: string;\n listVariableFields: Omit<ListVariableSpec, 'name' | 'display'>;\n textVariableFields: Omit<TextVariableSpec, 'name' | 'display'>;\n};\n\nexport function getInitialState(initialVariableDefinition: VariableDefinition): VariableEditorState {\n const textVariableFields: Omit<TextVariableSpec, 'name' | 'display'> = {\n value: (initialVariableDefinition as TextVariableDefinition).spec.value ?? '',\n constant: (initialVariableDefinition as TextVariableDefinition).spec.constant ?? false,\n };\n\n const listVariableFields: Omit<ListVariableSpec, 'name' | 'display'> = {\n allowMultiple: false,\n allowAllValue: false,\n customAllValue: undefined,\n capturingRegexp: undefined,\n sort: undefined,\n plugin: {\n kind: '',\n spec: {},\n },\n };\n if (initialVariableDefinition.kind === 'ListVariable') {\n listVariableFields.allowMultiple = initialVariableDefinition.spec.allowMultiple ?? false;\n listVariableFields.allowAllValue = initialVariableDefinition.spec.allowAllValue ?? false;\n listVariableFields.customAllValue = initialVariableDefinition.spec.customAllValue;\n listVariableFields.capturingRegexp = initialVariableDefinition.spec.capturingRegexp;\n listVariableFields.sort = initialVariableDefinition.spec.sort;\n listVariableFields.plugin = initialVariableDefinition.spec.plugin;\n }\n\n return {\n name: initialVariableDefinition.spec.name,\n title: initialVariableDefinition.spec.display?.name ?? '',\n kind: initialVariableDefinition.kind,\n description: initialVariableDefinition.spec.display?.description ?? '',\n listVariableFields,\n textVariableFields,\n };\n}\n\nexport function getVariableDefinitionFromState(state: VariableEditorState): VariableDefinition {\n const { name, title, kind, description } = state;\n\n const display = { name: title, description: description };\n\n if (kind === 'TextVariable') {\n return {\n kind,\n spec: {\n name,\n display,\n ...state.textVariableFields,\n },\n };\n }\n\n if (kind === 'ListVariable') {\n return {\n kind,\n spec: {\n name,\n display,\n allowMultiple: state.listVariableFields.allowMultiple,\n allowAllValue: state.listVariableFields.allowAllValue,\n customAllValue: state.listVariableFields.customAllValue,\n capturingRegexp: state.listVariableFields.capturingRegexp,\n sort: state.listVariableFields.sort,\n plugin: state.listVariableFields.plugin,\n },\n };\n }\n throw new Error(`Unknown variable kind: ${kind}`);\n}\n"],"names":["SORT_METHODS","none","label","sort","input","slice","a","b","parseInt","toLowerCase","getInitialState","initialVariableDefinition","textVariableFields","value","spec","constant","listVariableFields","allowMultiple","allowAllValue","customAllValue","undefined","capturingRegexp","plugin","kind","name","title","display","description","getVariableDefinitionFromState","state","Error"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;A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AAM;gBACJU;gBACAE;gBACA,GAAGG,MAAMjB,kBAAkB;YAC7B;QACF;IACF;IAEA,IAAIW,SAAS,gBAAgB;QAC3B,OAAO;YACLA;YACAT,MAAM;gBACJU;gBACAE;gBACAT,eAAeY,MAAMb,kBAAkB,CAACC,aAAa;gBACrDC,eAAeW,MAAMb,kBAAkB,CAACE,aAAa;gBACrDC,gBAAgBU,MAAMb,kBAAkB,CAACG,cAAc;gBACvDE,iBAAiBQ,MAAMb,kBAAkB,CAACK,eAAe;gBACzDlB,MAAM0B,MAAMb,kBAAkB,CAACb,IAAI;gBACnCmB,QAAQO,MAAMb,kBAAkB,CAACM,MAAM;YACzC;QACF;IACF;IACA,MAAM,IAAIQ,MAAM,CAAC,uBAAuB,EAAEP,MAAM;AAClD"}
@@ -10,7 +10,7 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- export * from './variable-model';
14
- export * from './VariableEditorForm';
13
+ export * from "./variable-model.js";
14
+ export * from "./VariableEditorForm/index.js";
15
15
 
16
16
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Variables/index.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './variable-model';\nexport * from './VariableEditorForm';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,mBAAmB;AACjC,cAAc,uBAAuB"}
1
+ {"version":3,"sources":["../../../src/components/Variables/index.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './variable-model';\nexport * from './VariableEditorForm';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,sBAAmB;AACjC,cAAc,gCAAuB"}
@@ -1,7 +1,7 @@
1
- import { ListVariableDefinition, VariableDefinition, VariableValue } from '@perses-dev/spec';
2
- import { UseQueryResult } from '@tanstack/react-query';
3
- import { VariableOption } from '../../model';
4
- import { VariableStateMap } from '../../runtime';
1
+ import type { ListVariableDefinition, VariableDefinition, VariableValue } from '@perses-dev/spec';
2
+ import type { UseQueryResult } from '@tanstack/react-query';
3
+ import type { VariableOption } from '../../model';
4
+ import type { VariableStateMap } from '../../runtime';
5
5
  export declare function filterVariableList(data: VariableOption[], capturedRegexp: RegExp): VariableOption[];
6
6
  export declare function useListVariablePluginValues(definition: ListVariableDefinition): UseQueryResult<VariableOption[]>;
7
7
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"variable-model.d.ts","sourceRoot":"","sources":["../../../src/components/Variables/variable-model.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,aAAa,E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GG;AACH,wBAAgB,4BAA4B,CAAC,mBAAmB,EAAE,kBAAkB,EAAE,GAAG;IACvF,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACrD,SAAS,EAAE,OAAO,CAAC;CACpB,CAqEA;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,gBAAgB,GAAG,MAAM,CAIhE;AAED,eAAO,MAAM,cAAc;;;;;;EAGjB,CAAC"}
@@ -10,9 +10,9 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- import { useQueries, useQuery } from '@tanstack/react-query';
14
- import { useCallback, useMemo, useState } from 'react';
15
- import { useAllVariableValues, useDatasourceStore, usePlugin, usePlugins, useTimeRange } from '../../runtime';
13
+ import { useQueries, useQuery } from "@tanstack/react-query";
14
+ import { useCallback, useMemo, useState } from "react";
15
+ import { useAllVariableValues, useDatasourceStore, usePlugin, usePlugins, useTimeRange } from "../../runtime/index.js";
16
16
  export function filterVariableList(data, capturedRegexp) {
17
17
  const result = [];
18
18
  const filteredSet = new Set();
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Variables/variable-model.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ListVariableDefinition, VariableDefinition, VariableValue } from '@perses-dev/spec';\nimport { useQueries, useQuery, UseQueryOptions, UseQueryResult } from '@tanstack/react-query';\nimport { useCallback, useMemo, useState } from 'react';\nimport { GetVariableOptionsContext, VariableOption, VariablePlugin } from '../../model';\nimport {\n useAllVariableValues,\n useDatasourceStore,\n usePlugin,\n usePlugins,\n useTimeRange,\n VariableStateMap,\n} from '../../runtime';\n\nexport function filterVariableList(data: VariableOption[], capturedRegexp: RegExp): VariableOption[] {\n const result: VariableOption[] = [];\n const filteredSet = new Set<string>();\n for (const variableValue of data) {\n const matches = variableValue.value.matchAll(capturedRegexp);\n let concat = '';\n for (const match of matches) {\n for (let i = 1; i < match.length; i++) {\n const m = match[i];\n if (m !== undefined) {\n concat = `${concat}${m}`;\n }\n }\n }\n if (concat !== '' && !filteredSet.has(concat)) {\n // like that we are avoiding to have duplicating variable value\n filteredSet.add(concat);\n result.push({ label: variableValue.label, value: concat });\n }\n }\n return result;\n}\n\nfunction useVariablePluginContext(): GetVariableOptionsContext {\n const datasourceStore = useDatasourceStore();\n const allVariables = useAllVariableValues();\n const { absoluteTimeRange: timeRange } = useTimeRange();\n\n return { timeRange, datasourceStore, variables: allVariables };\n}\n\nconst getVariableQueryConfig = (\n definition: ListVariableDefinition,\n variablePluginCtx: GetVariableOptionsContext,\n variablePlugin: VariablePlugin | undefined,\n enabled: boolean,\n onFetched?: (name: string, options: VariableOption[], definition: ListVariableDefinition) => void\n): UseQueryOptions<VariableOption[]> => {\n const capturingRegexp =\n definition.spec.capturingRegexp !== undefined ? new RegExp(definition.spec.capturingRegexp, 'g') : undefined;\n const variablesValueKey = getVariableValuesKey(variablePluginCtx.variables);\n return {\n queryKey: ['variable', definition, variablePluginCtx.timeRange, variablesValueKey],\n queryFn: async ({ signal }): Promise<VariableOption[]> => {\n const resp = await variablePlugin?.getVariableOptions(definition.spec.plugin.spec, variablePluginCtx, signal);\n if (!resp?.data?.length) {\n onFetched?.(definition.spec.name, [], definition);\n return [];\n }\n const options = capturingRegexp ? filterVariableList(resp.data, capturingRegexp) : resp.data;\n onFetched?.(definition.spec.name, options, definition);\n return options;\n },\n enabled,\n };\n};\n\nfunction resolveDependsOnVariables(\n variablePlugin: VariablePlugin | undefined,\n variablePluginCtx: GetVariableOptionsContext,\n definition: ListVariableDefinition\n): string[] {\n if (variablePlugin?.dependsOn) {\n const dependencies = variablePlugin.dependsOn(definition.spec.plugin.spec, variablePluginCtx);\n return dependencies.variables ? dependencies.variables.filter((v) => v !== definition.spec.name) : []; // Exclude self variable to avoid circular dependency and default to empty array to avoid deadlock\n }\n return [];\n}\n\nexport function useListVariablePluginValues(definition: ListVariableDefinition): UseQueryResult<VariableOption[]> {\n const { data: variablePlugin } = usePlugin('Variable', definition.spec.plugin.kind);\n\n const variablePluginCtx = useVariablePluginContext();\n\n const dependsOnVariables = resolveDependsOnVariables(variablePlugin, variablePluginCtx, definition);\n\n const dependentVariables = useAllVariableValues(dependsOnVariables);\n const waitToLoad = dependsOnVariables.some((v) => dependentVariables[v]?.loading);\n\n const ctx = { ...variablePluginCtx, variables: dependentVariables };\n\n return useQuery(getVariableQueryConfig(definition, ctx, variablePlugin, !!variablePlugin && !waitToLoad));\n}\n\nfunction resolveDefaultValue(definition: ListVariableDefinition, options: VariableOption[]): VariableValue {\n const { defaultValue, allowMultiple } = definition.spec;\n if (defaultValue !== undefined && defaultValue !== null) {\n return defaultValue;\n }\n if (options[0]?.value) {\n const first = options[0].value;\n return allowMultiple ? [first] : first;\n }\n return allowMultiple ? [] : '';\n}\n\n/**\n * Resolves initial values for all ListVariable definitions by fetching their options in dependency order.\n * Returns a map of variable names to their resolved default values, merging with any already-provided outer variables.\n */\nexport function useResolveListVariableValues(variableDefinitions: VariableDefinition[]): {\n initialVariableValues: Record<string, VariableValue>;\n isLoading: boolean;\n} {\n const { timeRange, datasourceStore, variables: outerVariableValues } = useVariablePluginContext();\n\n const listVariables = useMemo(\n () => variableDefinitions.filter((v): v is ListVariableDefinition => v.kind === 'ListVariable'),\n [variableDefinitions]\n );\n\n const pluginResults = usePlugins(\n 'Variable',\n listVariables.map((d) => ({ kind: d.spec.plugin.kind }))\n );\n\n // Resolved variable state. Updated by onFetched when queries resolve.\n // Needed because of dependencies between variables that require multiple rounds of fetching.\n const [resolvedVariables, setResolvedVariables] = useState<VariableStateMap>({});\n\n const allVariables = useMemo(() => {\n return { ...outerVariableValues, ...resolvedVariables };\n }, [outerVariableValues, resolvedVariables]);\n\n const onFetched = useCallback((name: string, options: VariableOption[], definition: ListVariableDefinition) => {\n setResolvedVariables((prev) => ({\n ...prev,\n [name]: { value: resolveDefaultValue(definition, options), loading: false, options },\n }));\n }, []);\n\n const queryResults = useQueries({\n queries: listVariables.map((definition, index) => {\n const plugin = pluginResults[index]?.data;\n const isPluginLoading = pluginResults[index]?.isLoading ?? true;\n\n const dependsOn = resolveDependsOnVariables(\n plugin,\n { timeRange, datasourceStore, variables: allVariables },\n definition\n );\n\n const hasPendingDeps = dependsOn.some(\n (v) =>\n (resolvedVariables[v] === undefined && listVariables.some((lv) => lv.spec.name === v)) ||\n allVariables[v]?.loading\n );\n\n const dependentVariables: VariableStateMap = {};\n for (const v of dependsOn) {\n const state = allVariables[v];\n if (state) {\n dependentVariables[v] = state;\n }\n }\n\n const ctx = { timeRange, datasourceStore, variables: dependentVariables };\n return getVariableQueryConfig(definition, ctx, plugin, !hasPendingDeps && !isPluginLoading, onFetched);\n }),\n });\n\n const initialVariableValues: Record<string, VariableValue> = useMemo(\n () =>\n Object.fromEntries(\n Object.entries(allVariables)\n .filter(([, state]) => state?.value !== undefined)\n .map(([name, state]) => [name, state!.value])\n ),\n [allVariables]\n );\n\n return { initialVariableValues, isLoading: queryResults.some((r) => r.isLoading) };\n}\n\n/**\n * Returns a serialized string of the current state of variable values.\n */\nexport function getVariableValuesKey(v: VariableStateMap): string {\n return Object.values(v)\n .map((v) => JSON.stringify(v.value))\n .join(',');\n}\n\nexport const VARIABLE_TYPES = [\n { label: 'List', kind: 'ListVariable' },\n { label: 'Text', kind: 'TextVariable' },\n] as const;\n"],"names":["useQueries","useQuery","useCallback","useMemo","useState","useAllVariableValues","useDatasourceStore","usePlugin","usePlugins","useTimeRange","filterVariableList","data","capturedRegexp","result","filteredSet","Set","variableValue","matches","value","matchAll","concat","match","i","length","m","undefined","has","add","push","label","useVariablePluginContext","datasourceStore","allVariables","absoluteTimeRange","timeRange","variables","getVariableQueryConfig","definition","variablePluginCtx","variablePlugin","enabled","onFetched","capturingRegexp","spec","RegExp","variablesValueKey","getVariableValuesKey","queryKey","queryFn","signal","resp","getVariableOptions","plugin","name","options","resolveDependsOnVariables","dependsOn","dependencies","filter","v","useListVariablePluginValues","kind","dependsOnVariables","dependentVariables","waitToLoad","some","loading","ctx","resolveDefaultValue","defaultValue","allowMultiple","first","useResolveListVariableValues","variableDefinitions","outerVariableValues","listVariables","pluginResults","map","d","resolvedVariables","setResolvedVariables","prev","queryResults","queries","index","isPluginLoading","isLoading","hasPendingDeps","lv","state","initialVariableValues","Object","fromEntries","entries","r","values","JSON","stringify","join","VARIABLE_TYPES"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAASA,UAAU,EAAEC,QAAQ,QAAyC,wBAAwB;AAC9F,SAASC,WAAW,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAQ;AAEvD,SACEC,oBAAoB,EACpBC,kBAAkB,EAClBC,SAAS,EACTC,UAAU,EACVC,YAAY,QAEP,gBAAgB;AAEvB,OAAO,SAASC,mBAAmBC,IAAsB,EAAEC,cAAsB;IAC/E,MAAMC,SAA2B,EAAE;IACnC,MAAMC,cAAc,IAAIC;IACxB,KAAK,MAAMC,iBAAiBL,KAAM;QAChC,MAAMM,UAAUD,cAAcE,KAAK,CAACC,QAAQ,CAACP;QAC7C,IAAIQ,SAAS;QACb,KAAK,MAAMC,SAASJ,QAAS;YAC3B,IAAK,IAAIK,IAAI,GAAGA,IAAID,MAAME,MAAM,EAAED,IAAK;gBACrC,MAAME,IAAIH,KAAK,CAACC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ACnF3B,YAAY,CAAC2B,EAAE,EAAEO;YAGrB,MAAMH,qBAAuC,CAAC;YAC9C,KAAK,MAAMJ,KAAKH,UAAW;gBACzB,MAAMiC,QAAQzD,YAAY,CAAC2B,EAAE;gBAC7B,IAAI8B,OAAO;oBACT1B,kBAAkB,CAACJ,EAAE,GAAG8B;gBAC1B;YACF;YAEA,MAAMtB,MAAM;gBAAEjC;gBAAWH;gBAAiBI,WAAW4B;YAAmB;YACxE,OAAO3B,uBAAuBC,YAAY8B,KAAKf,QAAQ,CAACmC,kBAAkB,CAACF,iBAAiB5C;QAC9F;IACF;IAEA,MAAMiD,wBAAuDvF,QAC3D,IACEwF,OAAOC,WAAW,CAChBD,OAAOE,OAAO,CAAC7D,cACZ0B,MAAM,CAAC,CAAC,GAAG+B,MAAM,GAAKA,OAAOvE,UAAUO,WACvCoD,GAAG,CAAC,CAAC,CAACxB,MAAMoC,MAAM,GAAK;gBAACpC;gBAAMoC,MAAOvE,KAAK;aAAC,IAElD;QAACc;KAAa;IAGhB,OAAO;QAAE0D;QAAuBJ,WAAWJ,aAAajB,IAAI,CAAC,CAAC6B,IAAMA,EAAER,SAAS;IAAE;AACnF;AAEA;;CAEC,GACD,OAAO,SAASxC,qBAAqBa,CAAmB;IACtD,OAAOgC,OAAOI,MAAM,CAACpC,GAClBkB,GAAG,CAAC,CAAClB,IAAMqC,KAAKC,SAAS,CAACtC,EAAEzC,KAAK,GACjCgF,IAAI,CAAC;AACV;AAEA,OAAO,MAAMC,iBAAiB;IAC5B;QAAEtE,OAAO;QAAQgC,MAAM;IAAe;IACtC;QAAEhC,OAAO;QAAQgC,MAAM;IAAe;CACvC,CAAU"}
1
+ {"version":3,"sources":["../../../src/components/Variables/variable-model.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { ListVariableDefinition, VariableDefinition, VariableValue } from '@perses-dev/spec';\nimport type { UseQueryOptions, UseQueryResult } from '@tanstack/react-query';\nimport { useQueries, useQuery } from '@tanstack/react-query';\nimport { useCallback, useMemo, useState } from 'react';\n\nimport type { GetVariableOptionsContext, VariableOption, VariablePlugin } from '../../model';\nimport type { VariableStateMap } from '../../runtime';\nimport { useAllVariableValues, useDatasourceStore, usePlugin, usePlugins, useTimeRange } from '../../runtime';\n\nexport function filterVariableList(data: VariableOption[], capturedRegexp: RegExp): VariableOption[] {\n const result: VariableOption[] = [];\n const filteredSet = new Set<string>();\n for (const variableValue of data) {\n const matches = variableValue.value.matchAll(capturedRegexp);\n let concat = '';\n for (const match of matches) {\n for (let i = 1; i < match.length; i++) {\n const m = match[i];\n if (m !== undefined) {\n concat = `${concat}${m}`;\n }\n }\n }\n if (concat !== '' && !filteredSet.has(concat)) {\n // like that we are avoiding to have duplicating variable value\n filteredSet.add(concat);\n result.push({ label: variableValue.label, value: concat });\n }\n }\n return result;\n}\n\nfunction useVariablePluginContext(): GetVariableOptionsContext {\n const datasourceStore = useDatasourceStore();\n const allVariables = useAllVariableValues();\n const { absoluteTimeRange: timeRange } = useTimeRange();\n\n return { timeRange, datasourceStore, variables: allVariables };\n}\n\nconst getVariableQueryConfig = (\n definition: ListVariableDefinition,\n variablePluginCtx: GetVariableOptionsContext,\n variablePlugin: VariablePlugin | undefined,\n enabled: boolean,\n onFetched?: (name: string, options: VariableOption[], definition: ListVariableDefinition) => void,\n): UseQueryOptions<VariableOption[]> => {\n const capturingRegexp =\n definition.spec.capturingRegexp !== undefined ? new RegExp(definition.spec.capturingRegexp, 'g') : undefined;\n const variablesValueKey = getVariableValuesKey(variablePluginCtx.variables);\n return {\n queryKey: ['variable', definition, variablePluginCtx.timeRange, variablesValueKey],\n queryFn: async ({ signal }): Promise<VariableOption[]> => {\n const resp = await variablePlugin?.getVariableOptions(definition.spec.plugin.spec, variablePluginCtx, signal);\n if (!resp?.data?.length) {\n onFetched?.(definition.spec.name, [], definition);\n return [];\n }\n const options = capturingRegexp ? filterVariableList(resp.data, capturingRegexp) : resp.data;\n onFetched?.(definition.spec.name, options, definition);\n return options;\n },\n enabled,\n };\n};\n\nfunction resolveDependsOnVariables(\n variablePlugin: VariablePlugin | undefined,\n variablePluginCtx: GetVariableOptionsContext,\n definition: ListVariableDefinition,\n): string[] {\n if (variablePlugin?.dependsOn) {\n const dependencies = variablePlugin.dependsOn(definition.spec.plugin.spec, variablePluginCtx);\n return dependencies.variables ? dependencies.variables.filter((v) => v !== definition.spec.name) : []; // Exclude self variable to avoid circular dependency and default to empty array to avoid deadlock\n }\n return [];\n}\n\nexport function useListVariablePluginValues(definition: ListVariableDefinition): UseQueryResult<VariableOption[]> {\n const { data: variablePlugin } = usePlugin('Variable', definition.spec.plugin.kind);\n\n const variablePluginCtx = useVariablePluginContext();\n\n const dependsOnVariables = resolveDependsOnVariables(variablePlugin, variablePluginCtx, definition);\n\n const dependentVariables = useAllVariableValues(dependsOnVariables);\n const waitToLoad = dependsOnVariables.some((v) => dependentVariables[v]?.loading);\n\n const ctx = { ...variablePluginCtx, variables: dependentVariables };\n\n return useQuery(getVariableQueryConfig(definition, ctx, variablePlugin, !!variablePlugin && !waitToLoad));\n}\n\nfunction resolveDefaultValue(definition: ListVariableDefinition, options: VariableOption[]): VariableValue {\n const { defaultValue, allowMultiple } = definition.spec;\n if (defaultValue !== undefined && defaultValue !== null) {\n return defaultValue;\n }\n if (options[0]?.value) {\n const first = options[0].value;\n return allowMultiple ? [first] : first;\n }\n return allowMultiple ? [] : '';\n}\n\n/**\n * Resolves initial values for all ListVariable definitions by fetching their options in dependency order.\n * Returns a map of variable names to their resolved default values, merging with any already-provided outer variables.\n */\nexport function useResolveListVariableValues(variableDefinitions: VariableDefinition[]): {\n initialVariableValues: Record<string, VariableValue>;\n isLoading: boolean;\n} {\n const { timeRange, datasourceStore, variables: outerVariableValues } = useVariablePluginContext();\n\n const listVariables = useMemo(\n () => variableDefinitions.filter((v): v is ListVariableDefinition => v.kind === 'ListVariable'),\n [variableDefinitions],\n );\n\n const pluginResults = usePlugins(\n 'Variable',\n listVariables.map((d) => ({ kind: d.spec.plugin.kind })),\n );\n\n // Resolved variable state. Updated by onFetched when queries resolve.\n // Needed because of dependencies between variables that require multiple rounds of fetching.\n const [resolvedVariables, setResolvedVariables] = useState<VariableStateMap>({});\n\n const allVariables = useMemo(() => {\n return { ...outerVariableValues, ...resolvedVariables };\n }, [outerVariableValues, resolvedVariables]);\n\n const onFetched = useCallback((name: string, options: VariableOption[], definition: ListVariableDefinition) => {\n setResolvedVariables((prev) => ({\n ...prev,\n [name]: { value: resolveDefaultValue(definition, options), loading: false, options },\n }));\n }, []);\n\n const queryResults = useQueries({\n queries: listVariables.map((definition, index) => {\n const plugin = pluginResults[index]?.data;\n const isPluginLoading = pluginResults[index]?.isLoading ?? true;\n\n const dependsOn = resolveDependsOnVariables(\n plugin,\n { timeRange, datasourceStore, variables: allVariables },\n definition,\n );\n\n const hasPendingDeps = dependsOn.some(\n (v) =>\n (resolvedVariables[v] === undefined && listVariables.some((lv) => lv.spec.name === v)) ||\n allVariables[v]?.loading,\n );\n\n const dependentVariables: VariableStateMap = {};\n for (const v of dependsOn) {\n const state = allVariables[v];\n if (state) {\n dependentVariables[v] = state;\n }\n }\n\n const ctx = { timeRange, datasourceStore, variables: dependentVariables };\n return getVariableQueryConfig(definition, ctx, plugin, !hasPendingDeps && !isPluginLoading, onFetched);\n }),\n });\n\n const initialVariableValues: Record<string, VariableValue> = useMemo(\n () =>\n Object.fromEntries(\n Object.entries(allVariables)\n .filter(([, state]) => state?.value !== undefined)\n .map(([name, state]) => [name, state!.value]),\n ),\n [allVariables],\n );\n\n return { initialVariableValues, isLoading: queryResults.some((r) => r.isLoading) };\n}\n\n/**\n * Returns a serialized string of the current state of variable values.\n */\nexport function getVariableValuesKey(v: VariableStateMap): string {\n return Object.values(v)\n .map((v) => JSON.stringify(v.value))\n .join(',');\n}\n\nexport const VARIABLE_TYPES = [\n { label: 'List', kind: 'ListVariable' },\n { label: 'Text', kind: 'TextVariable' },\n] as const;\n"],"names":["useQueries","useQuery","useCallback","useMemo","useState","useAllVariableValues","useDatasourceStore","usePlugin","usePlugins","useTimeRange","filterVariableList","data","capturedRegexp","result","filteredSet","Set","variableValue","matches","value","matchAll","concat","match","i","length","m","undefined","has","add","push","label","useVariablePluginContext","datasourceStore","allVariables","absoluteTimeRange","timeRange","variables","getVariableQueryConfig","definition","variablePluginCtx","variablePlugin","enabled","onFetched","capturingRegexp","spec","RegExp","variablesValueKey","getVariableValuesKey","queryKey","queryFn","signal","resp","getVariableOptions","plugin","name","options","resolveDependsOnVariables","dependsOn","dependencies","filter","v","useListVariablePluginValues","kind","dependsOnVariables","dependentVariables","waitToLoad","some","loading","ctx","resolveDefaultValue","defaultValue","allowMultiple","first","useResolveListVariableValues","variableDefinitions","outerVariableValues","listVariables","pluginResults","map","d","resolvedVariables","setResolvedVariables","prev","queryResults","queries","index","isPluginLoading","isLoading","hasPendingDeps","lv","state","initialVariableValues","Object","fromEntries","entries","r","values","JSON","stringify","join","VARIABLE_TYPES"],"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;AAIjC,SAASA,UAAU,EAAEC,QAAQ,QAAQ,wBAAwB;AAC7D,SAASC,WAAW,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAQ;AAIvD,SAASC,oBAAoB,EAAEC,kBAAkB,EAAEC,SAAS,EAAEC,UAAU,EAAEC,YAAY,QAAQ,yBAAgB;AAE9G,OAAO,SAAS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AEA,OAAO,MAAMC,iBAAiB;IAC5B;QAAEtE,OAAO;QAAQgC,MAAM;IAAe;IACtC;QAAEhC,OAAO;QAAQgC,MAAM;IAAe;CACvC,CAAU"}
@@ -4,6 +4,7 @@ export * from './DatasourceEditorForm';
4
4
  export * from './DatasourceSelect';
5
5
  export * from './HTTPSettingsEditor';
6
6
  export * from './ItemSelectionActionsOptionsEditor';
7
+ export * from './LayoutEditor';
7
8
  export * from './LegendOptionsEditor';
8
9
  export * from './LinksEditor';
9
10
  export * from './MultiQueryEditor';
@@ -17,4 +18,5 @@ export * from './PluginSpecEditor';
17
18
  export * from './TimeRangeControls';
18
19
  export * from './Variables';
19
20
  export * from './MetricLabelInput';
21
+ export * from './DatasourceTestConnectionButton';
20
22
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAaA,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qCAAqC,CAAC;AACpD,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAaA,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qCAAqC,CAAC;AACpD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kCAAkC,CAAC"}
@@ -10,24 +10,26 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- export * from './Annotations';
14
- export * from './CalculationSelector';
15
- export * from './DatasourceEditorForm';
16
- export * from './DatasourceSelect';
17
- export * from './HTTPSettingsEditor';
18
- export * from './ItemSelectionActionsOptionsEditor';
19
- export * from './LegendOptionsEditor';
20
- export * from './LinksEditor';
21
- export * from './MultiQueryEditor';
22
- export * from './OptionsEditorRadios';
23
- export * from './OptionsEditorTabs';
24
- export * from './PanelSpecEditor';
25
- export * from './PluginEditor';
26
- export * from './PluginKindSelect';
27
- export * from './PluginRegistry';
28
- export * from './PluginSpecEditor';
29
- export * from './TimeRangeControls';
30
- export * from './Variables';
31
- export * from './MetricLabelInput';
13
+ export * from "./Annotations/index.js";
14
+ export * from "./CalculationSelector/index.js";
15
+ export * from "./DatasourceEditorForm/index.js";
16
+ export * from "./DatasourceSelect/index.js";
17
+ export * from "./HTTPSettingsEditor/index.js";
18
+ export * from "./ItemSelectionActionsOptionsEditor/index.js";
19
+ export * from "./LayoutEditor/index.js";
20
+ export * from "./LegendOptionsEditor/index.js";
21
+ export * from "./LinksEditor/index.js";
22
+ export * from "./MultiQueryEditor/index.js";
23
+ export * from "./OptionsEditorRadios/index.js";
24
+ export * from "./OptionsEditorTabs/index.js";
25
+ export * from "./PanelSpecEditor/index.js";
26
+ export * from "./PluginEditor/index.js";
27
+ export * from "./PluginKindSelect/index.js";
28
+ export * from "./PluginRegistry/index.js";
29
+ export * from "./PluginSpecEditor/index.js";
30
+ export * from "./TimeRangeControls/index.js";
31
+ export * from "./Variables/index.js";
32
+ export * from "./MetricLabelInput/index.js";
33
+ export * from "./DatasourceTestConnectionButton/index.js";
32
34
 
33
35
  //# sourceMappingURL=index.js.map