@perses-dev/plugin-system 0.53.0-rc.1 → 0.53.0-rc.3

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 (349) hide show
  1. package/dist/cjs/components/CalculationSelector/CalculationSelector.js +1 -1
  2. package/dist/cjs/components/CalculationSelector/index.js +1 -1
  3. package/dist/cjs/components/DatasourceEditorForm/DatasourceEditorForm.js +1 -1
  4. package/dist/cjs/components/DatasourceEditorForm/index.js +1 -1
  5. package/dist/cjs/components/DatasourceSelect/DatasourceSelect.js +1 -1
  6. package/dist/cjs/components/DatasourceSelect/index.js +1 -1
  7. package/dist/cjs/components/HTTPSettingsEditor/HTTPSettingsEditor.js +1 -1
  8. package/dist/cjs/components/HTTPSettingsEditor/index.js +1 -1
  9. package/dist/cjs/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.js +1175 -0
  10. package/dist/cjs/components/ItemSelectionActionsOptionsEditor/index.js +30 -0
  11. package/dist/cjs/components/LegendOptionsEditor/LegendOptionsEditor.js +1 -1
  12. package/dist/cjs/components/LegendOptionsEditor/index.js +1 -1
  13. package/dist/cjs/components/MetricLabelInput/MetricLabelInput.js +1 -1
  14. package/dist/cjs/components/MetricLabelInput/index.js +1 -1
  15. package/dist/cjs/components/MultiQueryEditor/MultiQueryEditor.js +1 -1
  16. package/dist/cjs/components/MultiQueryEditor/QueryEditorContainer.js +1 -1
  17. package/dist/cjs/components/MultiQueryEditor/index.js +1 -1
  18. package/dist/cjs/components/OptionsEditorRadios/OptionsEditorRadios.js +1 -1
  19. package/dist/cjs/components/OptionsEditorRadios/index.js +1 -1
  20. package/dist/cjs/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js +1 -1
  21. package/dist/cjs/components/OptionsEditorTabPanel/index.js +1 -1
  22. package/dist/cjs/components/OptionsEditorTabs/OptionsEditorTabs.js +1 -1
  23. package/dist/cjs/components/OptionsEditorTabs/index.js +1 -1
  24. package/dist/cjs/components/PanelSpecEditor/PanelSpecEditor.js +1 -1
  25. package/dist/cjs/components/PanelSpecEditor/index.js +1 -1
  26. package/dist/cjs/components/PluginEditor/PluginEditor.js +1 -1
  27. package/dist/cjs/components/PluginEditor/index.js +1 -1
  28. package/dist/cjs/components/PluginEditor/plugin-editor-api.js +1 -1
  29. package/dist/cjs/components/PluginKindSelect/PluginKindSelect.js +1 -1
  30. package/dist/cjs/components/PluginKindSelect/index.js +1 -1
  31. package/dist/cjs/components/PluginRegistry/PluginRegistry.js +1 -1
  32. package/dist/cjs/components/PluginRegistry/index.js +1 -1
  33. package/dist/cjs/components/PluginRegistry/plugin-indexes.js +1 -1
  34. package/dist/cjs/components/PluginSpecEditor/PluginSpecEditor.js +1 -1
  35. package/dist/cjs/components/PluginSpecEditor/index.js +1 -1
  36. package/dist/cjs/components/SelectionOptionsEditor/SelectionOptionsEditor.js +43 -0
  37. package/dist/cjs/components/SelectionOptionsEditor/index.js +30 -0
  38. package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +11 -3
  39. package/dist/cjs/components/TimeRangeControls/index.js +1 -1
  40. package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +1 -1
  41. package/dist/cjs/components/Variables/VariableEditorForm/VariablePreview.js +1 -1
  42. package/dist/cjs/components/Variables/VariableEditorForm/index.js +1 -1
  43. package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +1 -1
  44. package/dist/cjs/components/Variables/index.js +1 -1
  45. package/dist/cjs/components/Variables/variable-model.js +1 -1
  46. package/dist/cjs/components/index.js +2 -1
  47. package/dist/cjs/constants/index.js +1 -1
  48. package/dist/cjs/constants/user-interface-text.js +1 -1
  49. package/dist/cjs/context/ValidationProvider.js +1 -1
  50. package/dist/cjs/context/index.js +1 -1
  51. package/dist/cjs/index.js +1 -1
  52. package/dist/cjs/model/datasource.js +1 -1
  53. package/dist/cjs/model/explore.js +1 -1
  54. package/dist/cjs/model/index.js +1 -1
  55. package/dist/cjs/model/legend.js +1 -1
  56. package/dist/cjs/model/log-queries.js +1 -1
  57. package/dist/cjs/model/panels.js +1 -1
  58. package/dist/cjs/model/plugin-base.js +1 -1
  59. package/dist/cjs/model/plugin-loading.js +1 -1
  60. package/dist/cjs/model/plugins.js +1 -1
  61. package/dist/cjs/model/profile-queries.js +1 -1
  62. package/dist/cjs/model/time-series-queries.js +1 -1
  63. package/dist/cjs/model/trace-queries.js +1 -1
  64. package/dist/cjs/model/variables.js +1 -1
  65. package/dist/cjs/remote/PersesPlugin.types.js +1 -1
  66. package/dist/cjs/remote/PluginLoaderComponent.js +13 -1
  67. package/dist/cjs/remote/PluginRuntime.js +13 -1
  68. package/dist/cjs/remote/index.js +1 -1
  69. package/dist/cjs/remote/remotePluginLoader.js +1 -1
  70. package/dist/cjs/runtime/DataQueriesProvider/DataQueriesProvider.js +1 -1
  71. package/dist/cjs/runtime/DataQueriesProvider/index.js +1 -1
  72. package/dist/cjs/runtime/DataQueriesProvider/model.js +1 -1
  73. package/dist/cjs/runtime/QueryCountProvider.js +1 -1
  74. package/dist/cjs/runtime/RouterProvider.js +1 -1
  75. package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProvider.js +1 -1
  76. package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProviders.js +7 -2
  77. package/dist/cjs/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js +1 -1
  78. package/dist/cjs/runtime/TimeRangeProvider/index.js +1 -1
  79. package/dist/cjs/runtime/TimeRangeProvider/query-params.js +28 -1
  80. package/dist/cjs/runtime/TimeRangeProvider/refresh-interval.js +1 -1
  81. package/dist/cjs/runtime/UsageMetricsProvider.js +1 -1
  82. package/dist/cjs/runtime/builtin-variables.js +1 -1
  83. package/dist/cjs/runtime/datasources.js +1 -1
  84. package/dist/cjs/runtime/index.js +2 -1
  85. package/dist/cjs/runtime/item-actions.js +303 -0
  86. package/dist/cjs/runtime/log-queries.js +1 -1
  87. package/dist/cjs/runtime/plugin-registry.js +1 -1
  88. package/dist/cjs/runtime/profile-queries.js +1 -1
  89. package/dist/cjs/runtime/time-series-queries.js +1 -1
  90. package/dist/cjs/runtime/trace-queries.js +1 -1
  91. package/dist/cjs/runtime/utils.js +1 -1
  92. package/dist/cjs/runtime/variables.js +6 -6
  93. package/dist/cjs/test/index.js +1 -1
  94. package/dist/cjs/test/mock-data.js +1 -1
  95. package/dist/cjs/test/render-hook.js +1 -1
  96. package/dist/cjs/test/render.js +1 -1
  97. package/dist/cjs/test/setup-tests.js +1 -1
  98. package/dist/cjs/test/test-plugins/bert/index.js +1 -1
  99. package/dist/cjs/test/test-plugins/ernie/index.js +1 -1
  100. package/dist/cjs/test/test-plugins/index.js +1 -1
  101. package/dist/cjs/test/utils.js +1 -1
  102. package/dist/cjs/test-utils/index.js +1 -1
  103. package/dist/cjs/test-utils/mock-plugin-registry.js +1 -1
  104. package/dist/cjs/utils/action.js +1 -1
  105. package/dist/cjs/utils/event.js +1 -1
  106. package/dist/cjs/utils/index.js +1 -1
  107. package/dist/cjs/utils/variables.js +9 -146
  108. package/dist/components/CalculationSelector/CalculationSelector.js +1 -1
  109. package/dist/components/CalculationSelector/CalculationSelector.js.map +1 -1
  110. package/dist/components/CalculationSelector/index.js +1 -1
  111. package/dist/components/CalculationSelector/index.js.map +1 -1
  112. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js +1 -1
  113. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js.map +1 -1
  114. package/dist/components/DatasourceEditorForm/index.js +1 -1
  115. package/dist/components/DatasourceEditorForm/index.js.map +1 -1
  116. package/dist/components/DatasourceSelect/DatasourceSelect.js +1 -1
  117. package/dist/components/DatasourceSelect/DatasourceSelect.js.map +1 -1
  118. package/dist/components/DatasourceSelect/index.js +1 -1
  119. package/dist/components/DatasourceSelect/index.js.map +1 -1
  120. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js +1 -1
  121. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js.map +1 -1
  122. package/dist/components/HTTPSettingsEditor/index.js +1 -1
  123. package/dist/components/HTTPSettingsEditor/index.js.map +1 -1
  124. package/dist/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.d.ts +49 -0
  125. package/dist/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.d.ts.map +1 -0
  126. package/dist/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.js +1154 -0
  127. package/dist/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.js.map +1 -0
  128. package/dist/components/ItemSelectionActionsOptionsEditor/index.d.ts +2 -0
  129. package/dist/components/ItemSelectionActionsOptionsEditor/index.d.ts.map +1 -0
  130. package/dist/components/ItemSelectionActionsOptionsEditor/index.js +15 -0
  131. package/dist/components/ItemSelectionActionsOptionsEditor/index.js.map +1 -0
  132. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js +1 -1
  133. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js.map +1 -1
  134. package/dist/components/LegendOptionsEditor/index.js +1 -1
  135. package/dist/components/LegendOptionsEditor/index.js.map +1 -1
  136. package/dist/components/MetricLabelInput/MetricLabelInput.js +1 -1
  137. package/dist/components/MetricLabelInput/MetricLabelInput.js.map +1 -1
  138. package/dist/components/MetricLabelInput/index.js +1 -1
  139. package/dist/components/MetricLabelInput/index.js.map +1 -1
  140. package/dist/components/MultiQueryEditor/MultiQueryEditor.js +1 -1
  141. package/dist/components/MultiQueryEditor/MultiQueryEditor.js.map +1 -1
  142. package/dist/components/MultiQueryEditor/QueryEditorContainer.js +1 -1
  143. package/dist/components/MultiQueryEditor/QueryEditorContainer.js.map +1 -1
  144. package/dist/components/MultiQueryEditor/index.js +1 -1
  145. package/dist/components/MultiQueryEditor/index.js.map +1 -1
  146. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js +1 -1
  147. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js.map +1 -1
  148. package/dist/components/OptionsEditorRadios/index.js +1 -1
  149. package/dist/components/OptionsEditorRadios/index.js.map +1 -1
  150. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js +1 -1
  151. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js.map +1 -1
  152. package/dist/components/OptionsEditorTabPanel/index.js +1 -1
  153. package/dist/components/OptionsEditorTabPanel/index.js.map +1 -1
  154. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js +1 -1
  155. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js.map +1 -1
  156. package/dist/components/OptionsEditorTabs/index.js +1 -1
  157. package/dist/components/OptionsEditorTabs/index.js.map +1 -1
  158. package/dist/components/PanelSpecEditor/PanelSpecEditor.js +1 -1
  159. package/dist/components/PanelSpecEditor/PanelSpecEditor.js.map +1 -1
  160. package/dist/components/PanelSpecEditor/index.js +1 -1
  161. package/dist/components/PanelSpecEditor/index.js.map +1 -1
  162. package/dist/components/PluginEditor/PluginEditor.js +1 -1
  163. package/dist/components/PluginEditor/PluginEditor.js.map +1 -1
  164. package/dist/components/PluginEditor/index.js +1 -1
  165. package/dist/components/PluginEditor/index.js.map +1 -1
  166. package/dist/components/PluginEditor/plugin-editor-api.js +1 -1
  167. package/dist/components/PluginEditor/plugin-editor-api.js.map +1 -1
  168. package/dist/components/PluginKindSelect/PluginKindSelect.js +1 -1
  169. package/dist/components/PluginKindSelect/PluginKindSelect.js.map +1 -1
  170. package/dist/components/PluginKindSelect/index.js +1 -1
  171. package/dist/components/PluginKindSelect/index.js.map +1 -1
  172. package/dist/components/PluginRegistry/PluginRegistry.js +1 -1
  173. package/dist/components/PluginRegistry/PluginRegistry.js.map +1 -1
  174. package/dist/components/PluginRegistry/index.js +1 -1
  175. package/dist/components/PluginRegistry/index.js.map +1 -1
  176. package/dist/components/PluginRegistry/plugin-indexes.js +1 -1
  177. package/dist/components/PluginRegistry/plugin-indexes.js.map +1 -1
  178. package/dist/components/PluginSpecEditor/PluginSpecEditor.js +1 -1
  179. package/dist/components/PluginSpecEditor/PluginSpecEditor.js.map +1 -1
  180. package/dist/components/PluginSpecEditor/index.js +1 -1
  181. package/dist/components/PluginSpecEditor/index.js.map +1 -1
  182. package/dist/components/SelectionOptionsEditor/SelectionOptionsEditor.d.ts +10 -0
  183. package/dist/components/SelectionOptionsEditor/SelectionOptionsEditor.d.ts.map +1 -0
  184. package/dist/components/SelectionOptionsEditor/SelectionOptionsEditor.js +35 -0
  185. package/dist/components/SelectionOptionsEditor/SelectionOptionsEditor.js.map +1 -0
  186. package/dist/components/SelectionOptionsEditor/index.d.ts +2 -0
  187. package/dist/components/SelectionOptionsEditor/index.d.ts.map +1 -0
  188. package/dist/components/SelectionOptionsEditor/index.js +15 -0
  189. package/dist/components/SelectionOptionsEditor/index.js.map +1 -0
  190. package/dist/components/TimeRangeControls/TimeRangeControls.d.ts +4 -2
  191. package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -1
  192. package/dist/components/TimeRangeControls/TimeRangeControls.js +12 -4
  193. package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
  194. package/dist/components/TimeRangeControls/index.js +1 -1
  195. package/dist/components/TimeRangeControls/index.js.map +1 -1
  196. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +1 -1
  197. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
  198. package/dist/components/Variables/VariableEditorForm/VariablePreview.js +1 -1
  199. package/dist/components/Variables/VariableEditorForm/VariablePreview.js.map +1 -1
  200. package/dist/components/Variables/VariableEditorForm/index.js +1 -1
  201. package/dist/components/Variables/VariableEditorForm/index.js.map +1 -1
  202. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +1 -1
  203. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -1
  204. package/dist/components/Variables/index.js +1 -1
  205. package/dist/components/Variables/index.js.map +1 -1
  206. package/dist/components/Variables/variable-model.js +1 -1
  207. package/dist/components/Variables/variable-model.js.map +1 -1
  208. package/dist/components/index.d.ts +1 -0
  209. package/dist/components/index.d.ts.map +1 -1
  210. package/dist/components/index.js +2 -1
  211. package/dist/components/index.js.map +1 -1
  212. package/dist/constants/index.js +1 -1
  213. package/dist/constants/index.js.map +1 -1
  214. package/dist/constants/user-interface-text.js +1 -1
  215. package/dist/constants/user-interface-text.js.map +1 -1
  216. package/dist/context/ValidationProvider.js +1 -1
  217. package/dist/context/ValidationProvider.js.map +1 -1
  218. package/dist/context/index.js +1 -1
  219. package/dist/context/index.js.map +1 -1
  220. package/dist/index.js +1 -1
  221. package/dist/index.js.map +1 -1
  222. package/dist/model/datasource.js +1 -1
  223. package/dist/model/datasource.js.map +1 -1
  224. package/dist/model/explore.js +1 -1
  225. package/dist/model/explore.js.map +1 -1
  226. package/dist/model/index.js +1 -1
  227. package/dist/model/index.js.map +1 -1
  228. package/dist/model/legend.js +1 -1
  229. package/dist/model/legend.js.map +1 -1
  230. package/dist/model/log-queries.js +1 -1
  231. package/dist/model/log-queries.js.map +1 -1
  232. package/dist/model/panels.js +1 -1
  233. package/dist/model/panels.js.map +1 -1
  234. package/dist/model/plugin-base.js +1 -1
  235. package/dist/model/plugin-base.js.map +1 -1
  236. package/dist/model/plugin-loading.js +1 -1
  237. package/dist/model/plugin-loading.js.map +1 -1
  238. package/dist/model/plugins.js +1 -1
  239. package/dist/model/plugins.js.map +1 -1
  240. package/dist/model/profile-queries.js +1 -1
  241. package/dist/model/profile-queries.js.map +1 -1
  242. package/dist/model/time-series-queries.js +1 -1
  243. package/dist/model/time-series-queries.js.map +1 -1
  244. package/dist/model/trace-queries.js +1 -1
  245. package/dist/model/trace-queries.js.map +1 -1
  246. package/dist/model/variables.d.ts +4 -7
  247. package/dist/model/variables.d.ts.map +1 -1
  248. package/dist/model/variables.js +1 -1
  249. package/dist/model/variables.js.map +1 -1
  250. package/dist/remote/PersesPlugin.types.js +1 -1
  251. package/dist/remote/PersesPlugin.types.js.map +1 -1
  252. package/dist/remote/PluginLoaderComponent.d.ts.map +1 -1
  253. package/dist/remote/PluginLoaderComponent.js +13 -1
  254. package/dist/remote/PluginLoaderComponent.js.map +1 -1
  255. package/dist/remote/PluginRuntime.d.ts.map +1 -1
  256. package/dist/remote/PluginRuntime.js +13 -1
  257. package/dist/remote/PluginRuntime.js.map +1 -1
  258. package/dist/remote/index.js +1 -1
  259. package/dist/remote/index.js.map +1 -1
  260. package/dist/remote/remotePluginLoader.js +1 -1
  261. package/dist/remote/remotePluginLoader.js.map +1 -1
  262. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js +1 -1
  263. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js.map +1 -1
  264. package/dist/runtime/DataQueriesProvider/index.js +1 -1
  265. package/dist/runtime/DataQueriesProvider/index.js.map +1 -1
  266. package/dist/runtime/DataQueriesProvider/model.js +1 -1
  267. package/dist/runtime/DataQueriesProvider/model.js.map +1 -1
  268. package/dist/runtime/QueryCountProvider.js +1 -1
  269. package/dist/runtime/QueryCountProvider.js.map +1 -1
  270. package/dist/runtime/RouterProvider.js +1 -1
  271. package/dist/runtime/RouterProvider.js.map +1 -1
  272. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js +1 -1
  273. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js.map +1 -1
  274. package/dist/runtime/TimeRangeProvider/TimeRangeProviders.d.ts.map +1 -1
  275. package/dist/runtime/TimeRangeProvider/TimeRangeProviders.js +8 -3
  276. package/dist/runtime/TimeRangeProvider/TimeRangeProviders.js.map +1 -1
  277. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js +1 -1
  278. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js.map +1 -1
  279. package/dist/runtime/TimeRangeProvider/index.js +1 -1
  280. package/dist/runtime/TimeRangeProvider/index.js.map +1 -1
  281. package/dist/runtime/TimeRangeProvider/query-params.d.ts +11 -0
  282. package/dist/runtime/TimeRangeProvider/query-params.d.ts.map +1 -1
  283. package/dist/runtime/TimeRangeProvider/query-params.js +26 -2
  284. package/dist/runtime/TimeRangeProvider/query-params.js.map +1 -1
  285. package/dist/runtime/TimeRangeProvider/refresh-interval.js +1 -1
  286. package/dist/runtime/TimeRangeProvider/refresh-interval.js.map +1 -1
  287. package/dist/runtime/UsageMetricsProvider.js +1 -1
  288. package/dist/runtime/UsageMetricsProvider.js.map +1 -1
  289. package/dist/runtime/builtin-variables.js +1 -1
  290. package/dist/runtime/builtin-variables.js.map +1 -1
  291. package/dist/runtime/datasources.js +1 -1
  292. package/dist/runtime/datasources.js.map +1 -1
  293. package/dist/runtime/index.d.ts +1 -0
  294. package/dist/runtime/index.d.ts.map +1 -1
  295. package/dist/runtime/index.js +2 -1
  296. package/dist/runtime/index.js.map +1 -1
  297. package/dist/runtime/item-actions.d.ts +35 -0
  298. package/dist/runtime/item-actions.d.ts.map +1 -0
  299. package/dist/runtime/item-actions.js +300 -0
  300. package/dist/runtime/item-actions.js.map +1 -0
  301. package/dist/runtime/log-queries.js +1 -1
  302. package/dist/runtime/log-queries.js.map +1 -1
  303. package/dist/runtime/plugin-registry.js +1 -1
  304. package/dist/runtime/plugin-registry.js.map +1 -1
  305. package/dist/runtime/profile-queries.js +1 -1
  306. package/dist/runtime/profile-queries.js.map +1 -1
  307. package/dist/runtime/time-series-queries.js +1 -1
  308. package/dist/runtime/time-series-queries.js.map +1 -1
  309. package/dist/runtime/trace-queries.js +1 -1
  310. package/dist/runtime/trace-queries.js.map +1 -1
  311. package/dist/runtime/utils.js +1 -1
  312. package/dist/runtime/utils.js.map +1 -1
  313. package/dist/runtime/variables.d.ts +2 -18
  314. package/dist/runtime/variables.d.ts.map +1 -1
  315. package/dist/runtime/variables.js +3 -3
  316. package/dist/runtime/variables.js.map +1 -1
  317. package/dist/test/index.js +1 -1
  318. package/dist/test/index.js.map +1 -1
  319. package/dist/test/mock-data.js +1 -1
  320. package/dist/test/mock-data.js.map +1 -1
  321. package/dist/test/render-hook.js +1 -1
  322. package/dist/test/render-hook.js.map +1 -1
  323. package/dist/test/render.js +1 -1
  324. package/dist/test/render.js.map +1 -1
  325. package/dist/test/setup-tests.js +1 -1
  326. package/dist/test/setup-tests.js.map +1 -1
  327. package/dist/test/test-plugins/bert/index.js +1 -1
  328. package/dist/test/test-plugins/bert/index.js.map +1 -1
  329. package/dist/test/test-plugins/ernie/index.js +1 -1
  330. package/dist/test/test-plugins/ernie/index.js.map +1 -1
  331. package/dist/test/test-plugins/index.js +1 -1
  332. package/dist/test/test-plugins/index.js.map +1 -1
  333. package/dist/test/utils.js +1 -1
  334. package/dist/test/utils.js.map +1 -1
  335. package/dist/test-utils/index.js +1 -1
  336. package/dist/test-utils/index.js.map +1 -1
  337. package/dist/test-utils/mock-plugin-registry.js +1 -1
  338. package/dist/test-utils/mock-plugin-registry.js.map +1 -1
  339. package/dist/utils/action.js +1 -1
  340. package/dist/utils/action.js.map +1 -1
  341. package/dist/utils/event.js +1 -1
  342. package/dist/utils/event.js.map +1 -1
  343. package/dist/utils/index.js +1 -1
  344. package/dist/utils/index.js.map +1 -1
  345. package/dist/utils/variables.d.ts +2 -30
  346. package/dist/utils/variables.d.ts.map +1 -1
  347. package/dist/utils/variables.js +3 -144
  348. package/dist/utils/variables.js.map +1 -1
  349. package/package.json +3 -3
@@ -0,0 +1,1154 @@
1
+ // Copyright The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
14
+ import { Box, Button, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle, FormControl, FormControlLabel, FormLabel, IconButton, InputLabel, MenuItem, Radio, RadioGroup, Select, Stack, Switch, TextField, Typography } from '@mui/material';
15
+ import { DragAndDropElement, DragButton, handleMoveDown, handleMoveUp, InfoTooltip, JSONEditor, OptionsEditorControl, OptionsEditorGroup, useDragAndDropMonitor } from '@perses-dev/components';
16
+ import AlertIcon from 'mdi-material-ui/Alert';
17
+ import CheckIcon from 'mdi-material-ui/Check';
18
+ import ChevronDown from 'mdi-material-ui/ChevronDown';
19
+ import ChevronRight from 'mdi-material-ui/ChevronRight';
20
+ import CloseIcon from 'mdi-material-ui/Close';
21
+ import SettingsIcon from 'mdi-material-ui/Cog';
22
+ import DeleteIcon from 'mdi-material-ui/DeleteOutline';
23
+ import DownloadIcon from 'mdi-material-ui/Download';
24
+ import InfoIcon from 'mdi-material-ui/InformationOutline';
25
+ import LinkIcon from 'mdi-material-ui/Link';
26
+ import MagnifyScan from 'mdi-material-ui/MagnifyScan';
27
+ import PauseIcon from 'mdi-material-ui/Pause';
28
+ import PlayIcon from 'mdi-material-ui/Play';
29
+ import PlusIcon from 'mdi-material-ui/Plus';
30
+ import RefreshIcon from 'mdi-material-ui/Refresh';
31
+ import RobotOutline from 'mdi-material-ui/RobotOutline';
32
+ import SendIcon from 'mdi-material-ui/Send';
33
+ import StopIcon from 'mdi-material-ui/Stop';
34
+ import SyncIcon from 'mdi-material-ui/Sync';
35
+ import UploadIcon from 'mdi-material-ui/Upload';
36
+ import { useCallback, useMemo, useState } from 'react';
37
+ const HTTP_METHODS = [
38
+ 'GET',
39
+ 'POST',
40
+ 'PUT',
41
+ 'PATCH',
42
+ 'DELETE'
43
+ ];
44
+ const BATCH_MODES = [
45
+ {
46
+ value: 'individual',
47
+ label: 'Individual (one request per selection)'
48
+ },
49
+ {
50
+ value: 'batch',
51
+ label: 'Batch (single request with all selections)'
52
+ }
53
+ ];
54
+ const CONTENT_TYPES = [
55
+ {
56
+ value: 'none',
57
+ label: 'None'
58
+ },
59
+ {
60
+ value: 'json',
61
+ label: 'JSON'
62
+ },
63
+ {
64
+ value: 'text',
65
+ label: 'Text'
66
+ }
67
+ ];
68
+ const BODY_METHODS = [
69
+ 'POST',
70
+ 'PUT',
71
+ 'PATCH'
72
+ ];
73
+ const BODY_CLEAR_CONFIRM_MESSAGE = 'Changing this option will remove the current body template. Continue?';
74
+ /** Available action icons with their display components */ export const ACTION_ICONS = [
75
+ {
76
+ value: 'play',
77
+ label: 'Play',
78
+ icon: /*#__PURE__*/ _jsx(PlayIcon, {
79
+ fontSize: "inherit"
80
+ })
81
+ },
82
+ {
83
+ value: 'pause',
84
+ label: 'Pause',
85
+ icon: /*#__PURE__*/ _jsx(PauseIcon, {
86
+ fontSize: "inherit"
87
+ })
88
+ },
89
+ {
90
+ value: 'stop',
91
+ label: 'Stop',
92
+ icon: /*#__PURE__*/ _jsx(StopIcon, {
93
+ fontSize: "inherit"
94
+ })
95
+ },
96
+ {
97
+ value: 'delete',
98
+ label: 'Delete',
99
+ icon: /*#__PURE__*/ _jsx(DeleteIcon, {
100
+ fontSize: "inherit"
101
+ })
102
+ },
103
+ {
104
+ value: 'refresh',
105
+ label: 'Refresh',
106
+ icon: /*#__PURE__*/ _jsx(RefreshIcon, {
107
+ fontSize: "inherit"
108
+ })
109
+ },
110
+ {
111
+ value: 'send',
112
+ label: 'Send',
113
+ icon: /*#__PURE__*/ _jsx(SendIcon, {
114
+ fontSize: "inherit"
115
+ })
116
+ },
117
+ {
118
+ value: 'download',
119
+ label: 'Download',
120
+ icon: /*#__PURE__*/ _jsx(DownloadIcon, {
121
+ fontSize: "inherit"
122
+ })
123
+ },
124
+ {
125
+ value: 'upload',
126
+ label: 'Upload',
127
+ icon: /*#__PURE__*/ _jsx(UploadIcon, {
128
+ fontSize: "inherit"
129
+ })
130
+ },
131
+ {
132
+ value: 'check',
133
+ label: 'Check',
134
+ icon: /*#__PURE__*/ _jsx(CheckIcon, {
135
+ fontSize: "inherit"
136
+ })
137
+ },
138
+ {
139
+ value: 'close',
140
+ label: 'Close',
141
+ icon: /*#__PURE__*/ _jsx(CloseIcon, {
142
+ fontSize: "inherit"
143
+ })
144
+ },
145
+ {
146
+ value: 'alert',
147
+ label: 'Alert',
148
+ icon: /*#__PURE__*/ _jsx(AlertIcon, {
149
+ fontSize: "inherit"
150
+ })
151
+ },
152
+ {
153
+ value: 'info',
154
+ label: 'Info',
155
+ icon: /*#__PURE__*/ _jsx(InfoIcon, {
156
+ fontSize: "inherit"
157
+ })
158
+ },
159
+ {
160
+ value: 'settings',
161
+ label: 'Settings',
162
+ icon: /*#__PURE__*/ _jsx(SettingsIcon, {
163
+ fontSize: "inherit"
164
+ })
165
+ },
166
+ {
167
+ value: 'link',
168
+ label: 'Link',
169
+ icon: /*#__PURE__*/ _jsx(LinkIcon, {
170
+ fontSize: "inherit"
171
+ })
172
+ },
173
+ {
174
+ value: 'sync',
175
+ label: 'Sync',
176
+ icon: /*#__PURE__*/ _jsx(SyncIcon, {
177
+ fontSize: "inherit"
178
+ })
179
+ },
180
+ {
181
+ value: 'troubleshoot',
182
+ label: 'Troubleshoot',
183
+ icon: /*#__PURE__*/ _jsx(MagnifyScan, {
184
+ fontSize: "inherit"
185
+ })
186
+ },
187
+ {
188
+ value: 'ask-ai',
189
+ label: 'Ask AI',
190
+ icon: /*#__PURE__*/ _jsx(RobotOutline, {
191
+ fontSize: "inherit"
192
+ })
193
+ }
194
+ ];
195
+ const URL_HELPER_TEXT = 'Supports interpolation: ${__data.fields["fieldName"]}, ${__data.index}, ${__data.count}';
196
+ function createDefaultEventAction() {
197
+ return {
198
+ type: 'event',
199
+ name: 'New Event Action',
200
+ eventName: 'selection-action',
201
+ batchMode: 'individual',
202
+ enabled: true
203
+ };
204
+ }
205
+ function createDefaultWebhookAction() {
206
+ return {
207
+ type: 'webhook',
208
+ name: 'New Webhook Action',
209
+ url: '',
210
+ method: 'POST',
211
+ contentType: 'none',
212
+ batchMode: 'individual',
213
+ enabled: true
214
+ };
215
+ }
216
+ function InterpolationHelper({ batchMode }) {
217
+ let content = /*#__PURE__*/ _jsxs("div", {
218
+ children: [
219
+ "Individual mode patterns: ",
220
+ /*#__PURE__*/ _jsx("code", {
221
+ children: '${__data.fields["field"]}'
222
+ }),
223
+ ", ",
224
+ /*#__PURE__*/ _jsx("code", {
225
+ children: '${__data.index}'
226
+ }),
227
+ ",",
228
+ ' ',
229
+ /*#__PURE__*/ _jsx("code", {
230
+ children: '${__data.count}'
231
+ })
232
+ ]
233
+ });
234
+ if (batchMode === 'batch') {
235
+ content = /*#__PURE__*/ _jsxs("div", {
236
+ children: [
237
+ "Batch mode patterns: ",
238
+ /*#__PURE__*/ _jsx("code", {
239
+ children: '${__data}'
240
+ }),
241
+ ", ",
242
+ /*#__PURE__*/ _jsx("code", {
243
+ children: "${__data[0].fields['field']}"
244
+ }),
245
+ ",",
246
+ ' ',
247
+ /*#__PURE__*/ _jsx("code", {
248
+ children: "${__data.fields['field']:csv}"
249
+ }),
250
+ ", ",
251
+ /*#__PURE__*/ _jsx("code", {
252
+ children: '${__data.count}'
253
+ })
254
+ ]
255
+ });
256
+ }
257
+ return /*#__PURE__*/ _jsx(Typography, {
258
+ variant: "caption",
259
+ color: "text.secondary",
260
+ sx: {
261
+ mb: 1,
262
+ display: 'block'
263
+ },
264
+ children: content
265
+ });
266
+ }
267
+ function EventActionEditor({ action, index, onChange, onRemove, onMoveDown, onMoveUp }) {
268
+ const eventAction = action;
269
+ const [isCollapsed, setIsCollapsed] = useState(true);
270
+ const hasBodyTemplate = (eventAction.bodyTemplate ?? '').trim().length > 0;
271
+ const handleIncludesTemplateChange = useCallback((event)=>{
272
+ const nextContentType = event.target.value;
273
+ const bodyTemplate = nextContentType === 'custom' ? JSON.stringify({}) : undefined;
274
+ onChange(index, {
275
+ ...eventAction,
276
+ bodyTemplate: bodyTemplate
277
+ });
278
+ }, [
279
+ index,
280
+ onChange,
281
+ eventAction
282
+ ]);
283
+ const handleBodyTemplateChange = useCallback((template)=>{
284
+ onChange(index, {
285
+ ...eventAction,
286
+ bodyTemplate: template || undefined
287
+ });
288
+ }, [
289
+ index,
290
+ onChange,
291
+ eventAction
292
+ ]);
293
+ const jsonDataTemplate = useMemo(()=>{
294
+ if (eventAction.bodyTemplate) {
295
+ try {
296
+ return JSON.parse(eventAction.bodyTemplate);
297
+ } catch {
298
+ return {};
299
+ }
300
+ }
301
+ }, [
302
+ eventAction.bodyTemplate
303
+ ]);
304
+ return /*#__PURE__*/ _jsxs(DragAndDropElement, {
305
+ data: eventAction,
306
+ children: [
307
+ /*#__PURE__*/ _jsxs(Stack, {
308
+ direction: "row",
309
+ alignItems: "center",
310
+ justifyContent: "space-between",
311
+ gap: 4,
312
+ children: [
313
+ /*#__PURE__*/ _jsxs(Stack, {
314
+ direction: "row",
315
+ gap: 1,
316
+ children: [
317
+ /*#__PURE__*/ _jsx(IconButton, {
318
+ "data-testid": `event-action-toggle#${eventAction.name}`,
319
+ size: "small",
320
+ onClick: ()=>setIsCollapsed(!isCollapsed),
321
+ children: isCollapsed ? /*#__PURE__*/ _jsx(ChevronRight, {}) : /*#__PURE__*/ _jsx(ChevronDown, {})
322
+ }),
323
+ /*#__PURE__*/ _jsxs(Typography, {
324
+ variant: "overline",
325
+ component: "h4",
326
+ sx: {
327
+ textTransform: 'none'
328
+ },
329
+ children: [
330
+ "EVENT ACTION:",
331
+ ' ',
332
+ eventAction.name ? /*#__PURE__*/ _jsx("span", {
333
+ children: /*#__PURE__*/ _jsx("strong", {
334
+ children: eventAction.name
335
+ })
336
+ }) : /*#__PURE__*/ _jsx("strong", {
337
+ children: eventAction.name
338
+ })
339
+ ]
340
+ })
341
+ ]
342
+ }),
343
+ /*#__PURE__*/ _jsxs(Stack, {
344
+ direction: "row",
345
+ gap: 1,
346
+ children: [
347
+ /*#__PURE__*/ _jsx(InfoTooltip, {
348
+ description: "Remove action settings",
349
+ placement: "top",
350
+ children: /*#__PURE__*/ _jsx(IconButton, {
351
+ size: "small",
352
+ sx: {
353
+ marginLeft: 'auto'
354
+ },
355
+ onClick: ()=>onRemove(index),
356
+ children: /*#__PURE__*/ _jsx(DeleteIcon, {})
357
+ }, "delete-action-button")
358
+ }),
359
+ /*#__PURE__*/ _jsx(InfoTooltip, {
360
+ description: "Reorder action settings",
361
+ placement: "top",
362
+ children: /*#__PURE__*/ _jsx(DragButton, {
363
+ onMoveUp: onMoveUp,
364
+ onMoveDown: onMoveDown,
365
+ menuSx: {
366
+ '.MuiPaper-root': {
367
+ backgroundColor: (theme)=>theme.palette.background.lighter
368
+ }
369
+ }
370
+ }, "reorder-action-button")
371
+ })
372
+ ]
373
+ })
374
+ ]
375
+ }),
376
+ !isCollapsed && /*#__PURE__*/ _jsxs(Stack, {
377
+ spacing: 2,
378
+ children: [
379
+ /*#__PURE__*/ _jsx(OptionsEditorControl, {
380
+ label: "Enabled",
381
+ control: /*#__PURE__*/ _jsx(Switch, {
382
+ checked: eventAction?.enabled ?? false,
383
+ onChange: (e)=>onChange(index, {
384
+ ...eventAction,
385
+ enabled: e.target.checked
386
+ })
387
+ })
388
+ }),
389
+ /*#__PURE__*/ _jsxs(Stack, {
390
+ direction: "row",
391
+ spacing: 2,
392
+ children: [
393
+ /*#__PURE__*/ _jsx(TextField, {
394
+ label: "Action Name",
395
+ size: "small",
396
+ value: eventAction.name,
397
+ onChange: (e)=>onChange(index, {
398
+ ...eventAction,
399
+ name: e.target.value
400
+ }),
401
+ sx: {
402
+ flexGrow: 1
403
+ }
404
+ }),
405
+ /*#__PURE__*/ _jsxs(FormControl, {
406
+ size: "small",
407
+ sx: {
408
+ minWidth: 120
409
+ },
410
+ children: [
411
+ /*#__PURE__*/ _jsx(InputLabel, {
412
+ children: "Icon"
413
+ }),
414
+ /*#__PURE__*/ _jsxs(Select, {
415
+ value: eventAction.icon || '',
416
+ label: "Icon",
417
+ onChange: (e)=>onChange(index, {
418
+ ...eventAction,
419
+ icon: e.target.value || undefined
420
+ }),
421
+ children: [
422
+ /*#__PURE__*/ _jsx(MenuItem, {
423
+ value: "",
424
+ children: /*#__PURE__*/ _jsx("em", {
425
+ children: "None"
426
+ })
427
+ }),
428
+ ACTION_ICONS.map((iconOption)=>/*#__PURE__*/ _jsx(MenuItem, {
429
+ value: iconOption.value,
430
+ children: /*#__PURE__*/ _jsxs(Stack, {
431
+ direction: "row",
432
+ alignItems: "center",
433
+ spacing: 1,
434
+ children: [
435
+ iconOption.icon,
436
+ /*#__PURE__*/ _jsx("span", {
437
+ children: iconOption.label
438
+ })
439
+ ]
440
+ })
441
+ }, iconOption.value))
442
+ ]
443
+ })
444
+ ]
445
+ })
446
+ ]
447
+ }),
448
+ /*#__PURE__*/ _jsxs(Stack, {
449
+ direction: "row",
450
+ spacing: 2,
451
+ children: [
452
+ /*#__PURE__*/ _jsx(TextField, {
453
+ label: "Event Name",
454
+ size: "small",
455
+ value: eventAction.eventName,
456
+ onChange: (e)=>onChange(index, {
457
+ ...eventAction,
458
+ eventName: e.target.value
459
+ }),
460
+ helperText: "Name of the CustomEvent to dispatch (e.g., 'selection-action')",
461
+ fullWidth: true
462
+ }),
463
+ /*#__PURE__*/ _jsxs(FormControl, {
464
+ size: "small",
465
+ sx: {
466
+ flexGrow: 1,
467
+ minWidth: 280
468
+ },
469
+ children: [
470
+ /*#__PURE__*/ _jsx(InputLabel, {
471
+ children: "Batch Mode"
472
+ }),
473
+ /*#__PURE__*/ _jsx(Select, {
474
+ value: eventAction.batchMode ?? 'individual',
475
+ label: "Batch Mode",
476
+ onChange: (e)=>onChange(index, {
477
+ ...eventAction,
478
+ batchMode: e.target.value
479
+ }),
480
+ children: BATCH_MODES.map((mode)=>/*#__PURE__*/ _jsx(MenuItem, {
481
+ value: mode.value,
482
+ children: mode.label
483
+ }, mode.value))
484
+ })
485
+ ]
486
+ })
487
+ ]
488
+ }),
489
+ /*#__PURE__*/ _jsxs(FormControl, {
490
+ component: "fieldset",
491
+ size: "small",
492
+ children: [
493
+ /*#__PURE__*/ _jsx(FormLabel, {
494
+ component: "legend",
495
+ children: "Template"
496
+ }),
497
+ /*#__PURE__*/ _jsxs(RadioGroup, {
498
+ row: true,
499
+ value: hasBodyTemplate ? 'custom' : 'none',
500
+ onChange: handleIncludesTemplateChange,
501
+ children: [
502
+ /*#__PURE__*/ _jsx(FormControlLabel, {
503
+ value: "none",
504
+ control: /*#__PURE__*/ _jsx(Radio, {
505
+ size: "small"
506
+ }),
507
+ label: "None"
508
+ }),
509
+ /*#__PURE__*/ _jsx(FormControlLabel, {
510
+ value: "custom",
511
+ control: /*#__PURE__*/ _jsx(Radio, {
512
+ size: "small"
513
+ }),
514
+ label: "JSON template"
515
+ })
516
+ ]
517
+ })
518
+ ]
519
+ }),
520
+ hasBodyTemplate && /*#__PURE__*/ _jsxs(_Fragment, {
521
+ children: [
522
+ /*#__PURE__*/ _jsx(InterpolationHelper, {
523
+ batchMode: eventAction.batchMode
524
+ }),
525
+ /*#__PURE__*/ _jsx(JSONEditor, {
526
+ value: jsonDataTemplate || '',
527
+ onChange: handleBodyTemplateChange,
528
+ minHeight: "100px",
529
+ maxHeight: "200px"
530
+ })
531
+ ]
532
+ }),
533
+ /*#__PURE__*/ _jsx(TextField, {
534
+ label: "Confirmation Message (optional)",
535
+ size: "small",
536
+ value: eventAction.confirmMessage || '',
537
+ onChange: (e)=>onChange(index, {
538
+ ...eventAction,
539
+ confirmMessage: e.target.value || undefined
540
+ }),
541
+ helperText: "If set, shows a confirmation dialog before executing the action",
542
+ fullWidth: true,
543
+ multiline: true,
544
+ rows: 2
545
+ })
546
+ ]
547
+ })
548
+ ]
549
+ });
550
+ }
551
+ function WebhookActionEditor({ action, index, onChange, onRemove, onMoveUp, onMoveDown }) {
552
+ const webhookAction = action;
553
+ const [pendingChange, setPendingChange] = useState(null);
554
+ const contentTypeValue = webhookAction.contentType ?? 'none';
555
+ const hasBodyTemplate = (webhookAction.bodyTemplate ?? '').trim().length > 0;
556
+ const supportsBody = BODY_METHODS.includes(webhookAction.method);
557
+ const [isCollapsed, setIsCollapsed] = useState(true);
558
+ const handleBodyTemplateChange = useCallback((template)=>{
559
+ onChange(index, {
560
+ ...webhookAction,
561
+ bodyTemplate: template || undefined
562
+ });
563
+ }, [
564
+ index,
565
+ onChange,
566
+ webhookAction
567
+ ]);
568
+ const handleTextTemplateChange = useCallback((event)=>{
569
+ onChange(index, {
570
+ ...webhookAction,
571
+ bodyTemplate: event.target.value || undefined
572
+ });
573
+ }, [
574
+ index,
575
+ onChange,
576
+ webhookAction
577
+ ]);
578
+ const handleContentTypeChange = useCallback((event)=>{
579
+ const nextContentType = event.target.value;
580
+ if (nextContentType === contentTypeValue) {
581
+ return;
582
+ }
583
+ if (hasBodyTemplate) {
584
+ setPendingChange({
585
+ kind: 'contentType',
586
+ value: nextContentType
587
+ });
588
+ return;
589
+ }
590
+ onChange(index, {
591
+ ...webhookAction,
592
+ contentType: nextContentType
593
+ });
594
+ }, [
595
+ contentTypeValue,
596
+ hasBodyTemplate,
597
+ index,
598
+ onChange,
599
+ webhookAction
600
+ ]);
601
+ const handleMethodChange = useCallback((event)=>{
602
+ const nextMethod = event.target.value;
603
+ if (nextMethod === webhookAction.method) {
604
+ return;
605
+ }
606
+ const nextSupportsBody = BODY_METHODS.includes(nextMethod);
607
+ if (!nextSupportsBody && hasBodyTemplate) {
608
+ setPendingChange({
609
+ kind: 'method',
610
+ value: nextMethod
611
+ });
612
+ return;
613
+ }
614
+ onChange(index, {
615
+ ...webhookAction,
616
+ method: nextMethod
617
+ });
618
+ }, [
619
+ hasBodyTemplate,
620
+ index,
621
+ onChange,
622
+ webhookAction
623
+ ]);
624
+ const handleConfirmClose = useCallback(()=>{
625
+ setPendingChange(null);
626
+ }, []);
627
+ const handleConfirmApply = useCallback(()=>{
628
+ if (!pendingChange) {
629
+ return;
630
+ }
631
+ if (pendingChange.kind === 'contentType') {
632
+ onChange(index, {
633
+ ...webhookAction,
634
+ contentType: pendingChange.value,
635
+ bodyTemplate: undefined
636
+ });
637
+ } else {
638
+ onChange(index, {
639
+ ...webhookAction,
640
+ method: pendingChange.value,
641
+ bodyTemplate: undefined
642
+ });
643
+ }
644
+ setPendingChange(null);
645
+ }, [
646
+ index,
647
+ onChange,
648
+ pendingChange,
649
+ webhookAction
650
+ ]);
651
+ const jsonBodyTemplate = useMemo(()=>{
652
+ if (webhookAction.contentType === 'json' && webhookAction.bodyTemplate) {
653
+ try {
654
+ return JSON.parse(webhookAction.bodyTemplate);
655
+ } catch {
656
+ return {};
657
+ }
658
+ }
659
+ }, [
660
+ webhookAction.bodyTemplate,
661
+ webhookAction.contentType
662
+ ]);
663
+ return /*#__PURE__*/ _jsxs(DragAndDropElement, {
664
+ data: webhookAction,
665
+ children: [
666
+ /*#__PURE__*/ _jsxs(Stack, {
667
+ direction: "row",
668
+ alignItems: "center",
669
+ justifyContent: "space-between",
670
+ gap: 4,
671
+ children: [
672
+ /*#__PURE__*/ _jsxs(Stack, {
673
+ direction: "row",
674
+ gap: 1,
675
+ children: [
676
+ /*#__PURE__*/ _jsx(IconButton, {
677
+ "data-testid": `column-toggle#${webhookAction.name}`,
678
+ size: "small",
679
+ onClick: ()=>setIsCollapsed(!isCollapsed),
680
+ children: isCollapsed ? /*#__PURE__*/ _jsx(ChevronRight, {}) : /*#__PURE__*/ _jsx(ChevronDown, {})
681
+ }),
682
+ /*#__PURE__*/ _jsxs(Typography, {
683
+ variant: "overline",
684
+ component: "h4",
685
+ sx: {
686
+ textTransform: 'none'
687
+ },
688
+ children: [
689
+ "WEBHOOK ACTION: ",
690
+ /*#__PURE__*/ _jsx("strong", {
691
+ children: webhookAction.name
692
+ })
693
+ ]
694
+ })
695
+ ]
696
+ }),
697
+ /*#__PURE__*/ _jsxs(Stack, {
698
+ direction: "row",
699
+ gap: 1,
700
+ children: [
701
+ /*#__PURE__*/ _jsx(InfoTooltip, {
702
+ description: "Remove action settings",
703
+ placement: "top",
704
+ children: /*#__PURE__*/ _jsx(IconButton, {
705
+ size: "small",
706
+ sx: {
707
+ marginLeft: 'auto'
708
+ },
709
+ onClick: ()=>onRemove(index),
710
+ children: /*#__PURE__*/ _jsx(DeleteIcon, {})
711
+ }, "delete-action-button")
712
+ }),
713
+ /*#__PURE__*/ _jsx(InfoTooltip, {
714
+ description: "Reorder action settings",
715
+ placement: "top",
716
+ children: /*#__PURE__*/ _jsx(DragButton, {
717
+ onMoveUp: onMoveUp,
718
+ onMoveDown: onMoveDown,
719
+ menuSx: {
720
+ '.MuiPaper-root': {
721
+ backgroundColor: (theme)=>theme.palette.background.lighter
722
+ }
723
+ }
724
+ }, "reorder-action-button")
725
+ })
726
+ ]
727
+ })
728
+ ]
729
+ }),
730
+ !isCollapsed && /*#__PURE__*/ _jsxs(Stack, {
731
+ spacing: 2,
732
+ children: [
733
+ /*#__PURE__*/ _jsx(OptionsEditorControl, {
734
+ label: "Enabled",
735
+ control: /*#__PURE__*/ _jsx(Switch, {
736
+ checked: action?.enabled ?? false,
737
+ onChange: (e)=>onChange(index, {
738
+ ...webhookAction,
739
+ enabled: e.target.checked
740
+ })
741
+ })
742
+ }),
743
+ /*#__PURE__*/ _jsxs(Stack, {
744
+ direction: "row",
745
+ spacing: 2,
746
+ children: [
747
+ /*#__PURE__*/ _jsx(TextField, {
748
+ label: "Action Name",
749
+ size: "small",
750
+ value: webhookAction.name,
751
+ onChange: (e)=>onChange(index, {
752
+ ...webhookAction,
753
+ name: e.target.value
754
+ }),
755
+ sx: {
756
+ flexGrow: 1
757
+ }
758
+ }),
759
+ /*#__PURE__*/ _jsxs(FormControl, {
760
+ size: "small",
761
+ sx: {
762
+ minWidth: 120
763
+ },
764
+ children: [
765
+ /*#__PURE__*/ _jsx(InputLabel, {
766
+ children: "Icon"
767
+ }),
768
+ /*#__PURE__*/ _jsxs(Select, {
769
+ value: webhookAction.icon || '',
770
+ label: "Icon",
771
+ onChange: (e)=>onChange(index, {
772
+ ...webhookAction,
773
+ icon: e.target.value || undefined
774
+ }),
775
+ children: [
776
+ /*#__PURE__*/ _jsx(MenuItem, {
777
+ value: "",
778
+ children: /*#__PURE__*/ _jsx("em", {
779
+ children: "None"
780
+ })
781
+ }),
782
+ ACTION_ICONS.map((iconOption)=>/*#__PURE__*/ _jsx(MenuItem, {
783
+ value: iconOption.value,
784
+ children: /*#__PURE__*/ _jsxs(Stack, {
785
+ direction: "row",
786
+ alignItems: "center",
787
+ spacing: 1,
788
+ children: [
789
+ iconOption.icon,
790
+ /*#__PURE__*/ _jsx("span", {
791
+ children: iconOption.label
792
+ })
793
+ ]
794
+ })
795
+ }, iconOption.value))
796
+ ]
797
+ })
798
+ ]
799
+ })
800
+ ]
801
+ }),
802
+ /*#__PURE__*/ _jsx(TextField, {
803
+ label: "URL",
804
+ size: "small",
805
+ value: webhookAction.url,
806
+ onChange: (e)=>onChange(index, {
807
+ ...webhookAction,
808
+ url: e.target.value
809
+ }),
810
+ helperText: URL_HELPER_TEXT,
811
+ fullWidth: true
812
+ }),
813
+ /*#__PURE__*/ _jsxs(Stack, {
814
+ direction: "row",
815
+ spacing: 2,
816
+ children: [
817
+ /*#__PURE__*/ _jsxs(FormControl, {
818
+ size: "small",
819
+ sx: {
820
+ minWidth: 120
821
+ },
822
+ children: [
823
+ /*#__PURE__*/ _jsx(InputLabel, {
824
+ children: "Method"
825
+ }),
826
+ /*#__PURE__*/ _jsx(Select, {
827
+ value: webhookAction.method,
828
+ label: "Method",
829
+ onChange: handleMethodChange,
830
+ children: HTTP_METHODS.map((method)=>/*#__PURE__*/ _jsx(MenuItem, {
831
+ value: method,
832
+ children: method
833
+ }, method))
834
+ })
835
+ ]
836
+ }),
837
+ /*#__PURE__*/ _jsxs(FormControl, {
838
+ size: "small",
839
+ sx: {
840
+ flexGrow: 1
841
+ },
842
+ children: [
843
+ /*#__PURE__*/ _jsx(InputLabel, {
844
+ children: "Batch Mode"
845
+ }),
846
+ /*#__PURE__*/ _jsx(Select, {
847
+ value: webhookAction.batchMode,
848
+ label: "Batch Mode",
849
+ onChange: (e)=>onChange(index, {
850
+ ...webhookAction,
851
+ batchMode: e.target.value
852
+ }),
853
+ children: BATCH_MODES.map((mode)=>/*#__PURE__*/ _jsx(MenuItem, {
854
+ value: mode.value,
855
+ children: mode.label
856
+ }, mode.value))
857
+ })
858
+ ]
859
+ })
860
+ ]
861
+ }),
862
+ /*#__PURE__*/ _jsxs(FormControl, {
863
+ component: "fieldset",
864
+ size: "small",
865
+ children: [
866
+ /*#__PURE__*/ _jsx(FormLabel, {
867
+ component: "legend",
868
+ children: "Content Type"
869
+ }),
870
+ /*#__PURE__*/ _jsx(RadioGroup, {
871
+ row: true,
872
+ value: contentTypeValue,
873
+ onChange: handleContentTypeChange,
874
+ children: CONTENT_TYPES.map((option)=>/*#__PURE__*/ _jsx(FormControlLabel, {
875
+ value: option.value,
876
+ control: /*#__PURE__*/ _jsx(Radio, {
877
+ size: "small"
878
+ }),
879
+ label: option.label
880
+ }, option.value))
881
+ })
882
+ ]
883
+ }),
884
+ supportsBody && contentTypeValue !== 'none' && /*#__PURE__*/ _jsxs(Box, {
885
+ children: [
886
+ /*#__PURE__*/ _jsx(Typography, {
887
+ variant: "body2",
888
+ color: "text.secondary",
889
+ sx: {
890
+ mb: 1
891
+ },
892
+ children: contentTypeValue === 'json' ? 'Body Template (JSON)' : 'Body Template (Text)'
893
+ }),
894
+ /*#__PURE__*/ _jsx(InterpolationHelper, {
895
+ batchMode: webhookAction.batchMode
896
+ }),
897
+ contentTypeValue === 'json' ? /*#__PURE__*/ _jsx(JSONEditor, {
898
+ value: jsonBodyTemplate || '',
899
+ onChange: handleBodyTemplateChange,
900
+ minHeight: "100px",
901
+ maxHeight: "200px"
902
+ }) : /*#__PURE__*/ _jsx(TextField, {
903
+ value: webhookAction.bodyTemplate || '',
904
+ onChange: handleTextTemplateChange,
905
+ fullWidth: true,
906
+ multiline: true,
907
+ rows: 5
908
+ })
909
+ ]
910
+ }),
911
+ /*#__PURE__*/ _jsx(TextField, {
912
+ label: "Confirmation Message (optional)",
913
+ size: "small",
914
+ value: webhookAction.confirmMessage || '',
915
+ onChange: (e)=>onChange(index, {
916
+ ...webhookAction,
917
+ confirmMessage: e.target.value || undefined
918
+ }),
919
+ helperText: "If set, shows a confirmation dialog before executing the action",
920
+ fullWidth: true,
921
+ multiline: true,
922
+ rows: 2
923
+ })
924
+ ]
925
+ }),
926
+ /*#__PURE__*/ _jsxs(Dialog, {
927
+ open: Boolean(pendingChange),
928
+ onClose: handleConfirmClose,
929
+ "aria-labelledby": "selection-body-clear-title",
930
+ children: [
931
+ /*#__PURE__*/ _jsx(DialogTitle, {
932
+ id: "selection-body-clear-title",
933
+ children: "Remove Body Template?"
934
+ }),
935
+ /*#__PURE__*/ _jsx(DialogContent, {
936
+ children: /*#__PURE__*/ _jsx(DialogContentText, {
937
+ children: BODY_CLEAR_CONFIRM_MESSAGE
938
+ })
939
+ }),
940
+ /*#__PURE__*/ _jsxs(DialogActions, {
941
+ children: [
942
+ /*#__PURE__*/ _jsx(Button, {
943
+ onClick: handleConfirmClose,
944
+ children: "Cancel"
945
+ }),
946
+ /*#__PURE__*/ _jsx(Button, {
947
+ onClick: handleConfirmApply,
948
+ variant: "contained",
949
+ color: "primary",
950
+ children: "Continue"
951
+ })
952
+ ]
953
+ })
954
+ ]
955
+ })
956
+ ]
957
+ });
958
+ }
959
+ export function ItemSelectionActionsEditor({ actionOptions, selectionOptions, onChangeActions, onChangeSelection }) {
960
+ const actions = useMemo(()=>actionOptions || {
961
+ enabled: true,
962
+ displayInHeader: true,
963
+ displayWithItem: false
964
+ }, [
965
+ actionOptions
966
+ ]);
967
+ const handleEnableActionsChange = (_, checked)=>{
968
+ onChangeActions({
969
+ ...actions,
970
+ enabled: checked ? true : undefined
971
+ });
972
+ };
973
+ const handleEnableSelectionChange = (_, checked)=>{
974
+ onChangeSelection({
975
+ ...selectionOptions,
976
+ enabled: checked ? true : undefined
977
+ });
978
+ };
979
+ const handleDisplayInHeaderChange = (_, checked)=>{
980
+ onChangeActions({
981
+ ...actions,
982
+ displayInHeader: checked ? true : undefined
983
+ });
984
+ };
985
+ const handleDisplayWithItemChange = (_, checked)=>{
986
+ onChangeActions({
987
+ ...actions,
988
+ displayWithItem: checked ? true : undefined
989
+ });
990
+ };
991
+ const handleAddEventAction = useCallback(()=>{
992
+ onChangeActions({
993
+ ...actions,
994
+ actionsList: [
995
+ ...actions.actionsList ?? [],
996
+ createDefaultEventAction()
997
+ ]
998
+ });
999
+ }, [
1000
+ actions,
1001
+ onChangeActions
1002
+ ]);
1003
+ const handleAddWebhookAction = useCallback(()=>{
1004
+ onChangeActions({
1005
+ ...actions,
1006
+ actionsList: [
1007
+ ...actions.actionsList ?? [],
1008
+ createDefaultWebhookAction()
1009
+ ]
1010
+ });
1011
+ }, [
1012
+ actions,
1013
+ onChangeActions
1014
+ ]);
1015
+ const handleActionChange = useCallback((index, updatedAction)=>{
1016
+ const newActions = actions.actionsList ? [
1017
+ ...actions.actionsList
1018
+ ] : [];
1019
+ newActions[index] = updatedAction;
1020
+ onChangeActions({
1021
+ ...actions,
1022
+ actionsList: newActions
1023
+ });
1024
+ }, [
1025
+ actions,
1026
+ onChangeActions
1027
+ ]);
1028
+ const handleRemoveAction = useCallback((index)=>{
1029
+ const newActions = actions.actionsList ? actions.actionsList.filter((_, i)=>i !== index) : [];
1030
+ onChangeActions(newActions.length > 0 ? {
1031
+ ...actions,
1032
+ actionsList: newActions
1033
+ } : undefined);
1034
+ }, [
1035
+ actions,
1036
+ onChangeActions
1037
+ ]);
1038
+ useDragAndDropMonitor({
1039
+ elements: actions.actionsList,
1040
+ accessKey: 'name',
1041
+ onChange: (newElements)=>{
1042
+ onChangeActions({
1043
+ ...actions,
1044
+ actionsList: newElements
1045
+ });
1046
+ }
1047
+ });
1048
+ return /*#__PURE__*/ _jsxs(Stack, {
1049
+ spacing: 1,
1050
+ children: [
1051
+ /*#__PURE__*/ _jsx(OptionsEditorControl, {
1052
+ label: "Enable Item Selection",
1053
+ description: "Allow selecting items",
1054
+ control: /*#__PURE__*/ _jsx(Switch, {
1055
+ checked: selectionOptions?.enabled ?? false,
1056
+ onChange: handleEnableSelectionChange
1057
+ })
1058
+ }),
1059
+ /*#__PURE__*/ _jsx(OptionsEditorControl, {
1060
+ label: "Enable Item Actions",
1061
+ description: "Allow executing actions on selected items",
1062
+ control: /*#__PURE__*/ _jsx(Switch, {
1063
+ checked: actionOptions?.enabled ?? false,
1064
+ onChange: handleEnableActionsChange
1065
+ })
1066
+ }),
1067
+ /*#__PURE__*/ _jsx(OptionsEditorControl, {
1068
+ label: "Display Actions in Panel Header",
1069
+ description: "Show action buttons in the panel header when items are selected",
1070
+ control: /*#__PURE__*/ _jsx(Switch, {
1071
+ checked: actionOptions?.displayInHeader ?? false,
1072
+ onChange: handleDisplayInHeaderChange
1073
+ })
1074
+ }),
1075
+ /*#__PURE__*/ _jsx(OptionsEditorControl, {
1076
+ label: "Display Actions with Each Item",
1077
+ description: "Show action buttons alongside each item when selected",
1078
+ control: /*#__PURE__*/ _jsx(Switch, {
1079
+ checked: actionOptions?.displayWithItem ?? false,
1080
+ onChange: handleDisplayWithItemChange
1081
+ })
1082
+ }),
1083
+ /*#__PURE__*/ _jsx(OptionsEditorGroup, {
1084
+ title: "Actions",
1085
+ children: /*#__PURE__*/ _jsxs(Stack, {
1086
+ spacing: 3,
1087
+ children: [
1088
+ !actions.actionsList || actions.actionsList.length === 0 ? /*#__PURE__*/ _jsx(Typography, {
1089
+ variant: "body2",
1090
+ color: "text.secondary",
1091
+ fontStyle: "italic",
1092
+ children: "No actions defined. Add an action to enable triggering events or webhooks on selected data."
1093
+ }) : /*#__PURE__*/ _jsx(Stack, {
1094
+ spacing: 1,
1095
+ border: "none",
1096
+ children: actions.actionsList && actions.actionsList.map((action, index)=>/*#__PURE__*/ _jsx(Box, {
1097
+ borderBottom: 1,
1098
+ borderColor: (theme)=>theme.palette.divider,
1099
+ pb: 1,
1100
+ children: action.type === 'event' ? /*#__PURE__*/ _jsx(EventActionEditor, {
1101
+ action: action,
1102
+ index: index,
1103
+ onChange: handleActionChange,
1104
+ onRemove: handleRemoveAction,
1105
+ onMoveDown: ()=>onChangeActions({
1106
+ ...actions,
1107
+ actionsList: handleMoveDown(action, actions.actionsList)
1108
+ }),
1109
+ onMoveUp: ()=>onChangeActions({
1110
+ ...actions,
1111
+ actionsList: handleMoveUp(action, actions.actionsList)
1112
+ })
1113
+ }) : /*#__PURE__*/ _jsx(WebhookActionEditor, {
1114
+ action: action,
1115
+ index: index,
1116
+ onChange: handleActionChange,
1117
+ onRemove: handleRemoveAction,
1118
+ onMoveDown: ()=>onChangeActions({
1119
+ ...actions,
1120
+ actionsList: handleMoveDown(action, actions.actionsList)
1121
+ }),
1122
+ onMoveUp: ()=>onChangeActions({
1123
+ ...actions,
1124
+ actionsList: handleMoveUp(action, actions.actionsList)
1125
+ })
1126
+ })
1127
+ }, index))
1128
+ }),
1129
+ /*#__PURE__*/ _jsxs(Stack, {
1130
+ direction: "row",
1131
+ spacing: 1,
1132
+ children: [
1133
+ /*#__PURE__*/ _jsx(Button, {
1134
+ variant: "contained",
1135
+ startIcon: /*#__PURE__*/ _jsx(PlusIcon, {}),
1136
+ onClick: handleAddEventAction,
1137
+ children: "Add Event Action"
1138
+ }),
1139
+ /*#__PURE__*/ _jsx(Button, {
1140
+ variant: "contained",
1141
+ startIcon: /*#__PURE__*/ _jsx(PlusIcon, {}),
1142
+ onClick: handleAddWebhookAction,
1143
+ children: "Add Webhook Action"
1144
+ })
1145
+ ]
1146
+ })
1147
+ ]
1148
+ })
1149
+ })
1150
+ ]
1151
+ });
1152
+ }
1153
+
1154
+ //# sourceMappingURL=ItemSelectionActionsOptionsEditor.js.map