@perses-dev/dashboards 0.0.0-snapshot-embed-import-errors-8906900 → 0.0.0-snapshot-test-internal-dep-dd238ac

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 (335) hide show
  1. package/dist/cjs/components/AddGroupButton/AddGroupButton.js +43 -0
  2. package/dist/cjs/components/AddGroupButton/index.js +28 -0
  3. package/dist/cjs/components/AddPanelButton/AddPanelButton.js +43 -0
  4. package/dist/cjs/components/AddPanelButton/index.js +28 -0
  5. package/dist/cjs/components/Dashboard/Dashboard.js +1 -1
  6. package/dist/cjs/components/Dashboard/index.js +1 -1
  7. package/dist/cjs/components/DashboardToolbar/DashboardToolbar.js +49 -22
  8. package/dist/cjs/components/DashboardToolbar/index.js +1 -1
  9. package/dist/cjs/components/DeletePanelDialog/DeletePanelDialog.js +9 -31
  10. package/dist/cjs/components/DeletePanelDialog/index.js +1 -1
  11. package/dist/cjs/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +2 -1
  12. package/dist/cjs/components/DeletePanelGroupDialog/index.js +1 -1
  13. package/dist/cjs/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js +2 -1
  14. package/dist/cjs/components/DiscardChangesConfirmationDialog/index.js +1 -1
  15. package/dist/cjs/components/DownloadButton/DownloadButton.js +16 -46
  16. package/dist/cjs/components/DownloadButton/index.js +1 -1
  17. package/dist/cjs/components/GridLayout/GridContainer.js +2 -1
  18. package/dist/cjs/components/GridLayout/GridItemContent.js +3 -2
  19. package/dist/cjs/components/GridLayout/GridLayout.js +6 -8
  20. package/dist/cjs/components/GridLayout/GridTitle.js +14 -11
  21. package/dist/cjs/components/GridLayout/index.js +1 -1
  22. package/dist/cjs/components/Panel/Panel.js +6 -6
  23. package/dist/cjs/components/Panel/PanelContent.js +3 -2
  24. package/dist/cjs/components/Panel/PanelHeader.js +26 -8
  25. package/dist/cjs/components/Panel/index.js +1 -1
  26. package/dist/cjs/components/PanelDrawer/PanelDrawer.js +2 -1
  27. package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +1 -1
  28. package/dist/cjs/components/PanelDrawer/PanelPreview.js +1 -1
  29. package/dist/cjs/components/PanelDrawer/index.js +1 -1
  30. package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.js +4 -1
  31. package/dist/cjs/components/PanelGroupDialog/PanelGroupEditorForm.js +1 -1
  32. package/dist/cjs/components/PanelGroupDialog/index.js +1 -1
  33. package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +19 -11
  34. package/dist/cjs/components/TimeRangeControls/index.js +1 -1
  35. package/dist/cjs/components/ToolbarIconButton/ToolbarIconButton.js +1 -1
  36. package/dist/cjs/components/ToolbarIconButton/index.js +1 -1
  37. package/dist/cjs/components/Variables/EditVariablesButton.js +75 -0
  38. package/dist/cjs/components/Variables/Variable.js +1 -1
  39. package/dist/cjs/components/Variables/VariableEditor.js +10 -6
  40. package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +6 -7
  41. package/dist/cjs/components/Variables/VariableEditorForm/index.js +1 -1
  42. package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +1 -1
  43. package/dist/cjs/components/Variables/VariableList.js +45 -111
  44. package/dist/cjs/components/Variables/index.js +4 -2
  45. package/dist/cjs/components/Variables/variable-model.js +1 -1
  46. package/dist/cjs/components/index.js +3 -1
  47. package/dist/cjs/{utils/functions.js → constants/grid-layout-config.js} +14 -6
  48. package/dist/cjs/constants/index.js +29 -0
  49. package/dist/cjs/constants/user-interface-text.js +61 -0
  50. package/dist/cjs/context/DashboardProvider/DashboardProvider.js +38 -14
  51. package/dist/cjs/context/DashboardProvider/common.js +1 -1
  52. package/dist/cjs/context/DashboardProvider/dashboard-provider-api.js +7 -5
  53. package/dist/cjs/context/DashboardProvider/delete-panel-group-slice.js +1 -1
  54. package/dist/cjs/context/DashboardProvider/delete-panel-slice.js +1 -1
  55. package/dist/cjs/context/DashboardProvider/discard-changes-dialog-slice.js +1 -1
  56. package/dist/cjs/context/DashboardProvider/duplicate-panel-slice.js +62 -0
  57. package/dist/cjs/context/DashboardProvider/index.js +1 -1
  58. package/dist/cjs/context/DashboardProvider/panel-editor-slice.js +9 -38
  59. package/dist/cjs/context/DashboardProvider/panel-group-editor-slice.js +1 -1
  60. package/dist/cjs/context/DashboardProvider/panel-group-slice.js +1 -1
  61. package/dist/cjs/context/DashboardProvider/panel-slice.js +1 -1
  62. package/dist/cjs/context/DatasourceStoreProvider.js +1 -1
  63. package/dist/cjs/context/TemplateVariableProvider/TemplateVariableProvider.js +1 -1
  64. package/dist/cjs/context/TemplateVariableProvider/index.js +1 -1
  65. package/dist/cjs/context/TemplateVariableProvider/query-params.js +1 -1
  66. package/dist/cjs/context/index.js +1 -1
  67. package/dist/cjs/context/useDashboard.js +5 -3
  68. package/dist/cjs/index.js +1 -1
  69. package/dist/cjs/test/dashboard-provider.js +1 -1
  70. package/dist/cjs/test/index.js +1 -1
  71. package/dist/cjs/test/plugin-registry.js +1 -1
  72. package/dist/cjs/test/render.js +1 -1
  73. package/dist/cjs/test/setup-tests.js +1 -1
  74. package/dist/cjs/test/testDashboard.js +1 -1
  75. package/dist/cjs/utils/index.js +28 -0
  76. package/dist/cjs/utils/panelUtils.js +168 -0
  77. package/dist/cjs/views/ViewDashboard/DashboardApp.js +5 -2
  78. package/dist/cjs/views/ViewDashboard/ViewDashboard.js +5 -3
  79. package/dist/cjs/views/ViewDashboard/index.js +1 -1
  80. package/dist/cjs/views/index.js +1 -1
  81. package/dist/components/AddGroupButton/AddGroupButton.d.ts +3 -0
  82. package/dist/components/AddGroupButton/AddGroupButton.d.ts.map +1 -0
  83. package/dist/components/AddGroupButton/AddGroupButton.js +32 -0
  84. package/dist/components/AddGroupButton/AddGroupButton.js.map +1 -0
  85. package/dist/components/AddGroupButton/index.d.ts +2 -0
  86. package/dist/components/AddGroupButton/index.d.ts.map +1 -0
  87. package/dist/{utils/functions.js → components/AddGroupButton/index.js} +3 -5
  88. package/dist/components/AddGroupButton/index.js.map +1 -0
  89. package/dist/components/AddPanelButton/AddPanelButton.d.ts +3 -0
  90. package/dist/components/AddPanelButton/AddPanelButton.d.ts.map +1 -0
  91. package/dist/components/AddPanelButton/AddPanelButton.js +32 -0
  92. package/dist/components/AddPanelButton/AddPanelButton.js.map +1 -0
  93. package/dist/components/AddPanelButton/index.d.ts +2 -0
  94. package/dist/components/AddPanelButton/index.d.ts.map +1 -0
  95. package/dist/components/AddPanelButton/index.js +15 -0
  96. package/dist/components/AddPanelButton/index.js.map +1 -0
  97. package/dist/components/Dashboard/Dashboard.js +1 -1
  98. package/dist/components/Dashboard/Dashboard.js.map +1 -1
  99. package/dist/components/Dashboard/index.js +1 -1
  100. package/dist/components/Dashboard/index.js.map +1 -1
  101. package/dist/components/DashboardToolbar/DashboardToolbar.d.ts.map +1 -1
  102. package/dist/components/DashboardToolbar/DashboardToolbar.js +50 -23
  103. package/dist/components/DashboardToolbar/DashboardToolbar.js.map +1 -1
  104. package/dist/components/DashboardToolbar/index.js +1 -1
  105. package/dist/components/DashboardToolbar/index.js.map +1 -1
  106. package/dist/components/DeletePanelDialog/DeletePanelDialog.d.ts.map +1 -1
  107. package/dist/components/DeletePanelDialog/DeletePanelDialog.js +8 -25
  108. package/dist/components/DeletePanelDialog/DeletePanelDialog.js.map +1 -1
  109. package/dist/components/DeletePanelDialog/index.js +1 -1
  110. package/dist/components/DeletePanelDialog/index.js.map +1 -1
  111. package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +2 -1
  112. package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js.map +1 -1
  113. package/dist/components/DeletePanelGroupDialog/index.js +1 -1
  114. package/dist/components/DeletePanelGroupDialog/index.js.map +1 -1
  115. package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js +2 -1
  116. package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js.map +1 -1
  117. package/dist/components/DiscardChangesConfirmationDialog/index.js +1 -1
  118. package/dist/components/DiscardChangesConfirmationDialog/index.js.map +1 -1
  119. package/dist/components/DownloadButton/DownloadButton.d.ts +5 -1
  120. package/dist/components/DownloadButton/DownloadButton.d.ts.map +1 -1
  121. package/dist/components/DownloadButton/DownloadButton.js +17 -8
  122. package/dist/components/DownloadButton/DownloadButton.js.map +1 -1
  123. package/dist/components/DownloadButton/index.js +1 -1
  124. package/dist/components/DownloadButton/index.js.map +1 -1
  125. package/dist/components/GridLayout/GridContainer.d.ts.map +1 -1
  126. package/dist/components/GridLayout/GridContainer.js +2 -1
  127. package/dist/components/GridLayout/GridContainer.js.map +1 -1
  128. package/dist/components/GridLayout/GridItemContent.d.ts.map +1 -1
  129. package/dist/components/GridLayout/GridItemContent.js +3 -2
  130. package/dist/components/GridLayout/GridItemContent.js.map +1 -1
  131. package/dist/components/GridLayout/GridLayout.d.ts.map +1 -1
  132. package/dist/components/GridLayout/GridLayout.js +6 -8
  133. package/dist/components/GridLayout/GridLayout.js.map +1 -1
  134. package/dist/components/GridLayout/GridTitle.d.ts.map +1 -1
  135. package/dist/components/GridLayout/GridTitle.js +14 -11
  136. package/dist/components/GridLayout/GridTitle.js.map +1 -1
  137. package/dist/components/GridLayout/index.js +1 -1
  138. package/dist/components/GridLayout/index.js.map +1 -1
  139. package/dist/components/Panel/Panel.js +7 -7
  140. package/dist/components/Panel/Panel.js.map +1 -1
  141. package/dist/components/Panel/PanelContent.d.ts.map +1 -1
  142. package/dist/components/Panel/PanelContent.js +3 -2
  143. package/dist/components/Panel/PanelContent.js.map +1 -1
  144. package/dist/components/Panel/PanelHeader.d.ts +1 -0
  145. package/dist/components/Panel/PanelHeader.d.ts.map +1 -1
  146. package/dist/components/Panel/PanelHeader.js +26 -8
  147. package/dist/components/Panel/PanelHeader.js.map +1 -1
  148. package/dist/components/Panel/index.js +1 -1
  149. package/dist/components/Panel/index.js.map +1 -1
  150. package/dist/components/PanelDrawer/PanelDrawer.js +2 -1
  151. package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -1
  152. package/dist/components/PanelDrawer/PanelEditorForm.js +1 -1
  153. package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -1
  154. package/dist/components/PanelDrawer/PanelPreview.js +1 -1
  155. package/dist/components/PanelDrawer/PanelPreview.js.map +1 -1
  156. package/dist/components/PanelDrawer/index.js +1 -1
  157. package/dist/components/PanelDrawer/index.js.map +1 -1
  158. package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts.map +1 -1
  159. package/dist/components/PanelGroupDialog/PanelGroupDialog.js +4 -1
  160. package/dist/components/PanelGroupDialog/PanelGroupDialog.js.map +1 -1
  161. package/dist/components/PanelGroupDialog/PanelGroupEditorForm.js +1 -1
  162. package/dist/components/PanelGroupDialog/PanelGroupEditorForm.js.map +1 -1
  163. package/dist/components/PanelGroupDialog/index.js +1 -1
  164. package/dist/components/PanelGroupDialog/index.js.map +1 -1
  165. package/dist/components/TimeRangeControls/TimeRangeControls.d.ts +2 -1
  166. package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -1
  167. package/dist/components/TimeRangeControls/TimeRangeControls.js +21 -13
  168. package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
  169. package/dist/components/TimeRangeControls/index.js +1 -1
  170. package/dist/components/TimeRangeControls/index.js.map +1 -1
  171. package/dist/components/ToolbarIconButton/ToolbarIconButton.js +1 -1
  172. package/dist/components/ToolbarIconButton/ToolbarIconButton.js.map +1 -1
  173. package/dist/components/ToolbarIconButton/index.js +1 -1
  174. package/dist/components/ToolbarIconButton/index.js.map +1 -1
  175. package/dist/components/Variables/EditVariablesButton.d.ts +3 -0
  176. package/dist/components/Variables/EditVariablesButton.d.ts.map +1 -0
  177. package/dist/components/Variables/EditVariablesButton.js +64 -0
  178. package/dist/components/Variables/EditVariablesButton.js.map +1 -0
  179. package/dist/components/Variables/Variable.js +1 -1
  180. package/dist/components/Variables/Variable.js.map +1 -1
  181. package/dist/components/Variables/VariableEditor.d.ts.map +1 -1
  182. package/dist/components/Variables/VariableEditor.js +10 -6
  183. package/dist/components/Variables/VariableEditor.js.map +1 -1
  184. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
  185. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +8 -9
  186. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
  187. package/dist/components/Variables/VariableEditorForm/index.js +1 -1
  188. package/dist/components/Variables/VariableEditorForm/index.js.map +1 -1
  189. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +1 -1
  190. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -1
  191. package/dist/components/Variables/VariableList.d.ts.map +1 -1
  192. package/dist/components/Variables/VariableList.js +47 -74
  193. package/dist/components/Variables/VariableList.js.map +1 -1
  194. package/dist/components/Variables/index.d.ts +3 -1
  195. package/dist/components/Variables/index.d.ts.map +1 -1
  196. package/dist/components/Variables/index.js +4 -2
  197. package/dist/components/Variables/index.js.map +1 -1
  198. package/dist/components/Variables/variable-model.js +1 -1
  199. package/dist/components/Variables/variable-model.js.map +1 -1
  200. package/dist/components/index.d.ts +2 -0
  201. package/dist/components/index.d.ts.map +1 -1
  202. package/dist/components/index.js +3 -1
  203. package/dist/components/index.js.map +1 -1
  204. package/dist/constants/grid-layout-config.d.ts +6 -0
  205. package/dist/constants/grid-layout-config.d.ts.map +1 -0
  206. package/dist/constants/grid-layout-config.js +19 -0
  207. package/dist/constants/grid-layout-config.js.map +1 -0
  208. package/dist/constants/index.d.ts +3 -0
  209. package/dist/constants/index.d.ts.map +1 -0
  210. package/dist/constants/index.js +16 -0
  211. package/dist/constants/index.js.map +1 -0
  212. package/dist/constants/user-interface-text.d.ts +30 -0
  213. package/dist/constants/user-interface-text.d.ts.map +1 -0
  214. package/dist/constants/user-interface-text.js +49 -0
  215. package/dist/constants/user-interface-text.js.map +1 -0
  216. package/dist/context/DashboardProvider/DashboardProvider.d.ts +6 -4
  217. package/dist/context/DashboardProvider/DashboardProvider.d.ts.map +1 -1
  218. package/dist/context/DashboardProvider/DashboardProvider.js +38 -9
  219. package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -1
  220. package/dist/context/DashboardProvider/common.js +1 -1
  221. package/dist/context/DashboardProvider/common.js.map +1 -1
  222. package/dist/context/DashboardProvider/dashboard-provider-api.d.ts +1 -0
  223. package/dist/context/DashboardProvider/dashboard-provider-api.d.ts.map +1 -1
  224. package/dist/context/DashboardProvider/dashboard-provider-api.js +7 -5
  225. package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -1
  226. package/dist/context/DashboardProvider/delete-panel-group-slice.js +1 -1
  227. package/dist/context/DashboardProvider/delete-panel-group-slice.js.map +1 -1
  228. package/dist/context/DashboardProvider/delete-panel-slice.js +1 -1
  229. package/dist/context/DashboardProvider/delete-panel-slice.js.map +1 -1
  230. package/dist/context/DashboardProvider/discard-changes-dialog-slice.js +1 -1
  231. package/dist/context/DashboardProvider/discard-changes-dialog-slice.js.map +1 -1
  232. package/dist/context/DashboardProvider/duplicate-panel-slice.d.ts +19 -0
  233. package/dist/context/DashboardProvider/duplicate-panel-slice.d.ts.map +1 -0
  234. package/dist/context/DashboardProvider/duplicate-panel-slice.js +58 -0
  235. package/dist/context/DashboardProvider/duplicate-panel-slice.js.map +1 -0
  236. package/dist/context/DashboardProvider/index.d.ts +1 -1
  237. package/dist/context/DashboardProvider/index.d.ts.map +1 -1
  238. package/dist/context/DashboardProvider/index.js +1 -1
  239. package/dist/context/DashboardProvider/index.js.map +1 -1
  240. package/dist/context/DashboardProvider/panel-editor-slice.d.ts +4 -0
  241. package/dist/context/DashboardProvider/panel-editor-slice.d.ts.map +1 -1
  242. package/dist/context/DashboardProvider/panel-editor-slice.js +7 -36
  243. package/dist/context/DashboardProvider/panel-editor-slice.js.map +1 -1
  244. package/dist/context/DashboardProvider/panel-group-editor-slice.js +1 -1
  245. package/dist/context/DashboardProvider/panel-group-editor-slice.js.map +1 -1
  246. package/dist/context/DashboardProvider/panel-group-slice.js +1 -1
  247. package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -1
  248. package/dist/context/DashboardProvider/panel-slice.js +1 -1
  249. package/dist/context/DashboardProvider/panel-slice.js.map +1 -1
  250. package/dist/context/DatasourceStoreProvider.js +1 -1
  251. package/dist/context/DatasourceStoreProvider.js.map +1 -1
  252. package/dist/context/TemplateVariableProvider/TemplateVariableProvider.js +1 -1
  253. package/dist/context/TemplateVariableProvider/TemplateVariableProvider.js.map +1 -1
  254. package/dist/context/TemplateVariableProvider/index.js +1 -1
  255. package/dist/context/TemplateVariableProvider/index.js.map +1 -1
  256. package/dist/context/TemplateVariableProvider/query-params.js +1 -1
  257. package/dist/context/TemplateVariableProvider/query-params.js.map +1 -1
  258. package/dist/context/index.js +1 -1
  259. package/dist/context/index.js.map +1 -1
  260. package/dist/context/useDashboard.d.ts.map +1 -1
  261. package/dist/context/useDashboard.js +5 -3
  262. package/dist/context/useDashboard.js.map +1 -1
  263. package/dist/index.js +1 -1
  264. package/dist/index.js.map +1 -1
  265. package/dist/test/dashboard-provider.js +1 -1
  266. package/dist/test/dashboard-provider.js.map +1 -1
  267. package/dist/test/index.js +1 -1
  268. package/dist/test/index.js.map +1 -1
  269. package/dist/test/plugin-registry.js +1 -1
  270. package/dist/test/plugin-registry.js.map +1 -1
  271. package/dist/test/render.js +1 -1
  272. package/dist/test/render.js.map +1 -1
  273. package/dist/test/setup-tests.js +1 -1
  274. package/dist/test/setup-tests.js.map +1 -1
  275. package/dist/test/testDashboard.js +1 -1
  276. package/dist/test/testDashboard.js.map +1 -1
  277. package/dist/utils/index.d.ts +2 -0
  278. package/dist/utils/index.d.ts.map +1 -0
  279. package/dist/utils/index.js +15 -0
  280. package/dist/utils/index.js.map +1 -0
  281. package/dist/utils/panelUtils.d.ts +27 -0
  282. package/dist/utils/panelUtils.d.ts.map +1 -0
  283. package/dist/utils/panelUtils.js +174 -0
  284. package/dist/utils/panelUtils.js.map +1 -0
  285. package/dist/views/ViewDashboard/DashboardApp.d.ts +1 -0
  286. package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -1
  287. package/dist/views/ViewDashboard/DashboardApp.js +5 -2
  288. package/dist/views/ViewDashboard/DashboardApp.js.map +1 -1
  289. package/dist/views/ViewDashboard/ViewDashboard.d.ts +2 -0
  290. package/dist/views/ViewDashboard/ViewDashboard.d.ts.map +1 -1
  291. package/dist/views/ViewDashboard/ViewDashboard.js +5 -3
  292. package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -1
  293. package/dist/views/ViewDashboard/index.js +1 -1
  294. package/dist/views/ViewDashboard/index.js.map +1 -1
  295. package/dist/views/index.js +1 -1
  296. package/dist/views/index.js.map +1 -1
  297. package/package.json +7 -6
  298. package/dist/cjs/components/Panel/Panel.test.js +0 -129
  299. package/dist/cjs/components/PanelDrawer/PanelDrawer.test.js +0 -131
  300. package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.test.js +0 -87
  301. package/dist/cjs/components/TimeRangeControls/TimeRangeControls.test.js +0 -95
  302. package/dist/cjs/components/Variables/variable-model.test.js +0 -106
  303. package/dist/cjs/context/TemplateVariableProvider/query-params.test.js +0 -82
  304. package/dist/cjs/views/ViewDashboard/tests/panelGroups.test.js +0 -110
  305. package/dist/components/Panel/Panel.test.d.ts +0 -2
  306. package/dist/components/Panel/Panel.test.d.ts.map +0 -1
  307. package/dist/components/Panel/Panel.test.js +0 -122
  308. package/dist/components/Panel/Panel.test.js.map +0 -1
  309. package/dist/components/PanelDrawer/PanelDrawer.test.d.ts +0 -2
  310. package/dist/components/PanelDrawer/PanelDrawer.test.d.ts.map +0 -1
  311. package/dist/components/PanelDrawer/PanelDrawer.test.js +0 -124
  312. package/dist/components/PanelDrawer/PanelDrawer.test.js.map +0 -1
  313. package/dist/components/PanelGroupDialog/PanelGroupDialog.test.d.ts +0 -2
  314. package/dist/components/PanelGroupDialog/PanelGroupDialog.test.d.ts.map +0 -1
  315. package/dist/components/PanelGroupDialog/PanelGroupDialog.test.js +0 -80
  316. package/dist/components/PanelGroupDialog/PanelGroupDialog.test.js.map +0 -1
  317. package/dist/components/TimeRangeControls/TimeRangeControls.test.d.ts +0 -2
  318. package/dist/components/TimeRangeControls/TimeRangeControls.test.d.ts.map +0 -1
  319. package/dist/components/TimeRangeControls/TimeRangeControls.test.js +0 -88
  320. package/dist/components/TimeRangeControls/TimeRangeControls.test.js.map +0 -1
  321. package/dist/components/Variables/variable-model.test.d.ts +0 -2
  322. package/dist/components/Variables/variable-model.test.d.ts.map +0 -1
  323. package/dist/components/Variables/variable-model.test.js +0 -104
  324. package/dist/components/Variables/variable-model.test.js.map +0 -1
  325. package/dist/context/TemplateVariableProvider/query-params.test.d.ts +0 -2
  326. package/dist/context/TemplateVariableProvider/query-params.test.d.ts.map +0 -1
  327. package/dist/context/TemplateVariableProvider/query-params.test.js +0 -80
  328. package/dist/context/TemplateVariableProvider/query-params.test.js.map +0 -1
  329. package/dist/utils/functions.d.ts +0 -2
  330. package/dist/utils/functions.d.ts.map +0 -1
  331. package/dist/utils/functions.js.map +0 -1
  332. package/dist/views/ViewDashboard/tests/panelGroups.test.d.ts +0 -2
  333. package/dist/views/ViewDashboard/tests/panelGroups.test.d.ts.map +0 -1
  334. package/dist/views/ViewDashboard/tests/panelGroups.test.js +0 -103
  335. package/dist/views/ViewDashboard/tests/panelGroups.test.js.map +0 -1
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 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
@@ -19,132 +19,66 @@ Object.defineProperty(exports, "TemplateVariableList", {
19
19
  get: ()=>TemplateVariableList
20
20
  });
21
21
  const _jsxRuntime = require("react/jsx-runtime");
22
- const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
22
+ const _react = require("react");
23
23
  const _material = require("@mui/material");
24
- const _pencil = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/Pencil"));
25
24
  const _pinOutline = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/PinOutline"));
26
25
  const _pinOffOutline = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/PinOffOutline"));
27
- const _components = require("@perses-dev/components");
28
26
  const _context = require("../../context");
29
27
  const _variable = require("./Variable");
30
- const _variableEditor = require("./VariableEditor");
31
28
  function _interopRequireDefault(obj) {
32
29
  return obj && obj.__esModule ? obj : {
33
30
  default: obj
34
31
  };
35
32
  }
36
- function _getRequireWildcardCache(nodeInterop) {
37
- if (typeof WeakMap !== "function") return null;
38
- var cacheBabelInterop = new WeakMap();
39
- var cacheNodeInterop = new WeakMap();
40
- return (_getRequireWildcardCache = function(nodeInterop) {
41
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
42
- })(nodeInterop);
43
- }
44
- function _interopRequireWildcard(obj, nodeInterop) {
45
- if (!nodeInterop && obj && obj.__esModule) {
46
- return obj;
47
- }
48
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
49
- return {
50
- default: obj
51
- };
52
- }
53
- var cache = _getRequireWildcardCache(nodeInterop);
54
- if (cache && cache.has(obj)) {
55
- return cache.get(obj);
56
- }
57
- var newObj = {};
58
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
59
- for(var key in obj){
60
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
61
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
62
- if (desc && (desc.get || desc.set)) {
63
- Object.defineProperty(newObj, key, desc);
64
- } else {
65
- newObj[key] = obj[key];
66
- }
67
- }
68
- }
69
- newObj.default = obj;
70
- if (cache) {
71
- cache.set(obj, newObj);
72
- }
73
- return newObj;
74
- }
33
+ const VARIABLE_INPUT_MIN_WIDTH = '120px';
34
+ const VARIABLE_INPUT_MAX_WIDTH = '240px';
75
35
  function TemplateVariableList(props) {
76
- const [isEditing, setIsEditing] = (0, _react.useState)(false);
77
36
  const [isPin, setIsPin] = (0, _react.useState)(props.initialVariableIsSticky);
78
37
  const variableDefinitions = (0, _context.useTemplateVariableDefinitions)();
79
- const { isEditMode } = (0, _context.useEditMode)();
80
- const { setVariableDefinitions } = (0, _context.useTemplateVariableActions)();
81
38
  const scrollTrigger = (0, _material.useScrollTrigger)({
82
39
  disableHysteresis: true
83
40
  });
84
41
  const isSticky = scrollTrigger && props.initialVariableIsSticky && isPin;
85
- const onClose = ()=>{
86
- setIsEditing(false);
87
- };
88
- return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Box, {
89
- children: [
90
- /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components.Drawer, {
91
- isOpen: isEditing,
92
- onClose: onClose,
93
- PaperProps: {
94
- sx: {
95
- width: '50%'
96
- }
97
- },
98
- children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_variableEditor.VariableEditor, {
99
- variableDefinitions: variableDefinitions,
100
- onCancel: onClose,
101
- onChange: (v)=>{
102
- setVariableDefinitions(v);
103
- setIsEditing(false);
104
- }
105
- })
106
- }),
107
- isEditMode && /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Box, {
108
- pb: 2,
109
- children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Button, {
110
- onClick: ()=>setIsEditing(true),
111
- startIcon: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pencil.default, {}),
112
- children: "Edit Variables"
113
- })
114
- }),
115
- /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.AppBar, {
116
- color: 'inherit',
117
- position: isSticky ? 'fixed' : 'static',
118
- elevation: isSticky ? 4 : 0,
119
- sx: {
120
- ...props.sx
121
- },
122
- children: /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Box, {
123
- display: 'flex',
124
- justifyContent: "space-between",
125
- my: isSticky ? 2 : 0,
126
- ml: isSticky ? 2 : 0,
127
- children: [
128
- /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Stack, {
129
- direction: "row",
130
- spacing: 1,
131
- children: variableDefinitions.map((v)=>{
132
- var ref;
133
- /*#__PURE__*/ return (0, _jsxRuntime.jsx)(_material.Box, {
134
- display: ((ref = v.spec.display) === null || ref === void 0 ? void 0 : ref.hidden) ? 'none' : undefined,
135
- children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_variable.TemplateVariable, {
136
- name: v.spec.name
137
- }, v.spec.name)
138
- }, v.spec.name);
139
- })
140
- }),
141
- props.initialVariableIsSticky && /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.IconButton, {
142
- onClick: ()=>setIsPin(!isPin),
143
- children: isPin ? /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pinOutline.default, {}) : /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pinOffOutline.default, {})
144
- })
145
- ]
146
- })
42
+ return(// marginBottom={-1} counteracts the marginBottom={1} on every variable input.
43
+ // The margin on the inputs is for spacing between inputs, but is not meant to add space to bottom of the container.
44
+ /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Box, {
45
+ marginBottom: -1,
46
+ "data-testid": "variable-list",
47
+ children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.AppBar, {
48
+ color: "inherit",
49
+ position: isSticky ? 'fixed' : 'static',
50
+ elevation: isSticky ? 4 : 0,
51
+ sx: {
52
+ backgroundColor: 'inherit',
53
+ ...props.sx
54
+ },
55
+ children: /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Box, {
56
+ display: "flex",
57
+ flexWrap: "wrap",
58
+ alignItems: "start",
59
+ my: isSticky ? 2 : 0,
60
+ ml: isSticky ? 2 : 0,
61
+ children: [
62
+ variableDefinitions.map((v)=>{
63
+ var ref;
64
+ /*#__PURE__*/ return (0, _jsxRuntime.jsx)(_material.Box, {
65
+ display: ((ref = v.spec.display) === null || ref === void 0 ? void 0 : ref.hidden) ? 'none' : undefined,
66
+ minWidth: VARIABLE_INPUT_MIN_WIDTH,
67
+ maxWidth: VARIABLE_INPUT_MAX_WIDTH,
68
+ marginBottom: 1,
69
+ marginRight: 1,
70
+ "data-testid": "template-variable",
71
+ children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_variable.TemplateVariable, {
72
+ name: v.spec.name
73
+ }, v.spec.name)
74
+ }, v.spec.name);
75
+ }),
76
+ props.initialVariableIsSticky && /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.IconButton, {
77
+ onClick: ()=>setIsPin(!isPin),
78
+ children: isPin ? /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pinOutline.default, {}) : /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pinOffOutline.default, {})
79
+ })
80
+ ]
147
81
  })
148
- ]
149
- });
82
+ })
83
+ }));
150
84
  }
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 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,9 +14,11 @@
14
14
  Object.defineProperty(exports, "__esModule", {
15
15
  value: true
16
16
  });
17
+ _exportStar(require("./EditVariablesButton"), exports);
17
18
  _exportStar(require("./Variable"), exports);
18
- _exportStar(require("./VariableList"), exports);
19
+ _exportStar(require("./VariableEditor"), exports);
19
20
  _exportStar(require("./VariableEditorForm"), exports);
21
+ _exportStar(require("./VariableList"), exports);
20
22
  function _exportStar(from, to) {
21
23
  Object.keys(from).forEach(function(k) {
22
24
  if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 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
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 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,6 +14,8 @@
14
14
  Object.defineProperty(exports, "__esModule", {
15
15
  value: true
16
16
  });
17
+ _exportStar(require("./AddGroupButton"), exports);
18
+ _exportStar(require("./AddPanelButton"), exports);
17
19
  _exportStar(require("./Dashboard"), exports);
18
20
  _exportStar(require("./DashboardToolbar"), exports);
19
21
  _exportStar(require("./DeletePanelDialog"), exports);
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 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,10 +14,18 @@
14
14
  Object.defineProperty(exports, "__esModule", {
15
15
  value: true
16
16
  });
17
- Object.defineProperty(exports, "removeWhiteSpacesAndSpecialCharacters", {
18
- enumerable: true,
19
- get: ()=>removeWhiteSpacesAndSpecialCharacters
17
+ function _export(target, all) {
18
+ for(var name in all)Object.defineProperty(target, name, {
19
+ enumerable: true,
20
+ get: all[name]
21
+ });
22
+ }
23
+ _export(exports, {
24
+ GRID_LAYOUT_COLS: ()=>GRID_LAYOUT_COLS,
25
+ GRID_LAYOUT_SMALL_BREAKPOINT: ()=>GRID_LAYOUT_SMALL_BREAKPOINT
20
26
  });
21
- const removeWhiteSpacesAndSpecialCharacters = (str)=>{
22
- return str.replace(/\s+/g, '');
27
+ const GRID_LAYOUT_COLS = {
28
+ sm: 24,
29
+ xxs: 2
23
30
  };
31
+ const GRID_LAYOUT_SMALL_BREAKPOINT = 'sm';
@@ -0,0 +1,29 @@
1
+ // Copyright 2023 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
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ _exportStar(require("./grid-layout-config"), exports);
18
+ _exportStar(require("./user-interface-text"), exports);
19
+ function _exportStar(from, to) {
20
+ Object.keys(from).forEach(function(k) {
21
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
22
+ enumerable: true,
23
+ get: function() {
24
+ return from[k];
25
+ }
26
+ });
27
+ });
28
+ return from;
29
+ }
@@ -0,0 +1,61 @@
1
+ // Copyright 2023 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
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ function _export(target, all) {
18
+ for(var name in all)Object.defineProperty(target, name, {
19
+ enumerable: true,
20
+ get: all[name]
21
+ });
22
+ }
23
+ _export(exports, {
24
+ TOOLTIP_TEXT: ()=>TOOLTIP_TEXT,
25
+ ARIA_LABEL_TEXT: ()=>ARIA_LABEL_TEXT
26
+ });
27
+ const TOOLTIP_TEXT = {
28
+ // Toolbar buttons
29
+ addPanel: 'Add panel',
30
+ addGroup: 'Add panel group',
31
+ downloadDashboard: 'Download JSON',
32
+ editVariables: 'Edit variables',
33
+ refreshDashboard: 'Refresh dashboard',
34
+ // Group buttons
35
+ addPanelToGroup: 'Add panel to group',
36
+ deleteGroup: 'Delete group',
37
+ editGroup: 'Edit group',
38
+ moveGroupDown: 'Move group down',
39
+ moveGroupUp: 'Move group up',
40
+ // Panel buttons
41
+ editPanel: 'Edit',
42
+ duplicatePanel: 'Duplicate',
43
+ deletePanel: 'Delete',
44
+ movePanel: 'Move',
45
+ // Variable editor buttons
46
+ refreshVariableValues: 'Refresh values',
47
+ copyVariableValues: 'Copy values to clipboard'
48
+ };
49
+ const ARIA_LABEL_TEXT = {
50
+ // Group buttons
51
+ addPanelToGroup: (groupName)=>`add panel to group ${groupName}`,
52
+ deleteGroup: (groupName)=>`delete group ${groupName}`,
53
+ editGroup: (groupName)=>`edit group ${groupName}`,
54
+ moveGroupDown: (groupName)=>`move group ${groupName} down`,
55
+ moveGroupUp: (groupName)=>`move group ${groupName} up`,
56
+ // Panel buttons
57
+ editPanel: (panelName)=>`edit panel ${panelName}`,
58
+ duplicatePanel: (panelName)=>`duplicate panel ${panelName}`,
59
+ deletePanel: (panelName)=>`delete panel ${panelName}`,
60
+ movePanel: (panelName)=>`move panel ${panelName}`
61
+ };
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 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
@@ -29,8 +29,9 @@ const _jsxRuntime = require("react/jsx-runtime");
29
29
  const _zustand = require("zustand");
30
30
  const _middleware = require("zustand/middleware");
31
31
  const _immer = require("zustand/middleware/immer");
32
- const _shallow = /*#__PURE__*/ _interopRequireDefault(require("zustand/shallow"));
32
+ const _shallow = require("zustand/shallow");
33
33
  const _react = require("react");
34
+ const _pluginSystem = require("@perses-dev/plugin-system");
34
35
  const _panelGroupEditorSlice = require("./panel-group-editor-slice");
35
36
  const _panelGroupSlice = require("./panel-group-slice");
36
37
  const _panelEditorSlice = require("./panel-editor-slice");
@@ -38,24 +39,40 @@ const _panelSlice = require("./panel-slice");
38
39
  const _deletePanelGroupSlice = require("./delete-panel-group-slice");
39
40
  const _deletePanelSlice = require("./delete-panel-slice");
40
41
  const _discardChangesDialogSlice = require("./discard-changes-dialog-slice");
41
- function _interopRequireDefault(obj) {
42
- return obj && obj.__esModule ? obj : {
43
- default: obj
44
- };
45
- }
42
+ const _duplicatePanelSlice = require("./duplicate-panel-slice");
46
43
  const DashboardContext = /*#__PURE__*/ (0, _react.createContext)(undefined);
47
44
  function useDashboardStore(selector) {
48
45
  const store = (0, _react.useContext)(DashboardContext);
49
46
  if (store === undefined) {
50
47
  throw new Error('No DashboardContext found. Did you forget a Provider?');
51
48
  }
52
- return (0, _zustand.useStore)(store, selector, _shallow.default);
49
+ return (0, _zustand.useStore)(store, selector, _shallow.shallow);
53
50
  }
54
51
  function DashboardProvider(props) {
55
52
  const createDashboardStore = (0, _react.useCallback)(initStore, [
56
53
  props
57
54
  ]);
55
+ // load plugin to retrieve initial spec if default panel kind is defined
56
+ const { defaultPluginKinds } = (0, _pluginSystem.usePluginRegistry)();
57
+ var ref;
58
+ const defaultPanelKind = (ref = defaultPluginKinds === null || defaultPluginKinds === void 0 ? void 0 : defaultPluginKinds['Panel']) !== null && ref !== void 0 ? ref : '';
59
+ const { data: plugin } = (0, _pluginSystem.usePlugin)('Panel', defaultPanelKind);
58
60
  const [store] = (0, _react.useState)(createDashboardStore(props)); // prevent calling createDashboardStore every time it rerenders
61
+ (0, _react.useEffect)(()=>{
62
+ if (plugin === undefined) return;
63
+ const spec = plugin.createInitialOptions();
64
+ // set default panel kind and spec for add panel editor
65
+ store.setState({
66
+ initialValues: {
67
+ kind: defaultPanelKind,
68
+ spec
69
+ }
70
+ });
71
+ }, [
72
+ plugin,
73
+ store,
74
+ defaultPanelKind
75
+ ]);
59
76
  return /*#__PURE__*/ (0, _jsxRuntime.jsx)(DashboardContext.Provider, {
60
77
  value: store,
61
78
  children: props.children
@@ -63,18 +80,24 @@ function DashboardProvider(props) {
63
80
  }
64
81
  function initStore(props) {
65
82
  const { initialState: { dashboardResource , isEditMode } , } = props;
66
- const { spec: { layouts , panels , duration } , metadata , } = dashboardResource;
83
+ const { spec: { display , duration } , metadata , } = dashboardResource;
84
+ let { spec: { layouts , panels } , } = dashboardResource;
85
+ // Set fallbacks in case the frontend is used with a non-Perses backend
86
+ layouts = layouts !== null && layouts !== void 0 ? layouts : [];
87
+ panels = panels !== null && panels !== void 0 ? panels : {};
67
88
  const store = (0, _zustand.createStore)()((0, _immer.immer)((0, _middleware.devtools)((...args)=>{
68
89
  const [set] = args;
69
90
  return {
70
- ...(0, _panelGroupSlice.createPanelGroupSlice)(layouts)(...args),
71
- ...(0, _panelSlice.createPanelSlice)(panels)(...args),
91
+ /* Groups */ ...(0, _panelGroupSlice.createPanelGroupSlice)(layouts)(...args),
72
92
  ...(0, _panelGroupEditorSlice.createPanelGroupEditorSlice)(...args),
73
93
  ...(0, _deletePanelGroupSlice.createDeletePanelGroupSlice)(...args),
94
+ /* Panels */ ...(0, _panelSlice.createPanelSlice)(panels)(...args),
74
95
  ...(0, _panelEditorSlice.createPanelEditorSlice)()(...args),
75
96
  ...(0, _deletePanelSlice.createDeletePanelSlice)()(...args),
76
- ...(0, _discardChangesDialogSlice.createDiscardChangesDialogSlice)(...args),
97
+ ...(0, _duplicatePanelSlice.createDuplicatePanelSlice)()(...args),
98
+ /* General */ ...(0, _discardChangesDialogSlice.createDiscardChangesDialogSlice)(...args),
77
99
  metadata,
100
+ display,
78
101
  defaultTimeRange: {
79
102
  pastDuration: duration
80
103
  },
@@ -82,11 +105,12 @@ function initStore(props) {
82
105
  setEditMode: (isEditMode)=>set({
83
106
  isEditMode
84
107
  }),
85
- setDashboard: ({ metadata , spec: { panels , layouts } })=>{
108
+ setDashboard: ({ metadata , spec: { display , panels ={} , layouts =[] } })=>{
86
109
  set((state)=>{
87
110
  state.metadata = metadata;
88
- const { panelGroups , panelGroupOrder } = (0, _panelGroupSlice.convertLayoutsToPanelGroups)(layouts);
111
+ state.display = display;
89
112
  state.panels = panels;
113
+ const { panelGroups , panelGroupOrder } = (0, _panelGroupSlice.convertLayoutsToPanelGroups)(layouts);
90
114
  state.panelGroups = panelGroups;
91
115
  state.panelGroupOrder = panelGroupOrder;
92
116
  });
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 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
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 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
@@ -162,15 +162,17 @@ function usePanel(panelGroupItemId) {
162
162
  }
163
163
  return panel;
164
164
  }
165
- const selectPanelActions = ({ openEditPanel , openDeletePanelDialog })=>({
165
+ const selectPanelActions = ({ openEditPanel , openDeletePanelDialog , duplicatePanel })=>({
166
166
  openEditPanel,
167
- openDeletePanelDialog
167
+ openDeletePanelDialog,
168
+ duplicatePanel
168
169
  });
169
170
  function usePanelActions(panelGroupItemId) {
170
- const { openEditPanel , openDeletePanelDialog } = (0, _dashboardProvider.useDashboardStore)(selectPanelActions);
171
+ const { openEditPanel , openDeletePanelDialog , duplicatePanel } = (0, _dashboardProvider.useDashboardStore)(selectPanelActions);
171
172
  return {
172
173
  openEditPanel: ()=>openEditPanel(panelGroupItemId),
173
- openDeletePanelDialog: ()=>openDeletePanelDialog(panelGroupItemId)
174
+ openDeletePanelDialog: ()=>openDeletePanelDialog(panelGroupItemId),
175
+ duplicatePanel: ()=>duplicatePanel(panelGroupItemId)
174
176
  };
175
177
  }
176
178
  const selectPanelEditor = (state)=>state.panelEditor;
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 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
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 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
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 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
@@ -0,0 +1,62 @@
1
+ // Copyright 2023 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
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ Object.defineProperty(exports, "createDuplicatePanelSlice", {
18
+ enumerable: true,
19
+ get: ()=>createDuplicatePanelSlice
20
+ });
21
+ const _panelUtils = require("../../utils/panelUtils");
22
+ const _common = require("./common");
23
+ function createDuplicatePanelSlice() {
24
+ return (set)=>({
25
+ duplicatePanel (panelGroupItemId) {
26
+ set((state)=>{
27
+ const panels = state.panels;
28
+ // Figure out the panel key at that location
29
+ const { panelGroupId , panelGroupItemLayoutId: panelGroupLayoutId } = panelGroupItemId;
30
+ const group = state.panelGroups[panelGroupId];
31
+ if (group === undefined) {
32
+ throw new Error(`Missing panel group ${panelGroupId}`);
33
+ }
34
+ const panelKey = group.itemPanelKeys[panelGroupLayoutId];
35
+ if (panelKey === undefined) {
36
+ throw new Error(`Could not find Panel Group item ${panelGroupItemId}`);
37
+ }
38
+ // Find the panel to edit
39
+ const panelToDupe = panels[panelKey];
40
+ if (panelToDupe === undefined) {
41
+ throw new Error(`Cannot find Panel with key '${panelKey}'`);
42
+ }
43
+ // Find the layout for the item being duped
44
+ const matchingLayout = group.itemLayouts.find((itemLayout)=>{
45
+ return itemLayout.i === panelGroupLayoutId;
46
+ });
47
+ if (matchingLayout === undefined) {
48
+ throw new Error(`Cannot find layout for Panel with key '${panelKey}'`);
49
+ }
50
+ const dupePanelKey = (0, _panelUtils.getValidPanelKey)(panelKey, panels);
51
+ state.panels[dupePanelKey] = panelToDupe;
52
+ const duplicateLayout = {
53
+ i: (0, _common.generateId)().toString(),
54
+ w: matchingLayout.w,
55
+ h: matchingLayout.h
56
+ };
57
+ group.itemLayouts = (0, _panelUtils.insertPanelInLayout)(duplicateLayout, matchingLayout, group.itemLayouts);
58
+ group.itemPanelKeys[duplicateLayout.i] = dupePanelKey;
59
+ });
60
+ }
61
+ });
62
+ }
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 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