@perses-dev/dashboards 0.0.0-snapshot-embed-import-errors-8906900 → 0.0.0-snapshot-datasource-browser-test-28cbb71

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 (325) 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/Panel.test.js +11 -3
  24. package/dist/cjs/components/Panel/PanelContent.js +3 -2
  25. package/dist/cjs/components/Panel/PanelHeader.js +26 -8
  26. package/dist/cjs/components/Panel/index.js +1 -1
  27. package/dist/cjs/components/PanelDrawer/PanelDrawer.js +2 -1
  28. package/dist/cjs/components/PanelDrawer/PanelDrawer.test.js +1 -1
  29. package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +1 -1
  30. package/dist/cjs/components/PanelDrawer/PanelPreview.js +1 -1
  31. package/dist/cjs/components/PanelDrawer/index.js +1 -1
  32. package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.js +4 -1
  33. package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.test.js +1 -1
  34. package/dist/cjs/components/PanelGroupDialog/PanelGroupEditorForm.js +1 -1
  35. package/dist/cjs/components/PanelGroupDialog/index.js +1 -1
  36. package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +13 -9
  37. package/dist/cjs/components/TimeRangeControls/TimeRangeControls.test.js +3 -3
  38. package/dist/cjs/components/TimeRangeControls/index.js +1 -1
  39. package/dist/cjs/components/ToolbarIconButton/ToolbarIconButton.js +1 -1
  40. package/dist/cjs/components/ToolbarIconButton/index.js +1 -1
  41. package/dist/cjs/components/Variables/EditVariablesButton.js +75 -0
  42. package/dist/cjs/components/Variables/Variable.js +1 -1
  43. package/dist/cjs/components/Variables/VariableEditor.js +10 -6
  44. package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +6 -7
  45. package/dist/cjs/components/Variables/VariableEditorForm/index.js +1 -1
  46. package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +1 -1
  47. package/dist/cjs/components/Variables/VariableList.js +45 -111
  48. package/dist/cjs/components/Variables/index.js +4 -2
  49. package/dist/cjs/components/Variables/variable-model.js +1 -1
  50. package/dist/cjs/components/Variables/variable-model.test.js +1 -1
  51. package/dist/cjs/components/index.js +3 -1
  52. package/dist/cjs/{utils/functions.js → constants/grid-layout-config.js} +14 -6
  53. package/dist/cjs/constants/index.js +29 -0
  54. package/dist/cjs/constants/user-interface-text.js +61 -0
  55. package/dist/cjs/context/DashboardProvider/DashboardProvider.js +28 -3
  56. package/dist/cjs/context/DashboardProvider/common.js +1 -1
  57. package/dist/cjs/context/DashboardProvider/dashboard-provider-api.js +7 -5
  58. package/dist/cjs/context/DashboardProvider/delete-panel-group-slice.js +1 -1
  59. package/dist/cjs/context/DashboardProvider/delete-panel-slice.js +1 -1
  60. package/dist/cjs/context/DashboardProvider/discard-changes-dialog-slice.js +1 -1
  61. package/dist/cjs/context/DashboardProvider/duplicate-panel-slice.js +62 -0
  62. package/dist/cjs/context/DashboardProvider/index.js +1 -1
  63. package/dist/cjs/context/DashboardProvider/panel-editor-slice.js +9 -38
  64. package/dist/cjs/context/DashboardProvider/panel-group-editor-slice.js +1 -1
  65. package/dist/cjs/context/DashboardProvider/panel-group-slice.js +1 -1
  66. package/dist/cjs/context/DashboardProvider/panel-slice.js +1 -1
  67. package/dist/cjs/context/DatasourceStoreProvider.js +1 -1
  68. package/dist/cjs/context/TemplateVariableProvider/TemplateVariableProvider.js +1 -1
  69. package/dist/cjs/context/TemplateVariableProvider/index.js +1 -1
  70. package/dist/cjs/context/TemplateVariableProvider/query-params.js +1 -1
  71. package/dist/cjs/context/TemplateVariableProvider/query-params.test.js +1 -1
  72. package/dist/cjs/context/index.js +1 -1
  73. package/dist/cjs/context/useDashboard.js +5 -3
  74. package/dist/cjs/index.js +1 -1
  75. package/dist/cjs/test/dashboard-provider.js +1 -1
  76. package/dist/cjs/test/index.js +1 -1
  77. package/dist/cjs/test/plugin-registry.js +1 -1
  78. package/dist/cjs/test/render.js +1 -1
  79. package/dist/cjs/test/setup-tests.js +1 -1
  80. package/dist/cjs/test/testDashboard.js +1 -1
  81. package/dist/cjs/utils/index.js +28 -0
  82. package/dist/cjs/utils/panelUtils.js +168 -0
  83. package/dist/cjs/utils/panelUtils.test.js +195 -0
  84. package/dist/cjs/views/ViewDashboard/DashboardApp.js +5 -2
  85. package/dist/cjs/views/ViewDashboard/ViewDashboard.js +5 -3
  86. package/dist/cjs/views/ViewDashboard/index.js +1 -1
  87. package/dist/cjs/views/ViewDashboard/tests/panelGroups.test.js +1 -1
  88. package/dist/cjs/views/index.js +1 -1
  89. package/dist/components/AddGroupButton/AddGroupButton.d.ts +3 -0
  90. package/dist/components/AddGroupButton/AddGroupButton.d.ts.map +1 -0
  91. package/dist/components/AddGroupButton/AddGroupButton.js +32 -0
  92. package/dist/components/AddGroupButton/AddGroupButton.js.map +1 -0
  93. package/dist/components/AddGroupButton/index.d.ts +2 -0
  94. package/dist/components/AddGroupButton/index.d.ts.map +1 -0
  95. package/dist/{utils/functions.js → components/AddGroupButton/index.js} +3 -5
  96. package/dist/components/AddGroupButton/index.js.map +1 -0
  97. package/dist/components/AddPanelButton/AddPanelButton.d.ts +3 -0
  98. package/dist/components/AddPanelButton/AddPanelButton.d.ts.map +1 -0
  99. package/dist/components/AddPanelButton/AddPanelButton.js +32 -0
  100. package/dist/components/AddPanelButton/AddPanelButton.js.map +1 -0
  101. package/dist/components/AddPanelButton/index.d.ts +2 -0
  102. package/dist/components/AddPanelButton/index.d.ts.map +1 -0
  103. package/dist/components/AddPanelButton/index.js +15 -0
  104. package/dist/components/AddPanelButton/index.js.map +1 -0
  105. package/dist/components/Dashboard/Dashboard.js +1 -1
  106. package/dist/components/Dashboard/Dashboard.js.map +1 -1
  107. package/dist/components/Dashboard/index.js +1 -1
  108. package/dist/components/Dashboard/index.js.map +1 -1
  109. package/dist/components/DashboardToolbar/DashboardToolbar.d.ts.map +1 -1
  110. package/dist/components/DashboardToolbar/DashboardToolbar.js +50 -23
  111. package/dist/components/DashboardToolbar/DashboardToolbar.js.map +1 -1
  112. package/dist/components/DashboardToolbar/index.js +1 -1
  113. package/dist/components/DashboardToolbar/index.js.map +1 -1
  114. package/dist/components/DeletePanelDialog/DeletePanelDialog.d.ts.map +1 -1
  115. package/dist/components/DeletePanelDialog/DeletePanelDialog.js +8 -25
  116. package/dist/components/DeletePanelDialog/DeletePanelDialog.js.map +1 -1
  117. package/dist/components/DeletePanelDialog/index.js +1 -1
  118. package/dist/components/DeletePanelDialog/index.js.map +1 -1
  119. package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +2 -1
  120. package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js.map +1 -1
  121. package/dist/components/DeletePanelGroupDialog/index.js +1 -1
  122. package/dist/components/DeletePanelGroupDialog/index.js.map +1 -1
  123. package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js +2 -1
  124. package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js.map +1 -1
  125. package/dist/components/DiscardChangesConfirmationDialog/index.js +1 -1
  126. package/dist/components/DiscardChangesConfirmationDialog/index.js.map +1 -1
  127. package/dist/components/DownloadButton/DownloadButton.d.ts +5 -1
  128. package/dist/components/DownloadButton/DownloadButton.d.ts.map +1 -1
  129. package/dist/components/DownloadButton/DownloadButton.js +17 -8
  130. package/dist/components/DownloadButton/DownloadButton.js.map +1 -1
  131. package/dist/components/DownloadButton/index.js +1 -1
  132. package/dist/components/DownloadButton/index.js.map +1 -1
  133. package/dist/components/GridLayout/GridContainer.d.ts.map +1 -1
  134. package/dist/components/GridLayout/GridContainer.js +2 -1
  135. package/dist/components/GridLayout/GridContainer.js.map +1 -1
  136. package/dist/components/GridLayout/GridItemContent.d.ts.map +1 -1
  137. package/dist/components/GridLayout/GridItemContent.js +3 -2
  138. package/dist/components/GridLayout/GridItemContent.js.map +1 -1
  139. package/dist/components/GridLayout/GridLayout.d.ts.map +1 -1
  140. package/dist/components/GridLayout/GridLayout.js +6 -8
  141. package/dist/components/GridLayout/GridLayout.js.map +1 -1
  142. package/dist/components/GridLayout/GridTitle.d.ts.map +1 -1
  143. package/dist/components/GridLayout/GridTitle.js +14 -11
  144. package/dist/components/GridLayout/GridTitle.js.map +1 -1
  145. package/dist/components/GridLayout/index.js +1 -1
  146. package/dist/components/GridLayout/index.js.map +1 -1
  147. package/dist/components/Panel/Panel.js +7 -7
  148. package/dist/components/Panel/Panel.js.map +1 -1
  149. package/dist/components/Panel/Panel.test.js +11 -3
  150. package/dist/components/Panel/Panel.test.js.map +1 -1
  151. package/dist/components/Panel/PanelContent.d.ts.map +1 -1
  152. package/dist/components/Panel/PanelContent.js +3 -2
  153. package/dist/components/Panel/PanelContent.js.map +1 -1
  154. package/dist/components/Panel/PanelHeader.d.ts +1 -0
  155. package/dist/components/Panel/PanelHeader.d.ts.map +1 -1
  156. package/dist/components/Panel/PanelHeader.js +26 -8
  157. package/dist/components/Panel/PanelHeader.js.map +1 -1
  158. package/dist/components/Panel/index.js +1 -1
  159. package/dist/components/Panel/index.js.map +1 -1
  160. package/dist/components/PanelDrawer/PanelDrawer.js +2 -1
  161. package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -1
  162. package/dist/components/PanelDrawer/PanelDrawer.test.js +1 -1
  163. package/dist/components/PanelDrawer/PanelDrawer.test.js.map +1 -1
  164. package/dist/components/PanelDrawer/PanelEditorForm.js +1 -1
  165. package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -1
  166. package/dist/components/PanelDrawer/PanelPreview.js +1 -1
  167. package/dist/components/PanelDrawer/PanelPreview.js.map +1 -1
  168. package/dist/components/PanelDrawer/index.js +1 -1
  169. package/dist/components/PanelDrawer/index.js.map +1 -1
  170. package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts.map +1 -1
  171. package/dist/components/PanelGroupDialog/PanelGroupDialog.js +4 -1
  172. package/dist/components/PanelGroupDialog/PanelGroupDialog.js.map +1 -1
  173. package/dist/components/PanelGroupDialog/PanelGroupDialog.test.js +1 -1
  174. package/dist/components/PanelGroupDialog/PanelGroupDialog.test.js.map +1 -1
  175. package/dist/components/PanelGroupDialog/PanelGroupEditorForm.js +1 -1
  176. package/dist/components/PanelGroupDialog/PanelGroupEditorForm.js.map +1 -1
  177. package/dist/components/PanelGroupDialog/index.js +1 -1
  178. package/dist/components/PanelGroupDialog/index.js.map +1 -1
  179. package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -1
  180. package/dist/components/TimeRangeControls/TimeRangeControls.js +14 -10
  181. package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
  182. package/dist/components/TimeRangeControls/TimeRangeControls.test.js +3 -3
  183. package/dist/components/TimeRangeControls/TimeRangeControls.test.js.map +1 -1
  184. package/dist/components/TimeRangeControls/index.js +1 -1
  185. package/dist/components/TimeRangeControls/index.js.map +1 -1
  186. package/dist/components/ToolbarIconButton/ToolbarIconButton.js +1 -1
  187. package/dist/components/ToolbarIconButton/ToolbarIconButton.js.map +1 -1
  188. package/dist/components/ToolbarIconButton/index.js +1 -1
  189. package/dist/components/ToolbarIconButton/index.js.map +1 -1
  190. package/dist/components/Variables/EditVariablesButton.d.ts +3 -0
  191. package/dist/components/Variables/EditVariablesButton.d.ts.map +1 -0
  192. package/dist/components/Variables/EditVariablesButton.js +64 -0
  193. package/dist/components/Variables/EditVariablesButton.js.map +1 -0
  194. package/dist/components/Variables/Variable.js +1 -1
  195. package/dist/components/Variables/Variable.js.map +1 -1
  196. package/dist/components/Variables/VariableEditor.d.ts.map +1 -1
  197. package/dist/components/Variables/VariableEditor.js +10 -6
  198. package/dist/components/Variables/VariableEditor.js.map +1 -1
  199. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
  200. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +8 -9
  201. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
  202. package/dist/components/Variables/VariableEditorForm/index.js +1 -1
  203. package/dist/components/Variables/VariableEditorForm/index.js.map +1 -1
  204. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +1 -1
  205. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -1
  206. package/dist/components/Variables/VariableList.d.ts.map +1 -1
  207. package/dist/components/Variables/VariableList.js +47 -74
  208. package/dist/components/Variables/VariableList.js.map +1 -1
  209. package/dist/components/Variables/index.d.ts +3 -1
  210. package/dist/components/Variables/index.d.ts.map +1 -1
  211. package/dist/components/Variables/index.js +4 -2
  212. package/dist/components/Variables/index.js.map +1 -1
  213. package/dist/components/Variables/variable-model.js +1 -1
  214. package/dist/components/Variables/variable-model.js.map +1 -1
  215. package/dist/components/Variables/variable-model.test.js +1 -1
  216. package/dist/components/Variables/variable-model.test.js.map +1 -1
  217. package/dist/components/index.d.ts +2 -0
  218. package/dist/components/index.d.ts.map +1 -1
  219. package/dist/components/index.js +3 -1
  220. package/dist/components/index.js.map +1 -1
  221. package/dist/constants/grid-layout-config.d.ts +6 -0
  222. package/dist/constants/grid-layout-config.d.ts.map +1 -0
  223. package/dist/constants/grid-layout-config.js +19 -0
  224. package/dist/constants/grid-layout-config.js.map +1 -0
  225. package/dist/constants/index.d.ts +3 -0
  226. package/dist/constants/index.d.ts.map +1 -0
  227. package/dist/constants/index.js +16 -0
  228. package/dist/constants/index.js.map +1 -0
  229. package/dist/constants/user-interface-text.d.ts +30 -0
  230. package/dist/constants/user-interface-text.d.ts.map +1 -0
  231. package/dist/constants/user-interface-text.js +49 -0
  232. package/dist/constants/user-interface-text.js.map +1 -0
  233. package/dist/context/DashboardProvider/DashboardProvider.d.ts +6 -4
  234. package/dist/context/DashboardProvider/DashboardProvider.d.ts.map +1 -1
  235. package/dist/context/DashboardProvider/DashboardProvider.js +29 -4
  236. package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -1
  237. package/dist/context/DashboardProvider/common.js +1 -1
  238. package/dist/context/DashboardProvider/common.js.map +1 -1
  239. package/dist/context/DashboardProvider/dashboard-provider-api.d.ts +1 -0
  240. package/dist/context/DashboardProvider/dashboard-provider-api.d.ts.map +1 -1
  241. package/dist/context/DashboardProvider/dashboard-provider-api.js +7 -5
  242. package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -1
  243. package/dist/context/DashboardProvider/delete-panel-group-slice.js +1 -1
  244. package/dist/context/DashboardProvider/delete-panel-group-slice.js.map +1 -1
  245. package/dist/context/DashboardProvider/delete-panel-slice.js +1 -1
  246. package/dist/context/DashboardProvider/delete-panel-slice.js.map +1 -1
  247. package/dist/context/DashboardProvider/discard-changes-dialog-slice.js +1 -1
  248. package/dist/context/DashboardProvider/discard-changes-dialog-slice.js.map +1 -1
  249. package/dist/context/DashboardProvider/duplicate-panel-slice.d.ts +19 -0
  250. package/dist/context/DashboardProvider/duplicate-panel-slice.d.ts.map +1 -0
  251. package/dist/context/DashboardProvider/duplicate-panel-slice.js +58 -0
  252. package/dist/context/DashboardProvider/duplicate-panel-slice.js.map +1 -0
  253. package/dist/context/DashboardProvider/index.d.ts +1 -1
  254. package/dist/context/DashboardProvider/index.d.ts.map +1 -1
  255. package/dist/context/DashboardProvider/index.js +1 -1
  256. package/dist/context/DashboardProvider/index.js.map +1 -1
  257. package/dist/context/DashboardProvider/panel-editor-slice.d.ts +4 -0
  258. package/dist/context/DashboardProvider/panel-editor-slice.d.ts.map +1 -1
  259. package/dist/context/DashboardProvider/panel-editor-slice.js +7 -36
  260. package/dist/context/DashboardProvider/panel-editor-slice.js.map +1 -1
  261. package/dist/context/DashboardProvider/panel-group-editor-slice.js +1 -1
  262. package/dist/context/DashboardProvider/panel-group-editor-slice.js.map +1 -1
  263. package/dist/context/DashboardProvider/panel-group-slice.js +1 -1
  264. package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -1
  265. package/dist/context/DashboardProvider/panel-slice.js +1 -1
  266. package/dist/context/DashboardProvider/panel-slice.js.map +1 -1
  267. package/dist/context/DatasourceStoreProvider.js +1 -1
  268. package/dist/context/DatasourceStoreProvider.js.map +1 -1
  269. package/dist/context/TemplateVariableProvider/TemplateVariableProvider.js +1 -1
  270. package/dist/context/TemplateVariableProvider/TemplateVariableProvider.js.map +1 -1
  271. package/dist/context/TemplateVariableProvider/index.js +1 -1
  272. package/dist/context/TemplateVariableProvider/index.js.map +1 -1
  273. package/dist/context/TemplateVariableProvider/query-params.js +1 -1
  274. package/dist/context/TemplateVariableProvider/query-params.js.map +1 -1
  275. package/dist/context/TemplateVariableProvider/query-params.test.js +1 -1
  276. package/dist/context/TemplateVariableProvider/query-params.test.js.map +1 -1
  277. package/dist/context/index.js +1 -1
  278. package/dist/context/index.js.map +1 -1
  279. package/dist/context/useDashboard.d.ts.map +1 -1
  280. package/dist/context/useDashboard.js +5 -3
  281. package/dist/context/useDashboard.js.map +1 -1
  282. package/dist/index.js +1 -1
  283. package/dist/index.js.map +1 -1
  284. package/dist/test/dashboard-provider.js +1 -1
  285. package/dist/test/dashboard-provider.js.map +1 -1
  286. package/dist/test/index.js +1 -1
  287. package/dist/test/index.js.map +1 -1
  288. package/dist/test/plugin-registry.js +1 -1
  289. package/dist/test/plugin-registry.js.map +1 -1
  290. package/dist/test/render.js +1 -1
  291. package/dist/test/render.js.map +1 -1
  292. package/dist/test/setup-tests.js +1 -1
  293. package/dist/test/setup-tests.js.map +1 -1
  294. package/dist/test/testDashboard.js +1 -1
  295. package/dist/test/testDashboard.js.map +1 -1
  296. package/dist/utils/index.d.ts +2 -0
  297. package/dist/utils/index.d.ts.map +1 -0
  298. package/dist/utils/index.js +15 -0
  299. package/dist/utils/index.js.map +1 -0
  300. package/dist/utils/panelUtils.d.ts +27 -0
  301. package/dist/utils/panelUtils.d.ts.map +1 -0
  302. package/dist/utils/panelUtils.js +174 -0
  303. package/dist/utils/panelUtils.js.map +1 -0
  304. package/dist/utils/panelUtils.test.d.ts +2 -0
  305. package/dist/utils/panelUtils.test.d.ts.map +1 -0
  306. package/dist/utils/panelUtils.test.js +193 -0
  307. package/dist/utils/panelUtils.test.js.map +1 -0
  308. package/dist/views/ViewDashboard/DashboardApp.d.ts +1 -0
  309. package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -1
  310. package/dist/views/ViewDashboard/DashboardApp.js +5 -2
  311. package/dist/views/ViewDashboard/DashboardApp.js.map +1 -1
  312. package/dist/views/ViewDashboard/ViewDashboard.d.ts +2 -0
  313. package/dist/views/ViewDashboard/ViewDashboard.d.ts.map +1 -1
  314. package/dist/views/ViewDashboard/ViewDashboard.js +5 -3
  315. package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -1
  316. package/dist/views/ViewDashboard/index.js +1 -1
  317. package/dist/views/ViewDashboard/index.js.map +1 -1
  318. package/dist/views/ViewDashboard/tests/panelGroups.test.js +1 -1
  319. package/dist/views/ViewDashboard/tests/panelGroups.test.js.map +1 -1
  320. package/dist/views/index.js +1 -1
  321. package/dist/views/index.js.map +1 -1
  322. package/package.json +4 -4
  323. package/dist/utils/functions.d.ts +0 -2
  324. package/dist/utils/functions.d.ts.map +0 -1
  325. package/dist/utils/functions.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Variables/VariableList.tsx"],"sourcesContent":["// Copyright 2022 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 React, { useState } from 'react';\nimport { Button, Stack, Box, AppBar, useScrollTrigger, IconButton, SxProps, Theme } from '@mui/material';\nimport PencilIcon from 'mdi-material-ui/Pencil';\nimport PinOutline from 'mdi-material-ui/PinOutline';\nimport PinOffOutline from 'mdi-material-ui/PinOffOutline';\nimport { Drawer } from '@perses-dev/components';\nimport { useTemplateVariableDefinitions, useEditMode, useTemplateVariableActions } from '../../context';\nimport { TemplateVariable } from './Variable';\nimport { VariableEditor } from './VariableEditor';\n\ninterface TemplateVariableListProps {\n initialVariableIsSticky?: boolean;\n sx?: SxProps<Theme>;\n}\n\nexport function TemplateVariableList(props: TemplateVariableListProps) {\n const [isEditing, setIsEditing] = useState(false);\n const [isPin, setIsPin] = useState(props.initialVariableIsSticky);\n const variableDefinitions = useTemplateVariableDefinitions();\n const { isEditMode } = useEditMode();\n const { setVariableDefinitions } = useTemplateVariableActions();\n const scrollTrigger = useScrollTrigger({ disableHysteresis: true });\n const isSticky = scrollTrigger && props.initialVariableIsSticky && isPin;\n\n const onClose = () => {\n setIsEditing(false);\n };\n\n return (\n <Box>\n <Drawer isOpen={isEditing} onClose={onClose} PaperProps={{ sx: { width: '50%' } }}>\n <VariableEditor\n variableDefinitions={variableDefinitions}\n onCancel={onClose}\n onChange={(v) => {\n setVariableDefinitions(v);\n setIsEditing(false);\n }}\n />\n </Drawer>\n {isEditMode && (\n <Box pb={2}>\n <Button onClick={() => setIsEditing(true)} startIcon={<PencilIcon />}>\n Edit Variables\n </Button>\n </Box>\n )}\n\n <AppBar\n color={'inherit'}\n position={isSticky ? 'fixed' : 'static'}\n elevation={isSticky ? 4 : 0}\n sx={{ ...props.sx }}\n >\n <Box display={'flex'} justifyContent=\"space-between\" my={isSticky ? 2 : 0} ml={isSticky ? 2 : 0}>\n <Stack direction=\"row\" spacing={1}>\n {variableDefinitions.map((v) => (\n <Box key={v.spec.name} display={v.spec.display?.hidden ? 'none' : undefined}>\n <TemplateVariable key={v.spec.name} name={v.spec.name} />\n </Box>\n ))}\n </Stack>\n {props.initialVariableIsSticky && (\n <IconButton onClick={() => setIsPin(!isPin)}>{isPin ? <PinOutline /> : <PinOffOutline />}</IconButton>\n )}\n </Box>\n </AppBar>\n </Box>\n );\n}\n"],"names":["React","useState","Button","Stack","Box","AppBar","useScrollTrigger","IconButton","PencilIcon","PinOutline","PinOffOutline","Drawer","useTemplateVariableDefinitions","useEditMode","useTemplateVariableActions","TemplateVariable","VariableEditor","TemplateVariableList","props","isEditing","setIsEditing","isPin","setIsPin","initialVariableIsSticky","variableDefinitions","isEditMode","setVariableDefinitions","scrollTrigger","disableHysteresis","isSticky","onClose","isOpen","PaperProps","sx","width","onCancel","onChange","v","pb","onClick","startIcon","color","position","elevation","display","justifyContent","my","ml","direction","spacing","map","spec","hidden","undefined","name"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAm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AACjC,GAAG;oCAAmBwC,OAAO,EAAEP,CAAAA,CAAAA,GAAc,GAAdA,CAAC,CAACc,IAAI,CAACP,OAAO,cAAdP,GAAc,WAAQ,GAAtBA,KAAAA,CAAsB,GAAtBA,GAAc,CAAEe,MAAM,CAAA,GAAG,MAAM,GAAGC,SAAS;8CACzE,cAAA,KAACtC,gBAAgB;wCAAmBuC,IAAI,EAAEjB,CAAC,CAACc,IAAI,CAACG,IAAI;uCAA9BjB,CAAC,CAACc,IAAI,CAACG,IAAI,CAAuB;mCADjDjB,CAAC,CAACc,IAAI,CAACG,IAAI,CAEf,CAAA;6BACP,CAAC;0BACI;wBACPpC,KAAK,CAACK,uBAAuB,kBAC5B,KAAChB,UAAU;4BAACgC,OAAO,EAAE,IAAMjB,QAAQ,CAAC,CAACD,KAAK,CAAC;sCAAGA,KAAK,iBAAG,KAACZ,UAAU,KAAG,iBAAG,KAACC,aAAa,KAAG;0BAAc,AACvG;;kBACG;cACC;;MACL,CACN;AACJ,CAAC"}
1
+ {"version":3,"sources":["../../../src/components/Variables/VariableList.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 { useState } from 'react';\nimport { AppBar, Box, IconButton, SxProps, Theme, useScrollTrigger } from '@mui/material';\nimport PinOutline from 'mdi-material-ui/PinOutline';\nimport PinOffOutline from 'mdi-material-ui/PinOffOutline';\nimport { VariableDefinition } from '@perses-dev/core';\nimport { useTemplateVariableDefinitions } from '../../context';\nimport { TemplateVariable } from './Variable';\n\nconst VARIABLE_INPUT_MIN_WIDTH = '120px';\nconst VARIABLE_INPUT_MAX_WIDTH = '240px';\n\ninterface TemplateVariableListProps {\n initialVariableIsSticky?: boolean;\n sx?: SxProps<Theme>;\n}\n\nexport function TemplateVariableList(props: TemplateVariableListProps) {\n const [isPin, setIsPin] = useState(props.initialVariableIsSticky);\n const variableDefinitions: VariableDefinition[] = useTemplateVariableDefinitions();\n\n const scrollTrigger = useScrollTrigger({ disableHysteresis: true });\n const isSticky = scrollTrigger && props.initialVariableIsSticky && isPin;\n\n return (\n // marginBottom={-1} counteracts the marginBottom={1} on every variable input.\n // The margin on the inputs is for spacing between inputs, but is not meant to add space to bottom of the container.\n <Box marginBottom={-1} data-testid=\"variable-list\">\n <AppBar\n color=\"inherit\"\n position={isSticky ? 'fixed' : 'static'}\n elevation={isSticky ? 4 : 0}\n sx={{ backgroundColor: 'inherit', ...props.sx }}\n >\n <Box display=\"flex\" flexWrap=\"wrap\" alignItems=\"start\" my={isSticky ? 2 : 0} ml={isSticky ? 2 : 0}>\n {variableDefinitions.map((v) => (\n <Box\n key={v.spec.name}\n display={v.spec.display?.hidden ? 'none' : undefined}\n minWidth={VARIABLE_INPUT_MIN_WIDTH}\n maxWidth={VARIABLE_INPUT_MAX_WIDTH}\n marginBottom={1}\n marginRight={1}\n data-testid=\"template-variable\"\n >\n <TemplateVariable key={v.spec.name} name={v.spec.name} />\n </Box>\n ))}\n {props.initialVariableIsSticky && (\n <IconButton onClick={() => setIsPin(!isPin)}>{isPin ? <PinOutline /> : <PinOffOutline />}</IconButton>\n )}\n </Box>\n </AppBar>\n </Box>\n );\n}\n"],"names":["useState","AppBar","Box","IconButton","useScrollTrigger","PinOutline","PinOffOutline","useTemplateVariableDefinitions","TemplateVariable","VARIABLE_INPUT_MIN_WIDTH","VARIABLE_INPUT_MAX_WIDTH","TemplateVariableList","props","isPin","setIsPin","initialVariableIsSticky","variableDefinitions","scrollTrigger","disableHysteresis","isSticky","marginBottom","data-testid","color","position","elevation","sx","backgroundColor","display","flexWrap","alignItems","my","ml","map","v","spec","hidden","undefined","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EC,eAAe,EAAE,SAAS;gBAAE,GAAGd,KAAK,CAACa,EAAE;aAAE;sBAE/C,cAAA,MAACvB,GAAG;gBAACyB,OAAO,EAAC,MAAM;gBAACC,QAAQ,EAAC,MAAM;gBAACC,UAAU,EAAC,OAAO;gBAACC,EAAE,EAAEX,QAAQ,GAAG,CAAC,GAAG,CAAC;gBAAEY,EAAE,EAAEZ,QAAQ,GAAG,CAAC,GAAG,CAAC;;oBAC9FH,mBAAmB,CAACgB,GAAG,CAAC,CAACC,CAAC;4BAGdA,GAAc;sCAFzB,OAAA,KAAC/B,GAAG;4BAEFyB,OAAO,EAAEM,CAAAA,CAAAA,GAAc,GAAdA,CAAC,CAACC,IAAI,CAACP,OAAO,cAAdM,GAAc,WAAQ,GAAtBA,KAAAA,CAAsB,GAAtBA,GAAc,CAAEE,MAAM,CAAA,GAAG,MAAM,GAAGC,SAAS;4BACpDC,QAAQ,EAAE5B,wBAAwB;4BAClC6B,QAAQ,EAAE5B,wBAAwB;4BAClCU,YAAY,EAAE,CAAC;4BACfmB,WAAW,EAAE,CAAC;4BACdlB,aAAW,EAAC,mBAAmB;sCAE/B,cAAA,KAACb,gBAAgB;gCAAmBgC,IAAI,EAAEP,CAAC,CAACC,IAAI,CAACM,IAAI;+BAA9BP,CAAC,CAACC,IAAI,CAACM,IAAI,CAAuB;2BARpDP,CAAC,CAACC,IAAI,CAACM,IAAI,CASZ,CAAA;qBACP,CAAC;oBACD5B,KAAK,CAACG,uBAAuB,kBAC5B,KAACZ,UAAU;wBAACsC,OAAO,EAAE,IAAM3B,QAAQ,CAAC,CAACD,KAAK,CAAC;kCAAGA,KAAK,iBAAG,KAACR,UAAU,KAAG,iBAAG,KAACC,aAAa,KAAG;sBAAc,AACvG;;cACG;UACC;MACL,EACN;AACJ,CAAC"}
@@ -1,4 +1,6 @@
1
+ export * from './EditVariablesButton';
1
2
  export * from './Variable';
2
- export * from './VariableList';
3
+ export * from './VariableEditor';
3
4
  export * from './VariableEditorForm';
5
+ export * from './VariableList';
4
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Variables/index.tsx"],"names":[],"mappings":"AAaA,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Variables/index.tsx"],"names":[],"mappings":"AAaA,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC"}
@@ -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
@@ -10,8 +10,10 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
+ export * from './EditVariablesButton';
13
14
  export * from './Variable';
14
- export * from './VariableList';
15
+ export * from './VariableEditor';
15
16
  export * from './VariableEditorForm';
17
+ export * from './VariableList';
16
18
 
17
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Variables/index.tsx"],"sourcesContent":["// Copyright 2022 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\nexport * from './Variable';\nexport * from './VariableList';\nexport * from './VariableEditorForm';\n"],"names":[],"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,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"sources":["../../../src/components/Variables/index.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\nexport * from './EditVariablesButton';\nexport * from './Variable';\nexport * from './VariableEditor';\nexport * from './VariableEditorForm';\nexport * from './VariableList';\n"],"names":[],"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,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC"}
@@ -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 +1 @@
1
- {"version":3,"sources":["../../../src/components/Variables/variable-model.ts"],"sourcesContent":["// Copyright 2022 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 { ListVariableDefinition } from '@perses-dev/core';\nimport {\n useDatasourceStore,\n usePlugin,\n useTemplateVariableValues,\n useTimeRange,\n VariableOption,\n VariableStateMap,\n} from '@perses-dev/plugin-system';\nimport { useQuery } from '@tanstack/react-query';\n\nexport function filterVariableList(data: VariableOption[], capturedRegexp: RegExp): VariableOption[] {\n const result: VariableOption[] = [];\n const filteredSet = new Set<string>();\n for (const variableValue of data) {\n const matches = variableValue.value.matchAll(capturedRegexp);\n let concat = '';\n for (const match of matches) {\n for (let i = 1; i < match.length; i++) {\n const m = match[i];\n if (m !== undefined) {\n concat = `${concat}${m}`;\n }\n }\n }\n if (concat !== '' && !filteredSet.has(concat)) {\n // like that we are avoiding to have duplicating variable value\n filteredSet.add(concat);\n result.push({ label: variableValue.label, value: concat });\n }\n }\n return result;\n}\n\nexport function useListVariablePluginValues(definition: ListVariableDefinition) {\n const { data: variablePlugin } = usePlugin('Variable', definition.spec.plugin.kind);\n const datasourceStore = useDatasourceStore();\n const allVariables = useTemplateVariableValues();\n const { absoluteTimeRange: timeRange, refreshKey } = useTimeRange();\n\n const variablePluginCtx = { timeRange, datasourceStore, variables: allVariables };\n\n const spec = definition.spec.plugin.spec;\n const capturingRegexp =\n definition.spec.capturing_regexp !== undefined ? new RegExp(definition.spec.capturing_regexp, 'g') : undefined;\n\n let dependsOnVariables: string[] | undefined;\n if (variablePlugin?.dependsOn) {\n const dependencies = variablePlugin.dependsOn(spec, variablePluginCtx);\n dependsOnVariables = dependencies.variables;\n }\n\n const variables = useTemplateVariableValues(dependsOnVariables);\n\n let waitToLoad = false;\n if (dependsOnVariables) {\n waitToLoad = dependsOnVariables.some((v) => variables[v]?.loading);\n }\n\n const variablesValueKey = getVariableValuesKey(variables);\n\n return useQuery(\n [name, definition, variablesValueKey, timeRange, refreshKey],\n async () => {\n const resp = await variablePlugin?.getVariableOptions(spec, { datasourceStore, variables, timeRange });\n if (resp === undefined) {\n return [];\n }\n if (capturingRegexp === undefined) {\n return resp.data;\n }\n return filterVariableList(resp.data, capturingRegexp);\n },\n { enabled: !!variablePlugin || waitToLoad }\n );\n}\n\n/**\n * Returns a serialized string of the current state of variable values.\n */\nexport function getVariableValuesKey(v: VariableStateMap) {\n return Object.values(v)\n .map((v) => JSON.stringify(v.value))\n .join(',');\n}\n\nexport const VARIABLE_TYPES = [\n { label: 'List', kind: 'ListVariable' },\n { label: 'Text', kind: 'TextVariable' },\n] as const;\n"],"names":["useDatasourceStore","usePlugin","useTemplateVariableValues","useTimeRange","useQuery","filterVariableList","data","capturedRegexp","result","filteredSet","Set","variableValue","matches","value","matchAll","concat","match","i","length","m","undefined","has","add","push","label","useListVariablePluginValues","definition","variablePlugin","spec","plugin","kind","datasourceStore","allVariables","absoluteTimeRange","timeRange","refreshKey","variablePluginCtx","variables","capturingRegexp","capturing_regexp","RegExp","dependsOnVariables","dependsOn","dependencies","waitToLoad","some","v","loading","variablesValueKey","getVariableValuesKey","name","resp","getVariableOptions","enabled","Object","values","map","JSON","stringify","join","VARIABLE_TYPES"],"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;AAGjC,SACEA,kBAAkB,EAClBC,SAAS,EACTC,yBAAyB,EACzBC,YAAY,QAGP,2BAA2B,CAAC;AACnC,SAASC,QAAQ,QAAQ,uBAAuB,CAAC;AAEjD,OAAO,SAASC,kBAAkB,CAACC,IAAsB,EA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iB;QAAEd,SAAS;QAAEC,UAAU;KAAC,EAC5D,UAAY;QACV,MAAMgB,IAAI,GAAG,OAAMxB,cAAc,aAAdA,cAAc,WAAoB,GAAlCA,KAAAA,CAAkC,GAAlCA,cAAc,CAAEyB,kBAAkB,CAACxB,IAAI,EAAE;YAAEG,eAAe;YAAEM,SAAS;YAAEH,SAAS;SAAE,CAAC,CAAA,AAAC;QACvG,IAAIiB,IAAI,KAAK/B,SAAS,EAAE;YACtB,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,IAAIkB,eAAe,KAAKlB,SAAS,EAAE;YACjC,OAAO+B,IAAI,CAAC7C,IAAI,CAAC;QACnB,CAAC;QACD,OAAOD,kBAAkB,CAAC8C,IAAI,CAAC7C,IAAI,EAAEgC,eAAe,CAAC,CAAC;IACxD,CAAC,EACD;QAAEe,OAAO,EAAE,CAAC,CAAC1B,cAAc,IAAIiB,UAAU;KAAE,CAC5C,CAAC;AACJ,CAAC;AAED;;CAEC,GACD,OAAO,SAASK,oBAAoB,CAACH,CAAmB,EAAE;IACxD,OAAOQ,MAAM,CAACC,MAAM,CAACT,CAAC,CAAC,CACpBU,GAAG,CAAC,CAACV,CAAC,GAAKW,IAAI,CAACC,SAAS,CAACZ,CAAC,CAACjC,KAAK,CAAC,CAAC,CACnC8C,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC;AAED,OAAO,MAAMC,cAAc,GAAG;IAC5B;QAAEpC,KAAK,EAAE,MAAM;QAAEM,IAAI,EAAE,cAAc;KAAE;IACvC;QAAEN,KAAK,EAAE,MAAM;QAAEM,IAAI,EAAE,cAAc;KAAE;CACxC,AAAS,CAAC"}
1
+ {"version":3,"sources":["../../../src/components/Variables/variable-model.ts"],"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 { ListVariableDefinition } from '@perses-dev/core';\nimport {\n useDatasourceStore,\n usePlugin,\n useTemplateVariableValues,\n useTimeRange,\n VariableOption,\n VariableStateMap,\n} from '@perses-dev/plugin-system';\nimport { useQuery } from '@tanstack/react-query';\n\nexport function filterVariableList(data: VariableOption[], capturedRegexp: RegExp): VariableOption[] {\n const result: VariableOption[] = [];\n const filteredSet = new Set<string>();\n for (const variableValue of data) {\n const matches = variableValue.value.matchAll(capturedRegexp);\n let concat = '';\n for (const match of matches) {\n for (let i = 1; i < match.length; i++) {\n const m = match[i];\n if (m !== undefined) {\n concat = `${concat}${m}`;\n }\n }\n }\n if (concat !== '' && !filteredSet.has(concat)) {\n // like that we are avoiding to have duplicating variable value\n filteredSet.add(concat);\n result.push({ label: variableValue.label, value: concat });\n }\n }\n return result;\n}\n\nexport function useListVariablePluginValues(definition: ListVariableDefinition) {\n const { data: variablePlugin } = usePlugin('Variable', definition.spec.plugin.kind);\n const datasourceStore = useDatasourceStore();\n const allVariables = useTemplateVariableValues();\n const { absoluteTimeRange: timeRange, refreshKey } = useTimeRange();\n\n const variablePluginCtx = { timeRange, datasourceStore, variables: allVariables };\n\n const spec = definition.spec.plugin.spec;\n const capturingRegexp =\n definition.spec.capturing_regexp !== undefined ? new RegExp(definition.spec.capturing_regexp, 'g') : undefined;\n\n let dependsOnVariables: string[] | undefined;\n if (variablePlugin?.dependsOn) {\n const dependencies = variablePlugin.dependsOn(spec, variablePluginCtx);\n dependsOnVariables = dependencies.variables;\n }\n\n const variables = useTemplateVariableValues(dependsOnVariables);\n\n let waitToLoad = false;\n if (dependsOnVariables) {\n waitToLoad = dependsOnVariables.some((v) => variables[v]?.loading);\n }\n\n const variablesValueKey = getVariableValuesKey(variables);\n\n return useQuery(\n [name, definition, variablesValueKey, timeRange, refreshKey],\n async () => {\n const resp = await variablePlugin?.getVariableOptions(spec, { datasourceStore, variables, timeRange });\n if (resp === undefined) {\n return [];\n }\n if (capturingRegexp === undefined) {\n return resp.data;\n }\n return filterVariableList(resp.data, capturingRegexp);\n },\n { enabled: !!variablePlugin || waitToLoad }\n );\n}\n\n/**\n * Returns a serialized string of the current state of variable values.\n */\nexport function getVariableValuesKey(v: VariableStateMap) {\n return Object.values(v)\n .map((v) => JSON.stringify(v.value))\n .join(',');\n}\n\nexport const VARIABLE_TYPES = [\n { label: 'List', kind: 'ListVariable' },\n { label: 'Text', kind: 'TextVariable' },\n] as const;\n"],"names":["useDatasourceStore","usePlugin","useTemplateVariableValues","useTimeRange","useQuery","filterVariableList","data","capturedRegexp","result","filteredSet","Set","variableValue","matches","value","matchAll","concat","match","i","length","m","undefined","has","add","push","label","useListVariablePluginValues","definition","variablePlugin","spec","plugin","kind","datasourceStore","allVariables","absoluteTimeRange","timeRange","refreshKey","variablePluginCtx","variables","capturingRegexp","capturing_regexp","RegExp","dependsOnVariables","dependsOn","dependencies","waitToLoad","some","v","loading","variablesValueKey","getVariableValuesKey","name","resp","getVariableOptions","enabled","Object","values","map","JSON","stringify","join","VARIABLE_TYPES"],"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;AAGjC,SACEA,kBAAkB,EAClBC,SAAS,EACTC,yBAAyB,EACzBC,YAAY,QAGP,2BAA2B,CAAC;AACnC,SAASC,QAAQ,QAAQ,uBAAuB,CAAC;AAEjD,OAAO,SAASC,kBAAkB,CAACC,IAAsB,EAAEC,cAAsB,EAAoB;IACnG,MAAMC,MAAM,GAAqB,EAAE,AAAC;IACpC,MAAMC,WAAW,GAAG,IAAIC,GAAG,EAAU,AAAC;IACtC,KAAK,MAAMC,aAAa,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AAlCA,cAAc,CAAEyB,kBAAkB,CAACxB,IAAI,EAAE;YAAEG,eAAe;YAAEM,SAAS;YAAEH,SAAS;SAAE,CAAC,CAAA,AAAC;QACvG,IAAIiB,IAAI,KAAK/B,SAAS,EAAE;YACtB,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,IAAIkB,eAAe,KAAKlB,SAAS,EAAE;YACjC,OAAO+B,IAAI,CAAC7C,IAAI,CAAC;QACnB,CAAC;QACD,OAAOD,kBAAkB,CAAC8C,IAAI,CAAC7C,IAAI,EAAEgC,eAAe,CAAC,CAAC;IACxD,CAAC,EACD;QAAEe,OAAO,EAAE,CAAC,CAAC1B,cAAc,IAAIiB,UAAU;KAAE,CAC5C,CAAC;AACJ,CAAC;AAED;;CAEC,GACD,OAAO,SAASK,oBAAoB,CAACH,CAAmB,EAAE;IACxD,OAAOQ,MAAM,CAACC,MAAM,CAACT,CAAC,CAAC,CACpBU,GAAG,CAAC,CAACV,CAAC,GAAKW,IAAI,CAACC,SAAS,CAACZ,CAAC,CAACjC,KAAK,CAAC,CAAC,CACnC8C,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC;AAED,OAAO,MAAMC,cAAc,GAAG;IAC5B;QAAEpC,KAAK,EAAE,MAAM;QAAEM,IAAI,EAAE,cAAc;KAAE;IACvC;QAAEN,KAAK,EAAE,MAAM;QAAEM,IAAI,EAAE,cAAc;KAAE;CACxC,AAAS,CAAC"}
@@ -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 +1 @@
1
- {"version":3,"sources":["../../../src/components/Variables/variable-model.test.ts"],"sourcesContent":["// Copyright 2022 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 { VariableOption } from '@perses-dev/plugin-system';\nimport { filterVariableList } from './variable-model';\n\ndescribe('filterVariableList', () => {\n const testSuite = [\n {\n title: 'basic case',\n capturing_regexp: /([^-]*)-host-([^-]*)/g,\n originalValues: [\n { label: 'l1', value: 'us1-host-ahdix' },\n { label: 'l2', value: 'us1-host-diua' },\n { label: 'l3', value: 'eu1-host-adf' },\n { label: 'l4', value: 'bar' },\n ] as VariableOption[],\n result: [\n { label: 'l1', value: 'us1ahdix' },\n { label: 'l2', value: 'us1diua' },\n { label: 'l3', value: 'eu1adf' },\n ],\n },\n {\n title: 'duplicate captured value',\n capturing_regexp: /prometheus-(.+):\\d+/g,\n originalValues: [\n { label: 'l1', value: 'prometheus-app:9090' },\n { label: 'l2', value: 'prometheus-app:9091' },\n { label: 'l3', value: 'prometheus-platform:9091' },\n { label: 'l4', value: 'prometheus-database:9091' },\n { label: 'l5', value: 'prometheus-perses:9091' },\n ] as VariableOption[],\n result: [\n { label: 'l1', value: 'app' },\n { label: 'l3', value: 'platform' },\n { label: 'l4', value: 'database' },\n { label: 'l5', value: 'perses' },\n ],\n },\n ];\n testSuite.forEach(({ title, capturing_regexp, originalValues, result }) => {\n it(title, () => {\n expect(filterVariableList(originalValues, capturing_regexp)).toEqual(result);\n });\n });\n});\n"],"names":["filterVariableList","describe","testSuite","title","capturing_regexp","originalValues","label","value","result","forEach","it","expect","toEqual"],"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;AAGjC,SAASA,kBAAkB,QAAQ,kBAAk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BAClC;oBAAED,KAAK,EAAE,IAAI;oBAAEC,KAAK,EAAE,UAAU;iBAAE;gBAClC;oBAAED,KAAK,EAAE,IAAI;oBAAEC,KAAK,EAAE,QAAQ;iBAAE;aACjC;SACF;KACF,AAAC;IACFL,SAAS,CAACO,OAAO,CAAC,CAAC,EAAEN,KAAK,CAAA,EAAEC,gBAAgB,CAAA,EAAEC,cAAc,CAAA,EAAEG,MAAM,CAAA,EAAE,GAAK;QACzEE,EAAE,CAACP,KAAK,EAAE,IAAM;YACdQ,MAAM,CAACX,kBAAkB,CAACK,cAAc,EAAED,gBAAgB,CAAC,CAAC,CAACQ,OAAO,CAACJ,MAAM,CAAC,CAAC;QAC/E,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
1
+ {"version":3,"sources":["../../../src/components/Variables/variable-model.test.ts"],"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 { VariableOption } from '@perses-dev/plugin-system';\nimport { filterVariableList } from './variable-model';\n\ndescribe('filterVariableList', () => {\n const testSuite = [\n {\n title: 'basic case',\n capturing_regexp: /([^-]*)-host-([^-]*)/g,\n originalValues: [\n { label: 'l1', value: 'us1-host-ahdix' },\n { label: 'l2', value: 'us1-host-diua' },\n { label: 'l3', value: 'eu1-host-adf' },\n { label: 'l4', value: 'bar' },\n ] as VariableOption[],\n result: [\n { label: 'l1', value: 'us1ahdix' },\n { label: 'l2', value: 'us1diua' },\n { label: 'l3', value: 'eu1adf' },\n ],\n },\n {\n title: 'duplicate captured value',\n capturing_regexp: /prometheus-(.+):\\d+/g,\n originalValues: [\n { label: 'l1', value: 'prometheus-app:9090' },\n { label: 'l2', value: 'prometheus-app:9091' },\n { label: 'l3', value: 'prometheus-platform:9091' },\n { label: 'l4', value: 'prometheus-database:9091' },\n { label: 'l5', value: 'prometheus-perses:9091' },\n ] as VariableOption[],\n result: [\n { label: 'l1', value: 'app' },\n { label: 'l3', value: 'platform' },\n { label: 'l4', value: 'database' },\n { label: 'l5', value: 'perses' },\n ],\n },\n ];\n testSuite.forEach(({ title, capturing_regexp, originalValues, result }) => {\n it(title, () => {\n expect(filterVariableList(originalValues, capturing_regexp)).toEqual(result);\n });\n });\n});\n"],"names":["filterVariableList","describe","testSuite","title","capturing_regexp","originalValues","label","value","result","forEach","it","expect","toEqual"],"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;AAGjC,SAASA,kBAAkB,QAAQ,kBAAkB,CAAC;AAEtDC,QAAQ,CAAC,oBAAoB,EAAE,IAAM;IACnC,MAAMC,SAAS,GAAG;QAChB;YACEC,KAAK,EAAE,YAAY;YACnBC,gBAAgB,yBAAyB;YACzCC,cAAc,EAAE;gBACd;oBAAEC,KAAK,EAAE,IAAI;oBAAEC,KAAK,EAAE,gBAAgB;iBAAE;gBACxC;oBAAED,KAAK,EAAE,IAAI;oBAAEC,KAAK,EAAE,eAAe;iBAAE;gBACvC;oBAAED,KAAK,EAAE,IAAI;oBAAEC,KAAK,EAAE,cAAc;iBAAE;gBACtC;oBAAED,KAAK,EAAE,IAAI;oBAAEC,KAAK,EAAE,KAAK;iBAAE;aAC9B;YACDC,MAAM,EAAE;gBACN;oBAAEF,KAAK,EAAE,IAAI;oBAAEC,KAAK,EAAE,UAAU;iBAAE;gBAClC;oBAAED,KAAK,EAAE,IAAI;oBAAEC,KAAK,EAAE,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
  export * from './Dashboard';
2
4
  export * from './DashboardToolbar';
3
5
  export * from './DeletePanelDialog';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAaA,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oCAAoC,CAAC;AACnD,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAaA,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oCAAoC,CAAC;AACnD,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC"}
@@ -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
@@ -10,6 +10,8 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
+ export * from './AddGroupButton';
14
+ export * from './AddPanelButton';
13
15
  export * from './Dashboard';
14
16
  export * from './DashboardToolbar';
15
17
  export * from './DeletePanelDialog';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/index.ts"],"sourcesContent":["// Copyright 2022 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\nexport * from './Dashboard';\nexport * from './DashboardToolbar';\nexport * from './DeletePanelDialog';\nexport * from './DeletePanelGroupDialog';\nexport * from './DiscardChangesConfirmationDialog';\nexport * from './DownloadButton';\nexport * from './GridLayout';\nexport * from './Panel';\nexport * from './PanelDrawer';\nexport * from './PanelGroupDialog';\nexport * from './TimeRangeControls';\nexport * from './ToolbarIconButton';\nexport * from './Variables';\n"],"names":[],"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,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oCAAoC,CAAC;AACnD,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC"}
1
+ {"version":3,"sources":["../../src/components/index.ts"],"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\nexport * from './AddGroupButton';\nexport * from './AddPanelButton';\nexport * from './Dashboard';\nexport * from './DashboardToolbar';\nexport * from './DeletePanelDialog';\nexport * from './DeletePanelGroupDialog';\nexport * from './DiscardChangesConfirmationDialog';\nexport * from './DownloadButton';\nexport * from './GridLayout';\nexport * from './Panel';\nexport * from './PanelDrawer';\nexport * from './PanelGroupDialog';\nexport * from './TimeRangeControls';\nexport * from './ToolbarIconButton';\nexport * from './Variables';\n"],"names":[],"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,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oCAAoC,CAAC;AACnD,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare const GRID_LAYOUT_COLS: {
2
+ readonly sm: 24;
3
+ readonly xxs: 2;
4
+ };
5
+ export declare const GRID_LAYOUT_SMALL_BREAKPOINT: "sm";
6
+ //# sourceMappingURL=grid-layout-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grid-layout-config.d.ts","sourceRoot":"","sources":["../../src/constants/grid-layout-config.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,gBAAgB;;;CAA8B,CAAC;AAE5D,eAAO,MAAM,4BAA4B,MAAgB,CAAC"}
@@ -0,0 +1,19 @@
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
+ export const GRID_LAYOUT_COLS = {
14
+ sm: 24,
15
+ xxs: 2
16
+ };
17
+ export const GRID_LAYOUT_SMALL_BREAKPOINT = 'sm';
18
+
19
+ //# sourceMappingURL=grid-layout-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/constants/grid-layout-config.ts"],"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\nexport const GRID_LAYOUT_COLS = { sm: 24, xxs: 2 } as const;\n\nexport const GRID_LAYOUT_SMALL_BREAKPOINT = 'sm' as const;\n"],"names":["GRID_LAYOUT_COLS","sm","xxs","GRID_LAYOUT_SMALL_BREAKPOINT"],"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,OAAO,MAAMA,gBAAgB,GAAG;IAAEC,EAAE,EAAE,EAAE;IAAEC,GAAG,EAAE,CAAC;CAAE,AAAS,CAAC;AAE5D,OAAO,MAAMC,4BAA4B,GAAG,IAAI,AAAS,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './grid-layout-config';
2
+ export * from './user-interface-text';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":"AAaA,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,16 @@
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
+ export * from './grid-layout-config';
14
+ export * from './user-interface-text';
15
+
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/constants/index.ts"],"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\nexport * from './grid-layout-config';\nexport * from './user-interface-text';\n"],"names":[],"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,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,30 @@
1
+ export declare const TOOLTIP_TEXT: {
2
+ addPanel: string;
3
+ addGroup: string;
4
+ downloadDashboard: string;
5
+ editVariables: string;
6
+ refreshDashboard: string;
7
+ addPanelToGroup: string;
8
+ deleteGroup: string;
9
+ editGroup: string;
10
+ moveGroupDown: string;
11
+ moveGroupUp: string;
12
+ editPanel: string;
13
+ duplicatePanel: string;
14
+ deletePanel: string;
15
+ movePanel: string;
16
+ refreshVariableValues: string;
17
+ copyVariableValues: string;
18
+ };
19
+ export declare const ARIA_LABEL_TEXT: {
20
+ addPanelToGroup: (groupName: string) => string;
21
+ deleteGroup: (groupName: string) => string;
22
+ editGroup: (groupName: string) => string;
23
+ moveGroupDown: (groupName: string) => string;
24
+ moveGroupUp: (groupName: string) => string;
25
+ editPanel: (panelName: string) => string;
26
+ duplicatePanel: (panelName: string) => string;
27
+ deletePanel: (panelName: string) => string;
28
+ movePanel: (panelName: string) => string;
29
+ };
30
+ //# sourceMappingURL=user-interface-text.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-interface-text.d.ts","sourceRoot":"","sources":["../../src/constants/user-interface-text.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;CAqBxB,CAAC;AAEF,eAAO,MAAM,eAAe;iCAEG,MAAM;6BACV,MAAM;2BACR,MAAM;+BACF,MAAM;6BACR,MAAM;2BAER,MAAM;gCACD,MAAM;6BACT,MAAM;2BACR,MAAM;CAC9B,CAAC"}
@@ -0,0 +1,49 @@
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
+ export const TOOLTIP_TEXT = {
14
+ // Toolbar buttons
15
+ addPanel: 'Add panel',
16
+ addGroup: 'Add panel group',
17
+ downloadDashboard: 'Download JSON',
18
+ editVariables: 'Edit variables',
19
+ refreshDashboard: 'Refresh dashboard',
20
+ // Group buttons
21
+ addPanelToGroup: 'Add panel to group',
22
+ deleteGroup: 'Delete group',
23
+ editGroup: 'Edit group',
24
+ moveGroupDown: 'Move group down',
25
+ moveGroupUp: 'Move group up',
26
+ // Panel buttons
27
+ editPanel: 'Edit',
28
+ duplicatePanel: 'Duplicate',
29
+ deletePanel: 'Delete',
30
+ movePanel: 'Move',
31
+ // Variable editor buttons
32
+ refreshVariableValues: 'Refresh values',
33
+ copyVariableValues: 'Copy values to clipboard'
34
+ };
35
+ export const ARIA_LABEL_TEXT = {
36
+ // Group buttons
37
+ addPanelToGroup: (groupName)=>`add panel to group ${groupName}`,
38
+ deleteGroup: (groupName)=>`delete group ${groupName}`,
39
+ editGroup: (groupName)=>`edit group ${groupName}`,
40
+ moveGroupDown: (groupName)=>`move group ${groupName} down`,
41
+ moveGroupUp: (groupName)=>`move group ${groupName} up`,
42
+ // Panel buttons
43
+ editPanel: (panelName)=>`edit panel ${panelName}`,
44
+ duplicatePanel: (panelName)=>`duplicate panel ${panelName}`,
45
+ deletePanel: (panelName)=>`delete panel ${panelName}`,
46
+ movePanel: (panelName)=>`move panel ${panelName}`
47
+ };
48
+
49
+ //# sourceMappingURL=user-interface-text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/constants/user-interface-text.ts"],"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\nexport const TOOLTIP_TEXT = {\n // Toolbar buttons\n addPanel: 'Add panel',\n addGroup: 'Add panel group',\n downloadDashboard: 'Download JSON',\n editVariables: 'Edit variables',\n refreshDashboard: 'Refresh dashboard',\n // Group buttons\n addPanelToGroup: 'Add panel to group',\n deleteGroup: 'Delete group',\n editGroup: 'Edit group',\n moveGroupDown: 'Move group down',\n moveGroupUp: 'Move group up',\n // Panel buttons\n editPanel: 'Edit',\n duplicatePanel: 'Duplicate',\n deletePanel: 'Delete',\n movePanel: 'Move',\n // Variable editor buttons\n refreshVariableValues: 'Refresh values',\n copyVariableValues: 'Copy values to clipboard',\n};\n\nexport const ARIA_LABEL_TEXT = {\n // Group buttons\n addPanelToGroup: (groupName: string) => `add panel to group ${groupName}`,\n deleteGroup: (groupName: string) => `delete group ${groupName}`,\n editGroup: (groupName: string) => `edit group ${groupName}`,\n moveGroupDown: (groupName: string) => `move group ${groupName} down`,\n moveGroupUp: (groupName: string) => `move group ${groupName} up`,\n // Panel buttons\n editPanel: (panelName: string) => `edit panel ${panelName}`,\n duplicatePanel: (panelName: string) => `duplicate panel ${panelName}`,\n deletePanel: (panelName: string) => `delete panel ${panelName}`,\n movePanel: (panelName: string) => `move panel ${panelName}`,\n};\n"],"names":["TOOLTIP_TEXT","addPanel","addGroup","downloadDashboard","editVariables","refreshDashboard","addPanelToGroup","deleteGroup","editGroup","moveGroupDown","moveGroupUp","editPanel","duplicatePanel","deletePanel","movePanel","refreshVariableValues","copyVariableValues","ARIA_LABEL_TEXT","groupName","panelName"],"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,OAAO,MAAMA,YAAY,GAAG;IAC1B,kBAAkB;IAClBC,QAAQ,EAAE,WAAW;IACrBC,QAAQ,EAAE,iBAAiB;IAC3BC,iBAAiB,EAAE,eAAe;IAClCC,aAAa,EAAE,gBAAgB;IAC/BC,gBAAgB,EAAE,mBAAmB;IACrC,gBAAgB;IAChBC,eAAe,EAAE,oBAAoB;IACrCC,WAAW,EAAE,cAAc;IAC3BC,SAAS,EAAE,YAAY;IACvBC,aAAa,EAAE,iBAAiB;IAChCC,WAAW,EAAE,eAAe;IAC5B,gBAAgB;IAChBC,SAAS,EAAE,MAAM;IACjBC,cAAc,EAAE,WAAW;IAC3BC,WAAW,EAAE,QAAQ;IACrBC,SAAS,EAAE,MAAM;IACjB,0BAA0B;IAC1BC,qBAAqB,EAAE,gBAAgB;IACvCC,kBAAkB,EAAE,0BAA0B;CAC/C,CAAC;AAEF,OAAO,MAAMC,eAAe,GAAG;IAC7B,gBAAgB;IAChBX,eAAe,EAAE,CAACY,SAAiB,GAAK,CAAC,mBAAmB,EAAEA,SAAS,CAAC,CAAC;IACzEX,WAAW,EAAE,CAACW,SAAiB,GAAK,CAAC,aAAa,EAAEA,SAAS,CAAC,CAAC;IAC/DV,SAAS,EAAE,CAACU,SAAiB,GAAK,CAAC,WAAW,EAAEA,SAAS,CAAC,CAAC;IAC3DT,aAAa,EAAE,CAACS,SAAiB,GAAK,CAAC,WAAW,EAAEA,SAAS,CAAC,KAAK,CAAC;IACpER,WAAW,EAAE,CAACQ,SAAiB,GAAK,CAAC,WAAW,EAAEA,SAAS,CAAC,GAAG,CAAC;IAChE,gBAAgB;IAChBP,SAAS,EAAE,CAACQ,SAAiB,GAAK,CAAC,WAAW,EAAEA,SAAS,CAAC,CAAC;IAC3DP,cAAc,EAAE,CAACO,SAAiB,GAAK,CAAC,gBAAgB,EAAEA,SAAS,CAAC,CAAC;IACrEN,WAAW,EAAE,CAACM,SAAiB,GAAK,CAAC,aAAa,EAAEA,SAAS,CAAC,CAAC;IAC/DL,SAAS,EAAE,CAACK,SAAiB,GAAK,CAAC,WAAW,EAAEA,SAAS,CAAC,CAAC;CAC5D,CAAC"}
@@ -1,6 +1,6 @@
1
- /// <reference types="react" />
2
1
  import type { StoreApi } from 'zustand';
3
- import { DashboardResource, ProjectMetadata, RelativeTimeRange } from '@perses-dev/core';
2
+ import { ReactNode } from 'react';
3
+ import { DashboardResource, Display, ProjectMetadata, RelativeTimeRange } from '@perses-dev/core';
4
4
  import { PanelGroupEditorSlice } from './panel-group-editor-slice';
5
5
  import { PanelGroupSlice } from './panel-group-slice';
6
6
  import { PanelEditorSlice } from './panel-editor-slice';
@@ -8,12 +8,14 @@ import { PanelSlice } from './panel-slice';
8
8
  import { DeletePanelGroupSlice } from './delete-panel-group-slice';
9
9
  import { DeletePanelSlice } from './delete-panel-slice';
10
10
  import { DiscardChangesConfirmationDialogSlice } from './discard-changes-dialog-slice';
11
- export interface DashboardStoreState extends PanelGroupSlice, PanelSlice, PanelGroupEditorSlice, DeletePanelGroupSlice, PanelEditorSlice, DeletePanelSlice, DiscardChangesConfirmationDialogSlice {
11
+ import { DuplicatePanelSlice } from './duplicate-panel-slice';
12
+ export interface DashboardStoreState extends PanelGroupSlice, PanelSlice, PanelGroupEditorSlice, DeletePanelGroupSlice, PanelEditorSlice, DeletePanelSlice, DiscardChangesConfirmationDialogSlice, DuplicatePanelSlice {
12
13
  isEditMode: boolean;
13
14
  setEditMode: (isEditMode: boolean) => void;
14
15
  defaultTimeRange: RelativeTimeRange;
15
16
  setDashboard: (dashboard: DashboardResource) => void;
16
17
  metadata: ProjectMetadata;
18
+ display?: Display;
17
19
  }
18
20
  export interface DashboardStoreProps {
19
21
  dashboardResource: DashboardResource;
@@ -21,7 +23,7 @@ export interface DashboardStoreProps {
21
23
  }
22
24
  export interface DashboardProviderProps {
23
25
  initialState: DashboardStoreProps;
24
- children?: React.ReactNode;
26
+ children?: ReactNode;
25
27
  }
26
28
  export declare const DashboardContext: import("react").Context<StoreApi<DashboardStoreState> | undefined>;
27
29
  export declare function useDashboardStore<T>(selector: (state: DashboardStoreState) => T): T;
@@ -1 +1 @@
1
- {"version":3,"file":"DashboardProvider.d.ts","sourceRoot":"","sources":["../../../src/context/DashboardProvider/DashboardProvider.tsx"],"names":[],"mappings":";AAcA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAKxC,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACzF,OAAO,EAA+B,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAChG,OAAO,EAAsD,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC1G,OAAO,EAA0B,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAChF,OAAO,EAAoB,UAAU,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAA+B,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAChG,OAAO,EAA0B,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAChF,OAAO,EAAmC,qCAAqC,EAAE,MAAM,gCAAgC,CAAC;AAExH,MAAM,WAAW,mBACf,SAAQ,eAAe,EACrB,UAAU,EACV,qBAAqB,EACrB,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,EAChB,qCAAqC;IACvC,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3C,gBAAgB,EAAE,iBAAiB,CAAC;I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CAAC;AAEzF,MAAM,WAAW,mBACf,SAAQ,eAAe,EACrB,UAAU,EACV,qBAAqB,EACrB,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,EAChB,qCAAqC,EACrC,mBAAmB;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3C,gBAAgB,EAAE,iBAAiB,CAAC;IACpC,YAAY,EAAE,CAAC,SAAS,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACrD,QAAQ,EAAE,eAAe,CAAC;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,sBAAsB;IACrC,YAAY,EAAE,mBAAmB,CAAC;IAClC,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,eAAO,MAAM,gBAAgB,oEAAsE,CAAC;AAEpG,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,CAAC,KAM/E;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,eAsB9D"}
@@ -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
@@ -15,7 +15,8 @@ import { createStore, useStore } from 'zustand';
15
15
  import { devtools } from 'zustand/middleware';
16
16
  import { immer } from 'zustand/middleware/immer';
17
17
  import shallow from 'zustand/shallow';
18
- import { createContext, useCallback, useContext, useState } from 'react';
18
+ import { createContext, useCallback, useContext, useEffect, useState } from 'react';
19
+ import { usePlugin, usePluginRegistry } from '@perses-dev/plugin-system';
19
20
  import { createPanelGroupEditorSlice } from './panel-group-editor-slice';
20
21
  import { convertLayoutsToPanelGroups, createPanelGroupSlice } from './panel-group-slice';
21
22
  import { createPanelEditorSlice } from './panel-editor-slice';
@@ -23,6 +24,7 @@ import { createPanelSlice } from './panel-slice';
23
24
  import { createDeletePanelGroupSlice } from './delete-panel-group-slice';
24
25
  import { createDeletePanelSlice } from './delete-panel-slice';
25
26
  import { createDiscardChangesDialogSlice } from './discard-changes-dialog-slice';
27
+ import { createDuplicatePanelSlice } from './duplicate-panel-slice';
26
28
  export const DashboardContext = /*#__PURE__*/ createContext(undefined);
27
29
  export function useDashboardStore(selector) {
28
30
  const store = useContext(DashboardContext);
@@ -35,7 +37,27 @@ export function DashboardProvider(props) {
35
37
  const createDashboardStore = useCallback(initStore, [
36
38
  props
37
39
  ]);
40
+ // load plugin to retrieve initial spec if default panel kind is defined
41
+ const { defaultPluginKinds } = usePluginRegistry();
42
+ var ref;
43
+ const defaultPanelKind = (ref = defaultPluginKinds === null || defaultPluginKinds === void 0 ? void 0 : defaultPluginKinds['Panel']) !== null && ref !== void 0 ? ref : '';
44
+ const { data: plugin } = usePlugin('Panel', defaultPanelKind);
38
45
  const [store] = useState(createDashboardStore(props)); // prevent calling createDashboardStore every time it rerenders
46
+ useEffect(()=>{
47
+ if (plugin === undefined) return;
48
+ const spec = plugin.createInitialOptions();
49
+ // set default panel kind and spec for add panel editor
50
+ store.setState({
51
+ initialValues: {
52
+ kind: defaultPanelKind,
53
+ spec
54
+ }
55
+ });
56
+ }, [
57
+ plugin,
58
+ store,
59
+ defaultPanelKind
60
+ ]);
39
61
  return /*#__PURE__*/ _jsx(DashboardContext.Provider, {
40
62
  value: store,
41
63
  children: props.children
@@ -43,7 +65,7 @@ export function DashboardProvider(props) {
43
65
  }
44
66
  function initStore(props) {
45
67
  const { initialState: { dashboardResource , isEditMode } , } = props;
46
- const { spec: { layouts , panels , duration } , metadata , } = dashboardResource;
68
+ const { spec: { display , layouts , panels , duration } , metadata , } = dashboardResource;
47
69
  const store = createStore()(immer(devtools((...args)=>{
48
70
  const [set] = args;
49
71
  return {
@@ -54,7 +76,9 @@ function initStore(props) {
54
76
  ...createPanelEditorSlice()(...args),
55
77
  ...createDeletePanelSlice()(...args),
56
78
  ...createDiscardChangesDialogSlice(...args),
79
+ ...createDuplicatePanelSlice()(...args),
57
80
  metadata,
81
+ display,
58
82
  defaultTimeRange: {
59
83
  pastDuration: duration
60
84
  },
@@ -62,9 +86,10 @@ function initStore(props) {
62
86
  setEditMode: (isEditMode)=>set({
63
87
  isEditMode
64
88
  }),
65
- setDashboard: ({ metadata , spec: { panels , layouts } })=>{
89
+ setDashboard: ({ metadata , spec: { display , panels , layouts } })=>{
66
90
  set((state)=>{
67
91
  state.metadata = metadata;
92
+ state.display = display;
68
93
  const { panelGroups , panelGroupOrder } = convertLayoutsToPanelGroups(layouts);
69
94
  state.panels = panels;
70
95
  state.panelGroups = panelGroups;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/context/DashboardProvider/DashboardProvider.tsx"],"sourcesContent":["// Copyright 2022 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 { createStore, useStore } from 'zustand';\nimport type { StoreApi } from 'zustand';\nimport { devtools } from 'zustand/middleware';\nimport { immer } from 'zustand/middleware/immer';\nimport shallow from 'zustand/shallow';\nimport { createContext, useCallback, useContext, useState } from 'react';\nimport { DashboardResource, ProjectMetadata, RelativeTimeRange } from '@perses-dev/core';\nimport { createPanelGroupEditorSlice, PanelGroupEditorSlice } from './panel-group-editor-slice';\nimport { convertLayoutsToPanelGroups, createPanelGroupSlice, PanelGroupSlice } from './panel-group-slice';\nimport { createPanelEditorSlice, PanelEditorSlice } from './panel-editor-slice';\nimport { createPanelSlice, PanelSlice } from './panel-slice';\nimport { createDeletePanelGroupSlice, DeletePanelGroupSlice } from './delete-panel-group-slice';\nimport { createDeletePanelSlice, DeletePanelSlice } from './delete-panel-slice';\nimport { createDiscardChangesDialogSlice, DiscardChangesConfirmationDialogSlice } from './discard-changes-dialog-slice';\n\nexport interface DashboardStoreState\n extends PanelGroupSlice,\n PanelSlice,\n PanelGroupEditorSlice,\n DeletePanelGroupSlice,\n PanelEditorSlice,\n DeletePanelSlice,\n DiscardChangesConfirmationDialogSlice {\n isEditMode: boolean;\n setEditMode: (isEditMode: boolean) => void;\n defaultTimeRange: RelativeTimeRange;\n setDashboard: (dashboard: DashboardResource) => void;\n metadata: ProjectMetadata;\n}\n\nexport interface DashboardStoreProps {\n dashboardResource: DashboardResource;\n isEditMode?: boolean;\n}\n\nexport interface DashboardProviderProps {\n initialState: DashboardStoreProps;\n children?: React.ReactNode;\n}\n\nexport const DashboardContext = createContext<StoreApi<DashboardStoreState> | undefined>(undefined);\n\nexport function useDashboardStore<T>(selector: (state: DashboardStoreState) => T) {\n const store = useContext(DashboardContext);\n if (store === undefined) {\n throw new Error('No DashboardContext found. Did you forget a Provider?');\n }\n return useStore(store, selector, shallow);\n}\n\nexport function DashboardProvider(props: DashboardProviderProps) {\n const createDashboardStore = useCallback(initStore, [props]);\n\n const [store] = useState(createDashboardStore(props)); // prevent calling createDashboardStore every time it rerenders\n\n return (\n <DashboardContext.Provider value={store as StoreApi<DashboardStoreState>}>\n {props.children}\n </DashboardContext.Provider>\n );\n}\n\nfunction initStore(props: DashboardProviderProps) {\n const {\n initialState: { dashboardResource, isEditMode },\n } = props;\n\n const {\n spec: { layouts, panels, duration },\n metadata,\n } = dashboardResource;\n const store = createStore<DashboardStoreState>()(\n immer(\n devtools((...args) => {\n const [set] = args;\n return {\n ...createPanelGroupSlice(layouts)(...args),\n ...createPanelSlice(panels)(...args),\n ...createPanelGroupEditorSlice(...args),\n ...createDeletePanelGroupSlice(...args),\n ...createPanelEditorSlice()(...args),\n ...createDeletePanelSlice()(...args),\n ...createDiscardChangesDialogSlice(...args),\n metadata,\n defaultTimeRange: { pastDuration: duration },\n isEditMode: !!isEditMode,\n setEditMode: (isEditMode: boolean) => set({ isEditMode }),\n setDashboard: ({ metadata, spec: { panels, layouts } }) => {\n set((state) => {\n state.metadata = metadata;\n const { panelGroups, panelGroupOrder } = convertLayoutsToPanelGroups(layouts);\n state.panels = panels;\n state.panelGroups = panelGroups;\n state.panelGroupOrder = panelGroupOrder;\n });\n },\n };\n })\n )\n );\n\n return store;\n}\n"],"names":["createStore","useStore","devtools","immer","shallow","createContext","useCallback","useContext","useState","createPanelGroupEditorSlice","convertLayoutsToPanelGroups","createPanelGroupSlice","createPanelEditorSlice","createPanelSlice","createDeletePanelGroupSlice","createDeletePanelSlice","createDiscardChangesDialogSlice","DashboardContext","undefined","useDashboardStore","selector","store","Error","DashboardProvider","props","createDashboardStore","initStore","Provider","value","children","initialState","dashboardResource","isEditMode","spec","layouts","panels","duration","metadata","args","set","defaultTimeRange","pastDuration","setEditMode","setDashboard","state","panelGroups","panelGroupOrder"],"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;AAAA,SAASA,WAAW,EAAEC,QAAQ,QAAQ,SAAS,CAAC;AAEhD,SAASC,QAAQ,QAAQ,oBAAoB,CAAC;AAC9C,SAASC,KAAK,QAAQ,0BAA0B,CAAC;AACjD,OAAOC,OAAO,MAAM,iBAAiB,CAAC;AACtC,SAASC,aAAa,EAAEC,WAAW,EAAEC,UAAU,EAAEC,QAAQ,QAAQ,OAAO,CAAC;AAEzE,SAASC,2BAA2B,QAA+B,4BAA4B,CAAC;AAChG,SAASC,2BAA2B,EAA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AC;IACJ,CAAC,CAAC,CACH,CACF,AAAC;IAEF,OAAOzB,KAAK,CAAC;AACf,CAAC"}
1
+ {"version":3,"sources":["../../../src/context/DashboardProvider/DashboardProvider.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 { createStore, useStore } from 'zustand';\nimport type { StoreApi } from 'zustand';\nimport { devtools } from 'zustand/middleware';\nimport { immer } from 'zustand/middleware/immer';\nimport shallow from 'zustand/shallow';\nimport { createContext, ReactNode, useCallback, useContext, useEffect, useState } from 'react';\nimport { DashboardResource, Display, ProjectMetadata, RelativeTimeRange } from '@perses-dev/core';\nimport { usePlugin, usePluginRegistry } from '@perses-dev/plugin-system';\nimport { createPanelGroupEditorSlice, PanelGroupEditorSlice } from './panel-group-editor-slice';\nimport { convertLayoutsToPanelGroups, createPanelGroupSlice, PanelGroupSlice } from './panel-group-slice';\nimport { createPanelEditorSlice, PanelEditorSlice } from './panel-editor-slice';\nimport { createPanelSlice, PanelSlice } from './panel-slice';\nimport { createDeletePanelGroupSlice, DeletePanelGroupSlice } from './delete-panel-group-slice';\nimport { createDeletePanelSlice, DeletePanelSlice } from './delete-panel-slice';\nimport { createDiscardChangesDialogSlice, DiscardChangesConfirmationDialogSlice } from './discard-changes-dialog-slice';\nimport { createDuplicatePanelSlice, DuplicatePanelSlice } from './duplicate-panel-slice';\n\nexport interface DashboardStoreState\n extends PanelGroupSlice,\n PanelSlice,\n PanelGroupEditorSlice,\n DeletePanelGroupSlice,\n PanelEditorSlice,\n DeletePanelSlice,\n DiscardChangesConfirmationDialogSlice,\n DuplicatePanelSlice {\n isEditMode: boolean;\n setEditMode: (isEditMode: boolean) => void;\n defaultTimeRange: RelativeTimeRange;\n setDashboard: (dashboard: DashboardResource) => void;\n metadata: ProjectMetadata;\n display?: Display;\n}\n\nexport interface DashboardStoreProps {\n dashboardResource: DashboardResource;\n isEditMode?: boolean;\n}\n\nexport interface DashboardProviderProps {\n initialState: DashboardStoreProps;\n children?: ReactNode;\n}\n\nexport const DashboardContext = createContext<StoreApi<DashboardStoreState> | undefined>(undefined);\n\nexport function useDashboardStore<T>(selector: (state: DashboardStoreState) => T) {\n const store = useContext(DashboardContext);\n if (store === undefined) {\n throw new Error('No DashboardContext found. Did you forget a Provider?');\n }\n return useStore(store, selector, shallow);\n}\n\nexport function DashboardProvider(props: DashboardProviderProps) {\n const createDashboardStore = useCallback(initStore, [props]);\n\n // load plugin to retrieve initial spec if default panel kind is defined\n const { defaultPluginKinds } = usePluginRegistry();\n const defaultPanelKind = defaultPluginKinds?.['Panel'] ?? '';\n const { data: plugin } = usePlugin('Panel', defaultPanelKind);\n\n const [store] = useState(createDashboardStore(props)); // prevent calling createDashboardStore every time it rerenders\n\n useEffect(() => {\n if (plugin === undefined) return;\n const spec = plugin.createInitialOptions();\n // set default panel kind and spec for add panel editor\n store.setState({ initialValues: { kind: defaultPanelKind, spec } });\n }, [plugin, store, defaultPanelKind]);\n\n return (\n <DashboardContext.Provider value={store as StoreApi<DashboardStoreState>}>\n {props.children}\n </DashboardContext.Provider>\n );\n}\n\nfunction initStore(props: DashboardProviderProps) {\n const {\n initialState: { dashboardResource, isEditMode },\n } = props;\n\n const {\n spec: { display, layouts, panels, duration },\n metadata,\n } = dashboardResource;\n const store = createStore<DashboardStoreState>()(\n immer(\n devtools((...args) => {\n const [set] = args;\n return {\n ...createPanelGroupSlice(layouts)(...args),\n ...createPanelSlice(panels)(...args),\n ...createPanelGroupEditorSlice(...args),\n ...createDeletePanelGroupSlice(...args),\n ...createPanelEditorSlice()(...args),\n ...createDeletePanelSlice()(...args),\n ...createDiscardChangesDialogSlice(...args),\n ...createDuplicatePanelSlice()(...args),\n metadata,\n display,\n defaultTimeRange: { pastDuration: duration },\n isEditMode: !!isEditMode,\n setEditMode: (isEditMode: boolean) => set({ isEditMode }),\n setDashboard: ({ metadata, spec: { display, panels, layouts } }) => {\n set((state) => {\n state.metadata = metadata;\n state.display = display;\n const { panelGroups, panelGroupOrder } = convertLayoutsToPanelGroups(layouts);\n state.panels = panels;\n state.panelGroups = panelGroups;\n state.panelGroupOrder = panelGroupOrder;\n });\n },\n };\n })\n )\n );\n\n return store;\n}\n"],"names":["createStore","useStore","devtools","immer","shallow","createContext","useCallback","useContext","useEffect","useState","usePlugin","usePluginRegistry","createPanelGroupEditorSlice","convertLayoutsToPanelGroups","createPanelGroupSlice","createPanelEditorSlice","createPanelSlice","createDeletePanelGroupSlice","createDeletePanelSlice","createDiscardChangesDialogSlice","createDuplicatePanelSlice","DashboardContext","undefined","useDashboardStore","selector","store","Error","DashboardProvider","props","createDashboardStore","initStore","defaultPluginKinds","defaultPanelKind","data","plugin","spec","createInitialOptions","setState","initialValues","kind","Provider","value","children","initialState","dashboardResource","isEditMode","display","layouts","panels","duration","metadata","args","set","defaultTimeRange","pastDuration","setEditMode","setDashboard","state","panelGroups","panelGroupOrder"],"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;AAAA,SAASA,WAAW,EAAEC,QAAQ,QAAQ,SAAS,CAAC;AAEhD,SAASC,QAAQ,QAAQ,oBAAoB,CAAC;AAC9C,SAASC,KAAK,QAAQ,0BAA0B,CAAC;AACjD,OAAOC,OAAO,MAAM,iBAAiB,CAAC;AACtC,SAASC,aAAa,EAAaC,WAAW,EAAEC,UAAU,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO,CAAC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ache 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 +1 @@
1
- {"version":3,"sources":["../../../src/context/DashboardProvider/common.ts"],"sourcesContent":["// Copyright 2022 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\n/**\n * The middleware applied to the DashboardStore (can be used as generic argument in StateCreator).\n */\nexport type Middleware = [['zustand/immer', never], ['zustand/devtools', never]];\n\ndeclare global {\n // eslint-disable-next-line no-var\n var dashboardStoreId: number;\n}\n\n/**\n * Helper function to generate unique IDs for things in the dashboard store that don't have a \"natural\" ID.\n */\nexport function generateId() {\n if (globalThis.dashboardStoreId === undefined) {\n globalThis.dashboardStoreId = 0;\n }\n return globalThis.dashboardStoreId++;\n}\n"],"names":["generateId","globalThis","dashboardStoreId","undefined"],"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;;CAEC,GACD,AAOA;;CAEC,GACD,OAAO,SAASA,UAAU,GAAG;IAC3B,IAAIC,UAAU,CAACC,gBAAgB,KAAKC,SAAS,EAAE;QAC7CF,UAAU,CAACC,gBAAgB,GAAG,CAAC,CAAC;IAClC,CAAC;IACD,OAAOD,UAAU,CAACC,gBAAgB,EAAE,CAAC;AACvC,CAAC"}
1
+ {"version":3,"sources":["../../../src/context/DashboardProvider/common.ts"],"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\n/**\n * The middleware applied to the DashboardStore (can be used as generic argument in StateCreator).\n */\nexport type Middleware = [['zustand/immer', never], ['zustand/devtools', never]];\n\ndeclare global {\n // eslint-disable-next-line no-var\n var dashboardStoreId: number;\n}\n\n/**\n * Helper function to generate unique IDs for things in the dashboard store that don't have a \"natural\" ID.\n */\nexport function generateId() {\n if (globalThis.dashboardStoreId === undefined) {\n globalThis.dashboardStoreId = 0;\n }\n return globalThis.dashboardStoreId++;\n}\n"],"names":["generateId","globalThis","dashboardStoreId","undefined"],"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;;CAEC,GACD,AAOA;;CAEC,GACD,OAAO,SAASA,UAAU,GAAG;IAC3B,IAAIC,UAAU,CAACC,gBAAgB,KAAKC,SAAS,EAAE;QAC7CF,UAAU,CAACC,gBAAgB,GAAG,CAAC,CAAC;IAClC,CAAC;IACD,OAAOD,UAAU,CAACC,gBAAgB,EAAE,CAAC;AACvC,CAAC"}
@@ -57,6 +57,7 @@ export declare function usePanel(panelGroupItemId: PanelGroupItemId): import("@p
57
57
  export declare function usePanelActions(panelGroupItemId: PanelGroupItemId): {
58
58
  openEditPanel: () => void;
59
59
  openDeletePanelDialog: () => void;
60
+ duplicatePanel: () => void;
60
61
  };
61
62
  /**
62
63
  * Gets the state for the Panel Editor.
@@ -1 +1 @@
1
- {"version":3,"file":"dashboard-provider-api.d.ts","sourceRoot":"","sources":["../../../src/context/DashboardProvider/dashboard-provider-api.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAG3F,wBAAgB,WAAW;;;EAE1B;AAOD;;GAEG;AACH,wBAAgB,mBAAmB;;;;EAOlC;AAGD;;GAEG;AACH,wBAAgB,gBAAgB,aAE/B;AAGD;;GAEG;AACH,wBAAgB,kBAAkB,yDAYjC;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,YAAY,EAAE,YAAY,sDAMvD;AAaD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,YAAY;;;;;;2CAWpB,oBAAoB,EAAE;EAGhE;AA4BD;;GAEG;AACH,wBAAgB,mBAAmB,sEAElC;AAaD;;GAEG;AACH,wBAAgB,yBAAyB;;;;;EASxC;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,sFAiB1D;AAMD;;GAEG;AACH,wBAAgB,eAAe,CAAC,gBAAgB,EAAE,gBAAgB;;;EAMjE;AAGD;;GAEG;AACH,wBAAgB,cAAc,gEAE7B;AAQD;;GAEG;AACH,wBAAgB,oBAAoB;;;;EAGnC;AAGD,wBAAgB,mBAAmB,iDAElC;AAWD,wBAAgB,mCAAmC;;;;EAElD"}
1
+ {"version":3,"file":"dashboard-provider-api.d.ts","sourceRoot":"","sources":["../../../src/context/DashboardProvider/dashboard-provider-api.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAG3F,wBAAgB,WAAW;;;EAE1B;AAOD;;GAEG;AACH,wBAAgB,mBAAmB;;;;EAOlC;AAGD;;GAEG;AACH,wBAAgB,gBAAgB,aAE/B;AAGD;;GAEG;AACH,wBAAgB,kBAAkB,yDAYjC;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,YAAY,EAAE,YAAY,sDAMvD;AAaD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,YAAY;;;;;;2CAWpB,oBAAoB,EAAE;EAGhE;AA4BD;;GAEG;AACH,wBAAgB,mBAAmB,sEAElC;AAaD;;GAEG;AACH,wBAAgB,yBAAyB;;;;;EASxC;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,sFAiB1D;AAQD;;GAEG;AACH,wBAAgB,eAAe,CAAC,gBAAgB,EAAE,gBAAgB;;;;EAOjE;AAGD;;GAEG;AACH,wBAAgB,cAAc,gEAE7B;AAQD;;GAEG;AACH,wBAAgB,oBAAoB;;;;EAGnC;AAGD,wBAAgB,mBAAmB,iDAElC;AAWD,wBAAgB,mCAAmC;;;;EAElD"}