@perses-dev/dashboards 0.0.0-snapshot-scatter-chart-embed-8efdfab → 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 (411) hide show
  1. package/dist/cjs/components/AddGroupButton/AddGroupButton.js +1 -1
  2. package/dist/cjs/components/AddPanelButton/AddPanelButton.js +2 -2
  3. package/dist/cjs/components/Dashboard/Dashboard.js +9 -2
  4. package/dist/cjs/components/DashboardStickyToolbar/DashboardStickyToolbar.js +4 -4
  5. package/dist/cjs/components/DashboardToolbar/DashboardToolbar.js +6 -6
  6. package/dist/cjs/components/Datasources/DatasourceEditor.js +19 -20
  7. package/dist/cjs/components/Datasources/EditDatasourcesButton.js +11 -8
  8. package/dist/cjs/components/DeletePanelDialog/DeletePanelDialog.js +4 -4
  9. package/dist/cjs/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +4 -5
  10. package/dist/cjs/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js +1 -1
  11. package/dist/cjs/components/DownloadButton/DownloadButton.js +3 -4
  12. package/dist/cjs/components/EditButton/EditButton.js +1 -1
  13. package/dist/cjs/components/EditJsonButton/EditJsonButton.js +3 -4
  14. package/dist/cjs/components/EditJsonDialog/EditJsonDialog.js +21 -17
  15. package/dist/cjs/components/EmptyDashboard/EmptyDashboard.js +5 -5
  16. package/dist/cjs/components/GridLayout/GridContainer.js +16 -11
  17. package/dist/cjs/components/GridLayout/GridItemContent.js +24 -10
  18. package/dist/cjs/components/GridLayout/GridLayout.js +63 -14
  19. package/dist/cjs/components/GridLayout/GridTitle.js +8 -9
  20. package/dist/cjs/{validation/panel.js → components/Panel/HeaderIconButton.js} +8 -10
  21. package/dist/cjs/components/Panel/Panel.js +15 -11
  22. package/dist/cjs/components/Panel/PanelActions.js +216 -0
  23. package/dist/cjs/components/Panel/PanelContent.js +6 -6
  24. package/dist/cjs/components/Panel/PanelHeader.js +36 -103
  25. package/dist/cjs/components/Panel/PanelLinks.js +136 -0
  26. package/dist/cjs/components/PanelDrawer/PanelDrawer.js +9 -6
  27. package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +67 -62
  28. package/dist/cjs/components/PanelDrawer/PanelPreview.js +9 -6
  29. package/dist/cjs/components/PanelDrawer/usePanelEditor.js +9 -6
  30. package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.js +1 -1
  31. package/dist/cjs/components/PanelGroupDialog/PanelGroupEditorForm.js +1 -1
  32. package/dist/cjs/components/QuerySummaryTable/QuerySummaryTable.js +5 -7
  33. package/dist/cjs/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +7 -9
  34. package/dist/cjs/components/SaveDashboardButton/SaveDashboardButton.js +8 -8
  35. package/dist/cjs/components/Variables/BuiltinVariableAccordions.js +8 -14
  36. package/dist/cjs/components/Variables/EditVariablesButton.js +5 -5
  37. package/dist/cjs/components/Variables/{TemplateVariable.js → Variable.js} +48 -56
  38. package/dist/cjs/components/Variables/VariableEditor.js +39 -46
  39. package/dist/cjs/components/Variables/VariableList.js +23 -22
  40. package/dist/cjs/components/Variables/index.js +2 -2
  41. package/dist/cjs/components/index.js +0 -2
  42. package/dist/cjs/constants/styles.js +17 -9
  43. package/dist/cjs/constants/user-interface-text.js +6 -5
  44. package/dist/cjs/context/DashboardProvider/DashboardProvider.js +24 -17
  45. package/dist/cjs/context/DashboardProvider/DashboardProviderWithQueryParams.js +36 -0
  46. package/dist/cjs/context/DashboardProvider/common.js +5 -5
  47. package/dist/cjs/context/DashboardProvider/dashboard-provider-api.js +51 -43
  48. package/dist/cjs/context/DashboardProvider/delete-panel-group-slice.js +1 -1
  49. package/dist/cjs/context/DashboardProvider/delete-panel-slice.js +4 -5
  50. package/dist/cjs/context/DashboardProvider/duplicate-panel-slice.js +1 -1
  51. package/dist/cjs/context/DashboardProvider/panel-editor-slice.js +11 -16
  52. package/dist/cjs/context/DashboardProvider/panel-group-editor-slice.js +1 -2
  53. package/dist/cjs/context/DashboardProvider/panel-group-slice.js +13 -8
  54. package/dist/cjs/context/DashboardProvider/view-panel-slice.js +79 -0
  55. package/dist/cjs/context/DatasourceStoreProvider.js +32 -31
  56. package/dist/cjs/context/{TemplateVariableProvider/TemplateVariableProvider.js → VariableProvider/VariableProvider.js} +128 -131
  57. package/dist/cjs/context/{TemplateVariableProvider → VariableProvider}/hydrationUtils.js +11 -14
  58. package/dist/cjs/{validation → context/VariableProvider}/index.js +2 -2
  59. package/dist/cjs/context/{TemplateVariableProvider → VariableProvider}/query-params.js +8 -8
  60. package/dist/cjs/context/{TemplateVariableProvider → VariableProvider}/utils.js +6 -6
  61. package/dist/cjs/context/index.js +2 -2
  62. package/dist/cjs/context/useDashboard.js +24 -9
  63. package/dist/cjs/stories/decorators/WithDashboard.js +1 -1
  64. package/dist/cjs/stories/decorators/WithDatasourceStore.js +1 -1
  65. package/dist/cjs/stories/decorators/{WithTemplateVariables.js → WithVariables.js} +9 -9
  66. package/dist/cjs/stories/decorators/index.js +2 -2
  67. package/dist/cjs/test/dashboard-provider.js +3 -3
  68. package/dist/cjs/test/datasource-provider.js +4 -4
  69. package/dist/cjs/test/plugin-registry.js +4 -2
  70. package/dist/cjs/test/render.js +14 -12
  71. package/dist/cjs/utils/index.js +0 -1
  72. package/dist/cjs/utils/panelUtils.js +5 -5
  73. package/dist/cjs/views/ViewDashboard/DashboardApp.js +8 -8
  74. package/dist/cjs/views/ViewDashboard/ViewDashboard.js +10 -11
  75. package/dist/components/AddGroupButton/AddGroupButton.d.ts +2 -2
  76. package/dist/components/AddGroupButton/AddGroupButton.d.ts.map +1 -1
  77. package/dist/components/AddGroupButton/AddGroupButton.js +1 -1
  78. package/dist/components/AddGroupButton/AddGroupButton.js.map +1 -1
  79. package/dist/components/AddPanelButton/AddPanelButton.d.ts +2 -2
  80. package/dist/components/AddPanelButton/AddPanelButton.d.ts.map +1 -1
  81. package/dist/components/AddPanelButton/AddPanelButton.js +2 -2
  82. package/dist/components/AddPanelButton/AddPanelButton.js.map +1 -1
  83. package/dist/components/Dashboard/Dashboard.d.ts +3 -3
  84. package/dist/components/Dashboard/Dashboard.d.ts.map +1 -1
  85. package/dist/components/Dashboard/Dashboard.js +9 -2
  86. package/dist/components/Dashboard/Dashboard.js.map +1 -1
  87. package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.d.ts +2 -2
  88. package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.d.ts.map +1 -1
  89. package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js +4 -4
  90. package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js.map +1 -1
  91. package/dist/components/DashboardToolbar/DashboardToolbar.d.ts +2 -2
  92. package/dist/components/DashboardToolbar/DashboardToolbar.d.ts.map +1 -1
  93. package/dist/components/DashboardToolbar/DashboardToolbar.js +5 -5
  94. package/dist/components/DashboardToolbar/DashboardToolbar.js.map +1 -1
  95. package/dist/components/Datasources/DatasourceEditor.d.ts +2 -2
  96. package/dist/components/Datasources/DatasourceEditor.d.ts.map +1 -1
  97. package/dist/components/Datasources/DatasourceEditor.js +20 -21
  98. package/dist/components/Datasources/DatasourceEditor.js.map +1 -1
  99. package/dist/components/Datasources/EditDatasourcesButton.d.ts +2 -2
  100. package/dist/components/Datasources/EditDatasourcesButton.d.ts.map +1 -1
  101. package/dist/components/Datasources/EditDatasourcesButton.js +11 -8
  102. package/dist/components/Datasources/EditDatasourcesButton.js.map +1 -1
  103. package/dist/components/DeletePanelDialog/DeletePanelDialog.d.ts +2 -2
  104. package/dist/components/DeletePanelDialog/DeletePanelDialog.d.ts.map +1 -1
  105. package/dist/components/DeletePanelDialog/DeletePanelDialog.js +4 -4
  106. package/dist/components/DeletePanelDialog/DeletePanelDialog.js.map +1 -1
  107. package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.d.ts +2 -2
  108. package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.d.ts.map +1 -1
  109. package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +4 -5
  110. package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js.map +1 -1
  111. package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.d.ts +2 -2
  112. package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.d.ts.map +1 -1
  113. package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js +1 -1
  114. package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js.map +1 -1
  115. package/dist/components/DownloadButton/DownloadButton.d.ts +2 -2
  116. package/dist/components/DownloadButton/DownloadButton.d.ts.map +1 -1
  117. package/dist/components/DownloadButton/DownloadButton.js +3 -4
  118. package/dist/components/DownloadButton/DownloadButton.js.map +1 -1
  119. package/dist/components/EditButton/EditButton.d.ts +2 -2
  120. package/dist/components/EditButton/EditButton.d.ts.map +1 -1
  121. package/dist/components/EditButton/EditButton.js +1 -1
  122. package/dist/components/EditButton/EditButton.js.map +1 -1
  123. package/dist/components/EditJsonButton/EditJsonButton.d.ts +2 -2
  124. package/dist/components/EditJsonButton/EditJsonButton.d.ts.map +1 -1
  125. package/dist/components/EditJsonButton/EditJsonButton.js +3 -4
  126. package/dist/components/EditJsonButton/EditJsonButton.js.map +1 -1
  127. package/dist/components/EditJsonDialog/EditJsonDialog.d.ts +2 -2
  128. package/dist/components/EditJsonDialog/EditJsonDialog.d.ts.map +1 -1
  129. package/dist/components/EditJsonDialog/EditJsonDialog.js +21 -17
  130. package/dist/components/EditJsonDialog/EditJsonDialog.js.map +1 -1
  131. package/dist/components/EmptyDashboard/EmptyDashboard.d.ts +3 -3
  132. package/dist/components/EmptyDashboard/EmptyDashboard.d.ts.map +1 -1
  133. package/dist/components/EmptyDashboard/EmptyDashboard.js +5 -5
  134. package/dist/components/EmptyDashboard/EmptyDashboard.js.map +1 -1
  135. package/dist/components/GridLayout/GridContainer.d.ts +5 -3
  136. package/dist/components/GridLayout/GridContainer.d.ts.map +1 -1
  137. package/dist/components/GridLayout/GridContainer.js +16 -11
  138. package/dist/components/GridLayout/GridContainer.js.map +1 -1
  139. package/dist/components/GridLayout/GridItemContent.d.ts +2 -2
  140. package/dist/components/GridLayout/GridItemContent.d.ts.map +1 -1
  141. package/dist/components/GridLayout/GridItemContent.js +25 -11
  142. package/dist/components/GridLayout/GridItemContent.js.map +1 -1
  143. package/dist/components/GridLayout/GridLayout.d.ts +4 -3
  144. package/dist/components/GridLayout/GridLayout.d.ts.map +1 -1
  145. package/dist/components/GridLayout/GridLayout.js +65 -16
  146. package/dist/components/GridLayout/GridLayout.js.map +1 -1
  147. package/dist/components/GridLayout/GridTitle.d.ts +3 -3
  148. package/dist/components/GridLayout/GridTitle.d.ts.map +1 -1
  149. package/dist/components/GridLayout/GridTitle.js +8 -9
  150. package/dist/components/GridLayout/GridTitle.js.map +1 -1
  151. package/dist/components/Panel/HeaderIconButton.d.ts +5 -0
  152. package/dist/components/Panel/HeaderIconButton.d.ts.map +1 -0
  153. package/dist/components/{TimeRangeControls/index.js → Panel/HeaderIconButton.js} +7 -3
  154. package/dist/components/Panel/HeaderIconButton.js.map +1 -0
  155. package/dist/components/Panel/Panel.d.ts +13 -7
  156. package/dist/components/Panel/Panel.d.ts.map +1 -1
  157. package/dist/components/Panel/Panel.js +16 -12
  158. package/dist/components/Panel/Panel.js.map +1 -1
  159. package/dist/components/Panel/PanelActions.d.ts +16 -0
  160. package/dist/components/Panel/PanelActions.d.ts.map +1 -0
  161. package/dist/components/Panel/PanelActions.js +203 -0
  162. package/dist/components/Panel/PanelActions.js.map +1 -0
  163. package/dist/components/Panel/PanelContent.d.ts +2 -2
  164. package/dist/components/Panel/PanelContent.d.ts.map +1 -1
  165. package/dist/components/Panel/PanelContent.js +6 -6
  166. package/dist/components/Panel/PanelContent.js.map +1 -1
  167. package/dist/components/Panel/PanelHeader.d.ts +9 -9
  168. package/dist/components/Panel/PanelHeader.d.ts.map +1 -1
  169. package/dist/components/Panel/PanelHeader.js +39 -106
  170. package/dist/components/Panel/PanelHeader.js.map +1 -1
  171. package/dist/components/Panel/PanelLinks.d.ts +6 -0
  172. package/dist/components/Panel/PanelLinks.d.ts.map +1 -0
  173. package/dist/components/Panel/PanelLinks.js +123 -0
  174. package/dist/components/Panel/PanelLinks.js.map +1 -0
  175. package/dist/components/PanelDrawer/PanelDrawer.d.ts +2 -2
  176. package/dist/components/PanelDrawer/PanelDrawer.d.ts.map +1 -1
  177. package/dist/components/PanelDrawer/PanelDrawer.js +10 -7
  178. package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -1
  179. package/dist/components/PanelDrawer/PanelEditorForm.d.ts +3 -4
  180. package/dist/components/PanelDrawer/PanelEditorForm.d.ts.map +1 -1
  181. package/dist/components/PanelDrawer/PanelEditorForm.js +70 -65
  182. package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -1
  183. package/dist/components/PanelDrawer/PanelPreview.d.ts +3 -3
  184. package/dist/components/PanelDrawer/PanelPreview.d.ts.map +1 -1
  185. package/dist/components/PanelDrawer/PanelPreview.js +9 -6
  186. package/dist/components/PanelDrawer/PanelPreview.js.map +1 -1
  187. package/dist/components/PanelDrawer/usePanelEditor.d.ts +12 -10
  188. package/dist/components/PanelDrawer/usePanelEditor.d.ts.map +1 -1
  189. package/dist/components/PanelDrawer/usePanelEditor.js +9 -6
  190. package/dist/components/PanelDrawer/usePanelEditor.js.map +1 -1
  191. package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts +2 -2
  192. package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts.map +1 -1
  193. package/dist/components/PanelGroupDialog/PanelGroupDialog.js +1 -1
  194. package/dist/components/PanelGroupDialog/PanelGroupDialog.js.map +1 -1
  195. package/dist/components/PanelGroupDialog/PanelGroupEditorForm.d.ts +2 -2
  196. package/dist/components/PanelGroupDialog/PanelGroupEditorForm.d.ts.map +1 -1
  197. package/dist/components/PanelGroupDialog/PanelGroupEditorForm.js +1 -1
  198. package/dist/components/PanelGroupDialog/PanelGroupEditorForm.js.map +1 -1
  199. package/dist/components/QuerySummaryTable/QuerySummaryTable.d.ts +2 -2
  200. package/dist/components/QuerySummaryTable/QuerySummaryTable.d.ts.map +1 -1
  201. package/dist/components/QuerySummaryTable/QuerySummaryTable.js +5 -7
  202. package/dist/components/QuerySummaryTable/QuerySummaryTable.js.map +1 -1
  203. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.d.ts +2 -2
  204. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.d.ts.map +1 -1
  205. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +8 -10
  206. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js.map +1 -1
  207. package/dist/components/SaveDashboardButton/SaveDashboardButton.d.ts +2 -2
  208. package/dist/components/SaveDashboardButton/SaveDashboardButton.d.ts.map +1 -1
  209. package/dist/components/SaveDashboardButton/SaveDashboardButton.js +9 -9
  210. package/dist/components/SaveDashboardButton/SaveDashboardButton.js.map +1 -1
  211. package/dist/components/Variables/BuiltinVariableAccordions.d.ts +3 -3
  212. package/dist/components/Variables/BuiltinVariableAccordions.d.ts.map +1 -1
  213. package/dist/components/Variables/BuiltinVariableAccordions.js +8 -14
  214. package/dist/components/Variables/BuiltinVariableAccordions.js.map +1 -1
  215. package/dist/components/Variables/EditVariablesButton.d.ts +2 -2
  216. package/dist/components/Variables/EditVariablesButton.d.ts.map +1 -1
  217. package/dist/components/Variables/EditVariablesButton.js +6 -6
  218. package/dist/components/Variables/EditVariablesButton.js.map +1 -1
  219. package/dist/components/Variables/{TemplateVariable.d.ts → Variable.d.ts} +6 -6
  220. package/dist/components/Variables/Variable.d.ts.map +1 -0
  221. package/dist/components/Variables/{TemplateVariable.js → Variable.js} +49 -57
  222. package/dist/components/Variables/Variable.js.map +1 -0
  223. package/dist/components/Variables/VariableEditor.d.ts +3 -3
  224. package/dist/components/Variables/VariableEditor.d.ts.map +1 -1
  225. package/dist/components/Variables/VariableEditor.js +40 -47
  226. package/dist/components/Variables/VariableEditor.js.map +1 -1
  227. package/dist/components/Variables/VariableList.d.ts +4 -4
  228. package/dist/components/Variables/VariableList.d.ts.map +1 -1
  229. package/dist/components/Variables/VariableList.js +21 -20
  230. package/dist/components/Variables/VariableList.js.map +1 -1
  231. package/dist/components/Variables/index.d.ts +1 -1
  232. package/dist/components/Variables/index.d.ts.map +1 -1
  233. package/dist/components/Variables/index.js +2 -2
  234. package/dist/components/Variables/index.js.map +1 -1
  235. package/dist/components/index.d.ts +0 -2
  236. package/dist/components/index.d.ts.map +1 -1
  237. package/dist/components/index.js +0 -2
  238. package/dist/components/index.js.map +1 -1
  239. package/dist/constants/styles.d.ts +4 -2
  240. package/dist/constants/styles.d.ts.map +1 -1
  241. package/dist/constants/styles.js +5 -3
  242. package/dist/constants/styles.js.map +1 -1
  243. package/dist/constants/user-interface-text.d.ts +3 -2
  244. package/dist/constants/user-interface-text.d.ts.map +1 -1
  245. package/dist/constants/user-interface-text.js +3 -2
  246. package/dist/constants/user-interface-text.js.map +1 -1
  247. package/dist/context/DashboardProvider/DashboardProvider.d.ts +11 -6
  248. package/dist/context/DashboardProvider/DashboardProvider.d.ts.map +1 -1
  249. package/dist/context/DashboardProvider/DashboardProvider.js +22 -15
  250. package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -1
  251. package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.d.ts +4 -0
  252. package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.d.ts.map +1 -0
  253. package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.js +28 -0
  254. package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.js.map +1 -0
  255. package/dist/context/DashboardProvider/common.d.ts +3 -3
  256. package/dist/context/DashboardProvider/common.d.ts.map +1 -1
  257. package/dist/context/DashboardProvider/common.js +2 -2
  258. package/dist/context/DashboardProvider/common.js.map +1 -1
  259. package/dist/context/DashboardProvider/dashboard-provider-api.d.ts +36 -23
  260. package/dist/context/DashboardProvider/dashboard-provider-api.d.ts.map +1 -1
  261. package/dist/context/DashboardProvider/dashboard-provider-api.js +26 -19
  262. package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -1
  263. package/dist/context/DashboardProvider/delete-panel-group-slice.d.ts +2 -1
  264. package/dist/context/DashboardProvider/delete-panel-group-slice.d.ts.map +1 -1
  265. package/dist/context/DashboardProvider/delete-panel-group-slice.js +1 -1
  266. package/dist/context/DashboardProvider/delete-panel-group-slice.js.map +1 -1
  267. package/dist/context/DashboardProvider/delete-panel-slice.js +4 -5
  268. package/dist/context/DashboardProvider/delete-panel-slice.js.map +1 -1
  269. package/dist/context/DashboardProvider/discard-changes-dialog-slice.js.map +1 -1
  270. package/dist/context/DashboardProvider/duplicate-panel-slice.js +1 -1
  271. package/dist/context/DashboardProvider/duplicate-panel-slice.js.map +1 -1
  272. package/dist/context/DashboardProvider/edit-json-dialog-slice.js.map +1 -1
  273. package/dist/context/DashboardProvider/index.d.ts +1 -2
  274. package/dist/context/DashboardProvider/index.d.ts.map +1 -1
  275. package/dist/context/DashboardProvider/index.js.map +1 -1
  276. package/dist/context/DashboardProvider/panel-editor-slice.d.ts +2 -9
  277. package/dist/context/DashboardProvider/panel-editor-slice.d.ts.map +1 -1
  278. package/dist/context/DashboardProvider/panel-editor-slice.js +8 -13
  279. package/dist/context/DashboardProvider/panel-editor-slice.js.map +1 -1
  280. package/dist/context/DashboardProvider/panel-group-editor-slice.d.ts +2 -1
  281. package/dist/context/DashboardProvider/panel-group-editor-slice.d.ts.map +1 -1
  282. package/dist/context/DashboardProvider/panel-group-editor-slice.js +1 -2
  283. package/dist/context/DashboardProvider/panel-group-editor-slice.js.map +1 -1
  284. package/dist/context/DashboardProvider/panel-group-slice.d.ts +3 -3
  285. package/dist/context/DashboardProvider/panel-group-slice.d.ts.map +1 -1
  286. package/dist/context/DashboardProvider/panel-group-slice.js +8 -4
  287. package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -1
  288. package/dist/context/DashboardProvider/save-changes-dialog-slice.js.map +1 -1
  289. package/dist/context/DashboardProvider/view-panel-slice.d.ts +21 -0
  290. package/dist/context/DashboardProvider/view-panel-slice.d.ts.map +1 -0
  291. package/dist/context/DashboardProvider/view-panel-slice.js +73 -0
  292. package/dist/context/DashboardProvider/view-panel-slice.js.map +1 -0
  293. package/dist/context/DatasourceStoreProvider.d.ts +10 -10
  294. package/dist/context/DatasourceStoreProvider.d.ts.map +1 -1
  295. package/dist/context/DatasourceStoreProvider.js +32 -31
  296. package/dist/context/DatasourceStoreProvider.js.map +1 -1
  297. package/dist/context/VariableProvider/VariableProvider.d.ts +119 -0
  298. package/dist/context/VariableProvider/VariableProvider.d.ts.map +1 -0
  299. package/dist/context/{TemplateVariableProvider/TemplateVariableProvider.js → VariableProvider/VariableProvider.js} +117 -116
  300. package/dist/context/VariableProvider/VariableProvider.js.map +1 -0
  301. package/dist/context/{TemplateVariableProvider → VariableProvider}/hydrationUtils.d.ts +1 -1
  302. package/dist/context/VariableProvider/hydrationUtils.d.ts.map +1 -0
  303. package/dist/context/{TemplateVariableProvider → VariableProvider}/hydrationUtils.js +9 -12
  304. package/dist/context/VariableProvider/hydrationUtils.js.map +1 -0
  305. package/dist/context/VariableProvider/index.d.ts +2 -0
  306. package/dist/context/VariableProvider/index.d.ts.map +1 -0
  307. package/dist/{validation → context/VariableProvider}/index.js +2 -2
  308. package/dist/context/VariableProvider/index.js.map +1 -0
  309. package/dist/context/{TemplateVariableProvider → VariableProvider}/query-params.d.ts +2 -6
  310. package/dist/context/VariableProvider/query-params.d.ts.map +1 -0
  311. package/dist/context/{TemplateVariableProvider → VariableProvider}/query-params.js +1 -1
  312. package/dist/context/VariableProvider/query-params.js.map +1 -0
  313. package/dist/context/{TemplateVariableProvider → VariableProvider}/utils.d.ts +1 -1
  314. package/dist/context/VariableProvider/utils.d.ts.map +1 -0
  315. package/dist/context/{TemplateVariableProvider → VariableProvider}/utils.js +3 -3
  316. package/dist/context/VariableProvider/utils.js.map +1 -0
  317. package/dist/context/index.d.ts +1 -1
  318. package/dist/context/index.d.ts.map +1 -1
  319. package/dist/context/index.js +2 -2
  320. package/dist/context/index.js.map +1 -1
  321. package/dist/context/useDashboard.d.ts +3 -3
  322. package/dist/context/useDashboard.d.ts.map +1 -1
  323. package/dist/context/useDashboard.js +24 -9
  324. package/dist/context/useDashboard.js.map +1 -1
  325. package/dist/stories/decorators/WithDashboard.js +1 -1
  326. package/dist/stories/decorators/WithDashboard.js.map +1 -1
  327. package/dist/stories/decorators/WithDatasourceStore.js +1 -1
  328. package/dist/stories/decorators/WithDatasourceStore.js.map +1 -1
  329. package/dist/stories/decorators/{WithTemplateVariables.js → WithVariables.js} +9 -9
  330. package/dist/stories/decorators/WithVariables.js.map +1 -0
  331. package/dist/stories/decorators/index.js +2 -2
  332. package/dist/stories/decorators/index.js.map +1 -1
  333. package/dist/test/dashboard-provider.d.ts +1 -1
  334. package/dist/test/dashboard-provider.d.ts.map +1 -1
  335. package/dist/test/dashboard-provider.js.map +1 -1
  336. package/dist/test/datasource-provider.d.ts +2 -2
  337. package/dist/test/datasource-provider.d.ts.map +1 -1
  338. package/dist/test/datasource-provider.js.map +1 -1
  339. package/dist/test/plugin-registry.d.ts.map +1 -1
  340. package/dist/test/plugin-registry.js +4 -2
  341. package/dist/test/plugin-registry.js.map +1 -1
  342. package/dist/test/render.d.ts +2 -2
  343. package/dist/test/render.d.ts.map +1 -1
  344. package/dist/test/render.js +10 -8
  345. package/dist/test/render.js.map +1 -1
  346. package/dist/test/setup-tests.js.map +1 -1
  347. package/dist/utils/index.d.ts +0 -1
  348. package/dist/utils/index.d.ts.map +1 -1
  349. package/dist/utils/index.js +0 -1
  350. package/dist/utils/index.js.map +1 -1
  351. package/dist/utils/panelUtils.d.ts +1 -1
  352. package/dist/utils/panelUtils.d.ts.map +1 -1
  353. package/dist/utils/panelUtils.js +2 -2
  354. package/dist/utils/panelUtils.js.map +1 -1
  355. package/dist/views/ViewDashboard/DashboardApp.d.ts +4 -4
  356. package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -1
  357. package/dist/views/ViewDashboard/DashboardApp.js +8 -8
  358. package/dist/views/ViewDashboard/DashboardApp.js.map +1 -1
  359. package/dist/views/ViewDashboard/ViewDashboard.d.ts +4 -4
  360. package/dist/views/ViewDashboard/ViewDashboard.d.ts.map +1 -1
  361. package/dist/views/ViewDashboard/ViewDashboard.js +11 -12
  362. package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -1
  363. package/package.json +9 -9
  364. package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +0 -210
  365. package/dist/cjs/components/TimeRangeControls/index.js +0 -30
  366. package/dist/cjs/components/ToolbarIconButton/ToolbarIconButton.js +0 -40
  367. package/dist/cjs/components/ToolbarIconButton/index.js +0 -30
  368. package/dist/cjs/context/TemplateVariableProvider/index.js +0 -30
  369. package/dist/cjs/utils/time.js +0 -29
  370. package/dist/components/TimeRangeControls/TimeRangeControls.d.ts +0 -14
  371. package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +0 -1
  372. package/dist/components/TimeRangeControls/TimeRangeControls.js +0 -186
  373. package/dist/components/TimeRangeControls/TimeRangeControls.js.map +0 -1
  374. package/dist/components/TimeRangeControls/index.d.ts +0 -2
  375. package/dist/components/TimeRangeControls/index.d.ts.map +0 -1
  376. package/dist/components/TimeRangeControls/index.js.map +0 -1
  377. package/dist/components/ToolbarIconButton/ToolbarIconButton.d.ts +0 -6
  378. package/dist/components/ToolbarIconButton/ToolbarIconButton.d.ts.map +0 -1
  379. package/dist/components/ToolbarIconButton/ToolbarIconButton.js +0 -32
  380. package/dist/components/ToolbarIconButton/ToolbarIconButton.js.map +0 -1
  381. package/dist/components/ToolbarIconButton/index.d.ts +0 -2
  382. package/dist/components/ToolbarIconButton/index.d.ts.map +0 -1
  383. package/dist/components/ToolbarIconButton/index.js +0 -15
  384. package/dist/components/ToolbarIconButton/index.js.map +0 -1
  385. package/dist/components/Variables/TemplateVariable.d.ts.map +0 -1
  386. package/dist/components/Variables/TemplateVariable.js.map +0 -1
  387. package/dist/context/TemplateVariableProvider/TemplateVariableProvider.d.ts +0 -77
  388. package/dist/context/TemplateVariableProvider/TemplateVariableProvider.d.ts.map +0 -1
  389. package/dist/context/TemplateVariableProvider/TemplateVariableProvider.js.map +0 -1
  390. package/dist/context/TemplateVariableProvider/hydrationUtils.d.ts.map +0 -1
  391. package/dist/context/TemplateVariableProvider/hydrationUtils.js.map +0 -1
  392. package/dist/context/TemplateVariableProvider/index.d.ts +0 -2
  393. package/dist/context/TemplateVariableProvider/index.d.ts.map +0 -1
  394. package/dist/context/TemplateVariableProvider/index.js +0 -15
  395. package/dist/context/TemplateVariableProvider/index.js.map +0 -1
  396. package/dist/context/TemplateVariableProvider/query-params.d.ts.map +0 -1
  397. package/dist/context/TemplateVariableProvider/query-params.js.map +0 -1
  398. package/dist/context/TemplateVariableProvider/utils.d.ts.map +0 -1
  399. package/dist/context/TemplateVariableProvider/utils.js.map +0 -1
  400. package/dist/stories/decorators/WithTemplateVariables.js.map +0 -1
  401. package/dist/utils/time.d.ts +0 -5
  402. package/dist/utils/time.d.ts.map +0 -1
  403. package/dist/utils/time.js +0 -23
  404. package/dist/utils/time.js.map +0 -1
  405. package/dist/validation/index.d.ts +0 -2
  406. package/dist/validation/index.d.ts.map +0 -1
  407. package/dist/validation/index.js.map +0 -1
  408. package/dist/validation/panel.d.ts +0 -19
  409. package/dist/validation/panel.d.ts.map +0 -1
  410. package/dist/validation/panel.js +0 -21
  411. 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":"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"}
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,SAASC,gBAAgB,QAAQ,qBAAqB;AActD,OAAO,SAASC,YAAY,EAC1BC,EAAE,EACFC,OAAOC,QAAQ,EACfC,aAAaC,cAAc,EAC3BC,KAAK,EACLC,YAAY,EACZC,YAAY,EACZC,EAAE,EACFC,KAAK,EACL,GAAGC,MACc;IACjB,MAAMC,iBAAiB,CAAC,EAAEX,GAAG,MAAM,CAAC;IACpC,MAAMY,uBAAuB,CAAC,EAAEZ,GAAG,YAAY,CAAC;IAEhD,MAAMC,QAAQR,4BAA4BS;IAC1C,MAAMC,cAAcV,4BAA4BW;IAEhD,qBACE,KAAChB;QACCY,IAAIA;QACJa,WAAU;QACVC,mBAAiBH;QACjBI,oBAAkBH;QAClBI,iBAAiB;QACjBf,qBACE,MAACZ;YAAM4B,WAAU;;8BACf,KAAC3B;oBACCU,IAAIW;oBACJO,SAAQ;oBACRV,IAAI;wBACF,gEAAgE;wBAChE,+CAA+C;wBAC/CW,YAAY;wBACZC,WAAW;wBACXC,YAAY;wBACZC,UAAU;wBACVC,cAAc;oBAChB;8BAECtB;;gBAGFE,gBAAgBqB,aAAarB,YAAYsB,IAAI,GAAGC,MAAM,GAAG,mBACxD,KAACvC;oBAAIqB,IAAI;wBAAEmB,SAASpB,iBAAiBiB,YAAY,6BAA6B;oBAAO;8BACnF,cAAA,KAACjC;wBAAYS,IAAIY;wBAAsBT,aAAaA;wBAAayB,YAAY;kCAC3E,cAAA,KAAC9B;4BAAiB+B,cAAW;4BAAoBC,MAAK;sCACpD,cAAA,KAACpC;gCACCqB,oBAAiB;gCACjBgB,eAAa;gCACbC,UAAS;gCACTxB,IAAI;oCAAEyB,OAAO,CAACC,QAAUA,MAAMC,OAAO,CAACC,IAAI,CAACC,SAAS;gCAAC;;;;;gBAM9DhC,UAAUmB,aAAanB,MAAMqB,MAAM,GAAG,mBAAK,KAAC7B;oBAAWQ,OAAOA;;;;QAGnEiC,sBAAQ,KAAC1C;YAAaK,OAAOA;YAAOK,cAAcA;YAAcC,cAAcA;YAAcE,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":"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"}
@@ -1,6 +1,6 @@
1
- /// <reference types="react" />
1
+ import { ReactElement } from 'react';
2
2
  /**
3
3
  * The Add/Edit panel drawer for editing a panel's options.
4
4
  */
5
- export declare const PanelDrawer: () => JSX.Element;
5
+ export declare const PanelDrawer: () => ReactElement;
6
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,mBA+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,aAAaF;QACzBJ,aAAa;IACf;IAEA,MAAMO,cAAc;QAClBP,aAAa;IACf;IAEA,6GAA6G;IAC7G,MAAMQ,eAAe;QACnBV,wBAAAA,yBAAAA,KAAAA,IAAAA,YAAaW;QACbT,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;YAC3BC,eAAenB,YAAYmB;YAC3BC,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,13 +1,12 @@
1
- /// <reference types="react" />
2
- import { Action } from '@perses-dev/core';
3
- import { PanelEditorValues } from '../../context/DashboardProvider/panel-editor-slice';
1
+ import { ReactElement } from 'react';
2
+ import { Action, PanelEditorValues } from '@perses-dev/core';
4
3
  export interface PanelEditorFormProps {
5
4
  initialValues: PanelEditorValues;
6
5
  initialAction: Action;
7
6
  onSave: (values: PanelEditorValues) => void;
8
7
  onClose: () => void;
9
8
  }
10
- export declare function PanelEditorForm(props: PanelEditorFormProps): JSX.Element;
9
+ export declare function PanelEditorForm(props: PanelEditorFormProps): ReactElement;
11
10
  /**
12
11
  * The `id` attribute added to the `PanelEditorForm` component, allowing submit buttons to live outside the form.
13
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,eAwN1D;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);
29
- const { plugin } = panelDefinition.spec;
26
+ const { panelDefinition, setName, setDescription, setLinks, setQueries, setPlugin, setPanelDefinition } = usePanelEditor(initialValues.panelDefinition);
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();
@@ -80,14 +86,13 @@ export function PanelEditorForm(props) {
80
86
  }
81
87
  const handlePanelDefinitionChange = (nextPanelDefStr)=>{
82
88
  const nextPanelDef = JSON.parse(nextPanelDefStr);
83
- const { kind: pluginKind , spec: pluginSpec } = nextPanelDef.spec.plugin;
89
+ const { kind: pluginKind, spec: pluginSpec } = nextPanelDef.spec.plugin;
84
90
  // if panel plugin kind and spec are modified, then need to save current spec
85
91
  if (panelDefinition.spec.plugin.kind !== pluginKind && JSON.stringify(panelDefinition.spec.plugin.spec) !== JSON.stringify(pluginSpec)) {
86
92
  pluginEditor.rememberCurrentSpecState();
87
93
  }
88
94
  setPanelDefinition(nextPanelDef);
89
95
  };
90
- var _panelGroup_title, _pluginEditor_error_message;
91
96
  return /*#__PURE__*/ _jsxs(FormProvider, {
92
97
  ...form,
93
98
  children: [
@@ -142,94 +147,93 @@ export function PanelEditorForm(props) {
142
147
  item: true,
143
148
  xs: 8,
144
149
  children: /*#__PURE__*/ _jsx(Controller, {
145
- name: "name",
146
- render: ({ field , fieldState })=>{
147
- var _fieldState_error;
148
- /*#__PURE__*/ return _jsx(TextField, {
150
+ control: form.control,
151
+ name: "panelDefinition.spec.display.name",
152
+ render: ({ field, fieldState })=>/*#__PURE__*/ _jsx(TextField, {
149
153
  ...field,
150
154
  required: true,
151
155
  fullWidth: true,
152
156
  label: "Name",
153
157
  error: !!fieldState.error,
154
- helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
158
+ helperText: fieldState.error?.message,
159
+ value: field.value ?? '',
155
160
  onChange: (event)=>{
156
161
  field.onChange(event);
157
162
  setName(event.target.value);
158
163
  }
159
- });
160
- }
164
+ })
161
165
  })
162
166
  }),
163
167
  /*#__PURE__*/ _jsx(Grid, {
164
168
  item: true,
165
169
  xs: 4,
166
170
  children: /*#__PURE__*/ _jsx(Controller, {
171
+ control: form.control,
167
172
  name: "groupId",
168
- render: ({ field , fieldState })=>{
169
- var _fieldState_error;
170
- /*#__PURE__*/ return _jsx(TextField, {
173
+ render: ({ field, fieldState })=>/*#__PURE__*/ _jsx(TextField, {
171
174
  select: true,
172
175
  ...field,
173
176
  required: true,
174
177
  fullWidth: true,
175
178
  label: "Group",
176
179
  error: !!fieldState.error,
177
- helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
180
+ helperText: fieldState.error?.message,
178
181
  onChange: (event)=>{
179
182
  field.onChange(event);
180
- setGroupId(+event.target.value);
181
183
  },
182
184
  children: panelGroups.map((panelGroup, index)=>/*#__PURE__*/ _jsx(MenuItem, {
183
185
  value: panelGroup.id,
184
- children: (_panelGroup_title = panelGroup.title) !== null && _panelGroup_title !== void 0 ? _panelGroup_title : `Group ${index + 1}`
186
+ children: panelGroup.title ?? `Group ${index + 1}`
185
187
  }, panelGroup.id))
186
- });
187
- }
188
+ })
188
189
  })
189
190
  }),
190
191
  /*#__PURE__*/ _jsx(Grid, {
191
192
  item: true,
192
193
  xs: 8,
193
194
  children: /*#__PURE__*/ _jsx(Controller, {
194
- name: "description",
195
- render: ({ field , fieldState })=>{
196
- var _fieldState_error;
197
- /*#__PURE__*/ return _jsx(TextField, {
195
+ control: form.control,
196
+ name: "panelDefinition.spec.display.description",
197
+ render: ({ field, fieldState })=>/*#__PURE__*/ _jsx(TextField, {
198
198
  ...field,
199
199
  fullWidth: true,
200
200
  label: "Description",
201
201
  error: !!fieldState.error,
202
- helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
202
+ helperText: fieldState.error?.message,
203
+ value: field.value ?? '',
203
204
  onChange: (event)=>{
204
205
  field.onChange(event);
205
206
  setDescription(event.target.value);
206
207
  }
207
- });
208
- }
208
+ })
209
209
  })
210
210
  }),
211
211
  /*#__PURE__*/ _jsx(Grid, {
212
212
  item: true,
213
213
  xs: 4,
214
214
  children: /*#__PURE__*/ _jsx(Controller, {
215
- name: "type",
216
- render: ({ field , fieldState })=>{
217
- var _pluginEditor_error, _fieldState_error;
218
- /*#__PURE__*/ return _jsx(PluginKindSelect, {
215
+ control: form.control,
216
+ name: "panelDefinition.spec.plugin.kind",
217
+ render: ({ field, fieldState })=>/*#__PURE__*/ _jsx(PluginKindSelect, {
219
218
  ...field,
220
- pluginType: "Panel",
219
+ pluginTypes: [
220
+ 'Panel'
221
+ ],
221
222
  required: true,
222
223
  fullWidth: true,
223
224
  label: "Type",
224
225
  disabled: pluginEditor.isLoading,
225
226
  error: !!pluginEditor.error || !!fieldState.error,
226
- 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
+ },
227
232
  onChange: (event)=>{
228
- field.onChange(event);
229
- pluginEditor.onKindChange(event);
233
+ field.onChange(event.kind);
234
+ pluginEditor.onSelectionChange(event);
230
235
  }
231
- });
232
- }
236
+ })
233
237
  })
234
238
  }),
235
239
  /*#__PURE__*/ _jsxs(Grid, {
@@ -255,6 +259,7 @@ export function PanelEditorForm(props) {
255
259
  children: /*#__PURE__*/ _jsx(ErrorBoundary, {
256
260
  FallbackComponent: ErrorAlert,
257
261
  children: /*#__PURE__*/ _jsx(PanelSpecEditor, {
262
+ control: form.control,
258
263
  panelDefinition: panelDefinition,
259
264
  onJSONChange: handlePanelDefinitionChange,
260
265
  onQueriesChange: (queries)=>{