@perses-dev/dashboards 0.38.0 → 0.40.0

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 (303) hide show
  1. package/dist/cjs/components/AddGroupButton/AddGroupButton.js +9 -7
  2. package/dist/cjs/components/AddGroupButton/index.js +10 -8
  3. package/dist/cjs/components/AddPanelButton/AddPanelButton.js +9 -7
  4. package/dist/cjs/components/AddPanelButton/index.js +10 -8
  5. package/dist/cjs/components/Dashboard/Dashboard.js +14 -11
  6. package/dist/cjs/components/Dashboard/index.js +10 -8
  7. package/dist/cjs/components/DashboardStickyToolbar/DashboardStickyToolbar.js +18 -16
  8. package/dist/cjs/components/DashboardStickyToolbar/index.js +10 -8
  9. package/dist/cjs/components/DashboardToolbar/DashboardToolbar.js +43 -41
  10. package/dist/cjs/components/DashboardToolbar/index.js +10 -8
  11. package/dist/cjs/components/DeletePanelDialog/DeletePanelDialog.js +12 -10
  12. package/dist/cjs/components/DeletePanelDialog/index.js +10 -8
  13. package/dist/cjs/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +17 -15
  14. package/dist/cjs/components/DeletePanelGroupDialog/index.js +10 -8
  15. package/dist/cjs/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js +5 -3
  16. package/dist/cjs/components/DiscardChangesConfirmationDialog/index.js +10 -8
  17. package/dist/cjs/components/DownloadButton/DownloadButton.js +12 -10
  18. package/dist/cjs/components/DownloadButton/index.js +10 -8
  19. package/dist/cjs/components/EditButton/EditButton.js +8 -6
  20. package/dist/cjs/components/EditButton/index.js +10 -8
  21. package/dist/cjs/components/EditJsonButton/EditJsonButton.js +10 -8
  22. package/dist/cjs/components/EditJsonButton/index.js +10 -8
  23. package/dist/cjs/components/EditJsonDialog/EditJsonDialog.js +29 -23
  24. package/dist/cjs/components/EditJsonDialog/index.js +10 -8
  25. package/dist/cjs/components/EmptyDashboard/EmptyDashboard.js +18 -16
  26. package/dist/cjs/components/EmptyDashboard/index.js +10 -8
  27. package/dist/cjs/components/GridLayout/GridContainer.js +5 -3
  28. package/dist/cjs/components/GridLayout/GridItemContent.js +33 -12
  29. package/dist/cjs/components/GridLayout/GridLayout.js +19 -16
  30. package/dist/cjs/components/GridLayout/GridTitle.js +35 -33
  31. package/dist/cjs/components/GridLayout/index.js +13 -11
  32. package/dist/cjs/components/Panel/Panel.js +21 -21
  33. package/dist/cjs/components/Panel/PanelContent.js +8 -6
  34. package/dist/cjs/components/Panel/PanelHeader.js +39 -33
  35. package/dist/cjs/components/Panel/index.js +10 -8
  36. package/dist/cjs/components/PanelDrawer/PanelDrawer.js +25 -77
  37. package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +269 -141
  38. package/dist/cjs/components/PanelDrawer/PanelPreview.js +11 -9
  39. package/dist/cjs/components/PanelDrawer/index.js +10 -8
  40. package/dist/cjs/components/PanelDrawer/usePanelEditor.js +3 -1
  41. package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.js +18 -16
  42. package/dist/cjs/components/PanelGroupDialog/PanelGroupEditorForm.js +15 -11
  43. package/dist/cjs/components/PanelGroupDialog/index.js +10 -8
  44. package/dist/cjs/components/QuerySummaryTable/QuerySummaryTable.js +46 -44
  45. package/dist/cjs/components/QuerySummaryTable/index.js +10 -8
  46. package/dist/cjs/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +23 -21
  47. package/dist/cjs/components/SaveChangesConfirmationDialog/index.js +10 -8
  48. package/dist/cjs/components/SaveDashboardButton/SaveDashboardButton.js +11 -9
  49. package/dist/cjs/components/SaveDashboardButton/index.js +10 -8
  50. package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +40 -16
  51. package/dist/cjs/components/TimeRangeControls/index.js +10 -8
  52. package/dist/cjs/components/ToolbarIconButton/ToolbarIconButton.js +5 -3
  53. package/dist/cjs/components/ToolbarIconButton/index.js +10 -8
  54. package/dist/cjs/components/Variables/BuiltinVariableAccordions.js +140 -0
  55. package/dist/cjs/components/Variables/EditVariablesButton.js +18 -11
  56. package/dist/cjs/components/Variables/TemplateVariable.js +127 -76
  57. package/dist/cjs/components/Variables/VariableEditor.js +356 -117
  58. package/dist/cjs/components/Variables/VariableList.js +45 -21
  59. package/dist/cjs/components/Variables/index.js +14 -11
  60. package/dist/cjs/components/index.js +31 -29
  61. package/dist/cjs/constants/grid-layout-config.js +6 -2
  62. package/dist/cjs/constants/index.js +11 -9
  63. package/dist/cjs/constants/user-interface-text.js +6 -2
  64. package/dist/cjs/context/DashboardProvider/DashboardProvider.js +40 -34
  65. package/dist/cjs/context/DashboardProvider/common.js +6 -2
  66. package/dist/cjs/context/DashboardProvider/dashboard-provider-api.js +70 -38
  67. package/dist/cjs/context/DashboardProvider/delete-panel-group-slice.js +3 -1
  68. package/dist/cjs/context/DashboardProvider/delete-panel-slice.js +5 -3
  69. package/dist/cjs/context/DashboardProvider/discard-changes-dialog-slice.js +3 -1
  70. package/dist/cjs/context/DashboardProvider/duplicate-panel-slice.js +3 -1
  71. package/dist/cjs/context/DashboardProvider/edit-json-dialog-slice.js +3 -1
  72. package/dist/cjs/context/DashboardProvider/index.js +12 -10
  73. package/dist/cjs/context/DashboardProvider/panel-editor-slice.js +13 -11
  74. package/dist/cjs/context/DashboardProvider/panel-group-editor-slice.js +8 -6
  75. package/dist/cjs/context/DashboardProvider/panel-group-slice.js +15 -7
  76. package/dist/cjs/context/DashboardProvider/panel-slice.js +3 -1
  77. package/dist/cjs/context/DashboardProvider/save-changes-dialog-slice.js +3 -1
  78. package/dist/cjs/context/DatasourceStoreProvider.js +114 -45
  79. package/dist/cjs/context/TemplateVariableProvider/TemplateVariableProvider.js +189 -51
  80. package/dist/cjs/context/TemplateVariableProvider/hydrationUtils.js +65 -13
  81. package/dist/cjs/context/TemplateVariableProvider/index.js +10 -8
  82. package/dist/cjs/context/TemplateVariableProvider/query-params.js +17 -7
  83. package/dist/cjs/context/TemplateVariableProvider/utils.js +49 -9
  84. package/dist/cjs/context/index.js +13 -11
  85. package/dist/cjs/context/useDashboard.js +8 -6
  86. package/dist/cjs/index.js +12 -10
  87. package/dist/cjs/stories/decorators/WithDashboard.js +6 -4
  88. package/dist/cjs/stories/decorators/WithDatasourceStore.js +6 -4
  89. package/dist/cjs/stories/decorators/WithTemplateVariables.js +6 -4
  90. package/dist/cjs/stories/decorators/constants.js +5 -3
  91. package/dist/cjs/stories/decorators/index.js +13 -11
  92. package/dist/cjs/test/dashboard-provider.js +8 -4
  93. package/dist/cjs/test/datasource-provider.js +16 -12
  94. package/dist/cjs/test/index.js +13 -11
  95. package/dist/cjs/test/plugin-registry.js +6 -4
  96. package/dist/cjs/test/render.js +27 -20
  97. package/dist/cjs/test/setup-tests.js +2 -2
  98. package/dist/cjs/test/testDashboard.js +13 -11
  99. package/dist/cjs/utils/index.js +11 -9
  100. package/dist/cjs/utils/panelUtils.js +9 -3
  101. package/dist/cjs/utils/time.js +5 -3
  102. package/dist/cjs/validation/index.js +30 -0
  103. package/dist/cjs/validation/panel.js +29 -0
  104. package/dist/cjs/views/ViewDashboard/DashboardApp.js +24 -15
  105. package/dist/cjs/views/ViewDashboard/ViewDashboard.js +64 -19
  106. package/dist/cjs/views/ViewDashboard/index.js +10 -8
  107. package/dist/cjs/views/index.js +10 -8
  108. package/dist/components/AddGroupButton/AddGroupButton.js.map +1 -1
  109. package/dist/components/AddGroupButton/index.js.map +1 -1
  110. package/dist/components/AddPanelButton/AddPanelButton.js.map +1 -1
  111. package/dist/components/AddPanelButton/index.js.map +1 -1
  112. package/dist/components/Dashboard/Dashboard.d.ts +3 -1
  113. package/dist/components/Dashboard/Dashboard.d.ts.map +1 -1
  114. package/dist/components/Dashboard/Dashboard.js +3 -2
  115. package/dist/components/Dashboard/Dashboard.js.map +1 -1
  116. package/dist/components/Dashboard/index.js.map +1 -1
  117. package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js.map +1 -1
  118. package/dist/components/DashboardStickyToolbar/index.js.map +1 -1
  119. package/dist/components/DashboardToolbar/DashboardToolbar.js +1 -1
  120. package/dist/components/DashboardToolbar/DashboardToolbar.js.map +1 -1
  121. package/dist/components/DashboardToolbar/index.js.map +1 -1
  122. package/dist/components/DeletePanelDialog/DeletePanelDialog.js.map +1 -1
  123. package/dist/components/DeletePanelDialog/index.js.map +1 -1
  124. package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +2 -2
  125. package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js.map +1 -1
  126. package/dist/components/DeletePanelGroupDialog/index.js.map +1 -1
  127. package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js.map +1 -1
  128. package/dist/components/DiscardChangesConfirmationDialog/index.js.map +1 -1
  129. package/dist/components/DownloadButton/DownloadButton.js.map +1 -1
  130. package/dist/components/DownloadButton/index.js.map +1 -1
  131. package/dist/components/EditButton/EditButton.js.map +1 -1
  132. package/dist/components/EditButton/index.js.map +1 -1
  133. package/dist/components/EditJsonButton/EditJsonButton.js.map +1 -1
  134. package/dist/components/EditJsonButton/index.js.map +1 -1
  135. package/dist/components/EditJsonDialog/EditJsonDialog.d.ts +4 -1
  136. package/dist/components/EditJsonDialog/EditJsonDialog.d.ts.map +1 -1
  137. package/dist/components/EditJsonDialog/EditJsonDialog.js +12 -8
  138. package/dist/components/EditJsonDialog/EditJsonDialog.js.map +1 -1
  139. package/dist/components/EditJsonDialog/index.js.map +1 -1
  140. package/dist/components/EmptyDashboard/EmptyDashboard.js.map +1 -1
  141. package/dist/components/EmptyDashboard/index.js.map +1 -1
  142. package/dist/components/GridLayout/GridContainer.js.map +1 -1
  143. package/dist/components/GridLayout/GridItemContent.d.ts +2 -0
  144. package/dist/components/GridLayout/GridItemContent.d.ts.map +1 -1
  145. package/dist/components/GridLayout/GridItemContent.js +27 -8
  146. package/dist/components/GridLayout/GridItemContent.js.map +1 -1
  147. package/dist/components/GridLayout/GridLayout.d.ts +2 -0
  148. package/dist/components/GridLayout/GridLayout.d.ts.map +1 -1
  149. package/dist/components/GridLayout/GridLayout.js +3 -2
  150. package/dist/components/GridLayout/GridLayout.js.map +1 -1
  151. package/dist/components/GridLayout/GridTitle.js.map +1 -1
  152. package/dist/components/GridLayout/index.js.map +1 -1
  153. package/dist/components/Panel/Panel.d.ts +20 -0
  154. package/dist/components/Panel/Panel.d.ts.map +1 -1
  155. package/dist/components/Panel/Panel.js +8 -10
  156. package/dist/components/Panel/Panel.js.map +1 -1
  157. package/dist/components/Panel/PanelContent.js.map +1 -1
  158. package/dist/components/Panel/PanelHeader.d.ts +2 -1
  159. package/dist/components/Panel/PanelHeader.d.ts.map +1 -1
  160. package/dist/components/Panel/PanelHeader.js +7 -3
  161. package/dist/components/Panel/PanelHeader.js.map +1 -1
  162. package/dist/components/Panel/index.js.map +1 -1
  163. package/dist/components/PanelDrawer/PanelDrawer.d.ts.map +1 -1
  164. package/dist/components/PanelDrawer/PanelDrawer.js +22 -76
  165. package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -1
  166. package/dist/components/PanelDrawer/PanelEditorForm.d.ts +4 -1
  167. package/dist/components/PanelDrawer/PanelEditorForm.d.ts.map +1 -1
  168. package/dist/components/PanelDrawer/PanelEditorForm.js +223 -138
  169. package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -1
  170. package/dist/components/PanelDrawer/PanelPreview.d.ts.map +1 -1
  171. package/dist/components/PanelDrawer/PanelPreview.js +2 -2
  172. package/dist/components/PanelDrawer/PanelPreview.js.map +1 -1
  173. package/dist/components/PanelDrawer/index.js.map +1 -1
  174. package/dist/components/PanelDrawer/usePanelEditor.js.map +1 -1
  175. package/dist/components/PanelGroupDialog/PanelGroupDialog.js.map +1 -1
  176. package/dist/components/PanelGroupDialog/PanelGroupEditorForm.js.map +1 -1
  177. package/dist/components/PanelGroupDialog/index.js.map +1 -1
  178. package/dist/components/QuerySummaryTable/QuerySummaryTable.js +4 -4
  179. package/dist/components/QuerySummaryTable/QuerySummaryTable.js.map +1 -1
  180. package/dist/components/QuerySummaryTable/index.js.map +1 -1
  181. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +4 -4
  182. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js.map +1 -1
  183. package/dist/components/SaveChangesConfirmationDialog/index.js.map +1 -1
  184. package/dist/components/SaveDashboardButton/SaveDashboardButton.js +4 -4
  185. package/dist/components/SaveDashboardButton/SaveDashboardButton.js.map +1 -1
  186. package/dist/components/SaveDashboardButton/index.js.map +1 -1
  187. package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -1
  188. package/dist/components/TimeRangeControls/TimeRangeControls.js +19 -1
  189. package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
  190. package/dist/components/TimeRangeControls/index.js.map +1 -1
  191. package/dist/components/ToolbarIconButton/ToolbarIconButton.js.map +1 -1
  192. package/dist/components/ToolbarIconButton/index.js.map +1 -1
  193. package/dist/components/Variables/BuiltinVariableAccordions.d.ts +8 -0
  194. package/dist/components/Variables/BuiltinVariableAccordions.d.ts.map +1 -0
  195. package/dist/components/Variables/BuiltinVariableAccordions.js +127 -0
  196. package/dist/components/Variables/BuiltinVariableAccordions.js.map +1 -0
  197. package/dist/components/Variables/EditVariablesButton.d.ts.map +1 -1
  198. package/dist/components/Variables/EditVariablesButton.js +6 -1
  199. package/dist/components/Variables/EditVariablesButton.js.map +1 -1
  200. package/dist/components/Variables/TemplateVariable.d.ts +12 -2
  201. package/dist/components/Variables/TemplateVariable.d.ts.map +1 -1
  202. package/dist/components/Variables/TemplateVariable.js +102 -61
  203. package/dist/components/Variables/TemplateVariable.js.map +1 -1
  204. package/dist/components/Variables/VariableEditor.d.ts +9 -1
  205. package/dist/components/Variables/VariableEditor.d.ts.map +1 -1
  206. package/dist/components/Variables/VariableEditor.js +326 -97
  207. package/dist/components/Variables/VariableEditor.js.map +1 -1
  208. package/dist/components/Variables/VariableList.d.ts +5 -0
  209. package/dist/components/Variables/VariableList.d.ts.map +1 -1
  210. package/dist/components/Variables/VariableList.js +32 -18
  211. package/dist/components/Variables/VariableList.js.map +1 -1
  212. package/dist/components/Variables/index.d.ts +1 -0
  213. package/dist/components/Variables/index.d.ts.map +1 -1
  214. package/dist/components/Variables/index.js +1 -0
  215. package/dist/components/Variables/index.js.map +1 -1
  216. package/dist/components/index.js.map +1 -1
  217. package/dist/constants/grid-layout-config.js.map +1 -1
  218. package/dist/constants/index.js.map +1 -1
  219. package/dist/constants/user-interface-text.js.map +1 -1
  220. package/dist/context/DashboardProvider/DashboardProvider.js +5 -5
  221. package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -1
  222. package/dist/context/DashboardProvider/common.js.map +1 -1
  223. package/dist/context/DashboardProvider/dashboard-provider-api.js +2 -2
  224. package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -1
  225. package/dist/context/DashboardProvider/delete-panel-group-slice.js.map +1 -1
  226. package/dist/context/DashboardProvider/delete-panel-slice.js +2 -2
  227. package/dist/context/DashboardProvider/delete-panel-slice.js.map +1 -1
  228. package/dist/context/DashboardProvider/discard-changes-dialog-slice.js.map +1 -1
  229. package/dist/context/DashboardProvider/duplicate-panel-slice.js.map +1 -1
  230. package/dist/context/DashboardProvider/edit-json-dialog-slice.js.map +1 -1
  231. package/dist/context/DashboardProvider/index.js.map +1 -1
  232. package/dist/context/DashboardProvider/panel-editor-slice.d.ts +2 -1
  233. package/dist/context/DashboardProvider/panel-editor-slice.d.ts.map +1 -1
  234. package/dist/context/DashboardProvider/panel-editor-slice.js +7 -7
  235. package/dist/context/DashboardProvider/panel-editor-slice.js.map +1 -1
  236. package/dist/context/DashboardProvider/panel-group-editor-slice.js +2 -2
  237. package/dist/context/DashboardProvider/panel-group-editor-slice.js.map +1 -1
  238. package/dist/context/DashboardProvider/panel-group-slice.js +3 -3
  239. package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -1
  240. package/dist/context/DashboardProvider/panel-slice.js.map +1 -1
  241. package/dist/context/DashboardProvider/save-changes-dialog-slice.js.map +1 -1
  242. package/dist/context/DatasourceStoreProvider.d.ts +14 -10
  243. package/dist/context/DatasourceStoreProvider.d.ts.map +1 -1
  244. package/dist/context/DatasourceStoreProvider.js +107 -40
  245. package/dist/context/DatasourceStoreProvider.js.map +1 -1
  246. package/dist/context/TemplateVariableProvider/TemplateVariableProvider.d.ts +48 -13
  247. package/dist/context/TemplateVariableProvider/TemplateVariableProvider.d.ts.map +1 -1
  248. package/dist/context/TemplateVariableProvider/TemplateVariableProvider.js +165 -41
  249. package/dist/context/TemplateVariableProvider/TemplateVariableProvider.js.map +1 -1
  250. package/dist/context/TemplateVariableProvider/hydrationUtils.d.ts +9 -2
  251. package/dist/context/TemplateVariableProvider/hydrationUtils.d.ts.map +1 -1
  252. package/dist/context/TemplateVariableProvider/hydrationUtils.js +67 -12
  253. package/dist/context/TemplateVariableProvider/hydrationUtils.js.map +1 -1
  254. package/dist/context/TemplateVariableProvider/index.js.map +1 -1
  255. package/dist/context/TemplateVariableProvider/query-params.js.map +1 -1
  256. package/dist/context/TemplateVariableProvider/utils.d.ts +27 -2
  257. package/dist/context/TemplateVariableProvider/utils.d.ts.map +1 -1
  258. package/dist/context/TemplateVariableProvider/utils.js +48 -6
  259. package/dist/context/TemplateVariableProvider/utils.js.map +1 -1
  260. package/dist/context/index.js.map +1 -1
  261. package/dist/context/useDashboard.js +1 -1
  262. package/dist/context/useDashboard.js.map +1 -1
  263. package/dist/index.js.map +1 -1
  264. package/dist/stories/decorators/WithDashboard.js.map +1 -1
  265. package/dist/stories/decorators/WithDatasourceStore.js.map +1 -1
  266. package/dist/stories/decorators/WithTemplateVariables.js.map +1 -1
  267. package/dist/stories/decorators/constants.js +2 -2
  268. package/dist/stories/decorators/constants.js.map +1 -1
  269. package/dist/stories/decorators/index.js.map +1 -1
  270. package/dist/test/dashboard-provider.js.map +1 -1
  271. package/dist/test/datasource-provider.d.ts.map +1 -1
  272. package/dist/test/datasource-provider.js +5 -7
  273. package/dist/test/datasource-provider.js.map +1 -1
  274. package/dist/test/index.js.map +1 -1
  275. package/dist/test/plugin-registry.js.map +1 -1
  276. package/dist/test/render.d.ts.map +1 -1
  277. package/dist/test/render.js +8 -3
  278. package/dist/test/render.js.map +1 -1
  279. package/dist/test/setup-tests.js.map +1 -1
  280. package/dist/test/testDashboard.js +10 -10
  281. package/dist/test/testDashboard.js.map +1 -1
  282. package/dist/utils/index.js.map +1 -1
  283. package/dist/utils/panelUtils.js.map +1 -1
  284. package/dist/utils/time.js.map +1 -1
  285. package/dist/validation/index.d.ts +2 -0
  286. package/dist/validation/index.d.ts.map +1 -0
  287. package/dist/validation/index.js +15 -0
  288. package/dist/validation/index.js.map +1 -0
  289. package/dist/validation/panel.d.ts +19 -0
  290. package/dist/validation/panel.d.ts.map +1 -0
  291. package/dist/validation/panel.js +21 -0
  292. package/dist/validation/panel.js.map +1 -0
  293. package/dist/views/ViewDashboard/DashboardApp.d.ts +1 -0
  294. package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -1
  295. package/dist/views/ViewDashboard/DashboardApp.js +11 -4
  296. package/dist/views/ViewDashboard/DashboardApp.js.map +1 -1
  297. package/dist/views/ViewDashboard/ViewDashboard.d.ts +3 -1
  298. package/dist/views/ViewDashboard/ViewDashboard.d.ts.map +1 -1
  299. package/dist/views/ViewDashboard/ViewDashboard.js +51 -8
  300. package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -1
  301. package/dist/views/ViewDashboard/index.js.map +1 -1
  302. package/dist/views/index.js.map +1 -1
  303. package/package.json +8 -7
@@ -14,15 +14,17 @@
14
14
  Object.defineProperty(exports, "__esModule", {
15
15
  value: true
16
16
  });
17
- _exportStar(require("./Panel"), exports);
18
- function _exportStar(from, to) {
17
+ _export_star(require("./Panel"), exports);
18
+ function _export_star(from, to) {
19
19
  Object.keys(from).forEach(function(k) {
20
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
21
- enumerable: true,
22
- get: function() {
23
- return from[k];
24
- }
25
- });
20
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
21
+ Object.defineProperty(to, k, {
22
+ enumerable: true,
23
+ get: function() {
24
+ return from[k];
25
+ }
26
+ });
27
+ }
26
28
  });
27
29
  return from;
28
30
  }
@@ -16,105 +16,53 @@ Object.defineProperty(exports, "__esModule", {
16
16
  });
17
17
  Object.defineProperty(exports, "PanelDrawer", {
18
18
  enumerable: true,
19
- get: ()=>PanelDrawer
19
+ get: function() {
20
+ return PanelDrawer;
21
+ }
20
22
  });
21
- const _jsxRuntime = require("react/jsx-runtime");
23
+ const _jsxruntime = require("react/jsx-runtime");
22
24
  const _react = require("react");
23
- const _material = require("@mui/material");
24
25
  const _components = require("@perses-dev/components");
25
26
  const _context = require("../../context");
26
- const _panelEditorForm = require("./PanelEditorForm");
27
+ const _PanelEditorForm = require("./PanelEditorForm");
27
28
  const PanelDrawer = ()=>{
28
29
  const panelEditor = (0, _context.usePanelEditor)();
29
- const { openDiscardChangesConfirmationDialog , closeDiscardChangesConfirmationDialog } = (0, _context.useDiscardChangesConfirmationDialog)();
30
- const [values, setValues] = (0, _react.useState)(undefined);
31
30
  // When the user clicks close, start closing but don't call the store yet to keep values stable during animtation
32
31
  const [isClosing, setIsClosing] = (0, _react.useState)(false);
33
- const handleClose = ()=>{
34
- const isModified = JSON.stringify(panelEditor === null || panelEditor === void 0 ? void 0 : panelEditor.initialValues) !== JSON.stringify(values);
35
- if (isModified) {
36
- openDiscardChangesConfirmationDialog({
37
- onDiscardChanges: ()=>{
38
- closeDiscardChangesConfirmationDialog();
39
- setIsClosing(true);
40
- },
41
- onCancel: ()=>{
42
- closeDiscardChangesConfirmationDialog();
43
- },
44
- description: 'You have unapplied changes in this panel. Are you sure you want to discard these changes? Changes cannot be recovered.'
45
- });
46
- } else {
47
- setIsClosing(true);
48
- }
49
- };
50
- // Don't call closeDrawer on the store until the Drawer has completely transitioned out
51
- const handleExited = ()=>{
52
- panelEditor === null || panelEditor === void 0 ? void 0 : panelEditor.close();
53
- setIsClosing(false);
54
- };
55
32
  // Drawer is open if we have a model and we're not transitioning out
56
33
  const isOpen = panelEditor !== undefined && isClosing === false;
57
- const handleSubmit = ()=>{
34
+ function handleSave(values) {
58
35
  // This shouldn't happen since we don't render the submit button until we have a model, but check to make TS happy
59
36
  if (panelEditor === undefined || values === undefined) {
60
37
  throw new Error('Cannot apply changes');
61
38
  }
62
39
  panelEditor.applyChanges(values);
63
40
  setIsClosing(true);
41
+ }
42
+ const handleClose = ()=>{
43
+ setIsClosing(true);
44
+ };
45
+ // Don't call closeDrawer on the store until the Drawer has completely transitioned out and reset close state
46
+ const handleExited = ()=>{
47
+ panelEditor === null || panelEditor === void 0 ? void 0 : panelEditor.close();
48
+ setIsClosing(false);
64
49
  };
65
- const handleChange = (0, _react.useCallback)((values)=>{
66
- setValues(values);
67
- }, []);
68
- return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components.Drawer, {
50
+ // Disables closing on click out. This is a quick-win solution to avoid losing draft changes.
51
+ // -> TODO find a way to enable closing by clicking-out in edit view, with a discard confirmation modal popping up
52
+ const handleClickOut = ()=>{
53
+ /* do nothing */ };
54
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.Drawer, {
69
55
  isOpen: isOpen,
70
- onClose: handleClose,
56
+ onClose: handleClickOut,
71
57
  SlideProps: {
72
58
  onExited: handleExited
73
59
  },
74
60
  "data-testid": "panel-editor",
75
- children: panelEditor !== undefined && /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
76
- children: [
77
- /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Box, {
78
- sx: {
79
- display: 'flex',
80
- alignItems: 'center',
81
- padding: (theme)=>theme.spacing(1, 2),
82
- borderBottom: (theme)=>`1px solid ${theme.palette.divider}`
83
- },
84
- children: [
85
- /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Typography, {
86
- variant: "h2",
87
- children: [
88
- panelEditor.mode,
89
- " Panel"
90
- ]
91
- }),
92
- /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Stack, {
93
- direction: "row",
94
- spacing: 1,
95
- marginLeft: "auto",
96
- children: [
97
- /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Button, {
98
- type: "submit",
99
- variant: "contained",
100
- onClick: handleSubmit,
101
- children: panelEditor.mode === 'Add' ? 'Add' : 'Apply'
102
- }),
103
- /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Button, {
104
- color: "secondary",
105
- variant: "outlined",
106
- onClick: handleClose,
107
- children: "Cancel"
108
- })
109
- ]
110
- })
111
- ]
112
- }),
113
- /*#__PURE__*/ (0, _jsxRuntime.jsx)(_panelEditorForm.PanelEditorForm, {
114
- initialValues: panelEditor.initialValues,
115
- onChange: handleChange
116
- })
117
- ]
61
+ children: panelEditor && /*#__PURE__*/ (0, _jsxruntime.jsx)(_PanelEditorForm.PanelEditorForm, {
62
+ initialAction: panelEditor.mode,
63
+ initialValues: panelEditor.initialValues,
64
+ onSave: handleSave,
65
+ onClose: handleClose
118
66
  })
119
67
  });
120
68
  };
@@ -21,26 +21,72 @@ function _export(target, all) {
21
21
  });
22
22
  }
23
23
  _export(exports, {
24
- PanelEditorForm: ()=>PanelEditorForm,
25
- panelEditorFormId: ()=>panelEditorFormId
24
+ PanelEditorForm: function() {
25
+ return PanelEditorForm;
26
+ },
27
+ panelEditorFormId: function() {
28
+ return panelEditorFormId;
29
+ }
26
30
  });
27
- const _jsxRuntime = require("react/jsx-runtime");
28
- const _react = require("react");
31
+ const _jsxruntime = require("react/jsx-runtime");
32
+ const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
29
33
  const _material = require("@mui/material");
30
34
  const _components = require("@perses-dev/components");
31
- const _pluginSystem = require("@perses-dev/plugin-system");
35
+ const _pluginsystem = require("@perses-dev/plugin-system");
36
+ const _reacthookform = require("react-hook-form");
37
+ const _zod = require("@hookform/resolvers/zod");
32
38
  const _context = require("../../context");
33
- const _panelPreview = require("./PanelPreview");
39
+ const _validation = require("../../validation");
40
+ const _PanelPreview = require("./PanelPreview");
34
41
  const _usePanelEditor = require("./usePanelEditor");
42
+ function _getRequireWildcardCache(nodeInterop) {
43
+ if (typeof WeakMap !== "function") return null;
44
+ var cacheBabelInterop = new WeakMap();
45
+ var cacheNodeInterop = new WeakMap();
46
+ return (_getRequireWildcardCache = function(nodeInterop) {
47
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
48
+ })(nodeInterop);
49
+ }
50
+ function _interop_require_wildcard(obj, nodeInterop) {
51
+ if (!nodeInterop && obj && obj.__esModule) {
52
+ return obj;
53
+ }
54
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
55
+ return {
56
+ default: obj
57
+ };
58
+ }
59
+ var cache = _getRequireWildcardCache(nodeInterop);
60
+ if (cache && cache.has(obj)) {
61
+ return cache.get(obj);
62
+ }
63
+ var newObj = {};
64
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
65
+ for(var key in obj){
66
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
67
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
68
+ if (desc && (desc.get || desc.set)) {
69
+ Object.defineProperty(newObj, key, desc);
70
+ } else {
71
+ newObj[key] = obj[key];
72
+ }
73
+ }
74
+ }
75
+ newObj.default = obj;
76
+ if (cache) {
77
+ cache.set(obj, newObj);
78
+ }
79
+ return newObj;
80
+ }
35
81
  function PanelEditorForm(props) {
36
- var ref;
37
- const { initialValues: { panelDefinition: initialPanelDef , groupId: initialGroupId } , onChange , } = props;
82
+ const { initialValues: { panelDefinition: initialPanelDef , groupId: initialGroupId } , initialAction , onSave , onClose } = props;
38
83
  const panelGroups = (0, _context.useListPanelGroups)();
39
84
  const [groupId, setGroupId] = (0, _react.useState)(initialGroupId);
40
85
  const { panelDefinition , setName , setDescription , setQueries , setPlugin , setPanelDefinition } = (0, _usePanelEditor.usePanelEditor)(initialPanelDef);
41
86
  const { plugin } = panelDefinition.spec;
87
+ const [isDiscardDialogOpened, setDiscardDialogOpened] = (0, _react.useState)(false);
42
88
  // Use common plugin editor logic even though we've split the inputs up in this form
43
- const pluginEditor = (0, _pluginSystem.usePluginEditor)({
89
+ const pluginEditor = (0, _pluginsystem.usePluginEditor)({
44
90
  pluginType: 'Panel',
45
91
  value: {
46
92
  kind: plugin.kind,
@@ -53,14 +99,42 @@ function PanelEditorForm(props) {
53
99
  setQueries(undefined, isHidden);
54
100
  }
55
101
  });
56
- // Ignore string values (which would be an "empty" value from the Select) since we don't allow them to unset it
57
- const handleGroupChange = (e)=>{
58
- const { value } = e.target;
59
- if (typeof value === 'string') {
60
- return;
102
+ const titleAction = (0, _pluginsystem.getTitleAction)(initialAction, true);
103
+ const submitText = (0, _pluginsystem.getSubmitText)(initialAction, true);
104
+ const form = (0, _reacthookform.useForm)({
105
+ resolver: (0, _zod.zodResolver)(_validation.panelEditorValidationSchema),
106
+ mode: 'onBlur',
107
+ defaultValues: {
108
+ name: initialPanelDef.spec.display.name,
109
+ groupId: initialGroupId,
110
+ description: initialPanelDef.spec.display.description,
111
+ type: pluginEditor.pendingKind ? pluginEditor.pendingKind : plugin.kind
61
112
  }
62
- setGroupId(value);
113
+ });
114
+ const processForm = ()=>{
115
+ const values = {
116
+ groupId,
117
+ panelDefinition
118
+ };
119
+ onSave(values);
63
120
  };
121
+ // When user click on cancel, several possibilities:
122
+ // - create action: ask for discard approval
123
+ // - update action: ask for discard approval if changed
124
+ // - read action: don´t ask for discard approval
125
+ function handleCancel() {
126
+ if (JSON.stringify({
127
+ groupId: initialGroupId,
128
+ panelDefinition: initialPanelDef
129
+ }) !== JSON.stringify({
130
+ groupId,
131
+ panelDefinition
132
+ })) {
133
+ setDiscardDialogOpened(true);
134
+ } else {
135
+ onClose();
136
+ }
137
+ }
64
138
  const handlePanelDefinitionChange = (nextPanelDef)=>{
65
139
  const { kind: pluginKind , spec: pluginSpec } = nextPanelDef.spec.plugin;
66
140
  // if panel plugin kind and spec are modified, then need to save current spec
@@ -69,146 +143,200 @@ function PanelEditorForm(props) {
69
143
  }
70
144
  setPanelDefinition(nextPanelDef);
71
145
  };
72
- (0, _react.useEffect)(()=>{
73
- const values = {
74
- groupId,
75
- panelDefinition
76
- };
77
- onChange(values);
78
- }, [
79
- groupId,
80
- panelDefinition,
81
- onChange
82
- ]);
83
- var _name, _title, _description, ref1;
84
- return(// Grid maxHeight allows user to scroll inside Drawer to see all content
85
- /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Box, {
86
- component: "form",
87
- id: panelEditorFormId,
88
- sx: {
89
- flex: 1,
90
- overflowY: 'scroll',
91
- padding: (theme)=>theme.spacing(2)
92
- },
93
- children: /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Grid, {
94
- container: true,
95
- spacing: 2,
96
- children: [
97
- /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Grid, {
98
- item: true,
99
- xs: 8,
100
- children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.TextField, {
101
- required: true,
102
- fullWidth: true,
103
- label: "Name",
104
- value: (_name = panelDefinition.spec.display.name) !== null && _name !== void 0 ? _name : '',
105
- variant: "outlined",
106
- onChange: (e)=>{
107
- setName(e.target.value);
108
- }
109
- })
110
- }),
111
- /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Grid, {
112
- item: true,
113
- xs: 4,
114
- children: /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.FormControl, {
115
- fullWidth: true,
146
+ var _panelGroup_title, _pluginEditor_error_message;
147
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_reacthookform.FormProvider, {
148
+ ...form,
149
+ children: [
150
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
151
+ sx: {
152
+ display: 'flex',
153
+ alignItems: 'center',
154
+ padding: (theme)=>theme.spacing(1, 2),
155
+ borderBottom: (theme)=>`1px solid ${theme.palette.divider}`
156
+ },
157
+ children: [
158
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Typography, {
159
+ variant: "h2",
116
160
  children: [
117
- /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.InputLabel, {
118
- id: "select-group",
119
- children: "Group"
161
+ titleAction,
162
+ " Panel"
163
+ ]
164
+ }),
165
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
166
+ direction: "row",
167
+ spacing: 1,
168
+ marginLeft: "auto",
169
+ children: [
170
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Button, {
171
+ variant: "contained",
172
+ disabled: !form.formState.isValid,
173
+ onClick: form.handleSubmit(processForm),
174
+ children: submitText
120
175
  }),
121
- /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Select, {
122
- required: true,
123
- labelId: "select-group",
124
- label: "Group",
125
- value: groupId,
126
- onChange: handleGroupChange,
127
- children: panelGroups.map((panelGroup, index)=>/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.MenuItem, {
128
- value: panelGroup.id,
129
- children: (_title = panelGroup.title) !== null && _title !== void 0 ? _title : `Group ${index + 1}`
130
- }, panelGroup.id))
176
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Button, {
177
+ color: "secondary",
178
+ variant: "outlined",
179
+ onClick: handleCancel,
180
+ children: "Cancel"
131
181
  })
132
182
  ]
133
183
  })
134
- }),
135
- /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Grid, {
136
- item: true,
137
- xs: 8,
138
- children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.TextField, {
139
- fullWidth: true,
140
- label: "Description",
141
- value: (_description = panelDefinition.spec.display.description) !== null && _description !== void 0 ? _description : '',
142
- variant: "outlined",
143
- onChange: (e)=>{
144
- setDescription(e.target.value);
145
- }
146
- })
147
- }),
148
- /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Grid, {
149
- item: true,
150
- xs: 4,
184
+ ]
185
+ }),
186
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
187
+ id: panelEditorFormId,
188
+ sx: {
189
+ flex: 1,
190
+ overflowY: 'scroll',
191
+ padding: (theme)=>theme.spacing(2)
192
+ },
193
+ children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Grid, {
194
+ container: true,
195
+ spacing: 2,
151
196
  children: [
152
- /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.FormControl, {
153
- fullWidth: true,
154
- disabled: pluginEditor.isLoading,
155
- error: pluginEditor.error !== null,
197
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid, {
198
+ item: true,
199
+ xs: 8,
200
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
201
+ name: "name",
202
+ render: ({ field , fieldState })=>{
203
+ var _fieldState_error;
204
+ /*#__PURE__*/ return (0, _jsxruntime.jsx)(_material.TextField, {
205
+ ...field,
206
+ required: true,
207
+ fullWidth: true,
208
+ label: "Name",
209
+ error: !!fieldState.error,
210
+ helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
211
+ onChange: (event)=>{
212
+ field.onChange(event);
213
+ setName(event.target.value);
214
+ }
215
+ });
216
+ }
217
+ })
218
+ }),
219
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid, {
220
+ item: true,
221
+ xs: 4,
222
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
223
+ name: "groupId",
224
+ render: ({ field , fieldState })=>{
225
+ var _fieldState_error;
226
+ /*#__PURE__*/ return (0, _jsxruntime.jsx)(_material.TextField, {
227
+ select: true,
228
+ ...field,
229
+ required: true,
230
+ fullWidth: true,
231
+ label: "Group",
232
+ error: !!fieldState.error,
233
+ helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
234
+ onChange: (event)=>{
235
+ field.onChange(event);
236
+ setGroupId(+event.target.value);
237
+ },
238
+ children: panelGroups.map((panelGroup, index)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
239
+ value: panelGroup.id,
240
+ children: (_panelGroup_title = panelGroup.title) !== null && _panelGroup_title !== void 0 ? _panelGroup_title : `Group ${index + 1}`
241
+ }, panelGroup.id))
242
+ });
243
+ }
244
+ })
245
+ }),
246
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid, {
247
+ item: true,
248
+ xs: 8,
249
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
250
+ name: "description",
251
+ render: ({ field , fieldState })=>{
252
+ var _fieldState_error;
253
+ /*#__PURE__*/ return (0, _jsxruntime.jsx)(_material.TextField, {
254
+ ...field,
255
+ fullWidth: true,
256
+ label: "Description",
257
+ error: !!fieldState.error,
258
+ helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
259
+ onChange: (event)=>{
260
+ field.onChange(event);
261
+ setDescription(event.target.value);
262
+ }
263
+ });
264
+ }
265
+ })
266
+ }),
267
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid, {
268
+ item: true,
269
+ xs: 4,
270
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
271
+ name: "type",
272
+ render: ({ field , fieldState })=>{
273
+ var _pluginEditor_error, _fieldState_error;
274
+ /*#__PURE__*/ return (0, _jsxruntime.jsx)(_pluginsystem.PluginKindSelect, {
275
+ ...field,
276
+ pluginType: "Panel",
277
+ required: true,
278
+ fullWidth: true,
279
+ label: "Type",
280
+ disabled: pluginEditor.isLoading,
281
+ error: !!pluginEditor.error || !!fieldState.error,
282
+ helperText: (_pluginEditor_error_message = (_pluginEditor_error = pluginEditor.error) === null || _pluginEditor_error === void 0 ? void 0 : _pluginEditor_error.message) !== null && _pluginEditor_error_message !== void 0 ? _pluginEditor_error_message : (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
283
+ onChange: (event)=>{
284
+ field.onChange(event);
285
+ pluginEditor.onKindChange(event);
286
+ }
287
+ });
288
+ }
289
+ })
290
+ }),
291
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Grid, {
292
+ item: true,
293
+ xs: 12,
156
294
  children: [
157
- /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.InputLabel, {
158
- id: "panel-type-label",
159
- children: "Type"
295
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
296
+ variant: "h4",
297
+ marginBottom: 1,
298
+ children: "Preview"
160
299
  }),
161
- /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pluginSystem.PluginKindSelect, {
162
- pluginType: "Panel",
163
- required: true,
164
- labelId: "panel-type-label",
165
- label: "Type",
166
- value: pluginEditor.pendingKind ? pluginEditor.pendingKind : plugin.kind,
167
- onChange: pluginEditor.onKindChange
300
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.ErrorBoundary, {
301
+ FallbackComponent: _components.ErrorAlert,
302
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_PanelPreview.PanelPreview, {
303
+ panelDefinition: panelDefinition
304
+ })
168
305
  })
169
306
  ]
170
307
  }),
171
- /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.FormHelperText, {
172
- children: (ref1 = (ref = pluginEditor.error) === null || ref === void 0 ? void 0 : ref.message) !== null && ref1 !== void 0 ? ref1 : ''
173
- })
174
- ]
175
- }),
176
- /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Grid, {
177
- item: true,
178
- xs: 12,
179
- children: [
180
- /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Typography, {
181
- variant: "h4",
182
- marginBottom: 1,
183
- children: "Preview"
184
- }),
185
- /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components.ErrorBoundary, {
186
- FallbackComponent: _components.ErrorAlert,
187
- children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_panelPreview.PanelPreview, {
188
- panelDefinition: panelDefinition
308
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid, {
309
+ item: true,
310
+ xs: 12,
311
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.ErrorBoundary, {
312
+ FallbackComponent: _components.ErrorAlert,
313
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.PanelSpecEditor, {
314
+ panelDefinition: panelDefinition,
315
+ onJSONChange: handlePanelDefinitionChange,
316
+ onQueriesChange: (queries)=>{
317
+ setQueries(queries);
318
+ },
319
+ onPluginSpecChange: (spec)=>{
320
+ pluginEditor.onSpecChange(spec);
321
+ }
322
+ })
189
323
  })
190
324
  })
191
325
  ]
192
- }),
193
- /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Grid, {
194
- item: true,
195
- xs: 12,
196
- children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components.ErrorBoundary, {
197
- FallbackComponent: _components.ErrorAlert,
198
- children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pluginSystem.PanelSpecEditor, {
199
- panelDefinition: panelDefinition,
200
- onJSONChange: handlePanelDefinitionChange,
201
- onQueriesChange: (queries)=>{
202
- setQueries(queries);
203
- },
204
- onPluginSpecChange: (spec)=>{
205
- pluginEditor.onSpecChange(spec);
206
- }
207
- })
208
- })
209
326
  })
210
- ]
211
- })
212
- }));
327
+ }),
328
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.DiscardChangesConfirmationDialog, {
329
+ description: "You have unapplied changes in this panel. Are you sure you want to discard these changes? Changes cannot be recovered.",
330
+ isOpen: isDiscardDialogOpened,
331
+ onCancel: ()=>{
332
+ setDiscardDialogOpened(false);
333
+ },
334
+ onDiscardChanges: ()=>{
335
+ setDiscardDialogOpened(false);
336
+ onClose();
337
+ }
338
+ })
339
+ ]
340
+ });
213
341
  }
214
342
  const panelEditorFormId = 'panel-editor-form';