@perses-dev/plugin-system 0.55.0-beta.1 → 0.55.0-beta.11

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 (577) 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/HTTPHeaderPolicyEditor.d.ts +10 -0
  40. package/dist/components/HTTPSettingsEditor/HTTPHeaderPolicyEditor.d.ts.map +1 -0
  41. package/dist/components/HTTPSettingsEditor/HTTPHeaderPolicyEditor.js +99 -0
  42. package/dist/components/HTTPSettingsEditor/HTTPHeaderPolicyEditor.js.map +1 -0
  43. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.d.ts +4 -2
  44. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.d.ts.map +1 -1
  45. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js +91 -41
  46. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js.map +1 -1
  47. package/dist/components/HTTPSettingsEditor/index.js +1 -1
  48. package/dist/components/HTTPSettingsEditor/index.js.map +1 -1
  49. package/dist/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.d.ts +1 -1
  50. package/dist/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.d.ts.map +1 -1
  51. package/dist/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.js +28 -28
  52. package/dist/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.js.map +1 -1
  53. package/dist/components/ItemSelectionActionsOptionsEditor/index.js +1 -1
  54. package/dist/components/ItemSelectionActionsOptionsEditor/index.js.map +1 -1
  55. package/dist/components/LayoutEditor/LayoutEditor.d.ts +16 -0
  56. package/dist/components/LayoutEditor/LayoutEditor.d.ts.map +1 -0
  57. package/dist/components/LayoutEditor/LayoutEditor.js +115 -0
  58. package/dist/components/LayoutEditor/LayoutEditor.js.map +1 -0
  59. package/dist/components/LayoutEditor/RepeatLayoutPreview.d.ts +7 -0
  60. package/dist/components/LayoutEditor/RepeatLayoutPreview.d.ts.map +1 -0
  61. package/dist/components/LayoutEditor/RepeatLayoutPreview.js +92 -0
  62. package/dist/components/LayoutEditor/RepeatLayoutPreview.js.map +1 -0
  63. package/dist/components/LayoutEditor/RepeatVariableEditor.d.ts +18 -0
  64. package/dist/components/LayoutEditor/RepeatVariableEditor.d.ts.map +1 -0
  65. package/dist/components/LayoutEditor/RepeatVariableEditor.js +168 -0
  66. package/dist/components/LayoutEditor/RepeatVariableEditor.js.map +1 -0
  67. package/dist/components/LayoutEditor/index.d.ts +4 -0
  68. package/dist/components/LayoutEditor/index.d.ts.map +1 -0
  69. package/dist/{cjs/model/explore.js → components/LayoutEditor/index.js} +5 -4
  70. package/dist/components/LayoutEditor/index.js.map +1 -0
  71. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.d.ts +2 -2
  72. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.d.ts.map +1 -1
  73. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js +5 -5
  74. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js.map +1 -1
  75. package/dist/components/LegendOptionsEditor/index.js +1 -1
  76. package/dist/components/LegendOptionsEditor/index.js.map +1 -1
  77. package/dist/components/LinksEditor/LinksEditor.d.ts +3 -3
  78. package/dist/components/LinksEditor/LinksEditor.d.ts.map +1 -1
  79. package/dist/components/LinksEditor/LinksEditor.js +6 -6
  80. package/dist/components/LinksEditor/LinksEditor.js.map +1 -1
  81. package/dist/components/LinksEditor/index.js +1 -1
  82. package/dist/components/LinksEditor/index.js.map +1 -1
  83. package/dist/components/MetricLabelInput/MetricLabelInput.d.ts +1 -1
  84. package/dist/components/MetricLabelInput/MetricLabelInput.d.ts.map +1 -1
  85. package/dist/components/MetricLabelInput/MetricLabelInput.js +2 -2
  86. package/dist/components/MetricLabelInput/MetricLabelInput.js.map +1 -1
  87. package/dist/components/MetricLabelInput/index.js +1 -1
  88. package/dist/components/MetricLabelInput/index.js.map +1 -1
  89. package/dist/components/MultiQueryEditor/MultiQueryEditor.d.ts +3 -4
  90. package/dist/components/MultiQueryEditor/MultiQueryEditor.d.ts.map +1 -1
  91. package/dist/components/MultiQueryEditor/MultiQueryEditor.js +27 -9
  92. package/dist/components/MultiQueryEditor/MultiQueryEditor.js.map +1 -1
  93. package/dist/components/MultiQueryEditor/QueryEditorContainer.d.ts +3 -4
  94. package/dist/components/MultiQueryEditor/QueryEditorContainer.d.ts.map +1 -1
  95. package/dist/components/MultiQueryEditor/QueryEditorContainer.js +14 -14
  96. package/dist/components/MultiQueryEditor/QueryEditorContainer.js.map +1 -1
  97. package/dist/components/MultiQueryEditor/index.js +2 -2
  98. package/dist/components/MultiQueryEditor/index.js.map +1 -1
  99. package/dist/components/MultiQueryEditor/utils.d.ts +1 -1
  100. package/dist/components/MultiQueryEditor/utils.d.ts.map +1 -1
  101. package/dist/components/MultiQueryEditor/utils.js.map +1 -1
  102. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts +1 -1
  103. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts.map +1 -1
  104. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js +4 -4
  105. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js.map +1 -1
  106. package/dist/components/OptionsEditorRadios/index.js +1 -1
  107. package/dist/components/OptionsEditorRadios/index.js.map +1 -1
  108. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts +1 -1
  109. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts.map +1 -1
  110. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js +1 -1
  111. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js.map +1 -1
  112. package/dist/components/OptionsEditorTabPanel/index.js +1 -1
  113. package/dist/components/OptionsEditorTabPanel/index.js.map +1 -1
  114. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.d.ts +1 -1
  115. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.d.ts.map +1 -1
  116. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js +4 -4
  117. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js.map +1 -1
  118. package/dist/components/OptionsEditorTabs/index.js +1 -1
  119. package/dist/components/OptionsEditorTabs/index.js.map +1 -1
  120. package/dist/components/PanelSpecEditor/PanelAnnotationsEditor.d.ts +2 -2
  121. package/dist/components/PanelSpecEditor/PanelAnnotationsEditor.d.ts.map +1 -1
  122. package/dist/components/PanelSpecEditor/PanelAnnotationsEditor.js +9 -9
  123. package/dist/components/PanelSpecEditor/PanelAnnotationsEditor.js.map +1 -1
  124. package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts +8 -5
  125. package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts.map +1 -1
  126. package/dist/components/PanelSpecEditor/PanelSpecEditor.js +27 -12
  127. package/dist/components/PanelSpecEditor/PanelSpecEditor.js.map +1 -1
  128. package/dist/components/PanelSpecEditor/index.js +1 -1
  129. package/dist/components/PanelSpecEditor/index.js.map +1 -1
  130. package/dist/components/PluginEditor/PluginEditor.d.ts +2 -2
  131. package/dist/components/PluginEditor/PluginEditor.d.ts.map +1 -1
  132. package/dist/components/PluginEditor/PluginEditor.js +10 -9
  133. package/dist/components/PluginEditor/PluginEditor.js.map +1 -1
  134. package/dist/components/PluginEditor/index.js +2 -2
  135. package/dist/components/PluginEditor/index.js.map +1 -1
  136. package/dist/components/PluginEditor/plugin-editor-api.d.ts +10 -3
  137. package/dist/components/PluginEditor/plugin-editor-api.d.ts.map +1 -1
  138. package/dist/components/PluginEditor/plugin-editor-api.js +10 -5
  139. package/dist/components/PluginEditor/plugin-editor-api.js.map +1 -1
  140. package/dist/components/PluginKindSelect/PluginKindSelect.d.ts +17 -4
  141. package/dist/components/PluginKindSelect/PluginKindSelect.d.ts.map +1 -1
  142. package/dist/components/PluginKindSelect/PluginKindSelect.js +191 -27
  143. package/dist/components/PluginKindSelect/PluginKindSelect.js.map +1 -1
  144. package/dist/components/PluginKindSelect/index.js +1 -1
  145. package/dist/components/PluginKindSelect/index.js.map +1 -1
  146. package/dist/components/PluginRegistry/PluginRegistry.d.ts +2 -2
  147. package/dist/components/PluginRegistry/PluginRegistry.d.ts.map +1 -1
  148. package/dist/components/PluginRegistry/PluginRegistry.js +71 -8
  149. package/dist/components/PluginRegistry/PluginRegistry.js.map +1 -1
  150. package/dist/components/PluginRegistry/getPluginSearchHelper.d.ts +2 -2
  151. package/dist/components/PluginRegistry/getPluginSearchHelper.d.ts.map +1 -1
  152. package/dist/components/PluginRegistry/getPluginSearchHelper.js +2 -2
  153. package/dist/components/PluginRegistry/getPluginSearchHelper.js.map +1 -1
  154. package/dist/components/PluginRegistry/index.js +1 -1
  155. package/dist/components/PluginRegistry/index.js.map +1 -1
  156. package/dist/components/PluginRegistry/plugin-indexes.d.ts +3 -1
  157. package/dist/components/PluginRegistry/plugin-indexes.d.ts.map +1 -1
  158. package/dist/components/PluginRegistry/plugin-indexes.js +9 -4
  159. package/dist/components/PluginRegistry/plugin-indexes.js.map +1 -1
  160. package/dist/components/PluginSpecEditor/DatasourceSpecEditor.d.ts +10 -0
  161. package/dist/components/PluginSpecEditor/DatasourceSpecEditor.d.ts.map +1 -0
  162. package/dist/components/PluginSpecEditor/DatasourceSpecEditor.js +62 -0
  163. package/dist/components/PluginSpecEditor/DatasourceSpecEditor.js.map +1 -0
  164. package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts +5 -4
  165. package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts.map +1 -1
  166. package/dist/components/PluginSpecEditor/PluginSpecEditor.js +24 -6
  167. package/dist/components/PluginSpecEditor/PluginSpecEditor.js.map +1 -1
  168. package/dist/components/PluginSpecEditor/index.js +1 -1
  169. package/dist/components/PluginSpecEditor/index.js.map +1 -1
  170. package/dist/components/SelectionOptionsEditor/SelectionOptionsEditor.d.ts +1 -1
  171. package/dist/components/SelectionOptionsEditor/SelectionOptionsEditor.d.ts.map +1 -1
  172. package/dist/components/SelectionOptionsEditor/SelectionOptionsEditor.js +3 -3
  173. package/dist/components/SelectionOptionsEditor/SelectionOptionsEditor.js.map +1 -1
  174. package/dist/components/SelectionOptionsEditor/index.js +1 -1
  175. package/dist/components/SelectionOptionsEditor/index.js.map +1 -1
  176. package/dist/components/TimeRangeControls/TimeRangeControls.d.ts +4 -4
  177. package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -1
  178. package/dist/components/TimeRangeControls/TimeRangeControls.js +18 -55
  179. package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
  180. package/dist/components/TimeRangeControls/index.js +1 -1
  181. package/dist/components/TimeRangeControls/index.js.map +1 -1
  182. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts +3 -3
  183. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
  184. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +11 -11
  185. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
  186. package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts +2 -2
  187. package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts.map +1 -1
  188. package/dist/components/Variables/VariableEditorForm/VariablePreview.js +8 -7
  189. package/dist/components/Variables/VariableEditorForm/VariablePreview.js.map +1 -1
  190. package/dist/components/Variables/VariableEditorForm/index.js +3 -3
  191. package/dist/components/Variables/VariableEditorForm/index.js.map +1 -1
  192. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts +2 -2
  193. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts.map +1 -1
  194. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +6 -6
  195. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -1
  196. package/dist/components/Variables/index.js +2 -2
  197. package/dist/components/Variables/index.js.map +1 -1
  198. package/dist/components/Variables/variable-model.d.ts +8 -8
  199. package/dist/components/Variables/variable-model.d.ts.map +1 -1
  200. package/dist/components/Variables/variable-model.js +10 -5
  201. package/dist/components/Variables/variable-model.js.map +1 -1
  202. package/dist/components/index.d.ts +2 -0
  203. package/dist/components/index.d.ts.map +1 -1
  204. package/dist/components/index.js +21 -19
  205. package/dist/components/index.js.map +1 -1
  206. package/dist/constants/index.d.ts +1 -0
  207. package/dist/constants/index.d.ts.map +1 -1
  208. package/dist/constants/index.js +2 -1
  209. package/dist/constants/index.js.map +1 -1
  210. package/dist/constants/repeat.d.ts +3 -0
  211. package/dist/constants/repeat.d.ts.map +1 -0
  212. package/dist/{cjs/model/datasource.js → constants/repeat.js} +4 -4
  213. package/dist/constants/repeat.js.map +1 -0
  214. package/dist/constants/user-interface-text.d.ts.map +1 -1
  215. package/dist/context/ValidationProvider.d.ts +9 -9
  216. package/dist/context/ValidationProvider.d.ts.map +1 -1
  217. package/dist/context/ValidationProvider.js +6 -6
  218. package/dist/context/ValidationProvider.js.map +1 -1
  219. package/dist/context/index.js +1 -1
  220. package/dist/context/index.js.map +1 -1
  221. package/dist/index.js +9 -9
  222. package/dist/index.js.map +1 -1
  223. package/dist/model/alerts-queries.d.ts +4 -4
  224. package/dist/model/alerts-queries.d.ts.map +1 -1
  225. package/dist/model/alerts-queries.js.map +1 -1
  226. package/dist/model/annotations.d.ts +3 -3
  227. package/dist/model/annotations.d.ts.map +1 -1
  228. package/dist/model/annotations.js.map +1 -1
  229. package/dist/model/calculations.d.ts +1 -1
  230. package/dist/model/calculations.d.ts.map +1 -1
  231. package/dist/model/calculations.js.map +1 -1
  232. package/dist/model/datasource.d.ts +10 -3
  233. package/dist/model/datasource.d.ts.map +1 -1
  234. package/dist/model/datasource.js +1 -1
  235. package/dist/model/datasource.js.map +1 -1
  236. package/dist/model/explore.d.ts +2 -3
  237. package/dist/model/explore.d.ts.map +1 -1
  238. package/dist/model/explore.js.map +1 -1
  239. package/dist/model/index.d.ts +1 -0
  240. package/dist/model/index.d.ts.map +1 -1
  241. package/dist/model/index.js +17 -16
  242. package/dist/model/index.js.map +1 -1
  243. package/dist/model/json-queries.d.ts +29 -0
  244. package/dist/model/json-queries.d.ts.map +1 -0
  245. package/dist/{cjs/model/annotations.js → model/json-queries.js} +5 -4
  246. package/dist/model/json-queries.js.map +1 -0
  247. package/dist/model/legend.d.ts +3 -3
  248. package/dist/model/legend.d.ts.map +1 -1
  249. package/dist/model/legend.js +2 -2
  250. package/dist/model/legend.js.map +1 -1
  251. package/dist/model/log-queries.d.ts +3 -3
  252. package/dist/model/log-queries.d.ts.map +1 -1
  253. package/dist/model/log-queries.js.map +1 -1
  254. package/dist/model/panels.d.ts +13 -4
  255. package/dist/model/panels.d.ts.map +1 -1
  256. package/dist/model/panels.js.map +1 -1
  257. package/dist/model/plugin-base.d.ts +3 -3
  258. package/dist/model/plugin-base.d.ts.map +1 -1
  259. package/dist/model/plugin-base.js.map +1 -1
  260. package/dist/model/plugin-loading.d.ts +1 -1
  261. package/dist/model/plugin-loading.d.ts.map +1 -1
  262. package/dist/model/plugin-loading.js +1 -1
  263. package/dist/model/plugin-loading.js.map +1 -1
  264. package/dist/model/plugins.d.ts +26 -13
  265. package/dist/model/plugins.d.ts.map +1 -1
  266. package/dist/model/plugins.js.map +1 -1
  267. package/dist/model/profile-queries.d.ts +4 -4
  268. package/dist/model/profile-queries.d.ts.map +1 -1
  269. package/dist/model/profile-queries.js.map +1 -1
  270. package/dist/model/silences-queries.d.ts +4 -4
  271. package/dist/model/silences-queries.d.ts.map +1 -1
  272. package/dist/model/silences-queries.js.map +1 -1
  273. package/dist/model/time-series-queries.d.ts +4 -4
  274. package/dist/model/time-series-queries.d.ts.map +1 -1
  275. package/dist/model/time-series-queries.js.map +1 -1
  276. package/dist/model/trace-queries.d.ts +4 -4
  277. package/dist/model/trace-queries.d.ts.map +1 -1
  278. package/dist/model/trace-queries.js.map +1 -1
  279. package/dist/model/variables.d.ts +7 -3
  280. package/dist/model/variables.d.ts.map +1 -1
  281. package/dist/model/variables.js +1 -3
  282. package/dist/model/variables.js.map +1 -1
  283. package/dist/remote/PluginLoaderComponent.d.ts +1 -2
  284. package/dist/remote/PluginLoaderComponent.d.ts.map +1 -1
  285. package/dist/remote/PluginLoaderComponent.js +2 -2
  286. package/dist/remote/PluginLoaderComponent.js.map +1 -1
  287. package/dist/remote/PluginRuntime.d.ts +11 -2
  288. package/dist/remote/PluginRuntime.d.ts.map +1 -1
  289. package/dist/remote/PluginRuntime.js +84 -79
  290. package/dist/remote/PluginRuntime.js.map +1 -1
  291. package/dist/remote/index.d.ts +1 -0
  292. package/dist/remote/index.d.ts.map +1 -1
  293. package/dist/remote/index.js +3 -2
  294. package/dist/remote/index.js.map +1 -1
  295. package/dist/remote/remotePluginLoader.d.ts +2 -2
  296. package/dist/remote/remotePluginLoader.d.ts.map +1 -1
  297. package/dist/remote/remotePluginLoader.js +3 -3
  298. package/dist/remote/remotePluginLoader.js.map +1 -1
  299. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts +3 -3
  300. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts.map +1 -1
  301. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js +20 -12
  302. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js.map +1 -1
  303. package/dist/runtime/DataQueriesProvider/index.js +2 -2
  304. package/dist/runtime/DataQueriesProvider/index.js.map +1 -1
  305. package/dist/runtime/DataQueriesProvider/model.d.ts +3 -3
  306. package/dist/runtime/DataQueriesProvider/model.d.ts.map +1 -1
  307. package/dist/runtime/DataQueriesProvider/model.js.map +1 -1
  308. package/dist/runtime/RouterProvider.d.ts +2 -1
  309. package/dist/runtime/RouterProvider.d.ts.map +1 -1
  310. package/dist/runtime/RouterProvider.js +3 -3
  311. package/dist/runtime/RouterProvider.js.map +1 -1
  312. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts +3 -2
  313. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts.map +1 -1
  314. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js +22 -8
  315. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js.map +1 -1
  316. package/dist/runtime/TimeRangeProvider/TimeRangeProviders.d.ts +3 -2
  317. package/dist/runtime/TimeRangeProvider/TimeRangeProviders.d.ts.map +1 -1
  318. package/dist/runtime/TimeRangeProvider/TimeRangeProviders.js +5 -5
  319. package/dist/runtime/TimeRangeProvider/TimeRangeProviders.js.map +1 -1
  320. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.d.ts +13 -2
  321. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.d.ts.map +1 -1
  322. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js +65 -4
  323. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js.map +1 -1
  324. package/dist/runtime/TimeRangeProvider/index.js +4 -4
  325. package/dist/runtime/TimeRangeProvider/index.js.map +1 -1
  326. package/dist/runtime/TimeRangeProvider/query-params.d.ts +3 -3
  327. package/dist/runtime/TimeRangeProvider/query-params.d.ts.map +1 -1
  328. package/dist/runtime/TimeRangeProvider/query-params.js +4 -4
  329. package/dist/runtime/TimeRangeProvider/query-params.js.map +1 -1
  330. package/dist/runtime/TimeRangeProvider/refresh-interval.d.ts +1 -1
  331. package/dist/runtime/TimeRangeProvider/refresh-interval.d.ts.map +1 -1
  332. package/dist/runtime/TimeRangeProvider/refresh-interval.js +2 -2
  333. package/dist/runtime/TimeRangeProvider/refresh-interval.js.map +1 -1
  334. package/dist/runtime/UsageMetricsProvider.d.ts +3 -3
  335. package/dist/runtime/UsageMetricsProvider.d.ts.map +1 -1
  336. package/dist/runtime/UsageMetricsProvider.js +3 -3
  337. package/dist/runtime/UsageMetricsProvider.js.map +1 -1
  338. package/dist/runtime/alerts-queries.d.ts +2 -2
  339. package/dist/runtime/alerts-queries.d.ts.map +1 -1
  340. package/dist/runtime/alerts-queries.js +11 -7
  341. package/dist/runtime/alerts-queries.js.map +1 -1
  342. package/dist/runtime/annotations.d.ts +2 -2
  343. package/dist/runtime/annotations.d.ts.map +1 -1
  344. package/dist/runtime/annotations.js +16 -9
  345. package/dist/runtime/annotations.js.map +1 -1
  346. package/dist/runtime/builtin-variables.d.ts +2 -3
  347. package/dist/runtime/builtin-variables.d.ts.map +1 -1
  348. package/dist/runtime/builtin-variables.js +1 -1
  349. package/dist/runtime/builtin-variables.js.map +1 -1
  350. package/dist/runtime/datasources.d.ts +2 -3
  351. package/dist/runtime/datasources.d.ts.map +1 -1
  352. package/dist/runtime/datasources.js +2 -2
  353. package/dist/runtime/datasources.js.map +1 -1
  354. package/dist/runtime/index.d.ts +1 -0
  355. package/dist/runtime/index.d.ts.map +1 -1
  356. package/dist/runtime/index.js +16 -15
  357. package/dist/runtime/index.js.map +1 -1
  358. package/dist/runtime/item-actions.d.ts +3 -3
  359. package/dist/runtime/item-actions.d.ts.map +1 -1
  360. package/dist/runtime/item-actions.js +2 -2
  361. package/dist/runtime/item-actions.js.map +1 -1
  362. package/dist/runtime/json-queries.d.ts +11 -0
  363. package/dist/runtime/json-queries.d.ts.map +1 -0
  364. package/dist/runtime/json-queries.js +58 -0
  365. package/dist/runtime/json-queries.js.map +1 -0
  366. package/dist/runtime/log-queries.d.ts +3 -3
  367. package/dist/runtime/log-queries.d.ts.map +1 -1
  368. package/dist/runtime/log-queries.js +8 -6
  369. package/dist/runtime/log-queries.js.map +1 -1
  370. package/dist/runtime/plugin-registry.d.ts +24 -11
  371. package/dist/runtime/plugin-registry.d.ts.map +1 -1
  372. package/dist/runtime/plugin-registry.js +54 -18
  373. package/dist/runtime/plugin-registry.js.map +1 -1
  374. package/dist/runtime/profile-queries.d.ts +2 -2
  375. package/dist/runtime/profile-queries.d.ts.map +1 -1
  376. package/dist/runtime/profile-queries.js +7 -5
  377. package/dist/runtime/profile-queries.js.map +1 -1
  378. package/dist/runtime/silences-queries.d.ts +2 -2
  379. package/dist/runtime/silences-queries.d.ts.map +1 -1
  380. package/dist/runtime/silences-queries.js +11 -7
  381. package/dist/runtime/silences-queries.js.map +1 -1
  382. package/dist/runtime/time-series-queries.d.ts +3 -3
  383. package/dist/runtime/time-series-queries.d.ts.map +1 -1
  384. package/dist/runtime/time-series-queries.js +16 -9
  385. package/dist/runtime/time-series-queries.js.map +1 -1
  386. package/dist/runtime/trace-queries.d.ts +2 -2
  387. package/dist/runtime/trace-queries.d.ts.map +1 -1
  388. package/dist/runtime/trace-queries.js +12 -8
  389. package/dist/runtime/trace-queries.js.map +1 -1
  390. package/dist/runtime/utils.d.ts +1 -1
  391. package/dist/runtime/utils.d.ts.map +1 -1
  392. package/dist/runtime/utils.js.map +1 -1
  393. package/dist/runtime/variables.d.ts +7 -2
  394. package/dist/runtime/variables.d.ts.map +1 -1
  395. package/dist/runtime/variables.js +20 -4
  396. package/dist/runtime/variables.js.map +1 -1
  397. package/dist/schema/index.js +1 -1
  398. package/dist/schema/index.js.map +1 -1
  399. package/dist/schema/panel.d.ts +4 -4
  400. package/dist/schema/panel.d.ts.map +1 -1
  401. package/dist/schema/panel.js +18 -4
  402. package/dist/schema/panel.js.map +1 -1
  403. package/dist/test/index.js +2 -2
  404. package/dist/test/index.js.map +1 -1
  405. package/dist/test/mock-data.d.ts +14 -13
  406. package/dist/test/mock-data.d.ts.map +1 -1
  407. package/dist/test/mock-data.js +6 -0
  408. package/dist/test/mock-data.js.map +1 -1
  409. package/dist/test/render-hook.d.ts +2 -2
  410. package/dist/test/render-hook.d.ts.map +1 -1
  411. package/dist/test/render-hook.js +2 -2
  412. package/dist/test/render-hook.js.map +1 -1
  413. package/dist/test/render.d.ts +3 -3
  414. package/dist/test/render.d.ts.map +1 -1
  415. package/dist/test/render.js +3 -3
  416. package/dist/test/render.js.map +1 -1
  417. package/dist/test/setup-tests.d.ts +1 -1
  418. package/dist/test/setup-tests.d.ts.map +1 -1
  419. package/dist/test/setup-tests.js +3 -2
  420. package/dist/test/setup-tests.js.map +1 -1
  421. package/dist/test/test-plugins/bert/index.d.ts +3 -3
  422. package/dist/test/test-plugins/bert/index.d.ts.map +1 -1
  423. package/dist/test/test-plugins/bert/index.js.map +1 -1
  424. package/dist/test/test-plugins/ernie/index.d.ts +7 -1
  425. package/dist/test/test-plugins/ernie/index.d.ts.map +1 -1
  426. package/dist/test/test-plugins/ernie/index.js +58 -1
  427. package/dist/test/test-plugins/ernie/index.js.map +1 -1
  428. package/dist/test/test-plugins/index.d.ts +1 -1
  429. package/dist/test/test-plugins/index.d.ts.map +1 -1
  430. package/dist/test/test-plugins/index.js +5 -5
  431. package/dist/test/test-plugins/index.js.map +1 -1
  432. package/dist/test/utils.d.ts +2 -2
  433. package/dist/test/utils.d.ts.map +1 -1
  434. package/dist/test/utils.js +5 -5
  435. package/dist/test/utils.js.map +1 -1
  436. package/dist/test-utils/index.js +1 -1
  437. package/dist/test-utils/index.js.map +1 -1
  438. package/dist/test-utils/mock-plugin-registry.d.ts +2 -2
  439. package/dist/test-utils/mock-plugin-registry.d.ts.map +1 -1
  440. package/dist/test-utils/mock-plugin-registry.js +1 -1
  441. package/dist/test-utils/mock-plugin-registry.js.map +1 -1
  442. package/dist/utils/csv-export.d.ts.map +1 -1
  443. package/dist/utils/csv-export.js +2 -2
  444. package/dist/utils/csv-export.js.map +1 -1
  445. package/dist/utils/event.js +1 -1
  446. package/dist/utils/index.d.ts +1 -0
  447. package/dist/utils/index.d.ts.map +1 -1
  448. package/dist/utils/index.js +4 -3
  449. package/dist/utils/index.js.map +1 -1
  450. package/dist/utils/plugin-versions.d.ts +18 -0
  451. package/dist/utils/plugin-versions.d.ts.map +1 -0
  452. package/dist/utils/plugin-versions.js +52 -0
  453. package/dist/utils/plugin-versions.js.map +1 -0
  454. package/dist/utils/variables.js +1 -1
  455. package/package.json +18 -17
  456. package/dist/cjs/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.js +0 -283
  457. package/dist/cjs/components/Annotations/AnnotationEditorForm/AnnotationPreview.js +0 -197
  458. package/dist/cjs/components/Annotations/AnnotationEditorForm/index.js +0 -30
  459. package/dist/cjs/components/Annotations/constants.js +0 -23
  460. package/dist/cjs/components/Annotations/index.js +0 -31
  461. package/dist/cjs/components/CalculationSelector/CalculationSelector.js +0 -49
  462. package/dist/cjs/components/CalculationSelector/index.js +0 -30
  463. package/dist/cjs/components/DatasourceEditorForm/DatasourceEditorForm.js +0 -270
  464. package/dist/cjs/components/DatasourceEditorForm/index.js +0 -30
  465. package/dist/cjs/components/DatasourceSelect/DatasourceSelect.js +0 -266
  466. package/dist/cjs/components/DatasourceSelect/index.js +0 -30
  467. package/dist/cjs/components/HTTPSettingsEditor/HTTPSettingsEditor.js +0 -568
  468. package/dist/cjs/components/HTTPSettingsEditor/index.js +0 -30
  469. package/dist/cjs/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.js +0 -1175
  470. package/dist/cjs/components/ItemSelectionActionsOptionsEditor/index.js +0 -30
  471. package/dist/cjs/components/LegendOptionsEditor/LegendOptionsEditor.js +0 -211
  472. package/dist/cjs/components/LegendOptionsEditor/index.js +0 -30
  473. package/dist/cjs/components/LinksEditor/LinksEditor.js +0 -162
  474. package/dist/cjs/components/LinksEditor/index.js +0 -30
  475. package/dist/cjs/components/MetricLabelInput/MetricLabelInput.js +0 -41
  476. package/dist/cjs/components/MetricLabelInput/index.js +0 -30
  477. package/dist/cjs/components/MultiQueryEditor/MultiQueryEditor.js +0 -159
  478. package/dist/cjs/components/MultiQueryEditor/QueryEditorContainer.js +0 -250
  479. package/dist/cjs/components/MultiQueryEditor/index.js +0 -31
  480. package/dist/cjs/components/MultiQueryEditor/utils.js +0 -36
  481. package/dist/cjs/components/OptionsEditorRadios/OptionsEditorRadios.js +0 -69
  482. package/dist/cjs/components/OptionsEditorRadios/index.js +0 -30
  483. package/dist/cjs/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js +0 -39
  484. package/dist/cjs/components/OptionsEditorTabPanel/index.js +0 -30
  485. package/dist/cjs/components/OptionsEditorTabs/OptionsEditorTabs.js +0 -61
  486. package/dist/cjs/components/OptionsEditorTabs/index.js +0 -30
  487. package/dist/cjs/components/PanelSpecEditor/PanelAnnotationsEditor.js +0 -246
  488. package/dist/cjs/components/PanelSpecEditor/PanelSpecEditor.js +0 -132
  489. package/dist/cjs/components/PanelSpecEditor/index.js +0 -30
  490. package/dist/cjs/components/PluginEditor/PluginEditor.js +0 -98
  491. package/dist/cjs/components/PluginEditor/index.js +0 -31
  492. package/dist/cjs/components/PluginEditor/plugin-editor-api.js +0 -136
  493. package/dist/cjs/components/PluginKindSelect/PluginKindSelect.js +0 -109
  494. package/dist/cjs/components/PluginKindSelect/index.js +0 -30
  495. package/dist/cjs/components/PluginRegistry/PluginRegistry.js +0 -86
  496. package/dist/cjs/components/PluginRegistry/getPluginSearchHelper.js +0 -92
  497. package/dist/cjs/components/PluginRegistry/index.js +0 -30
  498. package/dist/cjs/components/PluginRegistry/plugin-indexes.js +0 -88
  499. package/dist/cjs/components/PluginSpecEditor/PluginSpecEditor.js +0 -55
  500. package/dist/cjs/components/PluginSpecEditor/index.js +0 -30
  501. package/dist/cjs/components/SelectionOptionsEditor/SelectionOptionsEditor.js +0 -43
  502. package/dist/cjs/components/SelectionOptionsEditor/index.js +0 -30
  503. package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +0 -236
  504. package/dist/cjs/components/TimeRangeControls/index.js +0 -30
  505. package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +0 -613
  506. package/dist/cjs/components/Variables/VariableEditorForm/VariablePreview.js +0 -193
  507. package/dist/cjs/components/Variables/VariableEditorForm/index.js +0 -32
  508. package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +0 -143
  509. package/dist/cjs/components/Variables/index.js +0 -31
  510. package/dist/cjs/components/Variables/variable-model.js +0 -211
  511. package/dist/cjs/components/index.js +0 -48
  512. package/dist/cjs/constants/index.js +0 -30
  513. package/dist/cjs/constants/user-interface-text.js +0 -32
  514. package/dist/cjs/context/ValidationProvider.js +0 -77
  515. package/dist/cjs/context/index.js +0 -30
  516. package/dist/cjs/index.js +0 -38
  517. package/dist/cjs/model/calculations.js +0 -178
  518. package/dist/cjs/model/index.js +0 -45
  519. package/dist/cjs/model/legend.js +0 -111
  520. package/dist/cjs/model/log-queries.js +0 -16
  521. package/dist/cjs/model/log-volume-utils.js +0 -124
  522. package/dist/cjs/model/panels.js +0 -16
  523. package/dist/cjs/model/plugin-base.js +0 -16
  524. package/dist/cjs/model/plugin-loading.js +0 -56
  525. package/dist/cjs/model/plugins.js +0 -26
  526. package/dist/cjs/model/profile-queries.js +0 -16
  527. package/dist/cjs/model/silences-queries.js +0 -16
  528. package/dist/cjs/model/time-series-queries.js +0 -26
  529. package/dist/cjs/model/trace-queries.js +0 -16
  530. package/dist/cjs/model/variables.js +0 -16
  531. package/dist/cjs/remote/PersesPlugin.types.js +0 -16
  532. package/dist/cjs/remote/PluginLoaderComponent.js +0 -87
  533. package/dist/cjs/remote/PluginRuntime.js +0 -331
  534. package/dist/cjs/remote/index.js +0 -31
  535. package/dist/cjs/remote/remotePluginLoader.js +0 -101
  536. package/dist/cjs/runtime/DataQueriesProvider/DataQueriesProvider.js +0 -154
  537. package/dist/cjs/runtime/DataQueriesProvider/index.js +0 -31
  538. package/dist/cjs/runtime/DataQueriesProvider/model.js +0 -34
  539. package/dist/cjs/runtime/RouterProvider.js +0 -114
  540. package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProvider.js +0 -201
  541. package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProviders.js +0 -66
  542. package/dist/cjs/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js +0 -113
  543. package/dist/cjs/runtime/TimeRangeProvider/index.js +0 -33
  544. package/dist/cjs/runtime/TimeRangeProvider/query-params.js +0 -250
  545. package/dist/cjs/runtime/TimeRangeProvider/refresh-interval.js +0 -30
  546. package/dist/cjs/runtime/UsageMetricsProvider.js +0 -102
  547. package/dist/cjs/runtime/alerts-queries.js +0 -101
  548. package/dist/cjs/runtime/annotations.js +0 -148
  549. package/dist/cjs/runtime/builtin-variables.js +0 -81
  550. package/dist/cjs/runtime/datasources.js +0 -80
  551. package/dist/cjs/runtime/index.js +0 -44
  552. package/dist/cjs/runtime/item-actions.js +0 -302
  553. package/dist/cjs/runtime/log-queries.js +0 -76
  554. package/dist/cjs/runtime/plugin-registry.js +0 -135
  555. package/dist/cjs/runtime/profile-queries.js +0 -73
  556. package/dist/cjs/runtime/silences-queries.js +0 -101
  557. package/dist/cjs/runtime/time-series-queries.js +0 -165
  558. package/dist/cjs/runtime/trace-queries.js +0 -106
  559. package/dist/cjs/runtime/utils.js +0 -39
  560. package/dist/cjs/runtime/variables.js +0 -160
  561. package/dist/cjs/schema/index.js +0 -30
  562. package/dist/cjs/schema/panel.js +0 -42
  563. package/dist/cjs/test/index.js +0 -31
  564. package/dist/cjs/test/mock-data.js +0 -357
  565. package/dist/cjs/test/render-hook.js +0 -31
  566. package/dist/cjs/test/render.js +0 -31
  567. package/dist/cjs/test/setup-tests.js +0 -20
  568. package/dist/cjs/test/test-plugins/bert/index.js +0 -99
  569. package/dist/cjs/test/test-plugins/ernie/index.js +0 -92
  570. package/dist/cjs/test/test-plugins/index.js +0 -81
  571. package/dist/cjs/test/utils.js +0 -58
  572. package/dist/cjs/test-utils/index.js +0 -30
  573. package/dist/cjs/test-utils/mock-plugin-registry.js +0 -81
  574. package/dist/cjs/utils/csv-export.js +0 -248
  575. package/dist/cjs/utils/event.js +0 -30
  576. package/dist/cjs/utils/index.js +0 -32
  577. package/dist/cjs/utils/variables.js +0 -44
@@ -1,6 +1,6 @@
1
- import { DispatchWithoutAction, ReactElement } from 'react';
2
- import { AnnotationSpec } from '@perses-dev/spec';
3
- import { Action } from '@perses-dev/client';
1
+ import type { Action } from '@perses-dev/client';
2
+ import type { AnnotationSpec } from '@perses-dev/spec';
3
+ import type { DispatchWithoutAction, ReactElement } from 'react';
4
4
  interface AnnotationEditorFormProps {
5
5
  initialAnnotationSpec: AnnotationSpec;
6
6
  action: Action;
@@ -1 +1 @@
1
- {"version":3,"file":"AnnotationEditorForm.d.ts","sourceRoot":"","sources":["../../../../src/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAyB,MAAM,OAAO,CAAC;AAEnF,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAclD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAmD5C,UAAU,yBAAyB;IACjC,qBAAqB,EAAE,cAAc,CAAC;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,MAAM,EAAE,CAAC,GAAG,EAAE,cAAc,KAAK,IAAI,CAAC;IACtC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,qBAAqB,CAAC;CAClC;AAED,wBAAgB,oBAAoB,CAAC,EACnC,qBAAqB,EACrB,MAAM,EACN,OAAO,EACP,UAAU,EACV,cAAc,EACd,MAAM,EACN,OAAO,EACP,QAAQ,GACT,EAAE,yBAAyB,GAAG,YAAY,CAuK1C"}
1
+ {"version":3,"file":"AnnotationEditorForm.d.ts","sourceRoot":"","sources":["../../../../src/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAUjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGvD,OAAO,KAAK,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAuDjE,UAAU,yBAAyB;IACjC,qBAAqB,EAAE,cAAc,CAAC;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,MAAM,EAAE,CAAC,GAAG,EAAE,cAAc,KAAK,IAAI,CAAC;IACtC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,qBAAqB,CAAC;CAClC;AAED,wBAAgB,oBAAoB,CAAC,EACnC,qBAAqB,EACrB,MAAM,EACN,OAAO,EACP,UAAU,EACV,cAAc,EACd,MAAM,EACN,OAAO,EACP,QAAQ,GACT,EAAE,yBAAyB,GAAG,YAAY,CAuK1C"}
@@ -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, TextField, Grid, Divider, Stack, IconButton } from '@mui/material';
16
- import { DiscardChangesConfirmationDialog, ErrorAlert, ErrorBoundary, FormActions, OptionsColorPicker, getSubmitText, getTitleAction } from '@perses-dev/components';
17
- import { Controller, FormProvider, useForm, useWatch } from 'react-hook-form';
18
- import { zodResolver } from '@hookform/resolvers/zod';
19
- import { useQueryClient } from '@tanstack/react-query';
20
- import InvertColorsIcon from 'mdi-material-ui/InvertColors';
21
- import { PluginEditor } from '../../PluginEditor';
22
- import { useValidationSchemas } from '../../../context';
23
- import { DEFAULT_ANNOTATION_COLOR } from '../constants';
24
- import { AnnotationPreview } from './AnnotationPreview';
14
+ import { zodResolver } from "@hookform/resolvers/zod";
15
+ import { Box, Typography, TextField, Grid, Divider, Stack, IconButton } from "@mui/material";
16
+ import { DiscardChangesConfirmationDialog, ErrorAlert, ErrorBoundary, FormActions, OptionsColorPicker, getSubmitText, getTitleAction } from "@perses-dev/components";
17
+ import { useQueryClient } from "@tanstack/react-query";
18
+ import InvertColorsIcon from "mdi-material-ui/InvertColors";
19
+ import { useCallback, useState } from "react";
20
+ import { Controller, FormProvider, useForm, useWatch } from "react-hook-form";
21
+ import { useValidationSchemas } from "../../../context/index.js";
22
+ import { PluginEditor } from "../../PluginEditor/index.js";
23
+ import { DEFAULT_ANNOTATION_COLOR } from "../constants.js";
24
+ import { AnnotationPreview } from "./AnnotationPreview.js";
25
25
  function FallbackPreview() {
26
26
  return /*#__PURE__*/ _jsx("div", {
27
27
  children: "Error previewing annotations"
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.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, TextField, Grid, Divider, Stack, IconButton } from '@mui/material';\nimport { AnnotationSpec } from '@perses-dev/spec';\nimport {\n DiscardChangesConfirmationDialog,\n ErrorAlert,\n ErrorBoundary,\n FormActions,\n OptionsColorPicker,\n getSubmitText,\n getTitleAction,\n} from '@perses-dev/components';\nimport { Control, Controller, FormProvider, SubmitHandler, useForm, useWatch } from 'react-hook-form';\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport { useQueryClient } from '@tanstack/react-query';\nimport InvertColorsIcon from 'mdi-material-ui/InvertColors';\nimport { Action } from '@perses-dev/client';\nimport { PluginEditor } from '../../PluginEditor';\nimport { useValidationSchemas } from '../../../context';\nimport { DEFAULT_ANNOTATION_COLOR } from '../constants';\nimport { AnnotationPreview } from './AnnotationPreview';\n\nfunction FallbackPreview(): ReactElement {\n return <div>Error previewing annotations</div>;\n}\n\ninterface KindAnnotationEditorFormProps {\n action: Action;\n control: Control<AnnotationSpec>;\n onRunQuery: () => void;\n}\n\nfunction AnnotationPluginControl({ action, control, onRunQuery }: KindAnnotationEditorFormProps): ReactElement {\n const plugin = useWatch<AnnotationSpec, 'plugin'>({ control, name: 'plugin' });\n const kind = plugin?.kind;\n const pluginSpec = plugin?.spec;\n\n return (\n <Controller\n control={control}\n name=\"plugin\"\n render={({ field }) => {\n return (\n <PluginEditor\n withRunQueryButton\n width=\"100%\"\n pluginTypes={['Annotation']}\n pluginKindLabel=\"Source\"\n value={{\n selection: {\n type: 'Annotation',\n kind: kind ?? 'StaticListAnnotation',\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={onRunQuery}\n />\n );\n }}\n />\n );\n}\n\ninterface AnnotationEditorFormProps {\n initialAnnotationSpec: AnnotationSpec;\n action: Action;\n isDraft: boolean;\n isReadonly?: boolean;\n onActionChange?: (action: Action) => void;\n onSave: (def: AnnotationSpec) => void;\n onClose: () => void;\n onDelete?: DispatchWithoutAction;\n}\n\nexport function AnnotationEditorForm({\n initialAnnotationSpec,\n action,\n isDraft,\n isReadonly,\n onActionChange,\n onSave,\n onClose,\n onDelete,\n}: AnnotationEditorFormProps): ReactElement {\n const queryClient = useQueryClient();\n\n const [isDiscardDialogOpened, setDiscardDialogOpened] = useState<boolean>(false);\n const titleAction = getTitleAction(action, isDraft);\n const submitText = getSubmitText(action, isDraft);\n\n const { annotationEditorSchema } = useValidationSchemas();\n const form = useForm<AnnotationSpec>({\n resolver: zodResolver(annotationEditorSchema),\n mode: 'onBlur',\n defaultValues: initialAnnotationSpec,\n });\n\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 [previewSpec, setPreviewSpec] = useState(structuredClone(form.getValues()));\n\n const handleRunQuery = useCallback(async () => {\n const values = form.getValues();\n if (JSON.stringify(previewSpec) === JSON.stringify(values)) {\n await queryClient.invalidateQueries({ queryKey: ['annotation', previewSpec] });\n } else {\n setPreviewSpec(structuredClone(values));\n }\n }, [form, previewSpec, queryClient]);\n\n const processForm: SubmitHandler<AnnotationSpec> = (data: AnnotationSpec) => {\n // reset display attributes to undefined when empty, because we don't want to save empty strings\n onSave(data);\n };\n\n function handleCancel(): void {\n if (JSON.stringify(initialAnnotationSpec) !== JSON.stringify(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} Annotation</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={12}>\n <Controller\n control={form.control}\n name=\"display.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={12}>\n <Stack direction=\"row\" gap={1}>\n <Controller\n control={form.control}\n name=\"display.color\"\n render={({ field }) => {\n const isEnabled = field.value !== undefined;\n return (\n <>\n {isEnabled ? (\n <OptionsColorPicker\n size=\"medium\"\n label=\"annotation\"\n color={field.value ?? DEFAULT_ANNOTATION_COLOR}\n onColorChange={(color) => field.onChange(color)}\n onClear={() => field.onChange(undefined)}\n />\n ) : (\n <IconButton size=\"medium\" onClick={() => field.onChange(DEFAULT_ANNOTATION_COLOR)}>\n <InvertColorsIcon />\n </IconButton>\n )}\n </>\n );\n }}\n />\n\n <Controller\n control={form.control}\n name=\"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 </Stack>\n </Grid>\n </Grid>\n\n <Divider />\n\n <ErrorBoundary FallbackComponent={FallbackPreview} resetKeys={[previewSpec]}>\n <AnnotationPreview spec={previewSpec} sx={{ marginY: 2 }} />\n </ErrorBoundary>\n\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <AnnotationPluginControl action={action} control={form.control} onRunQuery={handleRunQuery} />\n </ErrorBoundary>\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","TextField","Grid","Divider","Stack","IconButton","DiscardChangesConfirmationDialog","ErrorAlert","ErrorBoundary","FormActions","OptionsColorPicker","getSubmitText","getTitleAction","Controller","FormProvider","useForm","useWatch","zodResolver","useQueryClient","InvertColorsIcon","PluginEditor","useValidationSchemas","DEFAULT_ANNOTATION_COLOR","AnnotationPreview","FallbackPreview","div","AnnotationPluginControl","action","control","onRunQuery","plugin","name","kind","pluginSpec","spec","render","field","withRunQueryButton","width","pluginTypes","pluginKindLabel","value","selection","type","isReadonly","onChange","v","AnnotationEditorForm","initialAnnotationSpec","isDraft","onActionChange","onSave","onClose","onDelete","queryClient","isDiscardDialogOpened","setDiscardDialogOpened","titleAction","submitText","annotationEditorSchema","form","resolver","mode","defaultValues","previewSpec","setPreviewSpec","structuredClone","getValues","handleRunQuery","values","JSON","stringify","invalidateQueries","queryKey","processForm","data","handleCancel","sx","display","alignItems","padding","theme","spacing","borderBottom","palette","divider","variant","isValid","formState","onSubmit","handleSubmit","onCancel","overflowY","container","mb","item","xs","fieldState","required","fullWidth","label","InputLabelProps","shrink","undefined","InputProps","disabled","readOnly","error","helperText","message","event","direction","gap","isEnabled","size","color","onColorChange","onClear","onClick","FallbackComponent","resetKeys","marginY","description","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,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Ne,OAAO/E,MAAMK,KAAK,IAAInB;wDACtB8F,eAAe,CAACD,QAAU/E,MAAMS,QAAQ,CAACsE;wDACzCE,SAAS,IAAMjF,MAAMS,QAAQ,CAAC0D;uEAGhC,KAAClG;wDAAW6G,MAAK;wDAASI,SAAS,IAAMlF,MAAMS,QAAQ,CAACvB;kEACtD,cAAA,KAACH;;;4CAKX;;sDAGF,KAACN;4CACCe,SAASgC,KAAKhC,OAAO;4CACrBG,MAAK;4CACLI,QAAQ,CAAC,EAAEC,KAAK,EAAE6D,UAAU,EAAE,iBAC5B,KAAChG;oDACE,GAAGmC,KAAK;oDACT+D,SAAS;oDACTC,OAAM;oDACNC,iBAAiB;wDAAEC,QAAQ3E,WAAW,SAAS,OAAO4E;oDAAU;oDAChEC,YAAY;wDACVE,UAAU/E,WAAW;oDACvB;oDACAgF,OAAO,CAAC,CAACV,WAAWU,KAAK;oDACzBC,YAAYX,WAAWU,KAAK,EAAEE;oDAC9BpE,OAAOL,MAAMK,KAAK,IAAI;oDACtBI,UAAU,CAACiE;wDACT1E,MAAMS,QAAQ,CAACiE;oDACjB;;;;;;;;kCAQZ,KAAC3G;kCAED,KAACK;wBAAc+G,mBAAmB/F;wBAAiBgG,WAAW;4BAACxD;yBAAY;kCACzE,cAAA,KAACzC;4BAAkBW,MAAM8B;4BAAaa,IAAI;gCAAE4C,SAAS;4BAAE;;;kCAGzD,KAACjH;wBAAc+G,mBAAmBhH;kCAChC,cAAA,KAACmB;4BAAwBC,QAAQA;4BAAQC,SAASgC,KAAKhC,OAAO;4BAAEC,YAAYuC;;;;;0BAGhF,KAAC9D;gBACCoH,aAAY;gBACZC,QAAQpE;gBACRoC,UAAU;oBACRnC,uBAAuB;gBACzB;gBACAoE,kBAAkB;oBAChBpE,uBAAuB;oBACvBJ;gBACF;;;;AAIR"}
1
+ {"version":3,"sources":["../../../../src/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.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, TextField, Grid, Divider, Stack, IconButton } from '@mui/material';\nimport type { Action } from '@perses-dev/client';\nimport {\n DiscardChangesConfirmationDialog,\n ErrorAlert,\n ErrorBoundary,\n FormActions,\n OptionsColorPicker,\n getSubmitText,\n getTitleAction,\n} from '@perses-dev/components';\nimport type { AnnotationSpec } from '@perses-dev/spec';\nimport { useQueryClient } from '@tanstack/react-query';\nimport InvertColorsIcon from 'mdi-material-ui/InvertColors';\nimport type { DispatchWithoutAction, ReactElement } from 'react';\nimport { useCallback, useState } from 'react';\nimport type { Control, SubmitHandler } from 'react-hook-form';\nimport { Controller, FormProvider, useForm, useWatch } from 'react-hook-form';\n\nimport { useValidationSchemas } from '../../../context';\nimport { PluginEditor } from '../../PluginEditor';\nimport { DEFAULT_ANNOTATION_COLOR } from '../constants';\nimport { AnnotationPreview } from './AnnotationPreview';\n\nfunction FallbackPreview(): ReactElement {\n return <div>Error previewing annotations</div>;\n}\n\ninterface KindAnnotationEditorFormProps {\n action: Action;\n control: Control<AnnotationSpec>;\n onRunQuery: () => void;\n}\n\nfunction AnnotationPluginControl({ action, control, onRunQuery }: KindAnnotationEditorFormProps): ReactElement {\n const plugin = useWatch<AnnotationSpec, 'plugin'>({ control, name: 'plugin' });\n const kind = plugin?.kind;\n const pluginSpec = plugin?.spec;\n\n return (\n <Controller\n control={control}\n name=\"plugin\"\n render={({ field }) => {\n return (\n <PluginEditor\n withRunQueryButton\n width=\"100%\"\n pluginTypes={['Annotation']}\n pluginKindLabel=\"Source\"\n value={{\n selection: {\n type: 'Annotation',\n kind: kind ?? 'StaticListAnnotation',\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={onRunQuery}\n />\n );\n }}\n />\n );\n}\n\ninterface AnnotationEditorFormProps {\n initialAnnotationSpec: AnnotationSpec;\n action: Action;\n isDraft: boolean;\n isReadonly?: boolean;\n onActionChange?: (action: Action) => void;\n onSave: (def: AnnotationSpec) => void;\n onClose: () => void;\n onDelete?: DispatchWithoutAction;\n}\n\nexport function AnnotationEditorForm({\n initialAnnotationSpec,\n action,\n isDraft,\n isReadonly,\n onActionChange,\n onSave,\n onClose,\n onDelete,\n}: AnnotationEditorFormProps): ReactElement {\n const queryClient = useQueryClient();\n\n const [isDiscardDialogOpened, setDiscardDialogOpened] = useState<boolean>(false);\n const titleAction = getTitleAction(action, isDraft);\n const submitText = getSubmitText(action, isDraft);\n\n const { annotationEditorSchema } = useValidationSchemas();\n const form = useForm<AnnotationSpec>({\n resolver: zodResolver(annotationEditorSchema),\n mode: 'onBlur',\n defaultValues: initialAnnotationSpec,\n });\n\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 [previewSpec, setPreviewSpec] = useState(structuredClone(form.getValues()));\n\n const handleRunQuery = useCallback(async () => {\n const values = form.getValues();\n if (JSON.stringify(previewSpec) === JSON.stringify(values)) {\n await queryClient.invalidateQueries({ queryKey: ['annotation', previewSpec] });\n } else {\n setPreviewSpec(structuredClone(values));\n }\n }, [form, previewSpec, queryClient]);\n\n const processForm: SubmitHandler<AnnotationSpec> = (data: AnnotationSpec) => {\n // reset display attributes to undefined when empty, because we don't want to save empty strings\n onSave(data);\n };\n\n function handleCancel(): void {\n if (JSON.stringify(initialAnnotationSpec) !== JSON.stringify(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} Annotation</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={12}>\n <Controller\n control={form.control}\n name=\"display.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={12}>\n <Stack direction=\"row\" gap={1}>\n <Controller\n control={form.control}\n name=\"display.color\"\n render={({ field }) => {\n const isEnabled = field.value !== undefined;\n return (\n <>\n {isEnabled ? (\n <OptionsColorPicker\n size=\"medium\"\n label=\"annotation\"\n color={field.value ?? DEFAULT_ANNOTATION_COLOR}\n onColorChange={(color) => field.onChange(color)}\n onClear={() => field.onChange(undefined)}\n />\n ) : (\n <IconButton size=\"medium\" onClick={() => field.onChange(DEFAULT_ANNOTATION_COLOR)}>\n <InvertColorsIcon />\n </IconButton>\n )}\n </>\n );\n }}\n />\n\n <Controller\n control={form.control}\n name=\"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 </Stack>\n </Grid>\n </Grid>\n\n <Divider />\n\n <ErrorBoundary FallbackComponent={FallbackPreview} resetKeys={[previewSpec]}>\n <AnnotationPreview spec={previewSpec} sx={{ marginY: 2 }} />\n </ErrorBoundary>\n\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <AnnotationPluginControl action={action} control={form.control} onRunQuery={handleRunQuery} />\n </ErrorBoundary>\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","TextField","Grid","Divider","Stack","IconButton","DiscardChangesConfirmationDialog","ErrorAlert","ErrorBoundary","FormActions","OptionsColorPicker","getSubmitText","getTitleAction","useQueryClient","InvertColorsIcon","useCallback","useState","Controller","FormProvider","useForm","useWatch","useValidationSchemas","PluginEditor","DEFAULT_ANNOTATION_COLOR","AnnotationPreview","FallbackPreview","div","AnnotationPluginControl","action","control","onRunQuery","plugin","name","kind","pluginSpec","spec","render","field","withRunQueryButton","width","pluginTypes","pluginKindLabel","value","selection","type","isReadonly","onChange","v","AnnotationEditorForm","initialAnnotationSpec","isDraft","onActionChange","onSave","onClose","onDelete","queryClient","isDiscardDialogOpened","setDiscardDialogOpened","titleAction","submitText","annotationEditorSchema","form","resolver","mode","defaultValues","previewSpec","setPreviewSpec","structuredClone","getValues","handleRunQuery","values","JSON","stringify","invalidateQueries","queryKey","processForm","data","handleCancel","sx","display","alignItems","padding","theme","spacing","borderBottom","palette","divider","variant","isValid","formState","onSubmit","handleSubmit","onCancel","overflowY","container","mb","item","xs","fieldState","required","fullWidth","label","InputLabelProps","shrink","undefined","InputProps","disabled","readOnly","error","helperText","message","event","direction","gap","isEnabled","size","color","onColorChange","onClear","onClick","FallbackComponent","resetKeys","marginY","description","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,SAASA,WAAW,QAAQ,0BAA0B;AACtD,SAASC,GAAG,EAAEC,UAAU,EAAEC,SAAS,EAAEC,IAAI,EAAEC,OAAO,EAAEC,KAAK,EAAEC,UAAU,QAAQ,gBAAgB;AAE7F,SACEC,gCAAgC,EAChCC,UAAU,EACVC,aAAa,EACbC,WAAW,EACXC,kBAAkB,EAClBC,aAAa,EACbC,cAAc,QACT,yBAAyB;AAEhC,SAASC,cAAc,QAAQ,wBAAwB;AACvD,OAAOC,sBAAsB,+BAA+B;AAE5D,SAASC,WAAW,EAAEC,QAAQ,QAAQ,QAAQ;AAE9C,SAASC,UAAU,EAAEC,YAAY,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,kBAAkB;AAE9E,SAASC,oBAAoB,QAAQ,4BAAmB;AACxD,SAASC,YAAY,QAAQ,8BAAqB;AAClD,SAASC,wBAAwB,QAAQ,kBAAe;AACxD,SAASC,iBAAiB,QAAQ,yBAAsB;AAExD,SAASC;IACP,qBAAO,KAACC;kBAAI;;AACd;AAQA,SAASC,wBAAwB,EAAEC,MAAM,EAAEC,OAAO,EAAEC,UAAU,EAAiC;IAC7F,MAAMC,SAASX,SAAmC;QAAES;QAASG,MAAM;IAAS;IAC5E,MAAMC,OAAOF,QAAQE;IACrB,MAAMC,aAAaH,QAAQI;IAE3B,qBACE,KAAClB;QACCY,SAASA;QACTG,MAAK;QACLI,QAAQ,CAAC,EAAEC,KAAK,EAAE;YAChB,qBACE,KAACf;gBACCgB,kBAAkB;gBAClBC,OAAM;gBACNC,aAAa;oBAAC;iBAAa;gBAC3B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AACoB;4BAAwBC,QAAQA;4BAAQC,SAASgC,KAAKhC,OAAO;4BAAEC,YAAYuC;;;;;0BAGhF,KAAC/D;gBACCqH,aAAY;gBACZC,QAAQpE;gBACRoC,UAAU;oBACRnC,uBAAuB;gBACzB;gBACAoE,kBAAkB;oBAChBpE,uBAAuB;oBACvBJ;gBACF;;;;AAIR"}
@@ -1,6 +1,6 @@
1
- import { ReactNode } from 'react';
2
- import { AnnotationSpec } from '@perses-dev/spec';
3
- import { CardProps } from '@mui/material';
1
+ import type { CardProps } from '@mui/material';
2
+ import type { AnnotationSpec } from '@perses-dev/spec';
3
+ import type { ReactNode } from 'react';
4
4
  export interface AnnotationPreviewProps extends CardProps {
5
5
  spec: AnnotationSpec;
6
6
  }
@@ -1 +1 @@
1
- {"version":3,"file":"AnnotationPreview.d.ts","sourceRoot":"","sources":["../../../../src/components/Annotations/AnnotationEditorForm/AnnotationPreview.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,SAAS,EAAqB,MAAM,OAAO,CAAC;AACrD,OAAO,EAAkB,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAIL,SAAS,EAOV,MAAM,eAAe,CAAC;AAsDvB,MAAM,WAAW,sBAAuB,SAAQ,SAAS;IACvD,IAAI,EAAE,cAAc,CAAC;CACtB;AAED,wBAAgB,iBAAiB,CAAC,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,sBAAsB,GAAG,SAAS,CA0DvF"}
1
+ {"version":3,"file":"AnnotationPreview.d.ts","sourceRoot":"","sources":["../../../../src/components/Annotations/AnnotationEditorForm/AnnotationPreview.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAa/C,OAAO,KAAK,EAAkB,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAsDvC,MAAM,WAAW,sBAAuB,SAAQ,SAAS;IACvD,IAAI,EAAE,cAAc,CAAC;CACtB;AAED,wBAAgB,iBAAiB,CAAC,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,sBAAsB,GAAG,SAAS,CA0DvF"}
@@ -1,4 +1,3 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
1
  // Copyright The Perses Authors
3
2
  // Licensed under the Apache License, Version 2.0 (the "License");
4
3
  // you may not use this file except in compliance with the License.
@@ -11,11 +10,12 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
11
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
11
  // See the License for the specific language governing permissions and
13
12
  // limitations under the License.
14
- import { useMemo, useState } from 'react';
15
- import { Card, CardContent, CardHeader, Chip, CircularProgress, Divider, IconButton, Stack, Typography } from '@mui/material';
16
- import { getDateAndTime, InfoTooltip, useTimeZone } from '@perses-dev/components';
17
- import AlertIcon from 'mdi-material-ui/Alert';
18
- import { useAnnotationData } from '../../../runtime';
13
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
14
+ import { Card, CardContent, CardHeader, Chip, CircularProgress, Divider, IconButton, Stack, Typography } from "@mui/material";
15
+ import { getDateAndTime, InfoTooltip, useTimeZone } from "@perses-dev/components";
16
+ import AlertIcon from "mdi-material-ui/Alert";
17
+ import { useMemo, useState } from "react";
18
+ import { useAnnotationData } from "../../../runtime/index.js";
19
19
  function AnnotationPreviewCard({ value, formatWithUserTimeZone, ...props }) {
20
20
  const start = getDateAndTime(value.start, formatWithUserTimeZone);
21
21
  const end = value.end !== undefined ? getDateAndTime(value.start, formatWithUserTimeZone) : null;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/Annotations/AnnotationEditorForm/AnnotationPreview.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 { ReactNode, useMemo, useState } from 'react';\nimport { AnnotationData, AnnotationSpec } from '@perses-dev/spec';\nimport {\n Card,\n CardContent,\n CardHeader,\n CardProps,\n Chip,\n CircularProgress,\n Divider,\n IconButton,\n Stack,\n Typography,\n} from '@mui/material';\nimport { getDateAndTime, InfoTooltip, useTimeZone } from '@perses-dev/components';\nimport AlertIcon from 'mdi-material-ui/Alert';\nimport { useAnnotationData } from '../../../runtime';\n\ninterface AnnotationPreviewCardProps extends CardProps {\n value: AnnotationData;\n formatWithUserTimeZone: (date: Date, format: string) => string;\n}\n\nfunction AnnotationPreviewCard({ value, formatWithUserTimeZone, ...props }: AnnotationPreviewCardProps): ReactNode {\n const start = getDateAndTime(value.start, formatWithUserTimeZone);\n const end = value.end !== undefined ? getDateAndTime(value.start, formatWithUserTimeZone) : null;\n\n const tags = useMemo(() => {\n return Object.entries(value.tags ?? []).map(([key, value]) => {\n return { key: key, value: value };\n });\n }, [value.tags]);\n\n return (\n <Card {...props}>\n <CardContent>\n <Stack gap={2}>\n {value.title && <Typography variant=\"h3\">{value.title}</Typography>}\n {value.legend && <Typography>{value.legend}</Typography>}\n\n <Stack flexWrap=\"wrap\" direction=\"row\" gap={0.5}>\n {tags.map((tag) => (\n <Chip size=\"small\" key={`${tag.key}=${tag.value}`} label={`${tag.key}: ${tag.value}`} />\n ))}\n </Stack>\n </Stack>\n\n <Divider sx={{ marginY: 2 }} />\n\n <Stack gap={0.5} direction=\"row\">\n <Typography variant=\"caption\">\n {start.formattedDate} - <strong>{start.formattedTime}</strong>\n </Typography>\n {end && (\n <>\n <Typography variant=\"caption\">{' → '}</Typography>\n <Typography variant=\"caption\">\n {end.formattedDate} - <strong>{end.formattedTime}</strong>\n </Typography>\n </>\n )}\n </Stack>\n </CardContent>\n </Card>\n );\n}\n\nexport interface AnnotationPreviewProps extends CardProps {\n spec: AnnotationSpec;\n}\n\nexport function AnnotationPreview({ spec, ...props }: AnnotationPreviewProps): ReactNode {\n const { data, isFetching, error } = useAnnotationData(spec);\n const { formatWithUserTimeZone } = useTimeZone();\n\n const [showAll, setShowAll] = useState<boolean>(false);\n const annotationsToShow = showAll ? data : data?.slice(0, 1);\n let notShown = 0;\n if (data && data?.length > 0 && annotationsToShow) {\n notShown = data.length - annotationsToShow.length;\n }\n\n const stateIndicator = useMemo((): ReactNode | undefined => {\n if (isFetching) {\n return <CircularProgress aria-label=\"loading\" size=\"1.125rem\" />;\n } else if (error) {\n return (\n <InfoTooltip description={error.toString()}>\n <IconButton aria-label=\"preview errors\" size=\"small\">\n <AlertIcon\n fontSize=\"inherit\"\n sx={{\n color: (theme) => theme.palette.error.main,\n }}\n />\n </IconButton>\n </InfoTooltip>\n );\n }\n }, [isFetching, error]);\n\n return (\n <Card variant=\"outlined\" {...props}>\n <CardHeader\n title={\n <Stack direction=\"row\" justifyContent=\"space-between\">\n <Typography variant=\"h4\">Preview Annotations</Typography>\n {stateIndicator}\n </Stack>\n }\n />\n <CardContent sx={{ display: 'flex', flexWrap: 'wrap', gap: 1, paddingY: 0 }}>\n {annotationsToShow?.map((item, index) => (\n <AnnotationPreviewCard\n key={index}\n value={item}\n formatWithUserTimeZone={formatWithUserTimeZone}\n sx={{ width: '100%' }}\n />\n ))}\n {notShown > 0 && (\n <Chip onClick={() => setShowAll(true)} variant=\"outlined\" size=\"small\" label={`+${notShown} more`} />\n )}\n {showAll && data && data.length > 1 && (\n <Chip onClick={() => setShowAll(false)} variant=\"outlined\" size=\"small\" label=\"-\" />\n )}\n </CardContent>\n </Card>\n );\n}\n"],"names":["useMemo","useState","Card","CardContent","CardHeader","Chip","CircularProgress","Divider","IconButton","Stack","Typography","getDateAndTime","InfoTooltip","useTimeZone","AlertIcon","useAnnotationData","AnnotationPreviewCard","value","formatWithUserTimeZone","props","start","end","undefined","tags","Object","entries","map","key","gap","title","variant","legend","flexWrap","direction","tag","size","label","sx","marginY","formattedDate","strong","formattedTime","AnnotationPreview","spec","data","isFetching","error","showAll","setShowAll","annotationsToShow","slice","notShown","length","stateIndicator","aria-label","description","toString","fontSize","color","theme","palette","main","justifyContent","display","paddingY","item","index","width","onClick"],"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,SAAoBA,OAAO,EAAEC,QAAQ,QAAQ,QAAQ;AAErD,SACEC,IAAI,EACJC,WAAW,EACXC,UAAU,EAEVC,IAAI,EACJC,gBAAgB,EAChBC,OAAO,EACPC,UAAU,EACVC,KAAK,EACLC,UAAU,QACL,gBAAgB;AACvB,SAASC,cAAc,EAAEC,WAAW,EAAEC,WAAW,QAAQ,yBAAyB;AAClF,OAAOC,eAAe,wBAAwB;AAC9C,SAASC,iBAAiB,QAAQ,mBAAmB;AAOrD,SAASC,sBAAsB,EAAEC,KAAK,EAAEC,sBAAsB,EAAE,GAAGC,OAAmC;IACpG,MAAMC,QAAQT,eAAeM,MAAMG,KAAK,EAAEF;IAC1C,MAAMG,MAAMJ,MAAMI,GAAG,KAAKC,YAAYX,eAAeM,MAAMG,KAAK,EAAEF,0BAA0B;IAE5F,MAAMK,OAAOvB,QAAQ;QACnB,OAAOwB,OAAOC,OAAO,CAACR,MAAMM,IAAI,IAAI,EAAE,EAAEG,GAAG,CAAC,CAAC,CAACC,KAAKV,MAAM;YACvD,OAAO;gBAAEU,KAAKA;gBAAKV,OAAOA;YAAM;QAClC;IACF,GAAG;QAACA,MAAMM,IAAI;KAAC;IAEf,qBACE,KAACrB;QAAM,GAAGiB,KAAK;kBAC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AkBG,MAAM;IACnD;IAEA,MAAMC,iBAAiBrD,QAAQ;QAC7B,IAAI6C,YAAY;YACd,qBAAO,KAACvC;gBAAiBgD,cAAW;gBAAUnB,MAAK;;QACrD,OAAO,IAAIW,OAAO;YAChB,qBACE,KAAClC;gBAAY2C,aAAaT,MAAMU,QAAQ;0BACtC,cAAA,KAAChD;oBAAW8C,cAAW;oBAAiBnB,MAAK;8BAC3C,cAAA,KAACrB;wBACC2C,UAAS;wBACTpB,IAAI;4BACFqB,OAAO,CAACC,QAAUA,MAAMC,OAAO,CAACd,KAAK,CAACe,IAAI;wBAC5C;;;;QAKV;IACF,GAAG;QAAChB;QAAYC;KAAM;IAEtB,qBACE,MAAC5C;QAAK4B,SAAQ;QAAY,GAAGX,KAAK;;0BAChC,KAACf;gBACCyB,qBACE,MAACpB;oBAAMwB,WAAU;oBAAM6B,gBAAe;;sCACpC,KAACpD;4BAAWoB,SAAQ;sCAAK;;wBACxBuB;;;;0BAIP,MAAClD;gBAAYkC,IAAI;oBAAE0B,SAAS;oBAAQ/B,UAAU;oBAAQJ,KAAK;oBAAGoC,UAAU;gBAAE;;oBACvEf,mBAAmBvB,IAAI,CAACuC,MAAMC,sBAC7B,KAAClD;4BAECC,OAAOgD;4BACP/C,wBAAwBA;4BACxBmB,IAAI;gCAAE8B,OAAO;4BAAO;2BAHfD;oBAMRf,WAAW,mBACV,KAAC9C;wBAAK+D,SAAS,IAAMpB,WAAW;wBAAOlB,SAAQ;wBAAWK,MAAK;wBAAQC,OAAO,CAAC,CAAC,EAAEe,SAAS,KAAK,CAAC;;oBAElGJ,WAAWH,QAAQA,KAAKQ,MAAM,GAAG,mBAChC,KAAC/C;wBAAK+D,SAAS,IAAMpB,WAAW;wBAAQlB,SAAQ;wBAAWK,MAAK;wBAAQC,OAAM;;;;;;AAKxF"}
1
+ {"version":3,"sources":["../../../../src/components/Annotations/AnnotationEditorForm/AnnotationPreview.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 type { CardProps } from '@mui/material';\nimport {\n Card,\n CardContent,\n CardHeader,\n Chip,\n CircularProgress,\n Divider,\n IconButton,\n Stack,\n Typography,\n} from '@mui/material';\nimport { getDateAndTime, InfoTooltip, useTimeZone } from '@perses-dev/components';\nimport type { AnnotationData, AnnotationSpec } from '@perses-dev/spec';\nimport AlertIcon from 'mdi-material-ui/Alert';\nimport type { ReactNode } from 'react';\nimport { useMemo, useState } from 'react';\n\nimport { useAnnotationData } from '../../../runtime';\n\ninterface AnnotationPreviewCardProps extends CardProps {\n value: AnnotationData;\n formatWithUserTimeZone: (date: Date, format: string) => string;\n}\n\nfunction AnnotationPreviewCard({ value, formatWithUserTimeZone, ...props }: AnnotationPreviewCardProps): ReactNode {\n const start = getDateAndTime(value.start, formatWithUserTimeZone);\n const end = value.end !== undefined ? getDateAndTime(value.start, formatWithUserTimeZone) : null;\n\n const tags = useMemo(() => {\n return Object.entries(value.tags ?? []).map(([key, value]) => {\n return { key: key, value: value };\n });\n }, [value.tags]);\n\n return (\n <Card {...props}>\n <CardContent>\n <Stack gap={2}>\n {value.title && <Typography variant=\"h3\">{value.title}</Typography>}\n {value.legend && <Typography>{value.legend}</Typography>}\n\n <Stack flexWrap=\"wrap\" direction=\"row\" gap={0.5}>\n {tags.map((tag) => (\n <Chip size=\"small\" key={`${tag.key}=${tag.value}`} label={`${tag.key}: ${tag.value}`} />\n ))}\n </Stack>\n </Stack>\n\n <Divider sx={{ marginY: 2 }} />\n\n <Stack gap={0.5} direction=\"row\">\n <Typography variant=\"caption\">\n {start.formattedDate} - <strong>{start.formattedTime}</strong>\n </Typography>\n {end && (\n <>\n <Typography variant=\"caption\">{' → '}</Typography>\n <Typography variant=\"caption\">\n {end.formattedDate} - <strong>{end.formattedTime}</strong>\n </Typography>\n </>\n )}\n </Stack>\n </CardContent>\n </Card>\n );\n}\n\nexport interface AnnotationPreviewProps extends CardProps {\n spec: AnnotationSpec;\n}\n\nexport function AnnotationPreview({ spec, ...props }: AnnotationPreviewProps): ReactNode {\n const { data, isFetching, error } = useAnnotationData(spec);\n const { formatWithUserTimeZone } = useTimeZone();\n\n const [showAll, setShowAll] = useState<boolean>(false);\n const annotationsToShow = showAll ? data : data?.slice(0, 1);\n let notShown = 0;\n if (data && data?.length > 0 && annotationsToShow) {\n notShown = data.length - annotationsToShow.length;\n }\n\n const stateIndicator = useMemo((): ReactNode | undefined => {\n if (isFetching) {\n return <CircularProgress aria-label=\"loading\" size=\"1.125rem\" />;\n } else if (error) {\n return (\n <InfoTooltip description={error.toString()}>\n <IconButton aria-label=\"preview errors\" size=\"small\">\n <AlertIcon\n fontSize=\"inherit\"\n sx={{\n color: (theme) => theme.palette.error.main,\n }}\n />\n </IconButton>\n </InfoTooltip>\n );\n }\n }, [isFetching, error]);\n\n return (\n <Card variant=\"outlined\" {...props}>\n <CardHeader\n title={\n <Stack direction=\"row\" justifyContent=\"space-between\">\n <Typography variant=\"h4\">Preview Annotations</Typography>\n {stateIndicator}\n </Stack>\n }\n />\n <CardContent sx={{ display: 'flex', flexWrap: 'wrap', gap: 1, paddingY: 0 }}>\n {annotationsToShow?.map((item, index) => (\n <AnnotationPreviewCard\n key={index}\n value={item}\n formatWithUserTimeZone={formatWithUserTimeZone}\n sx={{ width: '100%' }}\n />\n ))}\n {notShown > 0 && (\n <Chip onClick={() => setShowAll(true)} variant=\"outlined\" size=\"small\" label={`+${notShown} more`} />\n )}\n {showAll && data && data.length > 1 && (\n <Chip onClick={() => setShowAll(false)} variant=\"outlined\" size=\"small\" label=\"-\" />\n )}\n </CardContent>\n </Card>\n );\n}\n"],"names":["Card","CardContent","CardHeader","Chip","CircularProgress","Divider","IconButton","Stack","Typography","getDateAndTime","InfoTooltip","useTimeZone","AlertIcon","useMemo","useState","useAnnotationData","AnnotationPreviewCard","value","formatWithUserTimeZone","props","start","end","undefined","tags","Object","entries","map","key","gap","title","variant","legend","flexWrap","direction","tag","size","label","sx","marginY","formattedDate","strong","formattedTime","AnnotationPreview","spec","data","isFetching","error","showAll","setShowAll","annotationsToShow","slice","notShown","length","stateIndicator","aria-label","description","toString","fontSize","color","theme","palette","main","justifyContent","display","paddingY","item","index","width","onClick"],"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,SACEA,IAAI,EACJC,WAAW,EACXC,UAAU,EACVC,IAAI,EACJC,gBAAgB,EAChBC,OAAO,EACPC,UAAU,EACVC,KAAK,EACLC,UAAU,QACL,gBAAgB;AACvB,SAASC,cAAc,EAAEC,WAAW,EAAEC,WAAW,QAAQ,yBAAyB;AAElF,OAAOC,eAAe,wBAAwB;AAE9C,SAASC,OAAO,EAAEC,QAAQ,QAAQ,QAAQ;AAE1C,SAASC,iBAAiB,QAAQ,4BAAmB;AAOrD,SAASC,sBAAsB,EAAEC,KAAK,EAAEC,sBAAsB,EAAE,GAAGC,OAAmC;IACpG,MAAMC,QAAQX,eAAeQ,MAAMG,KAAK,EAAEF;IAC1C,MAAMG,MAAMJ,MAAMI,GAAG,KAAKC,YAAYb,eAAeQ,MAAMG,KAAK,EAAEF,0BAA0B;IAE5F,MAAMK,OAAOV,QAAQ;QACnB,OAAOW,OAAOC,OAAO,CAACR,MAAMM,IAAI,IAAI,EAAE,EAAEG,GAAG,CAAC,CAAC,CAACC,KAAKV,MAAM;YACvD,OAAO;gBAAEU,KAAKA;gBAAKV,OAAOA;YAAM;QAClC;IACF,GA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UT 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 './AnnotationEditorForm';
13
+ export * from "./AnnotationEditorForm.js";
14
14
 
15
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/Annotations/AnnotationEditorForm/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 './AnnotationEditorForm';\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,yBAAyB"}
1
+ {"version":3,"sources":["../../../../src/components/Annotations/AnnotationEditorForm/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 './AnnotationEditorForm';\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,4BAAyB"}
@@ -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 './AnnotationEditorForm';
14
- export * from './constants';
13
+ export * from "./AnnotationEditorForm/index.js";
14
+ export * from "./constants.js";
15
15
 
16
16
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Annotations/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 './AnnotationEditorForm';\nexport * from './constants';\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,yBAAyB;AACvC,cAAc,cAAc"}
1
+ {"version":3,"sources":["../../../src/components/Annotations/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 './AnnotationEditorForm';\nexport * from './constants';\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,kCAAyB;AACvC,cAAc,iBAAc"}
@@ -1,5 +1,5 @@
1
- import { ReactElement } from 'react';
2
- import { CalculationType } from '../../model';
1
+ import type { ReactElement } from 'react';
2
+ import type { CalculationType } from '../../model';
3
3
  export interface CalculationSelectorProps {
4
4
  value: CalculationType;
5
5
  onChange: (unit: CalculationType) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"CalculationSelector.d.ts","sourceRoot":"","sources":["../../../src/components/CalculationSelector/CalculationSelector.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAA0C,eAAe,EAAE,MAAM,aAAa,CAAC;AAUtF,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,eAAe,CAAC;IACvB,QAAQ,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,IAAI,CAAC;CAC3C;AAED,wBAAgB,mBAAmB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,wBAAwB,GAAG,YAAY,CAuB/F"}
1
+ {"version":3,"file":"CalculationSelector.d.ts","sourceRoot":"","sources":["../../../src/components/CalculationSelector/CalculationSelector.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,KAAK,EAAqB,eAAe,EAAE,MAAM,aAAa,CAAC;AAWtE,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,eAAe,CAAC;IACvB,QAAQ,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,IAAI,CAAC;CAC3C;AAED,wBAAgB,mBAAmB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,wBAAwB,GAAG,YAAY,CAuB/F"}
@@ -11,8 +11,8 @@ import { jsx as _jsx } 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 { OptionsEditorControl, SettingsAutocomplete } from '@perses-dev/components';
15
- import { CALCULATIONS_CONFIG } from '../../model'; // TODO weird this is part of the model from the core package ...
14
+ import { OptionsEditorControl, SettingsAutocomplete } from "@perses-dev/components";
15
+ import { CALCULATIONS_CONFIG } from "../../model/index.js"; // TODO weird this is part of the model from the core package ...
16
16
  const CALC_OPTIONS = Object.entries(CALCULATIONS_CONFIG).map(([id, config])=>{
17
17
  return {
18
18
  id: id,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/CalculationSelector/CalculationSelector.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 { OptionsEditorControl, SettingsAutocomplete } from '@perses-dev/components';\nimport { ReactElement } from 'react';\nimport { CALCULATIONS_CONFIG, CalculationConfig, CalculationType } from '../../model'; // TODO weird this is part of the model from the core package ...\n\ntype AutocompleteCalculationOption = CalculationConfig & { id: CalculationType };\nconst CALC_OPTIONS: AutocompleteCalculationOption[] = Object.entries(CALCULATIONS_CONFIG).map(([id, config]) => {\n return {\n id: id as CalculationType,\n ...config,\n };\n});\n\nexport interface CalculationSelectorProps {\n value: CalculationType;\n onChange: (unit: CalculationType) => void;\n}\n\nexport function CalculationSelector({ value, onChange }: CalculationSelectorProps): ReactElement {\n const handleCalculationChange = (_: unknown, newValue: AutocompleteCalculationOption): void => {\n onChange(newValue.id);\n };\n\n const calcConfig = CALCULATIONS_CONFIG[value];\n\n return (\n <OptionsEditorControl\n label=\"Calculation\"\n control={\n <SettingsAutocomplete\n value={{\n ...calcConfig,\n id: value,\n }}\n options={CALC_OPTIONS}\n onChange={handleCalculationChange}\n disableClearable\n />\n }\n />\n );\n}\n"],"names":["OptionsEditorControl","SettingsAutocomplete","CALCULATIONS_CONFIG","CALC_OPTIONS","Object","entries","map","id","config","CalculationSelector","value","onChange","handleCalculationChange","_","newValue","calcConfig","label","control","options","disableClearable"],"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,oBAAoB,EAAEC,oBAAoB,QAAQ,yBAAyB;AAEpF,SAASC,mBAAmB,QAA4C,cAAc,CAAC,iEAAiE;AAGxJ,MAAMC,eAAgDC,OAAOC,OAAO,CAACH,qBAAqBI,GAAG,CAAC,CAAC,CAACC,IAAIC,OAAO;IACzG,OAAO;QACLD,IAAIA;QACJ,GAAGC,MAAM;IACX;AACF;AAOA,OAAO,SAASC,oBAAoB,EAAEC,KAAK,EAAEC,QAAQ,EAA4B;IAC/E,MAAMC,0BAA0B,CAACC,GAAYC;QAC3CH,SAASG,SAASP,EAAE;IACtB;IAEA,MAAMQ,aAAab,mBAAmB,CAACQ,MAAM;IAE7C,qBACE,KAACV;QACCgB,OAAM;QACNC,uBACE,KAAChB;YACCS,OAAO;gBACL,GAAGK,UAAU;gBACbR,IAAIG;YACN;YACAQ,SAASf;YACTQ,UAAUC;YACVO,gBAAgB;;;AAK1B"}
1
+ {"version":3,"sources":["../../../src/components/CalculationSelector/CalculationSelector.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 { OptionsEditorControl, SettingsAutocomplete } from '@perses-dev/components';\nimport type { ReactElement } from 'react';\n\nimport type { CalculationConfig, CalculationType } from '../../model';\nimport { CALCULATIONS_CONFIG } from '../../model'; // TODO weird this is part of the model from the core package ...\n\ntype AutocompleteCalculationOption = CalculationConfig & { id: CalculationType };\nconst CALC_OPTIONS: AutocompleteCalculationOption[] = Object.entries(CALCULATIONS_CONFIG).map(([id, config]) => {\n return {\n id: id as CalculationType,\n ...config,\n };\n});\n\nexport interface CalculationSelectorProps {\n value: CalculationType;\n onChange: (unit: CalculationType) => void;\n}\n\nexport function CalculationSelector({ value, onChange }: CalculationSelectorProps): ReactElement {\n const handleCalculationChange = (_: unknown, newValue: AutocompleteCalculationOption): void => {\n onChange(newValue.id);\n };\n\n const calcConfig = CALCULATIONS_CONFIG[value];\n\n return (\n <OptionsEditorControl\n label=\"Calculation\"\n control={\n <SettingsAutocomplete\n value={{\n ...calcConfig,\n id: value,\n }}\n options={CALC_OPTIONS}\n onChange={handleCalculationChange}\n disableClearable\n />\n }\n />\n );\n}\n"],"names":["OptionsEditorControl","SettingsAutocomplete","CALCULATIONS_CONFIG","CALC_OPTIONS","Object","entries","map","id","config","CalculationSelector","value","onChange","handleCalculationChange","_","newValue","calcConfig","label","control","options","disableClearable"],"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,oBAAoB,EAAEC,oBAAoB,QAAQ,yBAAyB;AAIpF,SAASC,mBAAmB,QAAQ,uBAAc,CAAC,iEAAiE;AAGpH,MAAMC,eAAgDC,OAAOC,OAAO,CAACH,qBAAqBI,GAAG,CAAC,CAAC,CAACC,IAAIC,OAAO;IACzG,OAAO;QACLD,IAAIA;QACJ,GAAGC,MAAM;IACX;AACF;AAOA,OAAO,SAASC,oBAAoB,EAAEC,KAAK,EAAEC,QAAQ,EAA4B;IAC/E,MAAMC,0BAA0B,CAACC,GAAYC;QAC3CH,SAASG,SAASP,EAAE;IACtB;IAEA,MAAMQ,aAAab,mBAAmB,CAACQ,MAAM;IAE7C,qBACE,KAACV;QACCgB,OAAM;QACNC,uBACE,KAAChB;YACCS,OAAO;gBACL,GAAGK,UAAU;gBACbR,IAAIG;YACN;YACAQ,SAASf;YACTQ,UAAUC;YACVO,gBAAgB;;;AAK1B"}
@@ -10,6 +10,6 @@
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 './CalculationSelector';
13
+ export * from "./CalculationSelector.js";
14
14
 
15
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/CalculationSelector/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 './CalculationSelector';\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,wBAAwB"}
1
+ {"version":3,"sources":["../../../src/components/CalculationSelector/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 './CalculationSelector';\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,2BAAwB"}
@@ -1,5 +1,5 @@
1
- import { DispatchWithoutAction, ReactElement } from 'react';
2
- import { Action, DatasourceDefinition } from '@perses-dev/client';
1
+ import type { Action, DatasourceDefinition, DatasourceSpec } from '@perses-dev/client';
2
+ import type { DispatchWithoutAction, ReactElement } from 'react';
3
3
  interface DatasourceEditorFormProps {
4
4
  initialDatasourceDefinition: DatasourceDefinition;
5
5
  action: Action;
@@ -9,6 +9,7 @@ interface DatasourceEditorFormProps {
9
9
  onSave: (def: DatasourceDefinition) => void;
10
10
  onClose: DispatchWithoutAction;
11
11
  onDelete?: DispatchWithoutAction;
12
+ testConnection?: (spec: DatasourceSpec, healthCheckPath: string) => Promise<void>;
12
13
  }
13
14
  export declare function DatasourceEditorForm(props: DatasourceEditorFormProps): ReactElement;
14
15
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"DatasourceEditorForm.d.ts","sourceRoot":"","sources":["../../../src/components/DatasourceEditorForm/DatasourceEditorForm.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAY,MAAM,OAAO,CAAC;AAEtE,OAAO,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAIlE,UAAU,yBAAyB;IACjC,2BAA2B,EAAE,oBAAoB,CAAC;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,MAAM,EAAE,CAAC,GAAG,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAC5C,OAAO,EAAE,qBAAqB,CAAC;IAC/B,QAAQ,CAAC,EAAE,qBAAqB,CAAC;CAClC;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,GAAG,YAAY,CA8MnF"}
1
+ {"version":3,"file":"DatasourceEditorForm.d.ts","sourceRoot":"","sources":["../../../src/components/DatasourceEditorForm/DatasourceEditorForm.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,MAAM,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEvF,OAAO,KAAK,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAQjE,UAAU,yBAAyB;IACjC,2BAA2B,EAAE,oBAAoB,CAAC;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,MAAM,EAAE,CAAC,GAAG,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAC5C,OAAO,EAAE,qBAAqB,CAAC;IAC/B,QAAQ,CAAC,EAAE,qBAAqB,CAAC;IACjC,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACnF;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,GAAG,YAAY,CAyNnF"}
@@ -11,15 +11,15 @@ 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 { zodResolver } from '@hookform/resolvers/zod';
15
- import { Box, Divider, FormControlLabel, Grid, Stack, Switch, TextField, Typography } from '@mui/material';
16
- import { DiscardChangesConfirmationDialog, FormActions, getSubmitText, getTitleAction } from '@perses-dev/components';
17
- import { useState } from 'react';
18
- import { Controller, FormProvider, useForm } from 'react-hook-form';
19
- import { useValidationSchemas } from '../../context';
20
- import { PluginEditor } from '../PluginEditor';
14
+ import { zodResolver } from "@hookform/resolvers/zod";
15
+ import { Box, Divider, FormControlLabel, Grid, Stack, Switch, TextField, Typography } from "@mui/material";
16
+ import { DiscardChangesConfirmationDialog, FormActions, getSubmitText, getTitleAction } from "@perses-dev/components";
17
+ import { useState } from "react";
18
+ import { Controller, FormProvider, useForm } from "react-hook-form";
19
+ import { useValidationSchemas } from "../../context/index.js";
20
+ import { PluginEditor } from "../PluginEditor/index.js";
21
21
  export function DatasourceEditorForm(props) {
22
- const { initialDatasourceDefinition, action, isDraft, isReadonly, onActionChange, onSave, onClose, onDelete } = props;
22
+ const { initialDatasourceDefinition, action, isDraft, isReadonly, onActionChange, onSave, onClose, onDelete, testConnection } = props;
23
23
  const [isDiscardDialogOpened, setDiscardDialogOpened] = useState(false);
24
24
  const titleAction = getTitleAction(action, isDraft);
25
25
  const submitText = getSubmitText(action, isDraft);
@@ -241,7 +241,8 @@ export function DatasourceEditorForm(props) {
241
241
  kind: v.selection.kind,
242
242
  spec: v.spec
243
243
  });
244
- }
244
+ },
245
+ testConnection: testConnection
245
246
  })
246
247
  })
247
248
  ]
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/DatasourceEditorForm/DatasourceEditorForm.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, Divider, FormControlLabel, Grid, Stack, Switch, TextField, Typography } from '@mui/material';\nimport { DiscardChangesConfirmationDialog, FormActions, getSubmitText, getTitleAction } from '@perses-dev/components';\nimport { DispatchWithoutAction, ReactElement, useState } from 'react';\nimport { Controller, FormProvider, SubmitHandler, useForm } from 'react-hook-form';\nimport { Action, DatasourceDefinition } from '@perses-dev/client';\nimport { useValidationSchemas } from '../../context';\nimport { PluginEditor } from '../PluginEditor';\n\ninterface DatasourceEditorFormProps {\n initialDatasourceDefinition: DatasourceDefinition;\n action: Action;\n isDraft: boolean;\n isReadonly?: boolean;\n onActionChange?: (action: Action) => void;\n onSave: (def: DatasourceDefinition) => void;\n onClose: DispatchWithoutAction;\n onDelete?: DispatchWithoutAction;\n}\n\nexport function DatasourceEditorForm(props: DatasourceEditorFormProps): ReactElement {\n const { initialDatasourceDefinition, action, isDraft, isReadonly, onActionChange, onSave, onClose, onDelete } = props;\n\n const [isDiscardDialogOpened, setDiscardDialogOpened] = useState<boolean>(false);\n const titleAction = getTitleAction(action, isDraft);\n const submitText = getSubmitText(action, isDraft);\n\n const { datasourceEditorSchema } = useValidationSchemas();\n const form = useForm<DatasourceDefinition>({\n resolver: zodResolver(datasourceEditorSchema),\n mode: 'onBlur',\n defaultValues: initialDatasourceDefinition,\n });\n\n /*\n * Remove empty fields that are optional\n */\n function clearFormData(data: DatasourceDefinition): DatasourceDefinition {\n const result = { ...data };\n if (result.spec.display?.name === undefined && result.spec.display?.description === undefined) {\n delete result.spec.display;\n }\n return result;\n }\n\n const processForm: SubmitHandler<DatasourceDefinition> = (data: DatasourceDefinition) => {\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(initialDatasourceDefinition) !== 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} Datasource</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={4}>\n <Controller\n control={form.control}\n name=\"name\"\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n required\n fullWidth\n name=\"name\"\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={8}>\n <Controller\n control={form.control}\n name=\"spec.display.name\"\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n fullWidth\n name=\"title\"\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={12}>\n <Controller\n control={form.control}\n name=\"spec.display.description\"\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n fullWidth\n name=\"description\"\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={6} sx={{ paddingTop: '5px !important' }}>\n <Stack>\n <Controller\n control={form.control}\n name=\"spec.default\"\n render={({ field }) => (\n <FormControlLabel\n label=\"Set as default\"\n control={\n <Switch\n {...field}\n checked={!!field.value}\n readOnly={action === 'read'}\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\">\n Whether this datasource should be the default {form.getValues().spec.plugin.kind} to be used\n </Typography>\n </Stack>\n </Grid>\n </Grid>\n <Divider />\n <Typography py={1} variant=\"h3\">\n Plugin Options\n </Typography>\n <Controller\n control={form.control}\n name=\"spec.plugin\"\n render={({ field }) => (\n <PluginEditor\n width=\"100%\"\n pluginTypes={['Datasource']}\n pluginKindLabel=\"Source\"\n withRunQueryButton={false}\n value={{\n selection: {\n type: 'Datasource',\n kind: field.value.kind,\n },\n spec: field.value.spec,\n }}\n isReadonly={action === 'read'}\n onChange={(v) => {\n field.onChange({ kind: v.selection.kind, spec: v.spec });\n }}\n />\n )}\n />\n </Box>\n <DiscardChangesConfirmationDialog\n description=\"Are you sure you want to discard your changes? Changes cannot be recovered.\"\n isOpen={isDiscardDialogOpened}\n onCancel={() => setDiscardDialogOpened(false)}\n onDiscardChanges={() => {\n setDiscardDialogOpened(false);\n onClose();\n }}\n />\n </FormProvider>\n );\n}\n"],"names":["zodResolver","Box","Divider","FormControlLabel","Grid","Stack","Switch","TextField","Typography","DiscardChangesConfirmationDialog","FormActions","getSubmitText","getTitleAction","useState","Controller","FormProvider","useForm","useValidationSchemas","PluginEditor","DatasourceEditorForm","props","initialDatasourceDefinition","action","isDraft","isReadonly","onActionChange","onSave","onClose","onDelete","isDiscardDialogOpened","setDiscardDialogOpened","titleAction","submitText","datasourceEditorSchema","form","resolver","mode","defaultValues","clearFormData","data","result","spec","display","name","undefined","description","processForm","handleCancel","JSON","stringify","getValues","sx","alignItems","padding","theme","spacing","borderBottom","palette","divider","variant","isValid","formState","onSubmit","handleSubmit","onCancel","overflowY","container","mb","item","xs","control","render","field","fieldState","required","fullWidth","label","InputLabelProps","shrink","InputProps","disabled","readOnly","error","helperText","message","value","onChange","event","paddingTop","checked","plugin","kind","py","width","pluginTypes","pluginKindLabel","withRunQueryButton","selection","type","v","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,SAASA,WAAW,QAAQ,0BAA0B;AACtD,SAASC,GAAG,EAAEC,OAAO,EAAEC,gBAAgB,EAAEC,IAAI,EAAEC,KAAK,EAAEC,MAAM,EAAEC,SAAS,EAAEC,UAAU,QAAQ,gBAAgB;AAC3G,SAASC,gCAAgC,EAAEC,WAAW,EAAEC,aAAa,EAAEC,cAAc,QAAQ,yBAAyB;AACtH,SAA8CC,QAAQ,QAAQ,QAAQ;AACtE,SAASC,UAAU,EAAEC,YAAY,EAAiBC,OAAO,QAAQ,kBAAkB;AAEnF,SAASC,oBAAoB,QAAQ,gBAAgB;AACrD,SAASC,YAAY,QAAQ,kBAAkB;AAa/C,OAAO,SAASC,qBAAqBC,KAAgC;IACnE,M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zF;kCACD,KAACM;wBAAWoF,IAAI;wBAAGjC,SAAQ;kCAAK;;kCAGhC,KAAC7C;wBACCwD,SAASpC,KAAKoC,OAAO;wBACrB3B,MAAK;wBACL4B,QAAQ,CAAC,EAAEC,KAAK,EAAE,iBAChB,KAACtD;gCACC2E,OAAM;gCACNC,aAAa;oCAAC;iCAAa;gCAC3BC,iBAAgB;gCAChBC,oBAAoB;gCACpBX,OAAO;oCACLY,WAAW;wCACTC,MAAM;wCACNP,MAAMnB,MAAMa,KAAK,CAACM,IAAI;oCACxB;oCACAlD,MAAM+B,MAAMa,KAAK,CAAC5C,IAAI;gCACxB;gCACAjB,YAAYF,WAAW;gCACvBgE,UAAU,CAACa;oCACT3B,MAAMc,QAAQ,CAAC;wCAAEK,MAAMQ,EAAEF,SAAS,CAACN,IAAI;wCAAElD,MAAM0D,EAAE1D,IAAI;oCAAC;gCACxD;;;;;0BAKR,KAAChC;gBACCoC,aAAY;gBACZuD,QAAQvE;gBACRmC,UAAU,IAAMlC,uBAAuB;gBACvCuE,kBAAkB;oBAChBvE,uBAAuB;oBACvBH;gBACF;;;;AAIR"}
1
+ {"version":3,"sources":["../../../src/components/DatasourceEditorForm/DatasourceEditorForm.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, Divider, FormControlLabel, Grid, Stack, Switch, TextField, Typography } from '@mui/material';\nimport type { Action, DatasourceDefinition, DatasourceSpec } from '@perses-dev/client';\nimport { DiscardChangesConfirmationDialog, FormActions, getSubmitText, getTitleAction } from '@perses-dev/components';\nimport type { DispatchWithoutAction, ReactElement } from 'react';\nimport { useState } from 'react';\nimport type { SubmitHandler } from 'react-hook-form';\nimport { Controller, FormProvider, useForm } from 'react-hook-form';\n\nimport { useValidationSchemas } from '../../context';\nimport { PluginEditor } from '../PluginEditor';\n\ninterface DatasourceEditorFormProps {\n initialDatasourceDefinition: DatasourceDefinition;\n action: Action;\n isDraft: boolean;\n isReadonly?: boolean;\n onActionChange?: (action: Action) => void;\n onSave: (def: DatasourceDefinition) => void;\n onClose: DispatchWithoutAction;\n onDelete?: DispatchWithoutAction;\n testConnection?: (spec: DatasourceSpec, healthCheckPath: string) => Promise<void>;\n}\n\nexport function DatasourceEditorForm(props: DatasourceEditorFormProps): ReactElement {\n const {\n initialDatasourceDefinition,\n action,\n isDraft,\n isReadonly,\n onActionChange,\n onSave,\n onClose,\n onDelete,\n testConnection,\n } = props;\n\n const [isDiscardDialogOpened, setDiscardDialogOpened] = useState<boolean>(false);\n const titleAction = getTitleAction(action, isDraft);\n const submitText = getSubmitText(action, isDraft);\n\n const { datasourceEditorSchema } = useValidationSchemas();\n const form = useForm<DatasourceDefinition>({\n resolver: zodResolver(datasourceEditorSchema),\n mode: 'onBlur',\n defaultValues: initialDatasourceDefinition,\n });\n\n /*\n * Remove empty fields that are optional\n */\n function clearFormData(data: DatasourceDefinition): DatasourceDefinition {\n const result = { ...data };\n if (result.spec.display?.name === undefined && result.spec.display?.description === undefined) {\n delete result.spec.display;\n }\n return result;\n }\n\n const processForm: SubmitHandler<DatasourceDefinition> = (data: DatasourceDefinition) => {\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(initialDatasourceDefinition) !== 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} Datasource</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={4}>\n <Controller\n control={form.control}\n name=\"name\"\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n required\n fullWidth\n name=\"name\"\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={8}>\n <Controller\n control={form.control}\n name=\"spec.display.name\"\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n fullWidth\n name=\"title\"\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={12}>\n <Controller\n control={form.control}\n name=\"spec.display.description\"\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n fullWidth\n name=\"description\"\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={6} sx={{ paddingTop: '5px !important' }}>\n <Stack>\n <Controller\n control={form.control}\n name=\"spec.default\"\n render={({ field }) => (\n <FormControlLabel\n label=\"Set as default\"\n control={\n <Switch\n {...field}\n checked={!!field.value}\n readOnly={action === 'read'}\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\">\n Whether this datasource should be the default {form.getValues().spec.plugin.kind} to be used\n </Typography>\n </Stack>\n </Grid>\n </Grid>\n <Divider />\n <Typography py={1} variant=\"h3\">\n Plugin Options\n </Typography>\n <Controller\n control={form.control}\n name=\"spec.plugin\"\n render={({ field }) => (\n <PluginEditor\n width=\"100%\"\n pluginTypes={['Datasource']}\n pluginKindLabel=\"Source\"\n withRunQueryButton={false}\n value={{\n selection: {\n type: 'Datasource',\n kind: field.value.kind,\n },\n spec: field.value.spec,\n }}\n isReadonly={action === 'read'}\n onChange={(v) => {\n field.onChange({ kind: v.selection.kind, spec: v.spec });\n }}\n testConnection={testConnection}\n />\n )}\n />\n </Box>\n <DiscardChangesConfirmationDialog\n description=\"Are you sure you want to discard your changes? Changes cannot be recovered.\"\n isOpen={isDiscardDialogOpened}\n onCancel={() => setDiscardDialogOpened(false)}\n onDiscardChanges={() => {\n setDiscardDialogOpened(false);\n onClose();\n }}\n />\n </FormProvider>\n );\n}\n"],"names":["zodResolver","Box","Divider","FormControlLabel","Grid","Stack","Switch","TextField","Typography","DiscardChangesConfirmationDialog","FormActions","getSubmitText","getTitleAction","useState","Controller","FormProvider","useForm","useValidationSchemas","PluginEditor","DatasourceEditorForm","props","initialDatasourceDefinition","action","isDraft","isReadonly","onActionChange","onSave","onClose","onDelete","testConnection","isDiscardDialogOpened","setDiscardDialogOpened","titleAction","submitText","datasourceEditorSchema","form","resolver","mode","defaultValues","clearFormData","data","result","spec","display","name","undefined","description","processForm","handleCancel","JSON","stringify","getValues","sx","alignItems","padding","theme","spacing","borderBottom","palette","divider","variant","isValid","formState","onSubmit","handleSubmit","onCancel","overflowY","container","mb","item","xs","control","render","field","fieldState","required","fullWidth","label","InputLabelProps","shrink","InputProps","disabled","readOnly","error","helperText","message","value","onChange","event","paddingTop","checked","plugin","kind","py","width","pluginTypes","pluginKindLabel","withRunQueryButton","selection","type","v","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,SAASA,WAAW,QAAQ,0BAA0B;AACtD,SAASC,GAAG,EAAEC,OAAO,EAAEC,gBAAgB,EAAEC,IAAI,EAAEC,KAAK,EAAEC,MAAM,EAAEC,SAAS,EAAEC,UAAU,QAAQ,gBAAgB;AAE3G,SAASC,gCAAgC,EAAEC,WAAW,EAAEC,aAAa,EAAEC,cAAc,QAAQ,yBAAyB;AAEtH,SAASC,QAAQ,QAAQ,QAAQ;AAEjC,SAASC,UAAU,EAAEC,YAAY,EAAEC,OAAO,QAAQ,kBAAkB;AAEpE,SAASC,oBAAoB,QAAQ,yBAAgB;AACrD,SAASC,YAAY,QAAQ,2BAAkB;AAc/C,OAAO,SAASC,qBAAqBC,KAAgC;IACnE,MAAM,EACJC,2BAA2B,EAC3BC,MAAM,EACNC,OAAO,EACPC,UAAU,EACVC,cAAc,EACdC,MAAM,EACNC,OAAO,EACPC,QAAQ,EACRC,cAAc,EACf,GAAGT;IAEJ,MAAM,CAACU,uBAAuBC,uBAAuB,GAAGlB,SAAkB;IAC1E,MAAMmB,cAAcpB,eAAeU,QAAQC;IAC3C,MAAMU,aAAatB,cAAcW,QAAQC;IAEzC,MAAM,EAAEW,sBAAsB,EAAE,GAAGjB;IACnC,MAAMkB,OAAOnB,QAA8B;QACzCoB,UAAUpC,YAAYkC;QACtBG,MAAM;QACNC,eAAejB;IACjB;IAEA;;GAEC,GACD,SAASkB,cAAcC,IAA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,UAAU,CAACa;oCACT3B,MAAMc,QAAQ,CAAC;wCAAEK,MAAMQ,EAAEF,SAAS,CAACN,IAAI;wCAAElD,MAAM0D,EAAE1D,IAAI;oCAAC;gCACxD;gCACAb,gBAAgBA;;;;;0BAKxB,KAACpB;gBACCqC,aAAY;gBACZuD,QAAQvE;gBACRmC,UAAU,IAAMlC,uBAAuB;gBACvCuE,kBAAkB;oBAChBvE,uBAAuB;oBACvBJ;gBACF;;;;AAIR"}
@@ -10,6 +10,6 @@
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 './DatasourceEditorForm';
13
+ export * from "./DatasourceEditorForm.js";
14
14
 
15
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/DatasourceEditorForm/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 './DatasourceEditorForm';\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,yBAAyB"}
1
+ {"version":3,"sources":["../../../src/components/DatasourceEditorForm/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 './DatasourceEditorForm';\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,4BAAyB"}
@@ -1,7 +1,7 @@
1
- import { OutlinedSelectProps, BaseSelectProps } from '@mui/material';
2
- import { DatasourceSelector, VariableName } from '@perses-dev/spec';
3
- import { ReactElement } from 'react';
4
- import { DatasourceSelectItemGroup, DatasourceSelectItemSelector, VariableStateMap } from '../../runtime';
1
+ import type { OutlinedSelectProps, BaseSelectProps } from '@mui/material';
2
+ import type { DatasourceSelector, VariableName } from '@perses-dev/spec';
3
+ import type { ReactElement } from 'react';
4
+ import type { DatasourceSelectItemGroup, DatasourceSelectItemSelector, VariableStateMap } from '../../runtime';
5
5
  type OmittedMuiProps = 'children' | 'value' | 'onChange';
6
6
  export type DatasourceSelectValue<T = DatasourceSelector> = T | VariableName;
7
7
  export interface DatasourceSelectProps extends Omit<OutlinedSelectProps & BaseSelectProps<string>, OmittedMuiProps> {
@@ -1 +1 @@
1
- {"version":3,"file":"DatasourceSelect.d.ts","sourceRoot":"","sources":["../../../src/components/DatasourceSelect/DatasourceSelect.tsx"],"names":[],"mappings":"AAcA,OAAO,EAML,mBAAmB,EACnB,eAAe,EAGhB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,YAAY,EAAW,MAAM,OAAO,CAAC;AAC9C,OAAO,EAEL,yBAAyB,EACzB,4BAA4B,EA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,SAAS,GAAG,KAAK,IAAI,YAAY,CAEpG;AAED,eAAO,MAAM,+BAA+B,UACnC,qBAAqB,GAAG,SAAS,aAC7B,gBAAgB,8BACC,yBAAyB,EAAE,GAAG,SAAS,KAClE,kBAAkB,GAAG,SA4BvB,CAAC;AAEF,eAAO,MAAM,kCAAkC,UACtC,qBAAqB,wBACN,MAAM,KAC3B,kBAQF,CAAC"}
@@ -1,5 +1,3 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { createElement as _createElement } from "react";
3
1
  // Copyright The Perses Authors
4
2
  // Licensed under the Apache License, Version 2.0 (the "License");
5
3
  // you may not use this file except in compliance with the License.
@@ -12,11 +10,13 @@ import { createElement as _createElement } from "react";
12
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
11
  // See the License for the specific language governing permissions and
14
12
  // limitations under the License.
15
- import OpenInNewIcon from 'mdi-material-ui/OpenInNew';
16
- import { Stack, ListItemText, Chip, IconButton, Box, Autocomplete, TextField } from '@mui/material';
17
- import { useMemo } from 'react';
18
- import { useListDatasourceSelectItems, useVariableValues } from '../../runtime';
19
- import { parseVariables } from '../../utils';
13
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
14
+ import { createElement as _createElement } from "react";
15
+ import { Stack, ListItemText, Chip, IconButton, Box, Autocomplete, TextField } from "@mui/material";
16
+ import OpenInNewIcon from "mdi-material-ui/OpenInNew";
17
+ import { useMemo } from "react";
18
+ import { useListDatasourceSelectItems, useVariableValues } from "../../runtime/index.js";
19
+ import { parseVariables } from "../../utils/index.js";
20
20
  const DATASOURCE_VARIABLE_VALUE_PREFIX = '__DATASOURCE_VARIABLE_VALUE__';
21
21
  const VARIABLE_IDENTIFIER = '$';
22
22
  const emptyDatasourceOption = {