@perses-dev/dashboards 0.0.0-snapshot-scatterplot-fix-imports-95e1b59 → 0.0.0-snapshot-explorer-plugin-c4a7621

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 (348) hide show
  1. package/dist/cjs/components/Dashboard/Dashboard.js +8 -1
  2. package/dist/cjs/components/DashboardStickyToolbar/DashboardStickyToolbar.js +2 -2
  3. package/dist/cjs/components/DashboardToolbar/DashboardToolbar.js +1 -1
  4. package/dist/cjs/components/Datasources/DatasourceEditor.js +18 -18
  5. package/dist/cjs/components/Datasources/EditDatasourcesButton.js +2 -5
  6. package/dist/cjs/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +3 -4
  7. package/dist/cjs/components/EditJsonDialog/EditJsonDialog.js +10 -13
  8. package/dist/cjs/components/EmptyDashboard/EmptyDashboard.js +2 -2
  9. package/dist/cjs/components/GridLayout/GridContainer.js +15 -10
  10. package/dist/cjs/components/GridLayout/GridItemContent.js +19 -4
  11. package/dist/cjs/components/GridLayout/GridLayout.js +61 -12
  12. package/dist/cjs/components/GridLayout/GridTitle.js +3 -3
  13. package/dist/cjs/{validation/panel.js → components/Panel/HeaderIconButton.js} +8 -10
  14. package/dist/cjs/components/Panel/Panel.js +14 -10
  15. package/dist/cjs/components/Panel/PanelActions.js +216 -0
  16. package/dist/cjs/components/Panel/PanelContent.js +4 -4
  17. package/dist/cjs/components/Panel/PanelHeader.js +36 -103
  18. package/dist/cjs/components/Panel/PanelLinks.js +136 -0
  19. package/dist/cjs/components/PanelDrawer/PanelDrawer.js +9 -6
  20. package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +67 -65
  21. package/dist/cjs/components/PanelDrawer/PanelPreview.js +7 -3
  22. package/dist/cjs/components/PanelDrawer/usePanelEditor.js +9 -6
  23. package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.js +1 -1
  24. package/dist/cjs/components/QuerySummaryTable/QuerySummaryTable.js +3 -5
  25. package/dist/cjs/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +4 -6
  26. package/dist/cjs/components/SaveDashboardButton/SaveDashboardButton.js +2 -2
  27. package/dist/cjs/components/Variables/BuiltinVariableAccordions.js +7 -14
  28. package/dist/cjs/components/Variables/EditVariablesButton.js +4 -4
  29. package/dist/cjs/components/Variables/{TemplateVariable.js → Variable.js} +43 -60
  30. package/dist/cjs/components/Variables/VariableEditor.js +34 -40
  31. package/dist/cjs/components/Variables/VariableList.js +23 -22
  32. package/dist/cjs/components/Variables/index.js +2 -2
  33. package/dist/cjs/constants/styles.js +15 -7
  34. package/dist/cjs/constants/user-interface-text.js +3 -0
  35. package/dist/cjs/context/DashboardProvider/DashboardProvider.js +10 -8
  36. package/dist/cjs/context/DashboardProvider/DashboardProviderWithQueryParams.js +36 -0
  37. package/dist/cjs/context/DashboardProvider/common.js +2 -2
  38. package/dist/cjs/context/DashboardProvider/dashboard-provider-api.js +14 -6
  39. package/dist/cjs/context/DashboardProvider/delete-panel-slice.js +1 -2
  40. package/dist/cjs/context/DashboardProvider/panel-editor-slice.js +7 -10
  41. package/dist/cjs/context/DashboardProvider/panel-group-editor-slice.js +1 -2
  42. package/dist/cjs/context/DashboardProvider/panel-group-slice.js +8 -3
  43. package/dist/cjs/context/DashboardProvider/view-panel-slice.js +79 -0
  44. package/dist/cjs/context/DatasourceStoreProvider.js +18 -23
  45. package/dist/cjs/context/{TemplateVariableProvider/TemplateVariableProvider.js → VariableProvider/VariableProvider.js} +62 -69
  46. package/dist/cjs/context/{TemplateVariableProvider → VariableProvider}/hydrationUtils.js +11 -14
  47. package/dist/cjs/{validation → context/VariableProvider}/index.js +2 -2
  48. package/dist/cjs/context/{TemplateVariableProvider → VariableProvider}/query-params.js +1 -1
  49. package/dist/cjs/context/{TemplateVariableProvider → VariableProvider}/utils.js +3 -3
  50. package/dist/cjs/context/index.js +2 -2
  51. package/dist/cjs/context/useDashboard.js +4 -4
  52. package/dist/cjs/stories/decorators/WithDashboard.js +1 -1
  53. package/dist/cjs/stories/decorators/WithDatasourceStore.js +1 -1
  54. package/dist/cjs/stories/decorators/{WithTemplateVariables.js → WithVariables.js} +9 -9
  55. package/dist/cjs/stories/decorators/index.js +2 -2
  56. package/dist/cjs/test/plugin-registry.js +4 -2
  57. package/dist/cjs/test/render.js +13 -11
  58. package/dist/cjs/views/ViewDashboard/DashboardApp.js +3 -3
  59. package/dist/cjs/views/ViewDashboard/ViewDashboard.js +7 -8
  60. package/dist/components/AddGroupButton/AddGroupButton.d.ts +2 -1
  61. package/dist/components/AddGroupButton/AddGroupButton.d.ts.map +1 -1
  62. package/dist/components/AddGroupButton/AddGroupButton.js.map +1 -1
  63. package/dist/components/AddPanelButton/AddPanelButton.d.ts +2 -1
  64. package/dist/components/AddPanelButton/AddPanelButton.d.ts.map +1 -1
  65. package/dist/components/AddPanelButton/AddPanelButton.js.map +1 -1
  66. package/dist/components/Dashboard/Dashboard.d.ts +2 -1
  67. package/dist/components/Dashboard/Dashboard.d.ts.map +1 -1
  68. package/dist/components/Dashboard/Dashboard.js +8 -1
  69. package/dist/components/Dashboard/Dashboard.js.map +1 -1
  70. package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.d.ts +2 -1
  71. package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.d.ts.map +1 -1
  72. package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js +3 -3
  73. package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js.map +1 -1
  74. package/dist/components/DashboardToolbar/DashboardToolbar.d.ts +2 -2
  75. package/dist/components/DashboardToolbar/DashboardToolbar.d.ts.map +1 -1
  76. package/dist/components/DashboardToolbar/DashboardToolbar.js +1 -1
  77. package/dist/components/DashboardToolbar/DashboardToolbar.js.map +1 -1
  78. package/dist/components/Datasources/DatasourceEditor.d.ts +2 -1
  79. package/dist/components/Datasources/DatasourceEditor.d.ts.map +1 -1
  80. package/dist/components/Datasources/DatasourceEditor.js +19 -19
  81. package/dist/components/Datasources/DatasourceEditor.js.map +1 -1
  82. package/dist/components/Datasources/EditDatasourcesButton.d.ts +2 -1
  83. package/dist/components/Datasources/EditDatasourcesButton.d.ts.map +1 -1
  84. package/dist/components/Datasources/EditDatasourcesButton.js +2 -5
  85. package/dist/components/Datasources/EditDatasourcesButton.js.map +1 -1
  86. package/dist/components/DeletePanelDialog/DeletePanelDialog.d.ts +2 -1
  87. package/dist/components/DeletePanelDialog/DeletePanelDialog.d.ts.map +1 -1
  88. package/dist/components/DeletePanelDialog/DeletePanelDialog.js.map +1 -1
  89. package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.d.ts +2 -1
  90. package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.d.ts.map +1 -1
  91. package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +3 -4
  92. package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js.map +1 -1
  93. package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.d.ts +2 -1
  94. package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.d.ts.map +1 -1
  95. package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js.map +1 -1
  96. package/dist/components/DownloadButton/DownloadButton.d.ts +2 -1
  97. package/dist/components/DownloadButton/DownloadButton.d.ts.map +1 -1
  98. package/dist/components/DownloadButton/DownloadButton.js.map +1 -1
  99. package/dist/components/EditButton/EditButton.d.ts +2 -1
  100. package/dist/components/EditButton/EditButton.d.ts.map +1 -1
  101. package/dist/components/EditButton/EditButton.js.map +1 -1
  102. package/dist/components/EditJsonButton/EditJsonButton.d.ts +2 -1
  103. package/dist/components/EditJsonButton/EditJsonButton.d.ts.map +1 -1
  104. package/dist/components/EditJsonButton/EditJsonButton.js.map +1 -1
  105. package/dist/components/EditJsonDialog/EditJsonDialog.d.ts +2 -1
  106. package/dist/components/EditJsonDialog/EditJsonDialog.d.ts.map +1 -1
  107. package/dist/components/EditJsonDialog/EditJsonDialog.js +7 -10
  108. package/dist/components/EditJsonDialog/EditJsonDialog.js.map +1 -1
  109. package/dist/components/EmptyDashboard/EmptyDashboard.d.ts +3 -3
  110. package/dist/components/EmptyDashboard/EmptyDashboard.d.ts.map +1 -1
  111. package/dist/components/EmptyDashboard/EmptyDashboard.js +2 -2
  112. package/dist/components/EmptyDashboard/EmptyDashboard.js.map +1 -1
  113. package/dist/components/GridLayout/GridContainer.d.ts +5 -3
  114. package/dist/components/GridLayout/GridContainer.d.ts.map +1 -1
  115. package/dist/components/GridLayout/GridContainer.js +15 -10
  116. package/dist/components/GridLayout/GridContainer.js.map +1 -1
  117. package/dist/components/GridLayout/GridItemContent.d.ts +2 -1
  118. package/dist/components/GridLayout/GridItemContent.d.ts.map +1 -1
  119. package/dist/components/GridLayout/GridItemContent.js +21 -6
  120. package/dist/components/GridLayout/GridItemContent.js.map +1 -1
  121. package/dist/components/GridLayout/GridLayout.d.ts +4 -2
  122. package/dist/components/GridLayout/GridLayout.d.ts.map +1 -1
  123. package/dist/components/GridLayout/GridLayout.js +63 -14
  124. package/dist/components/GridLayout/GridLayout.js.map +1 -1
  125. package/dist/components/GridLayout/GridTitle.d.ts +3 -2
  126. package/dist/components/GridLayout/GridTitle.d.ts.map +1 -1
  127. package/dist/components/GridLayout/GridTitle.js +3 -3
  128. package/dist/components/GridLayout/GridTitle.js.map +1 -1
  129. package/dist/components/Panel/HeaderIconButton.d.ts +5 -0
  130. package/dist/components/Panel/HeaderIconButton.d.ts.map +1 -0
  131. package/dist/{context/TemplateVariableProvider/index.js → components/Panel/HeaderIconButton.js} +7 -3
  132. package/dist/components/Panel/HeaderIconButton.js.map +1 -0
  133. package/dist/components/Panel/Panel.d.ts +11 -5
  134. package/dist/components/Panel/Panel.d.ts.map +1 -1
  135. package/dist/components/Panel/Panel.js +15 -11
  136. package/dist/components/Panel/Panel.js.map +1 -1
  137. package/dist/components/Panel/PanelActions.d.ts +16 -0
  138. package/dist/components/Panel/PanelActions.d.ts.map +1 -0
  139. package/dist/components/Panel/PanelActions.js +203 -0
  140. package/dist/components/Panel/PanelActions.js.map +1 -0
  141. package/dist/components/Panel/PanelContent.d.ts +2 -1
  142. package/dist/components/Panel/PanelContent.d.ts.map +1 -1
  143. package/dist/components/Panel/PanelContent.js +4 -4
  144. package/dist/components/Panel/PanelContent.js.map +1 -1
  145. package/dist/components/Panel/PanelHeader.d.ts +8 -8
  146. package/dist/components/Panel/PanelHeader.d.ts.map +1 -1
  147. package/dist/components/Panel/PanelHeader.js +39 -106
  148. package/dist/components/Panel/PanelHeader.js.map +1 -1
  149. package/dist/components/Panel/PanelLinks.d.ts +6 -0
  150. package/dist/components/Panel/PanelLinks.d.ts.map +1 -0
  151. package/dist/components/Panel/PanelLinks.js +123 -0
  152. package/dist/components/Panel/PanelLinks.js.map +1 -0
  153. package/dist/components/PanelDrawer/PanelDrawer.d.ts +2 -1
  154. package/dist/components/PanelDrawer/PanelDrawer.d.ts.map +1 -1
  155. package/dist/components/PanelDrawer/PanelDrawer.js +10 -7
  156. package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -1
  157. package/dist/components/PanelDrawer/PanelEditorForm.d.ts +3 -3
  158. package/dist/components/PanelDrawer/PanelEditorForm.d.ts.map +1 -1
  159. package/dist/components/PanelDrawer/PanelEditorForm.js +70 -68
  160. package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -1
  161. package/dist/components/PanelDrawer/PanelPreview.d.ts +3 -2
  162. package/dist/components/PanelDrawer/PanelPreview.d.ts.map +1 -1
  163. package/dist/components/PanelDrawer/PanelPreview.js +8 -4
  164. package/dist/components/PanelDrawer/PanelPreview.js.map +1 -1
  165. package/dist/components/PanelDrawer/usePanelEditor.d.ts +12 -10
  166. package/dist/components/PanelDrawer/usePanelEditor.d.ts.map +1 -1
  167. package/dist/components/PanelDrawer/usePanelEditor.js +9 -6
  168. package/dist/components/PanelDrawer/usePanelEditor.js.map +1 -1
  169. package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts +2 -1
  170. package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts.map +1 -1
  171. package/dist/components/PanelGroupDialog/PanelGroupDialog.js +1 -1
  172. package/dist/components/PanelGroupDialog/PanelGroupDialog.js.map +1 -1
  173. package/dist/components/PanelGroupDialog/PanelGroupEditorForm.d.ts +2 -1
  174. package/dist/components/PanelGroupDialog/PanelGroupEditorForm.d.ts.map +1 -1
  175. package/dist/components/PanelGroupDialog/PanelGroupEditorForm.js.map +1 -1
  176. package/dist/components/QuerySummaryTable/QuerySummaryTable.d.ts +2 -1
  177. package/dist/components/QuerySummaryTable/QuerySummaryTable.d.ts.map +1 -1
  178. package/dist/components/QuerySummaryTable/QuerySummaryTable.js +3 -5
  179. package/dist/components/QuerySummaryTable/QuerySummaryTable.js.map +1 -1
  180. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.d.ts +2 -1
  181. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.d.ts.map +1 -1
  182. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +5 -7
  183. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js.map +1 -1
  184. package/dist/components/SaveDashboardButton/SaveDashboardButton.d.ts +2 -1
  185. package/dist/components/SaveDashboardButton/SaveDashboardButton.d.ts.map +1 -1
  186. package/dist/components/SaveDashboardButton/SaveDashboardButton.js +3 -3
  187. package/dist/components/SaveDashboardButton/SaveDashboardButton.js.map +1 -1
  188. package/dist/components/Variables/BuiltinVariableAccordions.d.ts +2 -1
  189. package/dist/components/Variables/BuiltinVariableAccordions.d.ts.map +1 -1
  190. package/dist/components/Variables/BuiltinVariableAccordions.js +7 -14
  191. package/dist/components/Variables/BuiltinVariableAccordions.js.map +1 -1
  192. package/dist/components/Variables/EditVariablesButton.d.ts +2 -1
  193. package/dist/components/Variables/EditVariablesButton.d.ts.map +1 -1
  194. package/dist/components/Variables/EditVariablesButton.js +5 -5
  195. package/dist/components/Variables/EditVariablesButton.js.map +1 -1
  196. package/dist/components/Variables/{TemplateVariable.d.ts → Variable.d.ts} +6 -5
  197. package/dist/components/Variables/Variable.d.ts.map +1 -0
  198. package/dist/components/Variables/{TemplateVariable.js → Variable.js} +44 -61
  199. package/dist/components/Variables/Variable.js.map +1 -0
  200. package/dist/components/Variables/VariableEditor.d.ts +3 -2
  201. package/dist/components/Variables/VariableEditor.d.ts.map +1 -1
  202. package/dist/components/Variables/VariableEditor.js +35 -41
  203. package/dist/components/Variables/VariableEditor.js.map +1 -1
  204. package/dist/components/Variables/VariableList.d.ts +4 -3
  205. package/dist/components/Variables/VariableList.d.ts.map +1 -1
  206. package/dist/components/Variables/VariableList.js +21 -20
  207. package/dist/components/Variables/VariableList.js.map +1 -1
  208. package/dist/components/Variables/index.d.ts +1 -1
  209. package/dist/components/Variables/index.d.ts.map +1 -1
  210. package/dist/components/Variables/index.js +2 -2
  211. package/dist/components/Variables/index.js.map +1 -1
  212. package/dist/constants/styles.d.ts +4 -2
  213. package/dist/constants/styles.d.ts.map +1 -1
  214. package/dist/constants/styles.js +5 -3
  215. package/dist/constants/styles.js.map +1 -1
  216. package/dist/constants/user-interface-text.d.ts +3 -0
  217. package/dist/constants/user-interface-text.d.ts.map +1 -1
  218. package/dist/constants/user-interface-text.js +3 -0
  219. package/dist/constants/user-interface-text.js.map +1 -1
  220. package/dist/context/DashboardProvider/DashboardProvider.d.ts +6 -3
  221. package/dist/context/DashboardProvider/DashboardProvider.d.ts.map +1 -1
  222. package/dist/context/DashboardProvider/DashboardProvider.js +11 -9
  223. package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -1
  224. package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.d.ts +4 -0
  225. package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.d.ts.map +1 -0
  226. package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.js +28 -0
  227. package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.js.map +1 -0
  228. package/dist/context/DashboardProvider/common.d.ts.map +1 -1
  229. package/dist/context/DashboardProvider/common.js +2 -2
  230. package/dist/context/DashboardProvider/common.js.map +1 -1
  231. package/dist/context/DashboardProvider/dashboard-provider-api.d.ts +36 -23
  232. package/dist/context/DashboardProvider/dashboard-provider-api.d.ts.map +1 -1
  233. package/dist/context/DashboardProvider/dashboard-provider-api.js +13 -6
  234. package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -1
  235. package/dist/context/DashboardProvider/delete-panel-group-slice.d.ts +2 -1
  236. package/dist/context/DashboardProvider/delete-panel-group-slice.d.ts.map +1 -1
  237. package/dist/context/DashboardProvider/delete-panel-group-slice.js.map +1 -1
  238. package/dist/context/DashboardProvider/delete-panel-slice.js +1 -2
  239. package/dist/context/DashboardProvider/delete-panel-slice.js.map +1 -1
  240. package/dist/context/DashboardProvider/discard-changes-dialog-slice.js.map +1 -1
  241. package/dist/context/DashboardProvider/duplicate-panel-slice.js.map +1 -1
  242. package/dist/context/DashboardProvider/edit-json-dialog-slice.js.map +1 -1
  243. package/dist/context/DashboardProvider/index.d.ts +1 -2
  244. package/dist/context/DashboardProvider/index.d.ts.map +1 -1
  245. package/dist/context/DashboardProvider/index.js.map +1 -1
  246. package/dist/context/DashboardProvider/panel-editor-slice.d.ts +2 -9
  247. package/dist/context/DashboardProvider/panel-editor-slice.d.ts.map +1 -1
  248. package/dist/context/DashboardProvider/panel-editor-slice.js +4 -7
  249. package/dist/context/DashboardProvider/panel-editor-slice.js.map +1 -1
  250. package/dist/context/DashboardProvider/panel-group-editor-slice.d.ts +2 -1
  251. package/dist/context/DashboardProvider/panel-group-editor-slice.d.ts.map +1 -1
  252. package/dist/context/DashboardProvider/panel-group-editor-slice.js +1 -2
  253. package/dist/context/DashboardProvider/panel-group-editor-slice.js.map +1 -1
  254. package/dist/context/DashboardProvider/panel-group-slice.d.ts +2 -2
  255. package/dist/context/DashboardProvider/panel-group-slice.d.ts.map +1 -1
  256. package/dist/context/DashboardProvider/panel-group-slice.js +7 -3
  257. package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -1
  258. package/dist/context/DashboardProvider/save-changes-dialog-slice.js.map +1 -1
  259. package/dist/context/DashboardProvider/view-panel-slice.d.ts +21 -0
  260. package/dist/context/DashboardProvider/view-panel-slice.d.ts.map +1 -0
  261. package/dist/context/DashboardProvider/view-panel-slice.js +73 -0
  262. package/dist/context/DashboardProvider/view-panel-slice.js.map +1 -0
  263. package/dist/context/DatasourceStoreProvider.d.ts +7 -7
  264. package/dist/context/DatasourceStoreProvider.d.ts.map +1 -1
  265. package/dist/context/DatasourceStoreProvider.js +18 -23
  266. package/dist/context/DatasourceStoreProvider.js.map +1 -1
  267. package/dist/context/VariableProvider/VariableProvider.d.ts +119 -0
  268. package/dist/context/VariableProvider/VariableProvider.d.ts.map +1 -0
  269. package/dist/context/{TemplateVariableProvider/TemplateVariableProvider.js → VariableProvider/VariableProvider.js} +51 -54
  270. package/dist/context/VariableProvider/VariableProvider.js.map +1 -0
  271. package/dist/context/{TemplateVariableProvider → VariableProvider}/hydrationUtils.d.ts +1 -1
  272. package/dist/context/VariableProvider/hydrationUtils.d.ts.map +1 -0
  273. package/dist/context/{TemplateVariableProvider → VariableProvider}/hydrationUtils.js +9 -12
  274. package/dist/context/VariableProvider/hydrationUtils.js.map +1 -0
  275. package/dist/context/VariableProvider/index.d.ts +2 -0
  276. package/dist/context/VariableProvider/index.d.ts.map +1 -0
  277. package/dist/{validation → context/VariableProvider}/index.js +2 -2
  278. package/dist/context/VariableProvider/index.js.map +1 -0
  279. package/dist/context/{TemplateVariableProvider → VariableProvider}/query-params.d.ts +2 -6
  280. package/dist/context/VariableProvider/query-params.d.ts.map +1 -0
  281. package/dist/context/{TemplateVariableProvider → VariableProvider}/query-params.js +1 -1
  282. package/dist/context/VariableProvider/query-params.js.map +1 -0
  283. package/dist/context/{TemplateVariableProvider → VariableProvider}/utils.d.ts +1 -1
  284. package/dist/context/VariableProvider/utils.d.ts.map +1 -0
  285. package/dist/context/{TemplateVariableProvider → VariableProvider}/utils.js +3 -3
  286. package/dist/context/VariableProvider/utils.js.map +1 -0
  287. package/dist/context/index.d.ts +1 -1
  288. package/dist/context/index.d.ts.map +1 -1
  289. package/dist/context/index.js +2 -2
  290. package/dist/context/index.js.map +1 -1
  291. package/dist/context/useDashboard.d.ts.map +1 -1
  292. package/dist/context/useDashboard.js +4 -4
  293. package/dist/context/useDashboard.js.map +1 -1
  294. package/dist/stories/decorators/WithDashboard.js +1 -1
  295. package/dist/stories/decorators/WithDashboard.js.map +1 -1
  296. package/dist/stories/decorators/WithDatasourceStore.js +1 -1
  297. package/dist/stories/decorators/WithDatasourceStore.js.map +1 -1
  298. package/dist/stories/decorators/{WithTemplateVariables.js → WithVariables.js} +9 -9
  299. package/dist/stories/decorators/WithVariables.js.map +1 -0
  300. package/dist/stories/decorators/index.js +2 -2
  301. package/dist/stories/decorators/index.js.map +1 -1
  302. package/dist/test/dashboard-provider.d.ts +1 -1
  303. package/dist/test/dashboard-provider.d.ts.map +1 -1
  304. package/dist/test/dashboard-provider.js.map +1 -1
  305. package/dist/test/datasource-provider.d.ts +2 -2
  306. package/dist/test/datasource-provider.d.ts.map +1 -1
  307. package/dist/test/datasource-provider.js.map +1 -1
  308. package/dist/test/plugin-registry.d.ts.map +1 -1
  309. package/dist/test/plugin-registry.js +4 -2
  310. package/dist/test/plugin-registry.js.map +1 -1
  311. package/dist/test/render.d.ts +2 -2
  312. package/dist/test/render.d.ts.map +1 -1
  313. package/dist/test/render.js +9 -7
  314. package/dist/test/render.js.map +1 -1
  315. package/dist/utils/panelUtils.d.ts.map +1 -1
  316. package/dist/utils/panelUtils.js.map +1 -1
  317. package/dist/views/ViewDashboard/DashboardApp.d.ts +2 -2
  318. package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -1
  319. package/dist/views/ViewDashboard/DashboardApp.js +3 -3
  320. package/dist/views/ViewDashboard/DashboardApp.js.map +1 -1
  321. package/dist/views/ViewDashboard/ViewDashboard.d.ts +4 -3
  322. package/dist/views/ViewDashboard/ViewDashboard.d.ts.map +1 -1
  323. package/dist/views/ViewDashboard/ViewDashboard.js +8 -9
  324. package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -1
  325. package/package.json +9 -9
  326. package/dist/cjs/context/TemplateVariableProvider/index.js +0 -30
  327. package/dist/components/Variables/TemplateVariable.d.ts.map +0 -1
  328. package/dist/components/Variables/TemplateVariable.js.map +0 -1
  329. package/dist/context/TemplateVariableProvider/TemplateVariableProvider.d.ts +0 -77
  330. package/dist/context/TemplateVariableProvider/TemplateVariableProvider.d.ts.map +0 -1
  331. package/dist/context/TemplateVariableProvider/TemplateVariableProvider.js.map +0 -1
  332. package/dist/context/TemplateVariableProvider/hydrationUtils.d.ts.map +0 -1
  333. package/dist/context/TemplateVariableProvider/hydrationUtils.js.map +0 -1
  334. package/dist/context/TemplateVariableProvider/index.d.ts +0 -2
  335. package/dist/context/TemplateVariableProvider/index.d.ts.map +0 -1
  336. package/dist/context/TemplateVariableProvider/index.js.map +0 -1
  337. package/dist/context/TemplateVariableProvider/query-params.d.ts.map +0 -1
  338. package/dist/context/TemplateVariableProvider/query-params.js.map +0 -1
  339. package/dist/context/TemplateVariableProvider/utils.d.ts.map +0 -1
  340. package/dist/context/TemplateVariableProvider/utils.js.map +0 -1
  341. package/dist/stories/decorators/WithTemplateVariables.js.map +0 -1
  342. package/dist/validation/index.d.ts +0 -2
  343. package/dist/validation/index.d.ts.map +0 -1
  344. package/dist/validation/index.js.map +0 -1
  345. package/dist/validation/panel.d.ts +0 -19
  346. package/dist/validation/panel.d.ts.map +0 -1
  347. package/dist/validation/panel.js +0 -21
  348. package/dist/validation/panel.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Panel/PanelHeader.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { CardHeader, Typography, Stack, IconButton, CardHeaderProps, styled } from '@mui/material';\nimport { InfoTooltip, combineSx } from '@perses-dev/components';\nimport InformationOutlineIcon from 'mdi-material-ui/InformationOutline';\nimport PencilIcon from 'mdi-material-ui/PencilOutline';\nimport DeleteIcon from 'mdi-material-ui/DeleteOutline';\nimport DragIcon from 'mdi-material-ui/DragVertical';\nimport ContentCopy from 'mdi-material-ui/ContentCopy';\nimport { useReplaceVariablesInString } from '@perses-dev/plugin-system';\nimport { ARIA_LABEL_TEXT, TOOLTIP_TEXT } from '../../constants';\ntype OmittedProps = 'children' | 'action' | 'title' | 'disableTypography';\n\nexport interface PanelHeaderProps extends Omit<CardHeaderProps, OmittedProps> {\n id: string;\n title: string;\n description?: string;\n extra?: React.ReactNode;\n editHandlers?: {\n onEditPanelClick: () => void;\n onDuplicatePanelClick: () => void;\n onDeletePanelClick: () => void;\n };\n}\n\nexport function PanelHeader({\n id,\n title: rawTitle,\n description: rawDescription,\n editHandlers,\n sx,\n extra,\n ...rest\n}: PanelHeaderProps) {\n const titleElementId = `${id}-title`;\n const descriptionTooltipId = `${id}-description`;\n\n const title = useReplaceVariablesInString(rawTitle) as string;\n const description = useReplaceVariablesInString(rawDescription);\n\n let actions: CardHeaderProps['action'] = undefined;\n if (editHandlers !== undefined) {\n // If there are edit handlers, always just show the edit buttons\n actions = (\n <>\n <InfoTooltip description={TOOLTIP_TEXT.editPanel}>\n <HeaderIconButton\n aria-label={ARIA_LABEL_TEXT.editPanel(title)}\n size=\"small\"\n onClick={editHandlers.onEditPanelClick}\n >\n <PencilIcon fontSize=\"inherit\" />\n </HeaderIconButton>\n </InfoTooltip>\n <InfoTooltip description={TOOLTIP_TEXT.duplicatePanel}>\n <HeaderIconButton\n aria-label={ARIA_LABEL_TEXT.duplicatePanel(title)}\n size=\"small\"\n onClick={editHandlers.onDuplicatePanelClick}\n >\n <ContentCopy\n fontSize=\"inherit\"\n sx={{\n // Shrink this icon a little bit to look more consistent\n // with the other icons in the header.\n transform: 'scale(0.925)',\n }}\n />\n </HeaderIconButton>\n </InfoTooltip>\n <InfoTooltip description={TOOLTIP_TEXT.deletePanel}>\n <HeaderIconButton\n aria-label={ARIA_LABEL_TEXT.deletePanel(title)}\n size=\"small\"\n onClick={editHandlers.onDeletePanelClick}\n >\n <DeleteIcon fontSize=\"inherit\" />\n </HeaderIconButton>\n </InfoTooltip>\n <InfoTooltip description={TOOLTIP_TEXT.movePanel}>\n <HeaderIconButton aria-label={ARIA_LABEL_TEXT.movePanel(title)} size=\"small\">\n <DragIcon className=\"drag-handle\" sx={{ cursor: 'grab' }} fontSize=\"inherit\" />\n </HeaderIconButton>\n </InfoTooltip>\n </>\n );\n }\n\n return (\n <CardHeader\n id={id}\n component=\"header\"\n aria-labelledby={titleElementId}\n aria-describedby={descriptionTooltipId}\n disableTypography\n title={\n <Stack direction=\"row\">\n <Typography\n id={titleElementId}\n variant=\"subtitle1\"\n sx={{\n // `minHeight` guarantees that the header has the correct height\n // when there is no title (i.e. in the preview)\n lineHeight: '24px',\n minHeight: '24px',\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n }}\n >\n {title}\n </Typography>\n {/* Show the info tooltip when description is defined and is not all whitespace */}\n {description !== undefined && description.trim().length > 0 && (\n <InfoTooltip id={descriptionTooltipId} description={description} enterDelay={100}>\n <HeaderIconButton aria-label=\"panel description\" size=\"small\">\n <InformationOutlineIcon\n aria-describedby=\"info-tooltip\"\n aria-hidden={false}\n fontSize=\"inherit\"\n sx={{ color: (theme) => theme.palette.text.secondary }}\n />\n </HeaderIconButton>\n </InfoTooltip>\n )}\n </Stack>\n }\n action={\n <HeaderActionWrapper direction=\"row\" spacing={0.25} alignItems=\"center\">\n {editHandlers === undefined && extra} {actions}\n </HeaderActionWrapper>\n }\n sx={combineSx(\n (theme) => ({\n padding: theme.spacing(1),\n borderBottom: `solid 1px ${theme.palette.divider}`,\n '.MuiCardHeader-content': {\n overflow: 'hidden',\n },\n '.MuiCardHeader-action': {\n // Overriding the negative margins from MUI's defaults, so we\n // can vertically center the icons. Moving these values to a wrapper\n // inside the action in `HeaderActionWrapper` below.\n // https://github.com/mui/material-ui/blob/master/packages/mui-material/src/CardHeader/CardHeader.js#L56-L58\n margin: 'auto',\n },\n }),\n sx\n )}\n {...rest}\n />\n );\n}\n\nconst HeaderIconButton = styled(IconButton)(({ theme }) => ({\n borderRadius: theme.shape.borderRadius,\n padding: '4px',\n}));\n\nconst HeaderActionWrapper = styled(Stack)(() => ({\n // Adding back the negative margins from MUI's defaults for actions, so we\n // avoid increasing the header size when actions are present while also being\n // able to vertically center the actions.\n // https://github.com/mui/material-ui/blob/master/packages/mui-material/src/CardHeader/CardHeader.js#L56-L58\n marginTop: -4,\n marginBottom: -4,\n}));\n"],"names":["CardHeader","Typography","Stack","IconButton","styled","InfoTooltip","combineSx","InformationOutlineIcon","PencilIcon","DeleteIcon","DragIcon","ContentCopy","useReplaceVariablesInString","ARIA_LABEL_TEXT","TOOLTIP_TEXT","PanelHeader","id","title","rawTitle","description","rawDescription","editHandlers","sx","extra","rest","titleElementId","descriptionTooltipId","actions","undefined","editPanel","HeaderIconButton","aria-label","size","onClick","onEditPanelClick","fontSize","duplicatePanel","onDuplicatePanelClick","transform","deletePanel","onDeletePanelClick","movePanel","className","cursor","component","aria-labelledby","aria-describedby","disableTypography","direction","variant","lineHeight","minHeight","whiteSpace","overflow","textOverflow","trim","length","enterDelay","aria-hidden","color","theme","palette","text","secondary","action","HeaderActionWrapper","spacing","alignItems","padding","borderBottom","divider","margin","borderRadius","shape","marginTop","marginBottom"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;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;QAG3CL,IAAIhB,UACF,CAACsD,QAAW,CAAA;gBACVQ,SAASR,MAAMM,OAAO,CAAC;gBACvBG,cAAc,CAAC,UAAU,EAAET,MAAMC,OAAO,CAACS,OAAO,CAAC,CAAC;gBAClD,0BAA0B;oBACxBjB,UAAU;gBACZ;gBACA,yBAAyB;oBACvB,6DAA6D;oBAC7D,oEAAoE;oBACpE,oDAAoD;oBACpD,4GAA4G;oBAC5GkB,QAAQ;gBACV;YACF,CAAA,GACAjD;QAED,GAAGE,IAAI;;AAGd;AAEA,MAAMM,mBAAmB1B,OAAOD,YAAY,CAAC,EAAEyD,KAAK,EAAE,GAAM,CAAA;QAC1DY,cAAcZ,MAAMa,KAAK,CAACD,YAAY;QACtCJ,SAAS;IACX,CAAA;AAEA,MAAMH,sBAAsB7D,OAAOF,OAAO,IAAO,CAAA;QAC/C,0EAA0E;QAC1E,6EAA6E;QAC7E,yCAAyC;QACzC,4GAA4G;QAC5GwE,WAAW,CAAC;QACZC,cAAc,CAAC;IACjB,CAAA"}
1
+ {"version":3,"sources":["../../../src/components/Panel/PanelHeader.tsx"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, CardHeader, CardHeaderProps, Stack, Typography } from '@mui/material';\nimport { InfoTooltip, combineSx } from '@perses-dev/components';\nimport { Link } from '@perses-dev/core';\nimport { useReplaceVariablesInString } from '@perses-dev/plugin-system';\nimport InformationOutlineIcon from 'mdi-material-ui/InformationOutline';\nimport { ReactElement, ReactNode } from 'react';\nimport { HEADER_ACTIONS_CONTAINER_NAME } from '../../constants';\nimport { PanelActions, PanelActionsProps } from './PanelActions';\nimport { PanelLinks } from './PanelLinks';\nimport { HeaderIconButton } from './HeaderIconButton';\n\ntype OmittedProps = 'children' | 'action' | 'title' | 'disableTypography';\n\nexport interface PanelHeaderProps extends Omit<CardHeaderProps, OmittedProps> {\n id: string;\n title: string;\n description?: string;\n links?: Link[];\n extra?: ReactNode;\n readHandlers?: PanelActionsProps['readHandlers'];\n editHandlers?: PanelActionsProps['editHandlers'];\n}\n\nexport function PanelHeader({\n id,\n title: rawTitle,\n description: rawDescription,\n links,\n readHandlers,\n editHandlers,\n sx,\n extra,\n ...rest\n}: PanelHeaderProps): ReactElement {\n const titleElementId = `${id}-title`;\n const descriptionTooltipId = `${id}-description`;\n\n const title = useReplaceVariablesInString(rawTitle) as string;\n const description = useReplaceVariablesInString(rawDescription);\n\n return (\n <CardHeader\n id={id}\n component=\"header\"\n aria-labelledby={titleElementId}\n aria-describedby={descriptionTooltipId}\n disableTypography\n title={\n <Stack direction=\"row\">\n <Typography\n id={titleElementId}\n variant=\"subtitle1\"\n sx={{\n // `minHeight` guarantees that the header has the correct height\n // when there is no title (i.e. in the preview)\n lineHeight: '24px',\n minHeight: '26px',\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n }}\n >\n {title}\n </Typography>\n {/* Show the info tooltip when description is defined and is not all whitespace */}\n {description !== undefined && description.trim().length > 0 && (\n <Box sx={{ display: editHandlers === undefined ? 'var(--panel-hover, none)' : 'flex' }}>\n <InfoTooltip id={descriptionTooltipId} description={description} enterDelay={100}>\n <HeaderIconButton aria-label=\"panel description\" size=\"small\">\n <InformationOutlineIcon\n aria-describedby=\"info-tooltip\"\n aria-hidden={false}\n fontSize=\"inherit\"\n sx={{ color: (theme) => theme.palette.text.secondary }}\n />\n </HeaderIconButton>\n </InfoTooltip>\n </Box>\n )}\n {links !== undefined && links.length > 0 && <PanelLinks links={links} />}\n </Stack>\n }\n action={<PanelActions title={title} readHandlers={readHandlers} editHandlers={editHandlers} extra={extra} />}\n sx={combineSx(\n (theme) => ({\n containerType: 'inline-size',\n containerName: HEADER_ACTIONS_CONTAINER_NAME,\n padding: theme.spacing(1),\n borderBottom: `solid 1px ${theme.palette.divider}`,\n '.MuiCardHeader-content': {\n overflow: 'hidden',\n },\n '.MuiCardHeader-action': {\n // Overriding the negative margins from MUI's defaults, so we\n // can vertically center the icons. Moving these values to a wrapper\n // inside the action in `HeaderActionWrapper` below.\n // https://github.com/mui/material-ui/blob/master/packages/mui-material/src/CardHeader/CardHeader.js#L56-L58\n margin: 'auto',\n },\n }),\n sx\n )}\n {...rest}\n />\n );\n}\n"],"names":["Box","CardHeader","Stack","Typography","InfoTooltip","combineSx","useReplaceVariablesInString","InformationOutlineIcon","HEADER_ACTIONS_CONTAINER_NAME","PanelActions","PanelLinks","HeaderIconButton","PanelHeader","id","title","rawTitle","description","rawDescription","links","readHandlers","editHandlers","sx","extra","rest","titleElementId","descriptionTooltipId","component","aria-labelledby","aria-describedby","disableTypography","direction","variant","lineHeight","minHeight","whiteSpace","overflow","textOverflow","undefined","trim","length","display","enterDelay","aria-label","size","aria-hidden","fontSize","color","theme","palette","text","secondary","action","containerType","containerName","padding","spacing","borderBottom","divider","margin"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,GAAG,EAAEC,UAAU,EAAmBC,KAAK,EAAEC,UAAU,QAAQ,gBAAgB;AACpF,SAASC,WAAW,EAAEC,SAAS,QAAQ,yBAAyB;AAEhE,SAASC,2BAA2B,QAAQ,4BAA4B;AACxE,OAAOC,4BAA4B,qCAAqC;AAExE,SAASC,6BAA6B,QAAQ,kBAAkB;AAChE,SAASC,YAAY,QAA2B,iBAAiB;AACjE,SAASC,UAAU,QAAQ,eAAe;AAC1C,SAAS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cE,OAAOA;;QACnGD,IAAIhB,UACF,CAAC0C,QAAW,CAAA;gBACVK,eAAe;gBACfC,eAAe7C;gBACf8C,SAASP,MAAMQ,OAAO,CAAC;gBACvBC,cAAc,CAAC,UAAU,EAAET,MAAMC,OAAO,CAACS,OAAO,CAAC,CAAC;gBAClD,0BAA0B;oBACxBtB,UAAU;gBACZ;gBACA,yBAAyB;oBACvB,6DAA6D;oBAC7D,oEAAoE;oBACpE,oDAAoD;oBACpD,4GAA4G;oBAC5GuB,QAAQ;gBACV;YACF,CAAA,GACArC;QAED,GAAGE,IAAI;;AAGd"}
@@ -0,0 +1,6 @@
1
+ import { Link } from '@perses-dev/core';
2
+ import { ReactElement } from 'react';
3
+ export declare function PanelLinks({ links }: {
4
+ links: Link[];
5
+ }): ReactElement;
6
+ //# sourceMappingURL=PanelLinks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PanelLinks.d.ts","sourceRoot":"","sources":["../../../src/components/Panel/PanelLinks.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAc,YAAY,EAAY,MAAM,OAAO,CAAC;AAI3D,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,IAAI,EAAE,CAAA;CAAE,GAAG,YAAY,CAgDrE"}
@@ -0,0 +1,123 @@
1
+ // Copyright 2024 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 { IconButton, Link as LinkComponent, Menu, MenuItem } from '@mui/material';
15
+ import LaunchIcon from 'mdi-material-ui/Launch';
16
+ import { useState } from 'react';
17
+ import { InfoTooltip } from '@perses-dev/components';
18
+ import { useReplaceVariablesInString } from '@perses-dev/plugin-system';
19
+ export function PanelLinks({ links }) {
20
+ const [anchorEl, setAnchorEl] = useState(null);
21
+ const isMenuOpened = Boolean(anchorEl);
22
+ const handleOpenMenu = (event)=>{
23
+ setAnchorEl(event.currentTarget);
24
+ };
25
+ const handleClose = ()=>{
26
+ setAnchorEl(null);
27
+ };
28
+ // If there is only one link, show it directly
29
+ if (links.length === 1 && links[0]) {
30
+ const link = links[0];
31
+ return /*#__PURE__*/ _jsx(LinkButton, {
32
+ link: link
33
+ });
34
+ }
35
+ // Else we show a menu with a list of all links
36
+ return /*#__PURE__*/ _jsxs(_Fragment, {
37
+ children: [
38
+ /*#__PURE__*/ _jsx(InfoTooltip, {
39
+ description: `${links.length} links`,
40
+ enterDelay: 100,
41
+ children: /*#__PURE__*/ _jsx(IconButton, {
42
+ "aria-label": "Panel links",
43
+ size: "small",
44
+ onClick: handleOpenMenu,
45
+ sx: (theme)=>({
46
+ borderRadius: theme.shape.borderRadius,
47
+ padding: '4px'
48
+ }),
49
+ children: /*#__PURE__*/ _jsx(LaunchIcon, {
50
+ "aria-describedby": "links-icon",
51
+ fontSize: "inherit",
52
+ sx: {
53
+ color: (theme)=>theme.palette.text.secondary
54
+ }
55
+ })
56
+ })
57
+ }),
58
+ /*#__PURE__*/ _jsx(Menu, {
59
+ anchorEl: anchorEl,
60
+ open: isMenuOpened,
61
+ onClose: handleClose,
62
+ MenuListProps: {
63
+ 'aria-labelledby': 'panel-links'
64
+ },
65
+ children: links.map((link)=>/*#__PURE__*/ _jsx(LinkMenuItem, {
66
+ link: link
67
+ }, link.url))
68
+ })
69
+ ]
70
+ });
71
+ }
72
+ function LinkButton({ link }) {
73
+ const { url, name, tooltip, targetBlank } = useLink(link);
74
+ return /*#__PURE__*/ _jsx(InfoTooltip, {
75
+ description: tooltip ?? url,
76
+ enterDelay: 100,
77
+ children: /*#__PURE__*/ _jsx(IconButton, {
78
+ "aria-label": name ?? url,
79
+ size: "small",
80
+ href: url,
81
+ target: targetBlank ? '_blank' : '_self',
82
+ sx: (theme)=>({
83
+ borderRadius: theme.shape.borderRadius,
84
+ padding: '4px'
85
+ }),
86
+ children: /*#__PURE__*/ _jsx(LaunchIcon, {
87
+ fontSize: "inherit",
88
+ sx: {
89
+ color: (theme)=>theme.palette.text.secondary
90
+ }
91
+ })
92
+ })
93
+ });
94
+ }
95
+ function LinkMenuItem({ link }) {
96
+ const { url, name, tooltip, targetBlank } = useLink(link);
97
+ return /*#__PURE__*/ _jsx(InfoTooltip, {
98
+ description: tooltip ?? url,
99
+ enterDelay: 100,
100
+ children: /*#__PURE__*/ _jsx(MenuItem, {
101
+ component: LinkComponent,
102
+ href: url,
103
+ target: targetBlank ? '_blank' : '_self',
104
+ children: name ?? url
105
+ })
106
+ });
107
+ }
108
+ function useLink(link) {
109
+ const url = useReplaceVariablesInString(link.url) ?? link.url;
110
+ const name = useReplaceVariablesInString(link.name);
111
+ const tooltip = useReplaceVariablesInString(link.tooltip);
112
+ if (link.renderVariables === false) {
113
+ return link;
114
+ }
115
+ return {
116
+ ...link,
117
+ url,
118
+ name,
119
+ tooltip
120
+ };
121
+ }
122
+
123
+ //# sourceMappingURL=PanelLinks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/Panel/PanelLinks.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { IconButton, Link as LinkComponent, Menu, MenuItem, Theme } from '@mui/material';\nimport LaunchIcon from 'mdi-material-ui/Launch';\nimport { Link } from '@perses-dev/core';\nimport { MouseEvent, ReactElement, useState } from 'react';\nimport { InfoTooltip } from '@perses-dev/components';\nimport { useReplaceVariablesInString } from '@perses-dev/plugin-system';\n\nexport function PanelLinks({ links }: { links: Link[] }): ReactElement {\n const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);\n const isMenuOpened = Boolean(anchorEl);\n const handleOpenMenu = (event: MouseEvent<HTMLButtonElement>): void => {\n setAnchorEl(event.currentTarget);\n };\n const handleClose = (): void => {\n setAnchorEl(null);\n };\n\n // If there is only one link, show it directly\n if (links.length === 1 && links[0]) {\n const link = links[0];\n return <LinkButton link={link} />;\n }\n\n // Else we show a menu with a list of all links\n return (\n <>\n <InfoTooltip description={`${links.length} links`} enterDelay={100}>\n <IconButton\n aria-label=\"Panel links\"\n size=\"small\"\n onClick={handleOpenMenu}\n sx={(theme) => ({ borderRadius: theme.shape.borderRadius, padding: '4px' })}\n >\n <LaunchIcon\n aria-describedby=\"links-icon\"\n fontSize=\"inherit\"\n sx={{ color: (theme) => theme.palette.text.secondary }}\n />\n </IconButton>\n </InfoTooltip>\n\n <Menu\n anchorEl={anchorEl}\n open={isMenuOpened}\n onClose={handleClose}\n MenuListProps={{\n 'aria-labelledby': 'panel-links',\n }}\n >\n {links.map((link: Link) => (\n <LinkMenuItem key={link.url} link={link} />\n ))}\n </Menu>\n </>\n );\n}\n\nfunction LinkButton({ link }: { link: Link }): ReactElement {\n const { url, name, tooltip, targetBlank } = useLink(link);\n\n return (\n <InfoTooltip description={tooltip ?? url} enterDelay={100}>\n <IconButton\n aria-label={name ?? url}\n size=\"small\"\n href={url}\n target={targetBlank ? '_blank' : '_self'}\n sx={(theme) => ({ borderRadius: theme.shape.borderRadius, padding: '4px' })}\n >\n <LaunchIcon fontSize=\"inherit\" sx={{ color: (theme: Theme) => theme.palette.text.secondary }} />\n </IconButton>\n </InfoTooltip>\n );\n}\n\nfunction LinkMenuItem({ link }: { link: Link }): ReactElement {\n const { url, name, tooltip, targetBlank } = useLink(link);\n\n return (\n <InfoTooltip description={tooltip ?? url} enterDelay={100}>\n <MenuItem component={LinkComponent} href={url} target={targetBlank ? '_blank' : '_self'}>\n {name ?? url}\n </MenuItem>\n </InfoTooltip>\n );\n}\n\nfunction useLink(link: Link): Link {\n const url = useReplaceVariablesInString(link.url) ?? link.url;\n const name = useReplaceVariablesInString(link.name);\n const tooltip = useReplaceVariablesInString(link.tooltip);\n\n if (link.renderVariables === false) {\n return link;\n }\n\n return { ...link, url, name, tooltip };\n}\n"],"names":["IconButton","Link","LinkComponent","Menu","MenuItem","LaunchIcon","useState","InfoTooltip","useReplaceVariablesInString","PanelLinks","links","anchorEl","setAnchorEl","isMenuOpened","Boolean","handleOpenMenu","event","currentTarget","handleClose","length","link","LinkButton","description","enterDelay","aria-label","size","onClick","sx","theme","borderRadius","shape","padding","aria-describedby","fontSize","color","palette","text","secondary","open","onClose","MenuListProps","map","LinkMenuItem","url","name","tooltip","targetBlank","useLink","href","target","component","renderVariables"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,UAAU,EAAEC,QAAQC,aAAa,EAAEC,IAAI,EAAEC,QAAQ,QAAe,gBAAgB;AACzF,OAAOC,gBAAgB,yBAAyB;AAEhD,SAAmCC,QAAQ,QAAQ,QAAQ;AAC3D,SAASC,WAAW,QAAQ,yBAAyB;AACrD,SAASC,2BAA2B,QAAQ,4BAA4B;AAExE,OAAO,SAASC,WAAW,EAAEC,KAAK,EAAqB;IACrD,MAAM,CAACC,UAAUC,YAAY,GAAGN,SAA6B;IAC7D,MAAMO,eAAeC,QAAQH;IAC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oBAAEE,SAAS;gBAAM,CAAA;sBAEzE,cAAA,KAAC1B;gBAAW4B,UAAS;gBAAUN,IAAI;oBAAEO,OAAO,CAACN,QAAiBA,MAAMO,OAAO,CAACC,IAAI,CAACC,SAAS;gBAAC;;;;AAInG;AAEA,SAASK,aAAa,EAAEtB,IAAI,EAAkB;IAC5C,MAAM,EAAEuB,GAAG,EAAEC,IAAI,EAAEC,OAAO,EAAEC,WAAW,EAAE,GAAGC,QAAQ3B;IAEpD,qBACE,KAACb;QAAYe,aAAauB,WAAWF;QAAKpB,YAAY;kBACpD,cAAA,KAACnB;YAAS8C,WAAWhD;YAAe8C,MAAML;YAAKM,QAAQH,cAAc,WAAW;sBAC7EF,QAAQD;;;AAIjB;AAEA,SAASI,QAAQ3B,IAAU;IACzB,MAAMuB,MAAMnC,4BAA4BY,KAAKuB,GAAG,KAAKvB,KAAKuB,GAAG;IAC7D,MAAMC,OAAOpC,4BAA4BY,KAAKwB,IAAI;IAClD,MAAMC,UAAUrC,4BAA4BY,KAAKyB,OAAO;IAExD,IAAIzB,KAAK+B,eAAe,KAAK,OAAO;QAClC,OAAO/B;IACT;IAEA,OAAO;QAAE,GAAGA,IAAI;QAAEuB;QAAKC;QAAMC;IAAQ;AACvC"}
@@ -1,5 +1,6 @@
1
+ import { ReactElement } from 'react';
1
2
  /**
2
3
  * The Add/Edit panel drawer for editing a panel's options.
3
4
  */
4
- export declare const PanelDrawer: () => import("react/jsx-runtime").JSX.Element;
5
+ export declare const PanelDrawer: () => ReactElement;
5
6
  //# sourceMappingURL=PanelDrawer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PanelDrawer.d.ts","sourceRoot":"","sources":["../../../src/components/PanelDrawer/PanelDrawer.tsx"],"names":[],"mappings":"AAmBA;;GAEG;AACH,eAAO,MAAM,WAAW,+CA+CvB,CAAC"}
1
+ {"version":3,"file":"PanelDrawer.d.ts","sourceRoot":"","sources":["../../../src/components/PanelDrawer/PanelDrawer.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,YAAY,EAAY,MAAM,OAAO,CAAC;AAM/C;;GAEG;AACH,eAAO,MAAM,WAAW,QAAO,YAiD9B,CAAC"}
@@ -12,7 +12,7 @@
12
12
  // limitations under the License.
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
14
  import { useState } from 'react';
15
- import { Drawer } from '@perses-dev/components';
15
+ import { Drawer, ErrorAlert, ErrorBoundary } from '@perses-dev/components';
16
16
  import { usePanelEditor } from '../../context';
17
17
  import { PanelEditorForm } from './PanelEditorForm';
18
18
  /**
@@ -36,7 +36,7 @@ import { PanelEditorForm } from './PanelEditorForm';
36
36
  };
37
37
  // Don't call closeDrawer on the store until the Drawer has completely transitioned out and reset close state
38
38
  const handleExited = ()=>{
39
- panelEditor === null || panelEditor === void 0 ? void 0 : panelEditor.close();
39
+ panelEditor?.close();
40
40
  setIsClosing(false);
41
41
  };
42
42
  // Disables closing on click out. This is a quick-win solution to avoid losing draft changes.
@@ -50,11 +50,14 @@ import { PanelEditorForm } from './PanelEditorForm';
50
50
  onExited: handleExited
51
51
  },
52
52
  "data-testid": "panel-editor",
53
- children: panelEditor && /*#__PURE__*/ _jsx(PanelEditorForm, {
54
- initialAction: panelEditor.mode,
55
- initialValues: panelEditor.initialValues,
56
- onSave: handleSave,
57
- onClose: handleClose
53
+ children: panelEditor && /*#__PURE__*/ _jsx(ErrorBoundary, {
54
+ FallbackComponent: ErrorAlert,
55
+ children: /*#__PURE__*/ _jsx(PanelEditorForm, {
56
+ initialAction: panelEditor.mode,
57
+ initialValues: panelEditor.initialValues,
58
+ onSave: handleSave,
59
+ onClose: handleClose
60
+ })
58
61
  })
59
62
  });
60
63
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/PanelDrawer/PanelDrawer.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-function */\n// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { useState } from 'react';\nimport { Drawer } from '@perses-dev/components';\nimport { PanelEditorValues, usePanelEditor } from '../../context';\nimport { PanelEditorForm } from './PanelEditorForm';\n\n/**\n * The Add/Edit panel drawer for editing a panel's options.\n */\nexport const PanelDrawer = () => {\n const panelEditor = usePanelEditor();\n\n // When the user clicks close, start closing but don't call the store yet to keep values stable during animtation\n const [isClosing, setIsClosing] = useState(false);\n\n // Drawer is open if we have a model and we're not transitioning out\n const isOpen = panelEditor !== undefined && isClosing === false;\n\n function handleSave(values: PanelEditorValues) {\n // This shouldn't happen since we don't render the submit button until we have a model, but check to make TS happy\n if (panelEditor === undefined || values === undefined) {\n throw new Error('Cannot apply changes');\n }\n panelEditor.applyChanges(values);\n setIsClosing(true);\n }\n\n const handleClose = () => {\n setIsClosing(true);\n };\n\n // Don't call closeDrawer on the store until the Drawer has completely transitioned out and reset close state\n const handleExited = () => {\n panelEditor?.close();\n setIsClosing(false);\n };\n\n // Disables closing on click out. This is a quick-win solution to avoid losing draft changes.\n // -> TODO find a way to enable closing by clicking-out in edit view, with a discard confirmation modal popping up\n const handleClickOut = () => {\n /* do nothing */\n };\n\n return (\n <Drawer isOpen={isOpen} onClose={handleClickOut} SlideProps={{ onExited: handleExited }} data-testid=\"panel-editor\">\n {/* When the drawer is opened, we should have panel editor state (this also ensures the form state gets reset between opens) */}\n {panelEditor && (\n <PanelEditorForm\n initialAction={panelEditor.mode}\n initialValues={panelEditor.initialValues}\n onSave={handleSave}\n onClose={handleClose}\n />\n )}\n </Drawer>\n );\n};\n"],"names":["useState","Drawer","usePanelEditor","PanelEditorForm","PanelDrawer","panelEditor","isClosing","setIsClosing","isOpen","undefined","handleSave","values","Error","applyChanges","handleClose","handleExited","close","handleClickOut","onClose","SlideProps","onExited","data-testid","initialAction","mode","initialValues","onSave"],"mappings":"AAAA,uDAAuD,GACvD,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,QAAQ,QAAQ,QAAQ;AACjC,SAASC,MAAM,QAAQ,yBAAyB;AAChD,SAA4BC,cAAc,QAAQ,gBAAgB;AAClE,SAASC,eAAe,QAAQ,oBAAoB;AAEpD;;CAEC,GACD,OAAO,MAAMC,cAAc;IACzB,MAAMC,cAAcH;IAEpB,iHAAiH;IACjH,MAAM,CAACI,WAAWC,aAAa,GAAGP,SAAS;IAE3C,oEAAoE;IACpE,MAAMQ,SAASH,gBAAgBI,aAAaH,cAAc;IAE1D,SAASI,WAAWC,MAAyB;QAC3C,kHAAkH;QAClH,IAAIN,gBAAgBI,aAAaE,WAAWF,WAAW;YACrD,MAAM,IAAIG,MAAM;QAClB;QACAP,YAAYQ,YAAY,CAACF;QACzBJ,aAAa;IACf;IAEA,MAAMO,cAAc;QAClBP,aAAa;IACf;IAEA,6GAA6G;IAC7G,MAAMQ,eAAe;QACnBV,wBAAAA,kCAAAA,YAAaW,KAAK;QAClBT,aAAa;IACf;IAEA,6FAA6F;IAC7F,kHAAkH;IAClH,MAAMU,iBAAiB;IACrB,cAAc,GAChB;IAEA,qBACE,KAAChB;QAAOO,QAAQA;QAAQU,SAASD;QAAgBE,YAAY;YAAEC,UAAUL;QAAa;QAAGM,eAAY;kBAElGhB,6BACC,KAACF;YACCmB,eAAejB,YAAYkB,IAAI;YAC/BC,eAAenB,YAAYmB,aAAa;YACxCC,QAAQf;YACRQ,SAASJ;;;AAKnB,EAAE"}
1
+ {"version":3,"sources":["../../../src/components/PanelDrawer/PanelDrawer.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-function */\n// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ReactElement, useState } from 'react';\nimport { Drawer, ErrorAlert, ErrorBoundary } from '@perses-dev/components';\nimport { PanelEditorValues } from '@perses-dev/core';\nimport { usePanelEditor } from '../../context';\nimport { PanelEditorForm } from './PanelEditorForm';\n\n/**\n * The Add/Edit panel drawer for editing a panel's options.\n */\nexport const PanelDrawer = (): ReactElement => {\n const panelEditor = usePanelEditor();\n\n // When the user clicks close, start closing but don't call the store yet to keep values stable during animtation\n const [isClosing, setIsClosing] = useState(false);\n\n // Drawer is open if we have a model and we're not transitioning out\n const isOpen = panelEditor !== undefined && isClosing === false;\n\n function handleSave(values: PanelEditorValues): void {\n // This shouldn't happen since we don't render the submit button until we have a model, but check to make TS happy\n if (panelEditor === undefined || values === undefined) {\n throw new Error('Cannot apply changes');\n }\n panelEditor.applyChanges(values);\n setIsClosing(true);\n }\n\n const handleClose = (): void => {\n setIsClosing(true);\n };\n\n // Don't call closeDrawer on the store until the Drawer has completely transitioned out and reset close state\n const handleExited = (): void => {\n panelEditor?.close();\n setIsClosing(false);\n };\n\n // Disables closing on click out. This is a quick-win solution to avoid losing draft changes.\n // -> TODO find a way to enable closing by clicking-out in edit view, with a discard confirmation modal popping up\n const handleClickOut = (): void => {\n /* do nothing */\n };\n\n return (\n <Drawer isOpen={isOpen} onClose={handleClickOut} SlideProps={{ onExited: handleExited }} data-testid=\"panel-editor\">\n {/* When the drawer is opened, we should have panel editor state (this also ensures the form state gets reset between opens) */}\n {panelEditor && (\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <PanelEditorForm\n initialAction={panelEditor.mode}\n initialValues={panelEditor.initialValues}\n onSave={handleSave}\n onClose={handleClose}\n />\n </ErrorBoundary>\n )}\n </Drawer>\n );\n};\n"],"names":["useState","Drawer","ErrorAlert","ErrorBoundary","usePanelEditor","PanelEditorForm","PanelDrawer","panelEditor","isClosing","setIsClosing","isOpen","undefined","handleSave","values","Error","applyChanges","handleClose","handleExited","close","handleClickOut","onClose","SlideProps","onExited","data-testid","FallbackComponent","initialAction","mode","initialValues","onSave"],"mappings":"AAAA,uDAAuD,GACvD,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAAuBA,QAAQ,QAAQ,QAAQ;AAC/C,SAASC,MAAM,EAAEC,UAAU,EAAEC,aAAa,QAAQ,yBAAyB;AAE3E,SAASC,cAAc,QAAQ,gBAAgB;AAC/C,SAASC,eAAe,QAAQ,oBAAoB;AAEpD;;CAEC,GACD,OAAO,MAAMC,cAAc;IACzB,MAAMC,cAAcH;IAEpB,iHAAiH;IACjH,MAAM,CAACI,WAAWC,aAAa,GAAGT,SAAS;IAE3C,oEAAoE;IACpE,MAAMU,SAASH,gBAAgBI,aAAaH,cAAc;IAE1D,SAASI,WAAWC,MAAyB;QAC3C,kHAAkH;QAClH,IAAIN,gBAAgBI,aAAaE,WAAWF,WAAW;YACrD,MAAM,IAAIG,MAAM;QAClB;QACAP,YAAYQ,YAAY,CAACF;QACzBJ,aAAa;IACf;IAEA,MAAMO,cAAc;QAClBP,aAAa;IACf;IAEA,6GAA6G;IAC7G,MAAMQ,eAAe;QACnBV,aAAaW;QACbT,aAAa;IACf;IAEA,6FAA6F;IAC7F,kHAAkH;IAClH,MAAMU,iBAAiB;IACrB,cAAc,GAChB;IAEA,qBACE,KAAClB;QAAOS,QAAQA;QAAQU,SAASD;QAAgBE,YAAY;YAAEC,UAAUL;QAAa;QAAGM,eAAY;kBAElGhB,6BACC,KAACJ;YAAcqB,mBAAmBtB;sBAChC,cAAA,KAACG;gBACCoB,eAAelB,YAAYmB,IAAI;gBAC/BC,eAAepB,YAAYoB,aAAa;gBACxCC,QAAQhB;gBACRQ,SAASJ;;;;AAMrB,EAAE"}
@@ -1,12 +1,12 @@
1
- import { Action } from '@perses-dev/core';
2
- import { PanelEditorValues } from '../../context/DashboardProvider/panel-editor-slice';
1
+ import { ReactElement } from 'react';
2
+ import { Action, PanelEditorValues } from '@perses-dev/core';
3
3
  export interface PanelEditorFormProps {
4
4
  initialValues: PanelEditorValues;
5
5
  initialAction: Action;
6
6
  onSave: (values: PanelEditorValues) => void;
7
7
  onClose: () => void;
8
8
  }
9
- export declare function PanelEditorForm(props: PanelEditorFormProps): import("react/jsx-runtime").JSX.Element;
9
+ export declare function PanelEditorForm(props: PanelEditorFormProps): ReactElement;
10
10
  /**
11
11
  * The `id` attribute added to the `PanelEditorForm` component, allowing submit buttons to live outside the form.
12
12
  */
@@ -1 +1 @@
1
- {"version":3,"file":"PanelEditorForm.d.ts","sourceRoot":"","sources":["../../../src/components/PanelDrawer/PanelEditorForm.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAE,MAAM,EAAmB,MAAM,kBAAkB,CAAC;AAY3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAC;AAKvF,MAAM,WAAW,oBAAoB;IACnC,aAAa,EAAE,iBAAiB,CAAC;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC5C,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,2CAwN1D;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB,sBAAsB,CAAC"}
1
+ {"version":3,"file":"PanelEditorForm.d.ts","sourceRoot":"","sources":["../../../src/components/PanelDrawer/PanelEditorForm.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAuB,MAAM,OAAO,CAAC;AAE1D,OAAO,EAAE,MAAM,EAAmB,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAgB9E,MAAM,WAAW,oBAAoB;IACnC,aAAa,EAAE,iBAAiB,CAAC;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC5C,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,YAAY,CA0NzE;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB,sBAAsB,CAAC"}
@@ -11,32 +11,42 @@
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
13
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
- import { useState } from 'react';
14
+ import { useEffect, useState } from 'react';
15
15
  import { Box, Button, Grid, MenuItem, Stack, TextField, Typography } from '@mui/material';
16
16
  import { DiscardChangesConfirmationDialog, ErrorAlert, ErrorBoundary } from '@perses-dev/components';
17
- import { PluginKindSelect, usePluginEditor, PanelSpecEditor, getTitleAction, getSubmitText } from '@perses-dev/plugin-system';
18
- import { Controller, FormProvider, useForm } from 'react-hook-form';
17
+ import { PluginKindSelect, usePluginEditor, PanelSpecEditor, getTitleAction, getSubmitText, useValidationSchemas } from '@perses-dev/plugin-system';
18
+ import { Controller, FormProvider, useForm, useWatch } from 'react-hook-form';
19
19
  import { zodResolver } from '@hookform/resolvers/zod';
20
20
  import { useListPanelGroups } from '../../context';
21
- import { panelEditorValidationSchema } from '../../validation';
22
21
  import { PanelPreview } from './PanelPreview';
23
22
  import { usePanelEditor } from './usePanelEditor';
24
23
  export function PanelEditorForm(props) {
25
- const { initialValues: { panelDefinition: initialPanelDef, groupId: initialGroupId }, initialAction, onSave, onClose } = props;
24
+ const { initialValues, initialAction, onSave, onClose } = props;
26
25
  const panelGroups = useListPanelGroups();
27
- const [groupId, setGroupId] = useState(initialGroupId);
28
- const { panelDefinition, setName, setDescription, setQueries, setPlugin, setPanelDefinition } = usePanelEditor(initialPanelDef);
26
+ const { panelDefinition, setName, setDescription, setLinks, setQueries, setPlugin, setPanelDefinition } = usePanelEditor(initialValues.panelDefinition);
29
27
  const { plugin } = panelDefinition.spec;
30
28
  const [isDiscardDialogOpened, setDiscardDialogOpened] = useState(false);
31
29
  // Use common plugin editor logic even though we've split the inputs up in this form
32
30
  const pluginEditor = usePluginEditor({
33
- pluginType: 'Panel',
31
+ pluginTypes: [
32
+ 'Panel'
33
+ ],
34
34
  value: {
35
- kind: plugin.kind,
35
+ selection: {
36
+ kind: plugin.kind,
37
+ type: 'Panel'
38
+ },
36
39
  spec: plugin.spec
37
40
  },
38
41
  onChange: (plugin)=>{
39
- setPlugin(plugin);
42
+ form.setValue('panelDefinition.spec.plugin', {
43
+ kind: plugin.selection.kind,
44
+ spec: plugin.spec
45
+ });
46
+ setPlugin({
47
+ kind: plugin.selection.kind,
48
+ spec: plugin.spec
49
+ });
40
50
  },
41
51
  onHideQueryEditorChange: (isHidden)=>{
42
52
  setQueries(undefined, isHidden);
@@ -44,35 +54,31 @@ export function PanelEditorForm(props) {
44
54
  });
45
55
  const titleAction = getTitleAction(initialAction, true);
46
56
  const submitText = getSubmitText(initialAction, true);
57
+ const { panelEditorSchema } = useValidationSchemas();
47
58
  const form = useForm({
48
- resolver: zodResolver(panelEditorValidationSchema),
59
+ resolver: zodResolver(panelEditorSchema),
49
60
  mode: 'onBlur',
50
- defaultValues: {
51
- name: initialPanelDef.spec.display.name,
52
- groupId: initialGroupId,
53
- description: initialPanelDef.spec.display.description,
54
- type: pluginEditor.pendingKind ? pluginEditor.pendingKind : plugin.kind
55
- }
61
+ defaultValues: initialValues
62
+ });
63
+ const links = useWatch({
64
+ control: form.control,
65
+ name: 'panelDefinition.spec.links'
56
66
  });
57
- const processForm = ()=>{
58
- const values = {
59
- groupId,
60
- panelDefinition
61
- };
62
- onSave(values);
67
+ useEffect(()=>{
68
+ setLinks(links);
69
+ }, [
70
+ setLinks,
71
+ links
72
+ ]);
73
+ const processForm = (data)=>{
74
+ onSave(data);
63
75
  };
64
76
  // When user click on cancel, several possibilities:
65
77
  // - create action: ask for discard approval
66
78
  // - update action: ask for discard approval if changed
67
79
  // - read action: don´t ask for discard approval
68
80
  function handleCancel() {
69
- if (JSON.stringify({
70
- groupId: initialGroupId,
71
- panelDefinition: initialPanelDef
72
- }) !== JSON.stringify({
73
- groupId,
74
- panelDefinition
75
- })) {
81
+ if (JSON.stringify(initialValues) !== JSON.stringify(form.getValues())) {
76
82
  setDiscardDialogOpened(true);
77
83
  } else {
78
84
  onClose();
@@ -141,98 +147,93 @@ export function PanelEditorForm(props) {
141
147
  item: true,
142
148
  xs: 8,
143
149
  children: /*#__PURE__*/ _jsx(Controller, {
144
- name: "name",
145
- render: ({ field, fieldState })=>{
146
- var _fieldState_error;
147
- return /*#__PURE__*/ _jsx(TextField, {
150
+ control: form.control,
151
+ name: "panelDefinition.spec.display.name",
152
+ render: ({ field, fieldState })=>/*#__PURE__*/ _jsx(TextField, {
148
153
  ...field,
149
154
  required: true,
150
155
  fullWidth: true,
151
156
  label: "Name",
152
157
  error: !!fieldState.error,
153
- helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
158
+ helperText: fieldState.error?.message,
159
+ value: field.value ?? '',
154
160
  onChange: (event)=>{
155
161
  field.onChange(event);
156
162
  setName(event.target.value);
157
163
  }
158
- });
159
- }
164
+ })
160
165
  })
161
166
  }),
162
167
  /*#__PURE__*/ _jsx(Grid, {
163
168
  item: true,
164
169
  xs: 4,
165
170
  children: /*#__PURE__*/ _jsx(Controller, {
171
+ control: form.control,
166
172
  name: "groupId",
167
- render: ({ field, fieldState })=>{
168
- var _fieldState_error;
169
- return /*#__PURE__*/ _jsx(TextField, {
173
+ render: ({ field, fieldState })=>/*#__PURE__*/ _jsx(TextField, {
170
174
  select: true,
171
175
  ...field,
172
176
  required: true,
173
177
  fullWidth: true,
174
178
  label: "Group",
175
179
  error: !!fieldState.error,
176
- helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
180
+ helperText: fieldState.error?.message,
177
181
  onChange: (event)=>{
178
182
  field.onChange(event);
179
- setGroupId(+event.target.value);
180
183
  },
181
- children: panelGroups.map((panelGroup, index)=>/*#__PURE__*/ {
182
- var _panelGroup_title;
183
- return _jsx(MenuItem, {
184
+ children: panelGroups.map((panelGroup, index)=>/*#__PURE__*/ _jsx(MenuItem, {
184
185
  value: panelGroup.id,
185
- children: (_panelGroup_title = panelGroup.title) !== null && _panelGroup_title !== void 0 ? _panelGroup_title : `Group ${index + 1}`
186
- }, panelGroup.id);
187
- })
188
- });
189
- }
186
+ children: panelGroup.title ?? `Group ${index + 1}`
187
+ }, panelGroup.id))
188
+ })
190
189
  })
191
190
  }),
192
191
  /*#__PURE__*/ _jsx(Grid, {
193
192
  item: true,
194
193
  xs: 8,
195
194
  children: /*#__PURE__*/ _jsx(Controller, {
196
- name: "description",
197
- render: ({ field, fieldState })=>{
198
- var _fieldState_error;
199
- return /*#__PURE__*/ _jsx(TextField, {
195
+ control: form.control,
196
+ name: "panelDefinition.spec.display.description",
197
+ render: ({ field, fieldState })=>/*#__PURE__*/ _jsx(TextField, {
200
198
  ...field,
201
199
  fullWidth: true,
202
200
  label: "Description",
203
201
  error: !!fieldState.error,
204
- helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
202
+ helperText: fieldState.error?.message,
203
+ value: field.value ?? '',
205
204
  onChange: (event)=>{
206
205
  field.onChange(event);
207
206
  setDescription(event.target.value);
208
207
  }
209
- });
210
- }
208
+ })
211
209
  })
212
210
  }),
213
211
  /*#__PURE__*/ _jsx(Grid, {
214
212
  item: true,
215
213
  xs: 4,
216
214
  children: /*#__PURE__*/ _jsx(Controller, {
217
- name: "type",
218
- render: ({ field, fieldState })=>/*#__PURE__*/ {
219
- var _pluginEditor_error, _fieldState_error;
220
- var _pluginEditor_error_message;
221
- return _jsx(PluginKindSelect, {
215
+ control: form.control,
216
+ name: "panelDefinition.spec.plugin.kind",
217
+ render: ({ field, fieldState })=>/*#__PURE__*/ _jsx(PluginKindSelect, {
222
218
  ...field,
223
- pluginType: "Panel",
219
+ pluginTypes: [
220
+ 'Panel'
221
+ ],
224
222
  required: true,
225
223
  fullWidth: true,
226
224
  label: "Type",
227
225
  disabled: pluginEditor.isLoading,
228
226
  error: !!pluginEditor.error || !!fieldState.error,
229
- 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,
227
+ helperText: pluginEditor.error?.message ?? fieldState.error?.message,
228
+ value: {
229
+ type: 'Panel',
230
+ kind: field.value
231
+ },
230
232
  onChange: (event)=>{
231
- field.onChange(event);
232
- pluginEditor.onKindChange(event);
233
+ field.onChange(event.kind);
234
+ pluginEditor.onSelectionChange(event);
233
235
  }
234
- });
235
- }
236
+ })
236
237
  })
237
238
  }),
238
239
  /*#__PURE__*/ _jsxs(Grid, {
@@ -258,6 +259,7 @@ export function PanelEditorForm(props) {
258
259
  children: /*#__PURE__*/ _jsx(ErrorBoundary, {
259
260
  FallbackComponent: ErrorAlert,
260
261
  children: /*#__PURE__*/ _jsx(PanelSpecEditor, {
262
+ control: form.control,
261
263
  panelDefinition: panelDefinition,
262
264
  onJSONChange: handlePanelDefinitionChange,
263
265
  onQueriesChange: (queries)=>{