@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,4 +1,4 @@
1
- // Copyright 2023 The Perses Authors
1
+ // Copyright 2024 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -22,24 +22,26 @@ Object.defineProperty(exports, "useDashboard", {
22
22
  });
23
23
  const _core = require("@perses-dev/core");
24
24
  const _DashboardProvider = require("./DashboardProvider");
25
- const _TemplateVariableProvider = require("./TemplateVariableProvider");
25
+ const _VariableProvider = require("./VariableProvider");
26
26
  function useDashboard() {
27
- const { panels , panelGroups , panelGroupOrder , setDashboard: setDashboardResource , metadata , display , duration , refreshInterval , datasources } = (0, _DashboardProvider.useDashboardStore)(({ panels , panelGroups , panelGroupOrder , setDashboard , metadata , display , duration , refreshInterval , datasources })=>({
27
+ const { panels, panelGroups, panelGroupOrder, setDashboard: setDashboardResource, kind, metadata, display, duration, refreshInterval, datasources, ttl } = (0, _DashboardProvider.useDashboardStore)(({ panels, panelGroups, panelGroupOrder, setDashboard, kind, metadata, display, duration, refreshInterval, datasources, ttl })=>({
28
28
  panels,
29
29
  panelGroups,
30
30
  panelGroupOrder,
31
31
  setDashboard,
32
+ kind,
32
33
  metadata,
33
34
  display,
34
35
  duration,
35
36
  refreshInterval,
36
- datasources
37
+ datasources,
38
+ ttl
37
39
  }));
38
- const { setVariableDefinitions } = (0, _TemplateVariableProvider.useTemplateVariableActions)();
39
- const variables = (0, _TemplateVariableProvider.useTemplateVariableDefinitions)();
40
+ const { setVariableDefinitions } = (0, _VariableProvider.useVariableDefinitionActions)();
41
+ const variables = (0, _VariableProvider.useVariableDefinitions)();
40
42
  const layouts = convertPanelGroupsToLayouts(panelGroups, panelGroupOrder);
41
- const dashboard = {
42
- kind: 'Dashboard',
43
+ const dashboard = kind === 'Dashboard' ? {
44
+ kind,
43
45
  metadata,
44
46
  spec: {
45
47
  display,
@@ -50,6 +52,19 @@ function useDashboard() {
50
52
  refreshInterval,
51
53
  datasources
52
54
  }
55
+ } : {
56
+ kind,
57
+ metadata,
58
+ spec: {
59
+ display,
60
+ panels,
61
+ layouts,
62
+ variables,
63
+ duration,
64
+ refreshInterval,
65
+ datasources,
66
+ ttl
67
+ }
53
68
  };
54
69
  const setDashboard = (dashboardResource)=>{
55
70
  setVariableDefinitions(dashboardResource.spec.variables);
@@ -67,7 +82,7 @@ function convertPanelGroupsToLayouts(panelGroups, panelGroupOrder) {
67
82
  if (group === undefined) {
68
83
  throw new Error('panel group not found');
69
84
  }
70
- const { title , isCollapsed , itemLayouts , itemPanelKeys } = group;
85
+ const { title, isCollapsed, itemLayouts, itemPanelKeys } = group;
71
86
  let display = undefined;
72
87
  if (title) {
73
88
  display = {
@@ -30,7 +30,7 @@ function isWithDashboardParameter(parameter) {
30
30
  const WithDashboard = (Story, context)=>{
31
31
  const initParameter = context.parameters.withDashboard;
32
32
  const parameter = isWithDashboardParameter(initParameter) ? initParameter : undefined;
33
- const props = parameter === null || parameter === void 0 ? void 0 : parameter.props;
33
+ const props = parameter?.props;
34
34
  return /*#__PURE__*/ (0, _jsxruntime.jsx)(_dashboards.DashboardProvider, {
35
35
  initialState: {
36
36
  dashboardResource: _constants.EMPTY_DASHBOARD_RESOURCE
@@ -30,7 +30,7 @@ function isWithDatasourceStoreParameter(parameter) {
30
30
  const WithDatasourceStore = (Story, context)=>{
31
31
  const initParameter = context.parameters.withDatasourceStore;
32
32
  const parameter = isWithDatasourceStoreParameter(initParameter) ? initParameter : undefined;
33
- const props = parameter === null || parameter === void 0 ? void 0 : parameter.props;
33
+ const props = parameter?.props;
34
34
  return /*#__PURE__*/ (0, _jsxruntime.jsx)(_dashboards.DatasourceStoreProvider, {
35
35
  ..._test.defaultDatasourceProps,
36
36
  ...props,
@@ -1,4 +1,4 @@
1
- // Copyright 2023 The Perses Authors
1
+ // Copyright 2024 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -14,23 +14,23 @@
14
14
  Object.defineProperty(exports, "__esModule", {
15
15
  value: true
16
16
  });
17
- Object.defineProperty(exports, "WithTemplateVariables", {
17
+ Object.defineProperty(exports, "WithVariables", {
18
18
  enumerable: true,
19
19
  get: function() {
20
- return WithTemplateVariables;
20
+ return WithVariables;
21
21
  }
22
22
  });
23
23
  const _jsxruntime = require("react/jsx-runtime");
24
24
  const _dashboards = require("@perses-dev/dashboards");
25
25
  // Type guard because storybook types parameters as `any`
26
- function isWithTemplateVariableParameter(parameter) {
26
+ function isWithVariableParameter(parameter) {
27
27
  return !!parameter && typeof parameter === 'object' && 'props' in parameter;
28
28
  }
29
- const WithTemplateVariables = (Story, context)=>{
30
- const initParameter = context.parameters.withTemplateVariables;
31
- const parameter = isWithTemplateVariableParameter(initParameter) ? initParameter : undefined;
32
- const props = parameter === null || parameter === void 0 ? void 0 : parameter.props;
33
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_dashboards.TemplateVariableProvider, {
29
+ const WithVariables = (Story, context)=>{
30
+ const initParameter = context.parameters.withVariables;
31
+ const parameter = isWithVariableParameter(initParameter) ? initParameter : undefined;
32
+ const props = parameter?.props;
33
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_dashboards.VariableProvider, {
34
34
  ...props,
35
35
  children: /*#__PURE__*/ (0, _jsxruntime.jsx)(Story, {})
36
36
  });
@@ -1,4 +1,4 @@
1
- // Copyright 2023 The Perses Authors
1
+ // Copyright 2024 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -17,7 +17,7 @@ Object.defineProperty(exports, "__esModule", {
17
17
  _export_star(require("./constants"), exports);
18
18
  _export_star(require("./WithDashboard"), exports);
19
19
  _export_star(require("./WithDatasourceStore"), exports);
20
- _export_star(require("./WithTemplateVariables"), exports);
20
+ _export_star(require("./WithVariables"), exports);
21
21
  function _export_star(from, to) {
22
22
  Object.keys(from).forEach(function(k) {
23
23
  if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
@@ -21,11 +21,11 @@ function _export(target, all) {
21
21
  });
22
22
  }
23
23
  _export(exports, {
24
- getTestDashboard: function() {
25
- return getTestDashboard;
26
- },
27
24
  createDashboardProviderSpy: function() {
28
25
  return createDashboardProviderSpy;
26
+ },
27
+ getTestDashboard: function() {
28
+ return getTestDashboard;
29
29
  }
30
30
  });
31
31
  const _react = require("react");
@@ -21,14 +21,14 @@ function _export(target, all) {
21
21
  });
22
22
  }
23
23
  _export(exports, {
24
- prometheusDemoUrl: function() {
25
- return prometheusDemoUrl;
24
+ defaultDatasourceProps: function() {
25
+ return defaultDatasourceProps;
26
26
  },
27
27
  prometheusDemo: function() {
28
28
  return prometheusDemo;
29
29
  },
30
- defaultDatasourceProps: function() {
31
- return defaultDatasourceProps;
30
+ prometheusDemoUrl: function() {
31
+ return prometheusDemoUrl;
32
32
  }
33
33
  });
34
34
  const _dashboardprovider = require("./dashboard-provider");
@@ -41,8 +41,10 @@ const FakeTimeSeriesPlugin = {
41
41
  createInitialOptions: ()=>({})
42
42
  };
43
43
  const MOCK_TIME_SERIES_PANEL = {
44
- pluginType: 'Panel',
45
- kind: 'TimeSeriesChart',
44
+ kind: 'Panel',
45
+ spec: {
46
+ name: 'TimeSeriesChart'
47
+ },
46
48
  plugin: FakeTimeSeriesPlugin
47
49
  };
48
50
  const MOCK_PLUGINS = [
@@ -21,27 +21,27 @@ Object.defineProperty(exports, "renderWithContext", {
21
21
  }
22
22
  });
23
23
  const _jsxruntime = require("react/jsx-runtime");
24
- const _react = require("react");
25
- const _react1 = require("@testing-library/react");
26
- const _reactrouterdom = require("react-router-dom");
24
+ const _components = require("@perses-dev/components");
25
+ const _pluginsystem = require("@perses-dev/plugin-system");
26
+ const _reactquery = require("@tanstack/react-query");
27
+ const _react = require("@testing-library/react");
27
28
  const _history = require("history");
29
+ const _react1 = require("react");
30
+ const _reactrouterdom = require("react-router-dom");
28
31
  const _usequeryparams = require("use-query-params");
29
32
  const _reactrouter6 = require("use-query-params/adapters/react-router-6");
30
- const _reactquery = require("@tanstack/react-query");
31
- const _components = require("@perses-dev/components");
32
- const _pluginsystem = require("@perses-dev/plugin-system");
33
33
  const _context = require("../context");
34
34
  const _test = require("../test");
35
35
  const _pluginregistry = require("./plugin-registry");
36
36
  /*
37
37
  * Workaround for React router upgrade type errors.
38
38
  * More details: https://stackoverflow.com/a/69948457/17575201
39
- */ const CustomRouter = ({ history , children })=>{
40
- const [state, setState] = (0, _react.useState)({
39
+ */ const CustomRouter = ({ history, children })=>{
40
+ const [state, setState] = (0, _react1.useState)({
41
41
  action: history.action,
42
42
  location: history.location
43
43
  });
44
- (0, _react.useLayoutEffect)(()=>history.listen(setState), [
44
+ (0, _react1.useLayoutEffect)(()=>history.listen(setState), [
45
45
  history
46
46
  ]);
47
47
  return /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactrouterdom.Router, {
@@ -61,7 +61,8 @@ function renderWithContext(ui, options, history) {
61
61
  }
62
62
  }
63
63
  });
64
- const customHistory = history !== null && history !== void 0 ? history : (0, _history.createMemoryHistory)();
64
+ const customHistory = history ?? (0, _history.createMemoryHistory)();
65
+ const mockRegistry = (0, _pluginsystem.mockPluginRegistry)(..._pluginregistry.MOCK_PLUGINS);
65
66
  const BaseRender = ()=>/*#__PURE__*/ (0, _jsxruntime.jsx)(CustomRouter, {
66
67
  history: customHistory,
67
68
  children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactquery.QueryClientProvider, {
@@ -76,7 +77,8 @@ function renderWithContext(ui, options, history) {
76
77
  children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.ChartsProvider, {
77
78
  chartsTheme: _components.testChartsTheme,
78
79
  children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.PluginRegistry, {
79
- ...(0, _pluginsystem.mockPluginRegistry)(..._pluginregistry.MOCK_PLUGINS),
80
+ pluginLoader: mockRegistry.pluginLoader,
81
+ defaultPluginKinds: mockRegistry.defaultPluginKinds,
80
82
  children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_context.DatasourceStoreProvider, {
81
83
  ..._test.defaultDatasourceProps,
82
84
  children: ui
@@ -87,5 +89,5 @@ function renderWithContext(ui, options, history) {
87
89
  })
88
90
  })
89
91
  });
90
- return (0, _react1.render)(/*#__PURE__*/ (0, _jsxruntime.jsx)(BaseRender, {}), options);
92
+ return (0, _react.render)(/*#__PURE__*/ (0, _jsxruntime.jsx)(BaseRender, {}), options);
91
93
  }
@@ -15,7 +15,6 @@ Object.defineProperty(exports, "__esModule", {
15
15
  value: true
16
16
  });
17
17
  _export_star(require("./panelUtils"), exports);
18
- _export_star(require("./time"), exports);
19
18
  function _export_star(from, to) {
20
19
  Object.keys(from).forEach(function(k) {
21
20
  if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
@@ -21,14 +21,14 @@ function _export(target, all) {
21
21
  });
22
22
  }
23
23
  _export(exports, {
24
+ getValidPanelKey: function() {
25
+ return getValidPanelKey;
26
+ },
24
27
  getYForNewRow: function() {
25
28
  return getYForNewRow;
26
29
  },
27
30
  insertPanelInLayout: function() {
28
31
  return insertPanelInLayout;
29
- },
30
- getValidPanelKey: function() {
31
- return getValidPanelKey;
32
32
  }
33
33
  });
34
34
  const _constants = require("../constants");
@@ -42,7 +42,7 @@ function getYForNewRow(group) {
42
42
  }
43
43
  return newRowY;
44
44
  }
45
- function getPanelBounds({ x , y , w , h }) {
45
+ function getPanelBounds({ x, y, w, h }) {
46
46
  return {
47
47
  x1: x,
48
48
  x2: x + w,
@@ -159,7 +159,7 @@ const removeWhiteSpaces = (str)=>{
159
159
  function getUniquePanelKeys(panels) {
160
160
  const uniquePanelKeys = {};
161
161
  Object.keys(panels).forEach((panelKey)=>{
162
- const { name , number } = getPanelKeyParts(panelKey);
162
+ const { name, number } = getPanelKeyParts(panelKey);
163
163
  if (uniquePanelKeys[name] === undefined) {
164
164
  uniquePanelKeys[name] = 0;
165
165
  }
@@ -28,13 +28,13 @@ const _pluginsystem = require("@perses-dev/plugin-system");
28
28
  const _components1 = require("../../components");
29
29
  const _context = require("../../context");
30
30
  const DashboardApp = (props)=>{
31
- const { dashboardResource , dashboardTitleComponent , emptyDashboardProps , onSave , onDiscard , initialVariableIsSticky , isReadonly , isCreating } = props;
31
+ const { dashboardResource, dashboardTitleComponent, emptyDashboardProps, onSave, onDiscard, initialVariableIsSticky, isReadonly, isCreating } = props;
32
32
  const chartsTheme = (0, _components.useChartsTheme)();
33
- const { isEditMode , setEditMode } = (0, _context.useEditMode)();
34
- const { dashboard , setDashboard } = (0, _context.useDashboard)();
33
+ const { isEditMode, setEditMode } = (0, _context.useEditMode)();
34
+ const { dashboard, setDashboard } = (0, _context.useDashboard)();
35
35
  const [originalDashboard, setOriginalDashboard] = (0, _react.useState)(undefined);
36
- const { setSavedDatasources } = (0, _pluginsystem.useDatasourceStore)();
37
- const { openDiscardChangesConfirmationDialog , closeDiscardChangesConfirmationDialog } = (0, _context.useDiscardChangesConfirmationDialog)();
36
+ const { setSavedDatasources } = (0, _pluginsystem.useDatasourceStore)();
37
+ const { openDiscardChangesConfirmationDialog, closeDiscardChangesConfirmationDialog } = (0, _context.useDiscardChangesConfirmationDialog)();
38
38
  const handleDiscardChanges = ()=>{
39
39
  // Reset to the original spec and exit edit mode
40
40
  if (originalDashboard) {
@@ -49,8 +49,7 @@ const DashboardApp = (props)=>{
49
49
  const onEditButtonClick = ()=>{
50
50
  setEditMode(true);
51
51
  setOriginalDashboard(dashboard);
52
- var _dashboard_spec_datasources;
53
- setSavedDatasources((_dashboard_spec_datasources = dashboard.spec.datasources) !== null && _dashboard_spec_datasources !== void 0 ? _dashboard_spec_datasources : {});
52
+ setSavedDatasources(dashboard.spec.datasources ?? {});
54
53
  };
55
54
  const onCancelButtonClick = ()=>{
56
55
  // check if dashboard has been modified
@@ -87,7 +86,8 @@ const DashboardApp = (props)=>{
87
86
  }),
88
87
  /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
89
88
  sx: {
90
- padding: (theme)=>theme.spacing(2),
89
+ paddingTop: 2,
90
+ paddingX: 2,
91
91
  height: '100%'
92
92
  },
93
93
  children: [
@@ -1,4 +1,4 @@
1
- // Copyright 2023 The Perses Authors
1
+ // Copyright 2024 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -27,17 +27,16 @@ const _components = require("@perses-dev/components");
27
27
  const _pluginsystem = require("@perses-dev/plugin-system");
28
28
  const _react = require("react");
29
29
  const _context = require("../../context");
30
+ const _DashboardProviderWithQueryParams = require("../../context/DashboardProvider/DashboardProviderWithQueryParams");
30
31
  const _DashboardApp = require("./DashboardApp");
31
32
  function ViewDashboard(props) {
32
- const { dashboardResource , datasourceApi , externalVariableDefinitions , dashboardTitleComponent , emptyDashboardProps , onSave , onDiscard , initialVariableIsSticky , isReadonly , isEditing , isCreating , sx , ...others } = props;
33
- const { spec } = dashboardResource;
34
- var _spec_duration;
35
- const dashboardDuration = (_spec_duration = spec.duration) !== null && _spec_duration !== void 0 ? _spec_duration : _core.DEFAULT_DASHBOARD_DURATION;
36
- var _spec_refreshInterval;
37
- const dashboardRefreshInterval = (_spec_refreshInterval = spec.refreshInterval) !== null && _spec_refreshInterval !== void 0 ? _spec_refreshInterval : _core.DEFAULT_REFRESH_INTERVAL;
33
+ const { dashboardResource, datasourceApi, externalVariableDefinitions, dashboardTitleComponent, emptyDashboardProps, onSave, onDiscard, initialVariableIsSticky, isReadonly, isEditing, isCreating, sx, ...others } = props;
34
+ const { spec } = dashboardResource;
35
+ const dashboardDuration = spec.duration ?? _core.DEFAULT_DASHBOARD_DURATION;
36
+ const dashboardRefreshInterval = spec.refreshInterval ?? _core.DEFAULT_REFRESH_INTERVAL;
38
37
  const initialTimeRange = (0, _pluginsystem.useInitialTimeRange)(dashboardDuration);
39
38
  const initialRefreshInterval = (0, _pluginsystem.useInitialRefreshInterval)(dashboardRefreshInterval);
40
- const { data } = (0, _pluginsystem.usePluginBuiltinVariableDefinitions)();
39
+ const { data } = (0, _pluginsystem.usePluginBuiltinVariableDefinitions)();
41
40
  const builtinVariables = (0, _react.useMemo)(()=>{
42
41
  const result = [
43
42
  {
@@ -79,7 +78,7 @@ function ViewDashboard(props) {
79
78
  return /*#__PURE__*/ (0, _jsxruntime.jsx)(_context.DatasourceStoreProvider, {
80
79
  dashboardResource: dashboardResource,
81
80
  datasourceApi: datasourceApi,
82
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_context.DashboardProvider, {
81
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_DashboardProviderWithQueryParams.DashboardProviderWithQueryParams, {
83
82
  initialState: {
84
83
  dashboardResource,
85
84
  isEditMode: !!isEditing
@@ -87,10 +86,10 @@ function ViewDashboard(props) {
87
86
  children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.TimeRangeProviderWithQueryParams, {
88
87
  initialTimeRange: initialTimeRange,
89
88
  initialRefreshInterval: initialRefreshInterval,
90
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_context.TemplateVariableProviderWithQueryParams, {
89
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_context.VariableProviderWithQueryParams, {
91
90
  initialVariableDefinitions: spec.variables,
92
91
  externalVariableDefinitions: externalVariableDefinitions,
93
- builtinVariables: builtinVariables,
92
+ builtinVariableDefinitions: builtinVariables,
94
93
  children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
95
94
  sx: (0, _components.combineSx)({
96
95
  display: 'flex',
@@ -1,3 +1,3 @@
1
- /// <reference types="react" />
2
- export declare const AddGroupButton: () => JSX.Element;
1
+ import { ReactElement } from 'react';
2
+ export declare const AddGroupButton: () => ReactElement;
3
3
  //# sourceMappingURL=AddGroupButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AddGroupButton.d.ts","sourceRoot":"","sources":["../../../src/components/AddGroupButton/AddGroupButton.tsx"],"names":[],"mappings":";AAmBA,eAAO,MAAM,cAAc,mBAe1B,CAAC"}
1
+ {"version":3,"file":"AddGroupButton.d.ts","sourceRoot":"","sources":["../../../src/components/AddGroupButton/AddGroupButton.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAIrC,eAAO,MAAM,cAAc,QAAO,YAejC,CAAC"}
@@ -17,7 +17,7 @@ import { InfoTooltip } from '@perses-dev/components';
17
17
  import { TOOLTIP_TEXT, editButtonStyle } from '../../constants';
18
18
  import { useDashboardActions } from '../../context';
19
19
  export const AddGroupButton = ()=>{
20
- const { openAddPanelGroup } = useDashboardActions();
20
+ const { openAddPanelGroup } = useDashboardActions();
21
21
  return /*#__PURE__*/ _jsx(InfoTooltip, {
22
22
  description: TOOLTIP_TEXT.addGroup,
23
23
  children: /*#__PURE__*/ _jsx(Button, {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/AddGroupButton/AddGroupButton.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 { Button } from '@mui/material';\nimport AddGroupIcon from 'mdi-material-ui/PlusBoxOutline';\nimport { InfoTooltip } from '@perses-dev/components';\nimport { TOOLTIP_TEXT, editButtonStyle } from '../../constants';\nimport { useDashboardActions } from '../../context';\n\nexport const AddGroupButton = () => {\n const { openAddPanelGroup } = useDashboardActions();\n\n return (\n <InfoTooltip description={TOOLTIP_TEXT.addGroup}>\n <Button\n startIcon={<AddGroupIcon />}\n onClick={openAddPanelGroup}\n aria-label={TOOLTIP_TEXT.addGroup}\n sx={editButtonStyle}\n >\n Panel Group\n </Button>\n </InfoTooltip>\n );\n};\n"],"names":["Button","AddGroupIcon","InfoTooltip","TOOLTIP_TEXT","editButtonStyle","useDashboardActions","AddGroupButton","openAddPanelGroup","description","addGroup","startIcon","onClick","aria-label","sx"],"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,MAAM,QAAQ,gBAAgB;AACvC,OAAOC,kBAAkB,iCAAiC;AAC1D,SAASC,WAAW,QAAQ,yBAAyB;AACrD,SAASC,YAAY,EAAEC,eAAe,QAAQ,kBAAkB;AAChE,SAASC,mBAAmB,QAAQ,gBAAgB;AAEpD,OAAO,MAAMC,iBAAiB;IAC5B,MAAM,EAAEC,kBAAiB,EAAE,GAAGF;IAE9B,qBACE,KAACH;QAAYM,aAAaL,aAAaM;kBACrC,cAAA,KAACT;YACCU,yBAAW,KAACT;YACZU,SAASJ;YACTK,cAAYT,aAAaM;YACzBI,IAAIT;sBACL;;;AAKP,EAAE"}
1
+ {"version":3,"sources":["../../../src/components/AddGroupButton/AddGroupButton.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 { Button } from '@mui/material';\nimport AddGroupIcon from 'mdi-material-ui/PlusBoxOutline';\nimport { InfoTooltip } from '@perses-dev/components';\nimport { ReactElement } from 'react';\nimport { TOOLTIP_TEXT, editButtonStyle } from '../../constants';\nimport { useDashboardActions } from '../../context';\n\nexport const AddGroupButton = (): ReactElement => {\n const { openAddPanelGroup } = useDashboardActions();\n\n return (\n <InfoTooltip description={TOOLTIP_TEXT.addGroup}>\n <Button\n startIcon={<AddGroupIcon />}\n onClick={openAddPanelGroup}\n aria-label={TOOLTIP_TEXT.addGroup}\n sx={editButtonStyle}\n >\n Panel Group\n </Button>\n </InfoTooltip>\n );\n};\n"],"names":["Button","AddGroupIcon","InfoTooltip","TOOLTIP_TEXT","editButtonStyle","useDashboardActions","AddGroupButton","openAddPanelGroup","description","addGroup","startIcon","onClick","aria-label","sx"],"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,MAAM,QAAQ,gBAAgB;AACvC,OAAOC,kBAAkB,iCAAiC;AAC1D,SAASC,WAAW,QAAQ,yBAAyB;AAErD,SAASC,YAAY,EAAEC,eAAe,QAAQ,kBAAkB;AAChE,SAASC,mBAAmB,QAAQ,gBAAgB;AAEpD,OAAO,MAAMC,iBAAiB;IAC5B,MAAM,EAAEC,iBAAiB,EAAE,GAAGF;IAE9B,qBACE,KAACH;QAAYM,aAAaL,aAAaM,QAAQ;kBAC7C,cAAA,KAACT;YACCU,yBAAW,KAACT;YACZU,SAASJ;YACTK,cAAYT,aAAaM,QAAQ;YACjCI,IAAIT;sBACL;;;AAKP,EAAE"}
@@ -1,5 +1,5 @@
1
- /// <reference types="react" />
2
1
  import { ButtonProps } from '@mui/material';
2
+ import { ReactElement } from 'react';
3
3
  export interface AddPanelButtonProps extends Pick<ButtonProps, 'fullWidth'> {
4
4
  /**
5
5
  * The variant to use to display the button.
@@ -14,5 +14,5 @@ export interface AddPanelButtonProps extends Pick<ButtonProps, 'fullWidth'> {
14
14
  */
15
15
  label?: string;
16
16
  }
17
- export declare const AddPanelButton: ({ variant, color, label, fullWidth, }: AddPanelButtonProps) => JSX.Element;
17
+ export declare const AddPanelButton: ({ variant, color, label, fullWidth, }: AddPanelButtonProps) => ReactElement;
18
18
  //# sourceMappingURL=AddPanelButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AddPanelButton.d.ts","sourceRoot":"","sources":["../../../src/components/AddPanelButton/AddPanelButton.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAU,WAAW,EAAE,MAAM,eAAe,CAAC;AAMpD,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC;IACzE;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IAE9B;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC;IAEhC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,cAAc,0CAKxB,mBAAmB,gBAkBrB,CAAC"}
1
+ {"version":3,"file":"AddPanelButton.d.ts","sourceRoot":"","sources":["../../../src/components/AddPanelButton/AddPanelButton.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAU,WAAW,EAAE,MAAM,eAAe,CAAC;AAGpD,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAIrC,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC;IACzE;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IAE9B;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC;IAEhC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,cAAc,0CAKxB,mBAAmB,KAAG,YAkBxB,CAAC"}
@@ -16,8 +16,8 @@ import AddPanelIcon from 'mdi-material-ui/ChartBoxPlusOutline';
16
16
  import { InfoTooltip } from '@perses-dev/components';
17
17
  import { TOOLTIP_TEXT, editButtonStyle } from '../../constants';
18
18
  import { useDashboardActions } from '../../context';
19
- export const AddPanelButton = ({ variant ='text' , color ='primary' , label ='Panel' , fullWidth })=>{
20
- const { openAddPanel } = useDashboardActions();
19
+ export const AddPanelButton = ({ variant = 'text', color = 'primary', label = 'Panel', fullWidth })=>{
20
+ const { openAddPanel } = useDashboardActions();
21
21
  return /*#__PURE__*/ _jsx(InfoTooltip, {
22
22
  description: TOOLTIP_TEXT.addPanel,
23
23
  children: /*#__PURE__*/ _jsx(Button, {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/AddPanelButton/AddPanelButton.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 { Button, ButtonProps } from '@mui/material';\nimport AddPanelIcon from 'mdi-material-ui/ChartBoxPlusOutline';\nimport { InfoTooltip } from '@perses-dev/components';\nimport { TOOLTIP_TEXT, editButtonStyle } from '../../constants';\nimport { useDashboardActions } from '../../context';\n\nexport interface AddPanelButtonProps extends Pick<ButtonProps, 'fullWidth'> {\n /**\n * The variant to use to display the button.\n */\n variant?: 'text' | 'outlined';\n\n /**\n * The color to use to display the button.\n */\n color?: 'primary' | 'secondary';\n\n /**\n * The label used inside the button.\n */\n label?: string;\n}\n\nexport const AddPanelButton = ({\n variant = 'text',\n color = 'primary',\n label = 'Panel',\n fullWidth,\n}: AddPanelButtonProps) => {\n const { openAddPanel } = useDashboardActions();\n\n return (\n <InfoTooltip description={TOOLTIP_TEXT.addPanel}>\n <Button\n startIcon={<AddPanelIcon />}\n onClick={openAddPanel}\n aria-label={TOOLTIP_TEXT.addPanel}\n variant={variant}\n color={color}\n fullWidth={fullWidth}\n sx={editButtonStyle}\n >\n {label}\n </Button>\n </InfoTooltip>\n );\n};\n"],"names":["Button","AddPanelIcon","InfoTooltip","TOOLTIP_TEXT","editButtonStyle","useDashboardActions","AddPanelButton","variant","color","label","fullWidth","openAddPanel","description","addPanel","startIcon","onClick","aria-label","sx"],"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,MAAM,QAAqB,gBAAgB;AACpD,OAAOC,kBAAkB,sCAAsC;AAC/D,SAASC,WAAW,QAAQ,yBAAyB;AACrD,SAASC,YAAY,EAAEC,eAAe,QAAQ,kBAAkB;AAChE,SAASC,mBAAmB,QAAQ,gBAAgB;AAmBpD,OAAO,MAAMC,iBAAiB,CAAC,EAC7BC,SAAU,OAAM,EAChBC,OAAQ,UAAS,EACjBC,OAAQ,QAAO,EACfC,UAAS,EACW;IACpB,MAAM,EAAEC,aAAY,EAAE,GAAGN;IAEzB,qBACE,KAACH;QAAYU,aAAaT,aAAaU;kBACrC,cAAA,KAACb;YACCc,yBAAW,KAACb;YACZc,SAASJ;YACTK,cAAYb,aAAaU;YACzBN,SAASA;YACTC,OAAOA;YACPE,WAAWA;YACXO,IAAIb;sBAEHK;;;AAIT,EAAE"}
1
+ {"version":3,"sources":["../../../src/components/AddPanelButton/AddPanelButton.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 { Button, ButtonProps } from '@mui/material';\nimport AddPanelIcon from 'mdi-material-ui/ChartBoxPlusOutline';\nimport { InfoTooltip } from '@perses-dev/components';\nimport { ReactElement } from 'react';\nimport { TOOLTIP_TEXT, editButtonStyle } from '../../constants';\nimport { useDashboardActions } from '../../context';\n\nexport interface AddPanelButtonProps extends Pick<ButtonProps, 'fullWidth'> {\n /**\n * The variant to use to display the button.\n */\n variant?: 'text' | 'outlined';\n\n /**\n * The color to use to display the button.\n */\n color?: 'primary' | 'secondary';\n\n /**\n * The label used inside the button.\n */\n label?: string;\n}\n\nexport const AddPanelButton = ({\n variant = 'text',\n color = 'primary',\n label = 'Panel',\n fullWidth,\n}: AddPanelButtonProps): ReactElement => {\n const { openAddPanel } = useDashboardActions();\n\n return (\n <InfoTooltip description={TOOLTIP_TEXT.addPanel}>\n <Button\n startIcon={<AddPanelIcon />}\n onClick={openAddPanel}\n aria-label={TOOLTIP_TEXT.addPanel}\n variant={variant}\n color={color}\n fullWidth={fullWidth}\n sx={editButtonStyle}\n >\n {label}\n </Button>\n </InfoTooltip>\n );\n};\n"],"names":["Button","AddPanelIcon","InfoTooltip","TOOLTIP_TEXT","editButtonStyle","useDashboardActions","AddPanelButton","variant","color","label","fullWidth","openAddPanel","description","addPanel","startIcon","onClick","aria-label","sx"],"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,MAAM,QAAqB,gBAAgB;AACpD,OAAOC,kBAAkB,sCAAsC;AAC/D,SAASC,WAAW,QAAQ,yBAAyB;AAErD,SAASC,YAAY,EAAEC,eAAe,QAAQ,kBAAkB;AAChE,SAASC,mBAAmB,QAAQ,gBAAgB;AAmBpD,OAAO,MAAMC,iBAAiB,CAAC,EAC7BC,UAAU,MAAM,EAChBC,QAAQ,SAAS,EACjBC,QAAQ,OAAO,EACfC,SAAS,EACW;IACpB,MAAM,EAAEC,YAAY,EAAE,GAAGN;IAEzB,qBACE,KAACH;QAAYU,aAAaT,aAAaU,QAAQ;kBAC7C,cAAA,KAACb;YACCc,yBAAW,KAACb;YACZc,SAASJ;YACTK,cAAYb,aAAaU,QAAQ;YACjCN,SAASA;YACTC,OAAOA;YACPE,WAAWA;YACXO,IAAIb;sBAEHK;;;AAIT,EAAE"}
@@ -1,8 +1,8 @@
1
- /// <reference types="react" />
2
1
  import { BoxProps } from '@mui/material';
2
+ import { ReactElement } from 'react';
3
3
  import { EmptyDashboardProps } from '../EmptyDashboard';
4
4
  import { PanelOptions } from '../Panel';
5
- export declare type DashboardProps = BoxProps & {
5
+ export type DashboardProps = BoxProps & {
6
6
  /**
7
7
  * Props for `EmptyDashboard` component that will be rendered when the dashboard
8
8
  * is empty (i.e. has no panel groups). If not specified, the defaults will
@@ -14,5 +14,5 @@ export declare type DashboardProps = BoxProps & {
14
14
  /**
15
15
  * Renders a Dashboard for the provided Dashboard spec.
16
16
  */
17
- export declare function Dashboard({ emptyDashboardProps, panelOptions, ...boxProps }: DashboardProps): JSX.Element;
17
+ export declare function Dashboard({ emptyDashboardProps, panelOptions, ...boxProps }: DashboardProps): ReactElement;
18
18
  //# sourceMappingURL=Dashboard.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Dashboard.d.ts","sourceRoot":"","sources":["../../../src/components/Dashboard/Dashboard.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAO,QAAQ,EAAE,MAAM,eAAe,CAAC;AAI9C,OAAO,EAAkB,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,oBAAY,cAAc,GAAG,QAAQ,GAAG;IACtC;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B,CAAC;AAEF;;GAEG;AACH,wBAAgB,SAAS,CAAC,EAAE,mBAAmB,EAAE,YAAY,EAAE,GAAG,QAAQ,EAAE,EAAE,cAAc,eAmB3F"}
1
+ {"version":3,"file":"Dashboard.d.ts","sourceRoot":"","sources":["../../../src/components/Dashboard/Dashboard.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAO,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAU,MAAM,OAAO,CAAC;AAG7C,OAAO,EAAkB,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG;IACtC;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B,CAAC;AAGF;;GAEG;AACH,wBAAgB,SAAS,CAAC,EAAE,mBAAmB,EAAE,YAAY,EAAE,GAAG,QAAQ,EAAE,EAAE,cAAc,GAAG,YAAY,CA2B1G"}
@@ -13,19 +13,25 @@
13
13
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
14
  import { Box } from '@mui/material';
15
15
  import { ErrorBoundary, ErrorAlert } from '@perses-dev/components';
16
+ import { useRef } from 'react';
16
17
  import { usePanelGroupIds } from '../../context';
17
18
  import { GridLayout } from '../GridLayout';
18
19
  import { EmptyDashboard } from '../EmptyDashboard';
20
+ const HEADER_HEIGHT = 165; // Approximate height of the header in dashboard view (including the navbar and variables toolbar)
19
21
  /**
20
22
  * Renders a Dashboard for the provided Dashboard spec.
21
- */ export function Dashboard({ emptyDashboardProps , panelOptions , ...boxProps }) {
23
+ */ export function Dashboard({ emptyDashboardProps, panelOptions, ...boxProps }) {
22
24
  const panelGroupIds = usePanelGroupIds();
25
+ const boxRef = useRef(null);
23
26
  const isEmpty = !panelGroupIds.length;
27
+ const dashboardTopPosition = boxRef.current?.getBoundingClientRect().top ?? HEADER_HEIGHT;
28
+ const panelFullHeight = window.innerHeight - dashboardTopPosition - window.scrollY;
24
29
  return /*#__PURE__*/ _jsx(Box, {
25
30
  ...boxProps,
26
31
  sx: {
27
32
  height: '100%'
28
33
  },
34
+ ref: boxRef,
29
35
  children: /*#__PURE__*/ _jsxs(ErrorBoundary, {
30
36
  FallbackComponent: ErrorAlert,
31
37
  children: [
@@ -41,7 +47,8 @@ import { EmptyDashboard } from '../EmptyDashboard';
41
47
  }),
42
48
  !isEmpty && panelGroupIds.map((panelGroupId)=>/*#__PURE__*/ _jsx(GridLayout, {
43
49
  panelGroupId: panelGroupId,
44
- panelOptions: panelOptions
50
+ panelOptions: panelOptions,
51
+ panelFullHeight: panelFullHeight
45
52
  }, panelGroupId))
46
53
  ]
47
54
  })
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Dashboard/Dashboard.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 { Box, BoxProps } from '@mui/material';\nimport { ErrorBoundary, ErrorAlert } from '@perses-dev/components';\nimport { usePanelGroupIds } from '../../context';\nimport { GridLayout } from '../GridLayout';\nimport { EmptyDashboard, EmptyDashboardProps } from '../EmptyDashboard';\nimport { PanelOptions } from '../Panel';\nexport type DashboardProps = BoxProps & {\n /**\n * Props for `EmptyDashboard` component that will be rendered when the dashboard\n * is empty (i.e. has no panel groups). If not specified, the defaults will\n * be used.\n */\n emptyDashboardProps?: EmptyDashboardProps;\n panelOptions?: PanelOptions;\n};\n\n/**\n * Renders a Dashboard for the provided Dashboard spec.\n */\nexport function Dashboard({ emptyDashboardProps, panelOptions, ...boxProps }: DashboardProps) {\n const panelGroupIds = usePanelGroupIds();\n const isEmpty = !panelGroupIds.length;\n\n return (\n <Box {...boxProps} sx={{ height: '100%' }}>\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n {isEmpty && (\n <Box sx={{ height: '100%', display: 'flex', alignItems: 'center' }}>\n <EmptyDashboard {...emptyDashboardProps} />\n </Box>\n )}\n {!isEmpty &&\n panelGroupIds.map((panelGroupId) => (\n <GridLayout key={panelGroupId} panelGroupId={panelGroupId} panelOptions={panelOptions} />\n ))}\n </ErrorBoundary>\n </Box>\n );\n}\n"],"names":["Box","ErrorBoundary","ErrorAlert","usePanelGroupIds","GridLayout","EmptyDashboard","Dashboard","emptyDashboardProps","panelOptions","boxProps","panelGroupIds","isEmpty","length","sx","height","FallbackComponent","display","alignItems","map","panelGroupId"],"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,QAAkB,gBAAgB;AAC9C,SAASC,aAAa,EAAEC,UAAU,QAAQ,yBAAyB;AACnE,SAASC,gBAAgB,QAAQ,gBAAgB;AACjD,SAASC,UAAU,QAAQ,gBAAgB;AAC3C,SAASC,cAAc,QAA6B,oBAAoB;AAYxE;;CAEC,GACD,OAAO,SAASC,UAAU,EAAEC,oBAAmB,EAAEC,aAAY,EAAE,GAAGC,UAA0B;IAC1F,MAAMC,gBAAgBP;IACtB,MAAMQ,UAAU,CAACD,cAAcE;IAE/B,qBACE,KAACZ;QAAK,GAAGS,QAAQ;QAAEI,IAAI;YAAEC,QAAQ;QAAO;kBACtC,cAAA,MAACb;YAAcc,mBAAmBb;;gBAC/BS,yBACC,KAACX;oBAAIa,IAAI;wBAAEC,QAAQ;wBAAQE,SAAS;wBAAQC,YAAY;oBAAS;8BAC/D,cAAA,KAACZ;wBAAgB,GAAGE,mBAAmB;;;gBAG1C,CAACI,WACAD,cAAcQ,IAAI,CAACC,6BACjB,KAACf;wBAA8Be,cAAcA;wBAAcX,cAAcA;uBAAxDW;;;;AAK7B"}
1
+ {"version":3,"sources":["../../../src/components/Dashboard/Dashboard.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 { Box, BoxProps } from '@mui/material';\nimport { ErrorBoundary, ErrorAlert } from '@perses-dev/components';\nimport { ReactElement, useRef } from 'react';\nimport { usePanelGroupIds } from '../../context';\nimport { GridLayout } from '../GridLayout';\nimport { EmptyDashboard, EmptyDashboardProps } from '../EmptyDashboard';\nimport { PanelOptions } from '../Panel';\nexport type DashboardProps = BoxProps & {\n /**\n * Props for `EmptyDashboard` component that will be rendered when the dashboard\n * is empty (i.e. has no panel groups). If not specified, the defaults will\n * be used.\n */\n emptyDashboardProps?: EmptyDashboardProps;\n panelOptions?: PanelOptions;\n};\nconst HEADER_HEIGHT = 165; // Approximate height of the header in dashboard view (including the navbar and variables toolbar)\n\n/**\n * Renders a Dashboard for the provided Dashboard spec.\n */\nexport function Dashboard({ emptyDashboardProps, panelOptions, ...boxProps }: DashboardProps): ReactElement {\n const panelGroupIds = usePanelGroupIds();\n const boxRef = useRef<HTMLDivElement>(null);\n const isEmpty = !panelGroupIds.length;\n const dashboardTopPosition = boxRef.current?.getBoundingClientRect().top ?? HEADER_HEIGHT;\n const panelFullHeight = window.innerHeight - dashboardTopPosition - window.scrollY;\n\n return (\n <Box {...boxProps} sx={{ height: '100%' }} ref={boxRef}>\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n {isEmpty && (\n <Box sx={{ height: '100%', display: 'flex', alignItems: 'center' }}>\n <EmptyDashboard {...emptyDashboardProps} />\n </Box>\n )}\n {!isEmpty &&\n panelGroupIds.map((panelGroupId) => (\n <GridLayout\n key={panelGroupId}\n panelGroupId={panelGroupId}\n panelOptions={panelOptions}\n panelFullHeight={panelFullHeight}\n />\n ))}\n </ErrorBoundary>\n </Box>\n );\n}\n"],"names":["Box","ErrorBoundary","ErrorAlert","useRef","usePanelGroupIds","GridLayout","EmptyDashboard","HEADER_HEIGHT","Dashboard","emptyDashboardProps","panelOptions","boxProps","panelGroupIds","boxRef","isEmpty","length","dashboardTopPosition","current","getBoundingClientRect","top","panelFullHeight","window","innerHeight","scrollY","sx","height","ref","FallbackComponent","display","alignItems","map","panelGroupId"],"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,QAAkB,gBAAgB;AAC9C,SAASC,aAAa,EAAEC,UAAU,QAAQ,yBAAyB;AACnE,SAAuBC,MAAM,QAAQ,QAAQ;AAC7C,SAASC,gBAAgB,QAAQ,gBAAgB;AACjD,SAASC,UAAU,QAAQ,gBAAgB;AAC3C,SAASC,cAAc,QAA6B,oBAAoB;AAWxE,MAAMC,gBAAgB,KAAK,kGAAkG;AAE7H;;CAEC,GACD,OAAO,SAASC,UAAU,EAAEC,mBAAmB,EAAEC,YAAY,EAAE,GAAGC,UAA0B;IAC1F,MAAMC,gBAAgBR;IACtB,MAAMS,SAASV,OAAuB;IACtC,MAAMW,UAAU,CAACF,cAAcG,MAAM;IACrC,MAAMC,uBAAuBH,OAAOI,OAAO,EAAEC,wBAAwBC,OAAOZ;IAC5E,MAAMa,kBAAkBC,OAAOC,WAAW,GAAGN,uBAAuBK,OAAOE,OAAO;IAElF,qBACE,KAACvB;QAAK,GAAGW,QAAQ;QAAEa,IAAI;YAAEC,QAAQ;QAAO;QAAGC,KAAKb;kBAC9C,cAAA,MAACZ;YAAc0B,mBAAmBzB;;gBAC/BY,yBACC,KAACd;oBAAIwB,IAAI;wBAAEC,QAAQ;wBAAQG,SAAS;wBAAQC,YAAY;oBAAS;8BAC/D,cAAA,KAACvB;wBAAgB,GAAGG,mBAAmB;;;gBAG1C,CAACK,WACAF,cAAckB,GAAG,CAAC,CAACC,6BACjB,KAAC1B;wBAEC0B,cAAcA;wBACdrB,cAAcA;wBACdU,iBAAiBA;uBAHZW;;;;AASnB"}
@@ -1,9 +1,9 @@
1
- /// <reference types="react" />
1
+ import { ReactElement } from 'react';
2
2
  import { SxProps, Theme } from '@mui/material';
3
3
  interface DashboardStickyToolbarProps {
4
4
  initialVariableIsSticky?: boolean;
5
5
  sx?: SxProps<Theme>;
6
6
  }
7
- export declare function DashboardStickyToolbar(props: DashboardStickyToolbarProps): JSX.Element;
7
+ export declare function DashboardStickyToolbar(props: DashboardStickyToolbarProps): ReactElement;
8
8
  export {};
9
9
  //# sourceMappingURL=DashboardStickyToolbar.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DashboardStickyToolbar.d.ts","sourceRoot":"","sources":["../../../src/components/DashboardStickyToolbar/DashboardStickyToolbar.tsx"],"names":[],"mappings":";AAcA,OAAO,EAKL,OAAO,EACP,KAAK,EAIN,MAAM,eAAe,CAAC;AAMvB,UAAU,2BAA2B;IACnC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,EAAE,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;CACrB;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,2BAA2B,eAuExE"}
1
+ {"version":3,"file":"DashboardStickyToolbar.d.ts","sourceRoot":"","sources":["../../../src/components/DashboardStickyToolbar/DashboardStickyToolbar.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAY,MAAM,OAAO,CAAC;AAC/C,OAAO,EAKL,OAAO,EACP,KAAK,EAIN,MAAM,eAAe,CAAC;AAMvB,UAAU,2BAA2B;IACnC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,EAAE,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;CACrB;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,2BAA2B,GAAG,YAAY,CAuEvF"}
@@ -1,4 +1,4 @@
1
- // Copyright 2023 The Perses Authors
1
+ // Copyright 2024 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -15,8 +15,8 @@ import { useState } from 'react';
15
15
  import { AppBar, Box, IconButton, Stack, useMediaQuery, useScrollTrigger, useTheme } from '@mui/material';
16
16
  import PinOutline from 'mdi-material-ui/PinOutline';
17
17
  import PinOffOutline from 'mdi-material-ui/PinOffOutline';
18
- import { TemplateVariableList } from '../Variables';
19
- import { TimeRangeControls } from '../TimeRangeControls';
18
+ import { TimeRangeControls } from '@perses-dev/plugin-system';
19
+ import { VariableList } from '../Variables';
20
20
  export function DashboardStickyToolbar(props) {
21
21
  const [isPin, setIsPin] = useState(props.initialVariableIsSticky);
22
22
  const scrollTrigger = useScrollTrigger({
@@ -69,7 +69,7 @@ export function DashboardStickyToolbar(props) {
69
69
  },
70
70
  gap: 1,
71
71
  children: [
72
- /*#__PURE__*/ _jsx(TemplateVariableList, {}),
72
+ /*#__PURE__*/ _jsx(VariableList, {}),
73
73
  props.initialVariableIsSticky && /*#__PURE__*/ _jsx(IconButton, {
74
74
  style: {
75
75
  width: 'fit-content',