@perses-dev/plugin-system 0.0.0-snapshot-panel-extra-content-3-17f9c42 → 0.0.0-snapshot-scatterplot-fix-imports-95e1b59

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 (425) hide show
  1. package/dist/cjs/components/CalculationSelector/CalculationSelector.js +7 -5
  2. package/dist/cjs/components/CalculationSelector/index.js +10 -8
  3. package/dist/cjs/components/DatasourceEditorForm/DatasourceEditorForm.js +350 -0
  4. package/dist/cjs/components/DatasourceEditorForm/index.js +30 -0
  5. package/dist/cjs/components/DatasourceSelect.js +137 -25
  6. package/dist/cjs/components/LegendOptionsEditor/LegendOptionsEditor.js +19 -17
  7. package/dist/cjs/components/LegendOptionsEditor/index.js +10 -8
  8. package/dist/cjs/components/OptionsEditorRadios/OptionsEditorRadios.js +25 -30
  9. package/dist/cjs/components/OptionsEditorRadios/index.js +10 -8
  10. package/dist/cjs/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js +7 -5
  11. package/dist/cjs/components/OptionsEditorTabPanel/index.js +10 -8
  12. package/dist/cjs/components/OptionsEditorTabs/OptionsEditorTabs.js +13 -11
  13. package/dist/cjs/components/OptionsEditorTabs/index.js +10 -8
  14. package/dist/cjs/components/PanelSpecEditor/PanelSpecEditor.js +60 -19
  15. package/dist/cjs/components/PanelSpecEditor/index.js +10 -8
  16. package/dist/cjs/components/PluginEditor/PluginEditor.js +25 -32
  17. package/dist/cjs/components/PluginEditor/index.js +11 -9
  18. package/dist/cjs/components/PluginEditor/plugin-editor-api.js +8 -6
  19. package/dist/cjs/components/PluginKindSelect/PluginKindSelect.js +25 -14
  20. package/dist/cjs/components/PluginKindSelect/index.js +10 -8
  21. package/dist/cjs/components/PluginRegistry/PluginRegistry.js +11 -9
  22. package/dist/cjs/components/PluginRegistry/index.js +10 -8
  23. package/dist/cjs/components/PluginRegistry/plugin-indexes.js +7 -3
  24. package/dist/cjs/components/PluginSpecEditor/PluginSpecEditor.js +9 -7
  25. package/dist/cjs/components/PluginSpecEditor/index.js +10 -8
  26. package/dist/cjs/components/ProjectSelect.js +96 -0
  27. package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +192 -0
  28. package/dist/cjs/components/TimeRangeControls/index.js +30 -0
  29. package/dist/cjs/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js +45 -49
  30. package/dist/cjs/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js +23 -21
  31. package/dist/cjs/components/TimeSeriesQueryEditor/index.js +10 -8
  32. package/dist/cjs/components/TraceQueryEditor/TraceQueryEditor.js +143 -0
  33. package/dist/cjs/components/TraceQueryEditor/TraceQueryInput.js +96 -0
  34. package/dist/cjs/components/TraceQueryEditor/index.js +30 -0
  35. package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +445 -230
  36. package/dist/cjs/components/Variables/VariableEditorForm/VariablePreview.js +38 -32
  37. package/dist/cjs/components/Variables/VariableEditorForm/index.js +11 -9
  38. package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +36 -37
  39. package/dist/cjs/components/Variables/index.js +11 -9
  40. package/dist/cjs/components/Variables/variable-model.js +24 -17
  41. package/dist/cjs/components/index.js +24 -19
  42. package/dist/cjs/constants/index.js +10 -8
  43. package/dist/cjs/constants/user-interface-text.js +7 -2
  44. package/dist/cjs/context/ProjectStoreProvider.js +78 -0
  45. package/dist/cjs/context/index.js +30 -0
  46. package/dist/cjs/context/query-params.js +49 -0
  47. package/dist/cjs/index.js +17 -13
  48. package/dist/cjs/model/index.js +18 -15
  49. package/dist/cjs/model/legend.js +32 -20
  50. package/dist/cjs/model/panels.js +2 -2
  51. package/dist/cjs/model/plugin-base.js +2 -2
  52. package/dist/cjs/model/plugin-loading.js +3 -1
  53. package/dist/cjs/model/trace-queries.js +16 -0
  54. package/dist/cjs/runtime/DataQueriesProvider/DataQueriesProvider.js +67 -35
  55. package/dist/cjs/runtime/DataQueriesProvider/index.js +11 -9
  56. package/dist/cjs/runtime/DataQueriesProvider/model.js +81 -0
  57. package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProvider.js +55 -27
  58. package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.js +43 -0
  59. package/dist/cjs/runtime/TimeRangeProvider/index.js +12 -9
  60. package/dist/cjs/runtime/TimeRangeProvider/query-params.js +45 -59
  61. package/dist/cjs/runtime/TimeRangeProvider/refresh-interval.js +30 -0
  62. package/dist/cjs/runtime/builtin-variables.js +81 -0
  63. package/dist/cjs/runtime/datasources.js +31 -12
  64. package/dist/cjs/runtime/index.js +17 -13
  65. package/dist/cjs/runtime/plugin-registry.js +44 -14
  66. package/dist/cjs/runtime/template-variables.js +51 -13
  67. package/dist/cjs/runtime/time-series-queries.js +43 -31
  68. package/dist/cjs/runtime/trace-queries.js +76 -0
  69. package/dist/cjs/stories/shared-utils/decorators/WithDataQueries.js +7 -5
  70. package/dist/cjs/stories/shared-utils/decorators/WithPluginRegistry.js +21 -16
  71. package/dist/cjs/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js +42 -0
  72. package/dist/cjs/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js +31 -13
  73. package/dist/cjs/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.js +6 -4
  74. package/dist/cjs/stories/shared-utils/decorators/WithTimeRange.js +9 -7
  75. package/dist/cjs/stories/shared-utils/decorators/index.js +15 -12
  76. package/dist/cjs/stories/shared-utils/index.js +10 -8
  77. package/dist/cjs/test/index.js +11 -8
  78. package/dist/cjs/test/mock-data.js +80 -0
  79. package/dist/cjs/test/render.js +13 -11
  80. package/dist/cjs/test/test-plugins/bert/index.js +16 -12
  81. package/dist/cjs/test/test-plugins/ernie/index.js +15 -11
  82. package/dist/cjs/test/test-plugins/index.js +14 -10
  83. package/dist/cjs/test-utils/index.js +10 -8
  84. package/dist/cjs/test-utils/mock-plugin-registry.js +9 -5
  85. package/dist/cjs/utils/action.js +43 -0
  86. package/dist/cjs/utils/index.js +11 -8
  87. package/dist/cjs/utils/variables.js +26 -8
  88. package/dist/cjs/validation/datasource.js +30 -0
  89. package/dist/cjs/validation/duration.js +25 -0
  90. package/dist/cjs/validation/index.js +34 -0
  91. package/dist/cjs/validation/resource.js +24 -0
  92. package/dist/cjs/validation/role.js +86 -0
  93. package/dist/cjs/validation/rolebinding.js +55 -0
  94. package/dist/cjs/validation/secret.js +176 -0
  95. package/dist/cjs/validation/user.js +46 -0
  96. package/dist/cjs/validation/variable.js +48 -0
  97. package/dist/components/CalculationSelector/CalculationSelector.d.ts +1 -2
  98. package/dist/components/CalculationSelector/CalculationSelector.d.ts.map +1 -1
  99. package/dist/components/CalculationSelector/CalculationSelector.js +1 -1
  100. package/dist/components/CalculationSelector/CalculationSelector.js.map +1 -1
  101. package/dist/components/CalculationSelector/index.js.map +1 -1
  102. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts +14 -0
  103. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts.map +1 -0
  104. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js +342 -0
  105. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js.map +1 -0
  106. package/dist/components/DatasourceEditorForm/index.d.ts +2 -0
  107. package/dist/components/DatasourceEditorForm/index.d.ts.map +1 -0
  108. package/dist/components/DatasourceEditorForm/index.js +15 -0
  109. package/dist/components/DatasourceEditorForm/index.js.map +1 -0
  110. package/dist/components/DatasourceSelect.d.ts +8 -3
  111. package/dist/components/DatasourceSelect.d.ts.map +1 -1
  112. package/dist/components/DatasourceSelect.js +120 -23
  113. package/dist/components/DatasourceSelect.js.map +1 -1
  114. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.d.ts +1 -2
  115. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.d.ts.map +1 -1
  116. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js +3 -3
  117. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js.map +1 -1
  118. package/dist/components/LegendOptionsEditor/index.js.map +1 -1
  119. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts +5 -5
  120. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts.map +1 -1
  121. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js +18 -25
  122. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js.map +1 -1
  123. package/dist/components/OptionsEditorRadios/index.js.map +1 -1
  124. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts +1 -1
  125. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts.map +1 -1
  126. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js +1 -1
  127. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js.map +1 -1
  128. package/dist/components/OptionsEditorTabPanel/index.js.map +1 -1
  129. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.d.ts +3 -3
  130. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.d.ts.map +1 -1
  131. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js +3 -3
  132. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js.map +1 -1
  133. package/dist/components/OptionsEditorTabs/index.js.map +1 -1
  134. package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts +2 -3
  135. package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts.map +1 -1
  136. package/dist/components/PanelSpecEditor/PanelSpecEditor.js +50 -11
  137. package/dist/components/PanelSpecEditor/PanelSpecEditor.js.map +1 -1
  138. package/dist/components/PanelSpecEditor/index.js.map +1 -1
  139. package/dist/components/PluginEditor/PluginEditor.d.ts +1 -2
  140. package/dist/components/PluginEditor/PluginEditor.d.ts.map +1 -1
  141. package/dist/components/PluginEditor/PluginEditor.js +17 -26
  142. package/dist/components/PluginEditor/PluginEditor.js.map +1 -1
  143. package/dist/components/PluginEditor/index.js.map +1 -1
  144. package/dist/components/PluginEditor/plugin-editor-api.d.ts +3 -3
  145. package/dist/components/PluginEditor/plugin-editor-api.d.ts.map +1 -1
  146. package/dist/components/PluginEditor/plugin-editor-api.js +5 -5
  147. package/dist/components/PluginEditor/plugin-editor-api.js.map +1 -1
  148. package/dist/components/PluginKindSelect/PluginKindSelect.d.ts +3 -3
  149. package/dist/components/PluginKindSelect/PluginKindSelect.d.ts.map +1 -1
  150. package/dist/components/PluginKindSelect/PluginKindSelect.js +23 -14
  151. package/dist/components/PluginKindSelect/PluginKindSelect.js.map +1 -1
  152. package/dist/components/PluginKindSelect/index.js.map +1 -1
  153. package/dist/components/PluginRegistry/PluginRegistry.d.ts +4 -4
  154. package/dist/components/PluginRegistry/PluginRegistry.d.ts.map +1 -1
  155. package/dist/components/PluginRegistry/PluginRegistry.js +3 -3
  156. package/dist/components/PluginRegistry/PluginRegistry.js.map +1 -1
  157. package/dist/components/PluginRegistry/index.js.map +1 -1
  158. package/dist/components/PluginRegistry/plugin-indexes.js +1 -1
  159. package/dist/components/PluginRegistry/plugin-indexes.js.map +1 -1
  160. package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts +2 -2
  161. package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts.map +1 -1
  162. package/dist/components/PluginSpecEditor/PluginSpecEditor.js +3 -3
  163. package/dist/components/PluginSpecEditor/PluginSpecEditor.js.map +1 -1
  164. package/dist/components/PluginSpecEditor/index.js.map +1 -1
  165. package/dist/components/ProjectSelect.d.ts +14 -0
  166. package/dist/components/ProjectSelect.d.ts.map +1 -0
  167. package/dist/components/ProjectSelect.js +91 -0
  168. package/dist/components/ProjectSelect.js.map +1 -0
  169. package/dist/components/TimeRangeControls/TimeRangeControls.d.ts +13 -0
  170. package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -0
  171. package/dist/components/TimeRangeControls/TimeRangeControls.js +168 -0
  172. package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -0
  173. package/dist/components/TimeRangeControls/index.d.ts +2 -0
  174. package/dist/components/TimeRangeControls/index.d.ts.map +1 -0
  175. package/dist/components/TimeRangeControls/index.js +15 -0
  176. package/dist/components/TimeRangeControls/index.js.map +1 -0
  177. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.d.ts +1 -2
  178. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.d.ts.map +1 -1
  179. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js +38 -44
  180. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js.map +1 -1
  181. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.d.ts +1 -2
  182. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.d.ts.map +1 -1
  183. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js +3 -3
  184. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js.map +1 -1
  185. package/dist/components/TimeSeriesQueryEditor/index.js.map +1 -1
  186. package/dist/components/TraceQueryEditor/TraceQueryEditor.d.ts +8 -0
  187. package/dist/components/TraceQueryEditor/TraceQueryEditor.d.ts.map +1 -0
  188. package/dist/components/TraceQueryEditor/TraceQueryEditor.js +130 -0
  189. package/dist/components/TraceQueryEditor/TraceQueryEditor.js.map +1 -0
  190. package/dist/components/TraceQueryEditor/TraceQueryInput.d.ts +12 -0
  191. package/dist/components/TraceQueryEditor/TraceQueryInput.d.ts.map +1 -0
  192. package/dist/components/TraceQueryEditor/TraceQueryInput.js +83 -0
  193. package/dist/components/TraceQueryEditor/TraceQueryInput.js.map +1 -0
  194. package/dist/components/TraceQueryEditor/index.d.ts +2 -0
  195. package/dist/components/TraceQueryEditor/index.d.ts.map +1 -0
  196. package/dist/components/TraceQueryEditor/index.js +15 -0
  197. package/dist/components/TraceQueryEditor/index.js.map +1 -0
  198. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts +10 -8
  199. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
  200. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +395 -184
  201. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
  202. package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts +2 -3
  203. package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts.map +1 -1
  204. package/dist/components/Variables/VariableEditorForm/VariablePreview.js +4 -4
  205. package/dist/components/Variables/VariableEditorForm/VariablePreview.js.map +1 -1
  206. package/dist/components/Variables/VariableEditorForm/index.js.map +1 -1
  207. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts +8 -19
  208. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts.map +1 -1
  209. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +30 -35
  210. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -1
  211. package/dist/components/Variables/index.js.map +1 -1
  212. package/dist/components/Variables/variable-model.d.ts.map +1 -1
  213. package/dist/components/Variables/variable-model.js +9 -10
  214. package/dist/components/Variables/variable-model.js.map +1 -1
  215. package/dist/components/index.d.ts +3 -0
  216. package/dist/components/index.d.ts.map +1 -1
  217. package/dist/components/index.js +3 -0
  218. package/dist/components/index.js.map +1 -1
  219. package/dist/constants/index.js.map +1 -1
  220. package/dist/constants/user-interface-text.d.ts +2 -0
  221. package/dist/constants/user-interface-text.d.ts.map +1 -1
  222. package/dist/constants/user-interface-text.js +4 -1
  223. package/dist/constants/user-interface-text.js.map +1 -1
  224. package/dist/context/ProjectStoreProvider.d.ts +16 -0
  225. package/dist/context/ProjectStoreProvider.d.ts.map +1 -0
  226. package/dist/context/ProjectStoreProvider.js +56 -0
  227. package/dist/context/ProjectStoreProvider.js.map +1 -0
  228. package/dist/context/index.d.ts +2 -0
  229. package/dist/context/index.d.ts.map +1 -0
  230. package/dist/context/index.js +15 -0
  231. package/dist/context/index.js.map +1 -0
  232. package/dist/context/query-params.d.ts +5 -0
  233. package/dist/context/query-params.d.ts.map +1 -0
  234. package/dist/context/query-params.js +41 -0
  235. package/dist/context/query-params.js.map +1 -0
  236. package/dist/index.d.ts +2 -0
  237. package/dist/index.d.ts.map +1 -1
  238. package/dist/index.js +2 -0
  239. package/dist/index.js.map +1 -1
  240. package/dist/model/datasource.d.ts +2 -1
  241. package/dist/model/datasource.d.ts.map +1 -1
  242. package/dist/model/datasource.js +3 -1
  243. package/dist/model/datasource.js.map +1 -1
  244. package/dist/model/index.d.ts +1 -0
  245. package/dist/model/index.d.ts.map +1 -1
  246. package/dist/model/index.js +1 -0
  247. package/dist/model/index.js.map +1 -1
  248. package/dist/model/legend.d.ts +3 -3
  249. package/dist/model/legend.d.ts.map +1 -1
  250. package/dist/model/legend.js +14 -14
  251. package/dist/model/legend.js.map +1 -1
  252. package/dist/model/panels.d.ts +3 -2
  253. package/dist/model/panels.d.ts.map +1 -1
  254. package/dist/model/panels.js.map +1 -1
  255. package/dist/model/plugin-base.js.map +1 -1
  256. package/dist/model/plugin-loading.js.map +1 -1
  257. package/dist/model/plugins.d.ts +6 -4
  258. package/dist/model/plugins.d.ts.map +1 -1
  259. package/dist/model/plugins.js.map +1 -1
  260. package/dist/model/time-series-queries.d.ts +2 -2
  261. package/dist/model/time-series-queries.d.ts.map +1 -1
  262. package/dist/model/time-series-queries.js.map +1 -1
  263. package/dist/model/trace-queries.d.ts +19 -0
  264. package/dist/model/trace-queries.d.ts.map +1 -0
  265. package/dist/model/trace-queries.js +15 -0
  266. package/dist/model/trace-queries.js.map +1 -0
  267. package/dist/model/variables.d.ts +2 -2
  268. package/dist/model/variables.d.ts.map +1 -1
  269. package/dist/model/variables.js +3 -1
  270. package/dist/model/variables.js.map +1 -1
  271. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts +6 -6
  272. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts.map +1 -1
  273. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js +52 -28
  274. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js.map +1 -1
  275. package/dist/runtime/DataQueriesProvider/index.js.map +1 -1
  276. package/dist/runtime/DataQueriesProvider/model.d.ts +18 -13
  277. package/dist/runtime/DataQueriesProvider/model.d.ts.map +1 -1
  278. package/dist/runtime/DataQueriesProvider/model.js +67 -1
  279. package/dist/runtime/DataQueriesProvider/model.js.map +1 -1
  280. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts +9 -4
  281. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts.map +1 -1
  282. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js +37 -20
  283. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js.map +1 -1
  284. package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.d.ts +9 -0
  285. package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.d.ts.map +1 -0
  286. package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.js +30 -0
  287. package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.js.map +1 -0
  288. package/dist/runtime/TimeRangeProvider/index.d.ts +1 -0
  289. package/dist/runtime/TimeRangeProvider/index.d.ts.map +1 -1
  290. package/dist/runtime/TimeRangeProvider/index.js +1 -0
  291. package/dist/runtime/TimeRangeProvider/index.js.map +1 -1
  292. package/dist/runtime/TimeRangeProvider/query-params.d.ts +5 -5
  293. package/dist/runtime/TimeRangeProvider/query-params.d.ts.map +1 -1
  294. package/dist/runtime/TimeRangeProvider/query-params.js +13 -45
  295. package/dist/runtime/TimeRangeProvider/query-params.js.map +1 -1
  296. package/dist/runtime/TimeRangeProvider/refresh-interval.d.ts +7 -0
  297. package/dist/runtime/TimeRangeProvider/refresh-interval.d.ts.map +1 -0
  298. package/dist/runtime/TimeRangeProvider/refresh-interval.js +25 -0
  299. package/dist/runtime/TimeRangeProvider/refresh-interval.js.map +1 -0
  300. package/dist/runtime/builtin-variables.d.ts +11 -0
  301. package/dist/runtime/builtin-variables.d.ts.map +1 -0
  302. package/dist/runtime/builtin-variables.js +59 -0
  303. package/dist/runtime/builtin-variables.js.map +1 -0
  304. package/dist/runtime/datasources.d.ts +42 -7
  305. package/dist/runtime/datasources.d.ts.map +1 -1
  306. package/dist/runtime/datasources.js +15 -7
  307. package/dist/runtime/datasources.js.map +1 -1
  308. package/dist/runtime/index.d.ts +2 -0
  309. package/dist/runtime/index.d.ts.map +1 -1
  310. package/dist/runtime/index.js +2 -0
  311. package/dist/runtime/index.js.map +1 -1
  312. package/dist/runtime/plugin-registry.d.ts +5 -3
  313. package/dist/runtime/plugin-registry.d.ts.map +1 -1
  314. package/dist/runtime/plugin-registry.js +22 -5
  315. package/dist/runtime/plugin-registry.js.map +1 -1
  316. package/dist/runtime/template-variables.d.ts +6 -5
  317. package/dist/runtime/template-variables.d.ts.map +1 -1
  318. package/dist/runtime/template-variables.js +36 -9
  319. package/dist/runtime/template-variables.js.map +1 -1
  320. package/dist/runtime/time-series-queries.d.ts +3 -3
  321. package/dist/runtime/time-series-queries.d.ts.map +1 -1
  322. package/dist/runtime/time-series-queries.js +21 -19
  323. package/dist/runtime/time-series-queries.js.map +1 -1
  324. package/dist/runtime/trace-queries.d.ts +14 -0
  325. package/dist/runtime/trace-queries.d.ts.map +1 -0
  326. package/dist/runtime/trace-queries.js +61 -0
  327. package/dist/runtime/trace-queries.js.map +1 -0
  328. package/dist/stories/shared-utils/decorators/WithDataQueries.d.ts +2 -3
  329. package/dist/stories/shared-utils/decorators/WithDataQueries.d.ts.map +1 -1
  330. package/dist/stories/shared-utils/decorators/WithDataQueries.js.map +1 -1
  331. package/dist/stories/shared-utils/decorators/WithPluginRegistry.d.ts +1 -2
  332. package/dist/stories/shared-utils/decorators/WithPluginRegistry.d.ts.map +1 -1
  333. package/dist/stories/shared-utils/decorators/WithPluginRegistry.js +2 -1
  334. package/dist/stories/shared-utils/decorators/WithPluginRegistry.js.map +1 -1
  335. package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.d.ts +12 -0
  336. package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.d.ts.map +1 -0
  337. package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js +39 -0
  338. package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js.map +1 -0
  339. package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.d.ts +2 -3
  340. package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.d.ts.map +1 -1
  341. package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js +24 -8
  342. package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js.map +1 -1
  343. package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.d.ts +2 -3
  344. package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.d.ts.map +1 -1
  345. package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.js.map +1 -1
  346. package/dist/stories/shared-utils/decorators/WithTimeRange.d.ts +4 -5
  347. package/dist/stories/shared-utils/decorators/WithTimeRange.d.ts.map +1 -1
  348. package/dist/stories/shared-utils/decorators/WithTimeRange.js +2 -2
  349. package/dist/stories/shared-utils/decorators/WithTimeRange.js.map +1 -1
  350. package/dist/stories/shared-utils/decorators/index.d.ts +1 -0
  351. package/dist/stories/shared-utils/decorators/index.d.ts.map +1 -1
  352. package/dist/stories/shared-utils/decorators/index.js +1 -0
  353. package/dist/stories/shared-utils/decorators/index.js.map +1 -1
  354. package/dist/stories/shared-utils/index.js.map +1 -1
  355. package/dist/test/index.d.ts +1 -0
  356. package/dist/test/index.d.ts.map +1 -1
  357. package/dist/test/index.js +1 -0
  358. package/dist/test/index.js.map +1 -1
  359. package/dist/test/mock-data.d.ts +4 -0
  360. package/dist/test/mock-data.d.ts.map +1 -0
  361. package/dist/test/mock-data.js +64 -0
  362. package/dist/test/mock-data.js.map +1 -0
  363. package/dist/test/render.d.ts +1 -1
  364. package/dist/test/render.d.ts.map +1 -1
  365. package/dist/test/render.js +2 -2
  366. package/dist/test/render.js.map +1 -1
  367. package/dist/test/setup-tests.js.map +1 -1
  368. package/dist/test/test-plugins/bert/index.js +2 -2
  369. package/dist/test/test-plugins/bert/index.js.map +1 -1
  370. package/dist/test/test-plugins/ernie/index.js +2 -2
  371. package/dist/test/test-plugins/ernie/index.js.map +1 -1
  372. package/dist/test/test-plugins/index.js.map +1 -1
  373. package/dist/test-utils/index.js.map +1 -1
  374. package/dist/test-utils/mock-plugin-registry.d.ts +1 -1
  375. package/dist/test-utils/mock-plugin-registry.d.ts.map +1 -1
  376. package/dist/test-utils/mock-plugin-registry.js +3 -3
  377. package/dist/test-utils/mock-plugin-registry.js.map +1 -1
  378. package/dist/utils/action.d.ts +4 -0
  379. package/dist/utils/action.d.ts.map +1 -0
  380. package/dist/utils/action.js +27 -0
  381. package/dist/utils/action.js.map +1 -0
  382. package/dist/utils/index.d.ts +1 -0
  383. package/dist/utils/index.d.ts.map +1 -1
  384. package/dist/utils/index.js +1 -0
  385. package/dist/utils/index.js.map +1 -1
  386. package/dist/utils/variables.d.ts.map +1 -1
  387. package/dist/utils/variables.js +17 -5
  388. package/dist/utils/variables.js.map +1 -1
  389. package/dist/validation/datasource.d.ts +19 -0
  390. package/dist/validation/datasource.d.ts.map +1 -0
  391. package/dist/validation/datasource.js +22 -0
  392. package/dist/validation/datasource.js.map +1 -0
  393. package/dist/validation/duration.d.ts +3 -0
  394. package/dist/validation/duration.d.ts.map +1 -0
  395. package/dist/validation/duration.js +17 -0
  396. package/dist/validation/duration.js.map +1 -0
  397. package/dist/validation/index.d.ts +6 -0
  398. package/dist/validation/index.d.ts.map +1 -0
  399. package/dist/validation/index.js +19 -0
  400. package/dist/validation/index.js.map +1 -0
  401. package/dist/validation/resource.d.ts +3 -0
  402. package/dist/validation/resource.d.ts.map +1 -0
  403. package/dist/validation/resource.js +16 -0
  404. package/dist/validation/resource.js.map +1 -0
  405. package/dist/validation/role.d.ts +228 -0
  406. package/dist/validation/role.d.ts.map +1 -0
  407. package/dist/validation/role.js +67 -0
  408. package/dist/validation/role.js.map +1 -0
  409. package/dist/validation/rolebinding.d.ts +137 -0
  410. package/dist/validation/rolebinding.d.ts.map +1 -0
  411. package/dist/validation/rolebinding.js +47 -0
  412. package/dist/validation/rolebinding.js.map +1 -0
  413. package/dist/validation/secret.d.ts +964 -0
  414. package/dist/validation/secret.d.ts.map +1 -0
  415. package/dist/validation/secret.js +157 -0
  416. package/dist/validation/secret.js.map +1 -0
  417. package/dist/validation/user.d.ts +93 -0
  418. package/dist/validation/user.d.ts.map +1 -0
  419. package/dist/validation/user.js +38 -0
  420. package/dist/validation/user.js.map +1 -0
  421. package/dist/validation/variable.d.ts +96 -0
  422. package/dist/validation/variable.d.ts.map +1 -0
  423. package/dist/validation/variable.js +40 -0
  424. package/dist/validation/variable.js.map +1 -0
  425. package/package.json +9 -6
@@ -12,42 +12,29 @@
12
12
  // limitations under the License.
13
13
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
14
14
  import React, { useCallback, useMemo, useState } from 'react';
15
- import { Box, Typography, Switch, TextField, Grid, FormControl, FormControlLabel, InputLabel, MenuItem, Button, Stack, ClickAwayListener, Divider, Select, capitalize } from '@mui/material';
16
- import { useImmer } from 'use-immer';
15
+ import { Box, Typography, Switch, TextField, Grid, FormControlLabel, MenuItem, Button, Stack, ClickAwayListener, Divider } from '@mui/material';
17
16
  import { DiscardChangesConfirmationDialog, ErrorBoundary } from '@perses-dev/components';
17
+ import { Controller, FormProvider, useForm } from 'react-hook-form';
18
+ import { zodResolver } from '@hookform/resolvers/zod';
19
+ import { useImmer } from 'use-immer';
20
+ import { getSubmitText, getTitleAction } from '../../../utils';
18
21
  import { VARIABLE_TYPES } from '../variable-model';
19
22
  import { PluginEditor } from '../../PluginEditor';
23
+ import { variableEditorValidationSchema } from '../../../validation';
20
24
  import { VariableListPreview, VariablePreview } from './VariablePreview';
21
25
  import { getVariableDefinitionFromState, getInitialState } from './variable-editor-form-model';
22
- // TODO: Replace with proper validation library
23
- function getValidation(state) {
24
- /** Name validation */ let name = null;
25
- if (!state.name) {
26
- name = 'Name is required';
27
- }
28
- // name can only contain alphanumeric characters and underscores and no spaces
29
- if (state.name && !/^[a-zA-Z0-9_-]+$/.test(state.name)) {
30
- name = 'Name can only contain alphanumeric characters, underscores, and dashes';
31
- }
32
- return {
33
- name,
34
- isValid: !name
35
- };
36
- }
37
26
  function FallbackPreview() {
38
27
  return /*#__PURE__*/ _jsx("div", {
39
28
  children: "Error previewing values"
40
29
  });
41
30
  }
42
- export function VariableEditForm(props) {
43
- const { initialVariableDefinition , onChange , onCancel , action ='update' } = props;
31
+ export function VariableEditorForm(props) {
32
+ const { initialVariableDefinition, initialAction, isDraft, isReadonly, onSave, onClose, onDelete } = props;
44
33
  const initialState = getInitialState(initialVariableDefinition);
45
34
  const [state, setState] = useImmer(initialState);
46
- const validation = useMemo(()=>getValidation(state), [
47
- state
48
- ]);
49
- const [isDiscardDialogStateOpened, setDiscardDialogStateOpened] = useState(false);
35
+ const [isDiscardDialogOpened, setDiscardDialogOpened] = useState(false);
50
36
  const [previewKey, setPreviewKey] = useState(0);
37
+ const [action, setAction] = useState(initialAction);
51
38
  const refreshPreview = ()=>{
52
39
  setPreviewKey((prev)=>prev + 1);
53
40
  };
@@ -60,32 +47,38 @@ export function VariableEditForm(props) {
60
47
  }, [
61
48
  previewKey
62
49
  ]);
63
- const title = useMemo(()=>{
64
- if (action === 'read') return 'View Variable';
65
- if (action === 'create') return 'Create Variable';
66
- if (action === 'update') return 'Edit Variable';
67
- return '';
68
- }, [
69
- action
70
- ]);
50
+ const titleAction = getTitleAction(action, isDraft);
51
+ const submitText = getSubmitText(action, isDraft);
52
+ const form = useForm({
53
+ resolver: zodResolver(variableEditorValidationSchema),
54
+ mode: 'onBlur',
55
+ defaultValues: initialState
56
+ });
57
+ const processForm = ()=>{
58
+ // reset display attributes to undefined when empty, because we don't want to save empty strings
59
+ onSave(getVariableDefinitionFromState({
60
+ ...state,
61
+ title: state.title === '' ? undefined : state.title,
62
+ description: state.description === '' ? undefined : state.description
63
+ }));
64
+ };
71
65
  // When user click on cancel, several possibilities:
72
66
  // - create action: ask for discard approval
73
67
  // - update action: ask for discard approval if changed
74
68
  // - read action: don´t ask for discard approval
75
69
  const handleCancel = useCallback(()=>{
76
- if (action === 'create' || action === 'update' && JSON.stringify(initialState) !== JSON.stringify(state)) {
77
- setDiscardDialogStateOpened(true);
70
+ if (JSON.stringify(initialState) !== JSON.stringify(state)) {
71
+ setDiscardDialogOpened(true);
78
72
  } else {
79
- onCancel();
73
+ onClose();
80
74
  }
81
75
  }, [
82
- state,
83
76
  initialState,
84
- action,
85
- setDiscardDialogStateOpened,
86
- onCancel
77
+ state,
78
+ onClose
87
79
  ]);
88
- return /*#__PURE__*/ _jsxs(_Fragment, {
80
+ return /*#__PURE__*/ _jsxs(FormProvider, {
81
+ ...form,
89
82
  children: [
90
83
  /*#__PURE__*/ _jsxs(Box, {
91
84
  sx: {
@@ -95,32 +88,69 @@ export function VariableEditForm(props) {
95
88
  borderBottom: (theme)=>`1px solid ${theme.palette.divider}`
96
89
  },
97
90
  children: [
98
- /*#__PURE__*/ _jsx(Typography, {
91
+ /*#__PURE__*/ _jsxs(Typography, {
99
92
  variant: "h2",
100
- children: title
93
+ children: [
94
+ titleAction,
95
+ " Variable"
96
+ ]
101
97
  }),
102
- /*#__PURE__*/ _jsxs(Stack, {
98
+ /*#__PURE__*/ _jsx(Stack, {
103
99
  direction: "row",
104
100
  spacing: 1,
105
101
  sx: {
106
102
  marginLeft: 'auto'
107
103
  },
108
- children: [
109
- action !== 'read' && /*#__PURE__*/ _jsx(Button, {
110
- disabled: !validation.isValid,
111
- variant: "contained",
112
- onClick: ()=>{
113
- onChange(getVariableDefinitionFromState(state));
114
- },
115
- children: capitalize(action)
116
- }),
117
- /*#__PURE__*/ _jsx(Button, {
118
- color: "secondary",
119
- variant: "outlined",
120
- onClick: handleCancel,
121
- children: action === 'read' ? 'Close' : 'Cancel'
122
- })
123
- ]
104
+ children: action === 'read' ? /*#__PURE__*/ _jsxs(_Fragment, {
105
+ children: [
106
+ /*#__PURE__*/ _jsx(Button, {
107
+ disabled: isReadonly,
108
+ variant: "contained",
109
+ onClick: ()=>setAction('update'),
110
+ children: "Edit"
111
+ }),
112
+ /*#__PURE__*/ _jsx(Button, {
113
+ color: "error",
114
+ disabled: isReadonly,
115
+ variant: "outlined",
116
+ onClick: onDelete,
117
+ children: "Delete"
118
+ }),
119
+ /*#__PURE__*/ _jsx(Divider, {
120
+ orientation: "vertical",
121
+ flexItem: true,
122
+ sx: (theme)=>({
123
+ borderColor: theme.palette.grey['500'],
124
+ '&.MuiDivider-root': {
125
+ marginLeft: 2,
126
+ marginRight: 1
127
+ }
128
+ })
129
+ }),
130
+ /*#__PURE__*/ _jsx(Button, {
131
+ color: "secondary",
132
+ variant: "outlined",
133
+ onClick: onClose,
134
+ children: "Close"
135
+ })
136
+ ]
137
+ }) : /*#__PURE__*/ _jsxs(_Fragment, {
138
+ children: [
139
+ /*#__PURE__*/ _jsx(Button, {
140
+ type: "submit",
141
+ variant: "contained",
142
+ disabled: !form.formState.isValid,
143
+ onClick: form.handleSubmit(processForm),
144
+ children: submitText
145
+ }),
146
+ /*#__PURE__*/ _jsx(Button, {
147
+ color: "secondary",
148
+ variant: "outlined",
149
+ onClick: handleCancel,
150
+ children: "Cancel"
151
+ })
152
+ ]
153
+ })
124
154
  })
125
155
  ]
126
156
  }),
@@ -138,19 +168,31 @@ export function VariableEditForm(props) {
138
168
  /*#__PURE__*/ _jsx(Grid, {
139
169
  item: true,
140
170
  xs: 8,
141
- children: /*#__PURE__*/ _jsx(TextField, {
142
- required: true,
143
- error: !!validation.name,
144
- fullWidth: true,
145
- label: "Name",
146
- value: state.name,
147
- helperText: validation.name,
148
- InputProps: {
149
- readOnly: action === 'update' || action === 'read'
150
- },
151
- onChange: (v)=>{
152
- setState((draft)=>{
153
- draft.name = v.target.value;
171
+ children: /*#__PURE__*/ _jsx(Controller, {
172
+ name: "name",
173
+ render: ({ field, fieldState })=>{
174
+ var _fieldState_error;
175
+ return /*#__PURE__*/ _jsx(TextField, {
176
+ ...field,
177
+ required: true,
178
+ fullWidth: true,
179
+ label: "Name",
180
+ InputLabelProps: {
181
+ shrink: action === 'read' ? true : undefined
182
+ },
183
+ InputProps: {
184
+ disabled: action === 'update' && !isDraft,
185
+ readOnly: action === 'read'
186
+ },
187
+ error: !!fieldState.error,
188
+ helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
189
+ value: state.name,
190
+ onChange: (event)=>{
191
+ field.onChange(event);
192
+ setState((draft)=>{
193
+ draft.name = event.target.value;
194
+ });
195
+ }
154
196
  });
155
197
  }
156
198
  })
@@ -158,16 +200,30 @@ export function VariableEditForm(props) {
158
200
  /*#__PURE__*/ _jsx(Grid, {
159
201
  item: true,
160
202
  xs: 4,
161
- children: /*#__PURE__*/ _jsx(TextField, {
162
- fullWidth: true,
163
- label: "Display Label",
164
- value: state.title || '',
165
- InputProps: {
166
- readOnly: action === 'read'
167
- },
168
- onChange: (v)=>{
169
- setState((draft)=>{
170
- draft.title = v.target.value;
203
+ children: /*#__PURE__*/ _jsx(Controller, {
204
+ name: "title",
205
+ render: ({ field, fieldState })=>/*#__PURE__*/ {
206
+ var _fieldState_error;
207
+ var _state_title;
208
+ return _jsx(TextField, {
209
+ ...field,
210
+ fullWidth: true,
211
+ label: "Display Label",
212
+ InputLabelProps: {
213
+ shrink: action === 'read' ? true : undefined
214
+ },
215
+ InputProps: {
216
+ readOnly: action === 'read'
217
+ },
218
+ error: !!fieldState.error,
219
+ helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
220
+ value: (_state_title = state.title) !== null && _state_title !== void 0 ? _state_title : '',
221
+ onChange: (event)=>{
222
+ field.onChange(event);
223
+ setState((draft)=>{
224
+ draft.title = event.target.value;
225
+ });
226
+ }
171
227
  });
172
228
  }
173
229
  })
@@ -175,16 +231,30 @@ export function VariableEditForm(props) {
175
231
  /*#__PURE__*/ _jsx(Grid, {
176
232
  item: true,
177
233
  xs: 8,
178
- children: /*#__PURE__*/ _jsx(TextField, {
179
- fullWidth: true,
180
- label: "Description",
181
- value: state.description,
182
- InputProps: {
183
- readOnly: action === 'read'
184
- },
185
- onChange: (v)=>{
186
- setState((draft)=>{
187
- draft.description = v.target.value;
234
+ children: /*#__PURE__*/ _jsx(Controller, {
235
+ name: "description",
236
+ render: ({ field, fieldState })=>/*#__PURE__*/ {
237
+ var _fieldState_error;
238
+ var _state_description;
239
+ return _jsx(TextField, {
240
+ ...field,
241
+ fullWidth: true,
242
+ label: "Description",
243
+ InputLabelProps: {
244
+ shrink: action === 'read' ? true : undefined
245
+ },
246
+ InputProps: {
247
+ readOnly: action === 'read'
248
+ },
249
+ error: !!fieldState.error,
250
+ helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
251
+ value: (_state_description = state.description) !== null && _state_description !== void 0 ? _state_description : '',
252
+ onChange: (event)=>{
253
+ field.onChange(event);
254
+ setState((draft)=>{
255
+ draft.description = event.target.value;
256
+ });
257
+ }
188
258
  });
189
259
  }
190
260
  })
@@ -192,30 +262,36 @@ export function VariableEditForm(props) {
192
262
  /*#__PURE__*/ _jsx(Grid, {
193
263
  item: true,
194
264
  xs: 4,
195
- children: /*#__PURE__*/ _jsxs(FormControl, {
196
- fullWidth: true,
197
- children: [
198
- /*#__PURE__*/ _jsx(InputLabel, {
199
- id: "variable-type-select-label",
200
- children: "Type"
201
- }),
202
- /*#__PURE__*/ _jsx(Select, {
203
- labelId: "variable-type-select-label",
204
- id: "variable-type-select",
265
+ children: /*#__PURE__*/ _jsx(Controller, {
266
+ name: "kind",
267
+ render: ({ field, fieldState })=>{
268
+ var _fieldState_error;
269
+ return /*#__PURE__*/ _jsx(TextField, {
270
+ select: true,
271
+ ...field,
272
+ fullWidth: true,
205
273
  label: "Type",
274
+ InputLabelProps: {
275
+ shrink: action === 'read' ? true : undefined
276
+ },
277
+ InputProps: {
278
+ readOnly: action === 'read'
279
+ },
280
+ error: !!fieldState.error,
281
+ helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
206
282
  value: state.kind,
207
- readOnly: action === 'read',
208
- onChange: (v)=>{
283
+ onChange: (event)=>{
284
+ field.onChange(event);
209
285
  setState((draft)=>{
210
- draft.kind = v.target.value;
286
+ draft.kind = event.target.value;
211
287
  });
212
288
  },
213
289
  children: VARIABLE_TYPES.map((v)=>/*#__PURE__*/ _jsx(MenuItem, {
214
290
  value: v.kind,
215
291
  children: v.label
216
292
  }, v.kind))
217
- })
218
- ]
293
+ });
294
+ }
219
295
  })
220
296
  })
221
297
  ]
@@ -238,17 +314,49 @@ export function VariableEditForm(props) {
238
314
  ]
239
315
  })
240
316
  }),
241
- /*#__PURE__*/ _jsx(TextField, {
242
- label: "Value",
243
- value: state.textVariableFields.value,
244
- InputProps: {
245
- readOnly: action === 'read'
246
- },
247
- onChange: (v)=>{
248
- setState((draft)=>{
249
- draft.textVariableFields.value = v.target.value;
317
+ /*#__PURE__*/ _jsx(Controller, {
318
+ name: "textVariableFields.value",
319
+ render: ({ field, fieldState })=>{
320
+ var _fieldState_error;
321
+ return /*#__PURE__*/ _jsx(TextField, {
322
+ ...field,
323
+ label: "Value",
324
+ InputLabelProps: {
325
+ shrink: action === 'read' ? true : undefined
326
+ },
327
+ InputProps: {
328
+ readOnly: action === 'read'
329
+ },
330
+ error: !!fieldState.error,
331
+ helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
332
+ value: state.textVariableFields.value,
333
+ onChange: (event)=>{
334
+ field.onChange(event);
335
+ setState((draft)=>{
336
+ draft.textVariableFields.value = event.target.value;
337
+ });
338
+ }
250
339
  });
251
340
  }
341
+ }),
342
+ /*#__PURE__*/ _jsx(Controller, {
343
+ name: "textVariableFields.constant",
344
+ render: ({ field })=>/*#__PURE__*/ _jsx(FormControlLabel, {
345
+ label: "Constant",
346
+ control: /*#__PURE__*/ _jsx(Switch, {
347
+ ...field,
348
+ checked: !!field.value,
349
+ readOnly: action === 'read',
350
+ value: state.textVariableFields.constant,
351
+ onChange: (event)=>{
352
+ if (action === 'read') return; // ReadOnly prop is not blocking user interaction...
353
+ field.onChange(event);
354
+ setState((draft)=>{
355
+ draft.textVariableFields.constant = event.target.checked;
356
+ });
357
+ }
358
+ })
359
+ })
252
360
  })
253
361
  ]
254
362
  })
@@ -285,38 +393,115 @@ export function VariableEditForm(props) {
285
393
  onClickAway: ()=>refreshPreview(),
286
394
  children: /*#__PURE__*/ _jsx(Box, {})
287
395
  }),
288
- /*#__PURE__*/ _jsx(PluginEditor, {
289
- width: "100%",
290
- pluginType: "Variable",
291
- pluginKindLabel: "Source",
292
- value: state.listVariableFields.plugin,
293
- isReadonly: action === 'read',
294
- onChange: (val)=>{
295
- setState((draft)=>{
296
- draft.listVariableFields.plugin = val;
297
- });
298
- }
396
+ /*#__PURE__*/ _jsx(Controller, {
397
+ name: "listVariableFields.plugin",
398
+ render: ({ field })=>/*#__PURE__*/ _jsx(PluginEditor, {
399
+ width: "100%",
400
+ pluginType: "Variable",
401
+ pluginKindLabel: "Source",
402
+ isReadonly: action === 'read',
403
+ value: state.listVariableFields.plugin,
404
+ onChange: (val)=>{
405
+ field.onChange(val);
406
+ setState((draft)=>{
407
+ draft.listVariableFields.plugin = val;
408
+ });
409
+ }
410
+ })
299
411
  })
300
412
  ]
301
413
  }),
302
414
  /*#__PURE__*/ _jsx(Stack, {
303
- children: /*#__PURE__*/ _jsx(TextField, {
304
- label: "Capturing Regexp Filter",
305
- value: state.listVariableFields.capturing_regexp || '',
306
- InputProps: {
307
- readOnly: action === 'read'
308
- },
309
- onChange: (e)=>{
310
- setState((draft)=>{
311
- if (e.target.value) {
312
- // TODO: do a better fix, if empty string => it should skip the filter
313
- draft.listVariableFields.capturing_regexp = e.target.value;
314
- } else {
315
- draft.listVariableFields.capturing_regexp = undefined;
316
- }
415
+ children: /*#__PURE__*/ _jsx(Controller, {
416
+ name: "listVariableFields.capturingRegexp",
417
+ render: ({ field, fieldState })=>/*#__PURE__*/ {
418
+ var _fieldState_error;
419
+ var _state_listVariableFields_capturingRegexp;
420
+ return _jsx(TextField, {
421
+ ...field,
422
+ label: "Capturing Regexp Filter",
423
+ InputLabelProps: {
424
+ shrink: action === 'read' ? true : undefined
425
+ },
426
+ InputProps: {
427
+ readOnly: action === 'read'
428
+ },
429
+ error: !!fieldState.error,
430
+ value: (_state_listVariableFields_capturingRegexp = state.listVariableFields.capturingRegexp) !== null && _state_listVariableFields_capturingRegexp !== void 0 ? _state_listVariableFields_capturingRegexp : '',
431
+ onChange: (event)=>{
432
+ field.onChange(event);
433
+ setState((draft)=>{
434
+ if (event.target.value) {
435
+ // TODO: do a better fix, if empty string => it should skip the filter
436
+ draft.listVariableFields.capturingRegexp = event.target.value;
437
+ } else {
438
+ draft.listVariableFields.capturingRegexp = undefined;
439
+ }
440
+ });
441
+ },
442
+ helperText: ((_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message) ? fieldState.error.message : 'Optional, if you want to filter on captured result.'
317
443
  });
318
- },
319
- helperText: "Optional, if you want to filter on captured result."
444
+ }
445
+ })
446
+ }),
447
+ /*#__PURE__*/ _jsx(Stack, {
448
+ children: /*#__PURE__*/ _jsx(Controller, {
449
+ name: "listVariableFields.sort",
450
+ render: ({ field, fieldState })=>/*#__PURE__*/ {
451
+ var _fieldState_error;
452
+ var _state_listVariableFields_sort;
453
+ return _jsxs(TextField, {
454
+ select: true,
455
+ ...field,
456
+ fullWidth: true,
457
+ label: "Sort",
458
+ InputLabelProps: {
459
+ shrink: action === 'read' ? true : undefined
460
+ },
461
+ InputProps: {
462
+ readOnly: action === 'read'
463
+ },
464
+ error: !!fieldState.error,
465
+ helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
466
+ value: (_state_listVariableFields_sort = state.listVariableFields.sort) !== null && _state_listVariableFields_sort !== void 0 ? _state_listVariableFields_sort : 'none',
467
+ onChange: (event)=>{
468
+ field.onChange(event);
469
+ setState((draft)=>{
470
+ draft.listVariableFields.sort = event.target.value;
471
+ });
472
+ },
473
+ children: [
474
+ /*#__PURE__*/ _jsx(MenuItem, {
475
+ value: "none",
476
+ children: "None"
477
+ }),
478
+ /*#__PURE__*/ _jsx(MenuItem, {
479
+ value: "alphabetical-asc",
480
+ children: "Alphabetical, asc"
481
+ }),
482
+ /*#__PURE__*/ _jsx(MenuItem, {
483
+ value: "alphabetical-desc",
484
+ children: "Alphabetical, desc"
485
+ }),
486
+ /*#__PURE__*/ _jsx(MenuItem, {
487
+ value: "numerical-asc",
488
+ children: "Numerical, asc"
489
+ }),
490
+ /*#__PURE__*/ _jsx(MenuItem, {
491
+ value: "numerical-desc",
492
+ children: "Numerical, desc"
493
+ }),
494
+ /*#__PURE__*/ _jsx(MenuItem, {
495
+ value: "alphabetical-ci-asc",
496
+ children: "Alphabetical, case-insensitive, asc"
497
+ }),
498
+ /*#__PURE__*/ _jsx(MenuItem, {
499
+ value: "alphabetical-ci-desc",
500
+ children: "Alphabetical, case-insensitive, desc"
501
+ })
502
+ ]
503
+ });
504
+ }
320
505
  })
321
506
  })
322
507
  ]
@@ -332,18 +517,24 @@ export function VariableEditForm(props) {
332
517
  children: [
333
518
  /*#__PURE__*/ _jsxs(Stack, {
334
519
  children: [
335
- /*#__PURE__*/ _jsx(FormControlLabel, {
336
- control: /*#__PURE__*/ _jsx(Switch, {
337
- checked: state.listVariableFields.allowMultiple,
338
- readOnly: action === 'read',
339
- onChange: (e)=>{
340
- if (action === 'read') return; // ReadOnly prop is not blocking user interaction...
341
- setState((draft)=>{
342
- draft.listVariableFields.allowMultiple = e.target.checked;
343
- });
344
- }
345
- }),
346
- label: "Allow Multiple Values"
520
+ /*#__PURE__*/ _jsx(Controller, {
521
+ name: "listVariableFields.allowMultiple",
522
+ render: ({ field })=>/*#__PURE__*/ _jsx(FormControlLabel, {
523
+ label: "Allow Multiple Values",
524
+ control: /*#__PURE__*/ _jsx(Switch, {
525
+ ...field,
526
+ checked: !!field.value,
527
+ readOnly: action === 'read',
528
+ value: state.listVariableFields.allowMultiple,
529
+ onChange: (event)=>{
530
+ if (action === 'read') return; // ReadOnly prop is not blocking user interaction...
531
+ field.onChange(event);
532
+ setState((draft)=>{
533
+ draft.listVariableFields.allowMultiple = event.target.checked;
534
+ });
535
+ }
536
+ })
537
+ })
347
538
  }),
348
539
  /*#__PURE__*/ _jsx(Typography, {
349
540
  variant: "caption",
@@ -353,40 +544,60 @@ export function VariableEditForm(props) {
353
544
  }),
354
545
  /*#__PURE__*/ _jsxs(Stack, {
355
546
  children: [
356
- /*#__PURE__*/ _jsx(FormControlLabel, {
357
- control: /*#__PURE__*/ _jsx(Switch, {
358
- checked: state.listVariableFields.allowAll,
359
- readOnly: action === 'read',
360
- onChange: (e)=>{
361
- if (action === 'read') return; // ReadOnly prop is not blocking user interaction...
362
- setState((draft)=>{
363
- draft.listVariableFields.allowAll = e.target.checked;
364
- });
365
- }
366
- }),
367
- label: "Allow All option"
547
+ /*#__PURE__*/ _jsx(Controller, {
548
+ name: "listVariableFields.allowAllValue",
549
+ render: ({ field })=>/*#__PURE__*/ _jsx(FormControlLabel, {
550
+ label: "Allow All option",
551
+ control: /*#__PURE__*/ _jsx(Switch, {
552
+ ...field,
553
+ checked: !!field.value,
554
+ readOnly: action === 'read',
555
+ value: state.listVariableFields.allowAllValue,
556
+ onChange: (event)=>{
557
+ if (action === 'read') return; // ReadOnly prop is not blocking user interaction...
558
+ field.onChange(event);
559
+ setState((draft)=>{
560
+ draft.listVariableFields.allowAllValue = event.target.checked;
561
+ });
562
+ }
563
+ })
564
+ })
368
565
  }),
369
566
  /*#__PURE__*/ _jsx(Typography, {
370
567
  mb: 1,
371
568
  variant: "caption",
372
569
  children: "Enables an option to include all variable values"
373
570
  }),
374
- state.listVariableFields.allowAll && /*#__PURE__*/ _jsx(TextField, {
375
- label: "Custom All Value",
376
- value: state.listVariableFields.customAllValue,
377
- InputProps: {
378
- readOnly: action === 'read'
379
- },
380
- onChange: (e)=>{
381
- setState((draft)=>{
382
- if (e.target.value) {
383
- draft.listVariableFields.customAllValue = e.target.value;
384
- } else {
385
- draft.listVariableFields.customAllValue = undefined;
571
+ state.listVariableFields.allowAllValue && /*#__PURE__*/ _jsx(Controller, {
572
+ name: "listVariableFields.customAllValue",
573
+ render: ({ field, fieldState })=>/*#__PURE__*/ {
574
+ var _fieldState_error;
575
+ var _state_listVariableFields_customAllValue;
576
+ return _jsx(TextField, {
577
+ ...field,
578
+ fullWidth: true,
579
+ label: "Custom All Value",
580
+ InputLabelProps: {
581
+ shrink: action === 'read' ? true : undefined
582
+ },
583
+ InputProps: {
584
+ readOnly: action === 'read'
585
+ },
586
+ error: !!fieldState.error,
587
+ helperText: ((_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message) ? fieldState.error.message : 'When All is selected, this value will be used',
588
+ value: (_state_listVariableFields_customAllValue = state.listVariableFields.customAllValue) !== null && _state_listVariableFields_customAllValue !== void 0 ? _state_listVariableFields_customAllValue : '',
589
+ onChange: (event)=>{
590
+ field.onChange(event);
591
+ setState((draft)=>{
592
+ if (event.target.value) {
593
+ draft.listVariableFields.customAllValue = event.target.value;
594
+ } else {
595
+ draft.listVariableFields.customAllValue = undefined;
596
+ }
597
+ });
386
598
  }
387
599
  });
388
- },
389
- helperText: "When All is selected, this value will be used"
600
+ }
390
601
  })
391
602
  ]
392
603
  })
@@ -398,13 +609,13 @@ export function VariableEditForm(props) {
398
609
  }),
399
610
  /*#__PURE__*/ _jsx(DiscardChangesConfirmationDialog, {
400
611
  description: "Are you sure you want to discard these changes? Changes cannot be recovered.",
401
- isOpen: isDiscardDialogStateOpened,
612
+ isOpen: isDiscardDialogOpened,
402
613
  onCancel: ()=>{
403
- setDiscardDialogStateOpened(false);
614
+ setDiscardDialogOpened(false);
404
615
  },
405
616
  onDiscardChanges: ()=>{
406
- setDiscardDialogStateOpened(false);
407
- onCancel();
617
+ setDiscardDialogOpened(false);
618
+ onClose();
408
619
  }
409
620
  })
410
621
  ]