@perses-dev/dashboards 0.53.1 → 0.54.0-beta.1

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 (319) hide show
  1. package/dist/cjs/components/DashboardLinks/DashboardLinksEditor.js +366 -0
  2. package/dist/cjs/components/DashboardLinks/EditDashboardLinksButton.js +81 -0
  3. package/dist/cjs/components/DashboardLinks/index.js +31 -0
  4. package/dist/cjs/components/DashboardShortcuts/index.js +23 -0
  5. package/dist/cjs/components/DashboardShortcuts/useDashboardShortcuts.js +373 -0
  6. package/dist/cjs/components/DashboardToolbar/DashboardToolbar.js +16 -1
  7. package/dist/cjs/components/Datasources/EditDatasourcesButton.js +1 -7
  8. package/dist/cjs/components/GridLayout/GridItemContent.js +21 -8
  9. package/dist/cjs/components/{Panel/PanelLinks.js → LinksDisplay/LinksDisplay.js} +59 -10
  10. package/dist/cjs/components/LinksDisplay/index.js +30 -0
  11. package/dist/cjs/components/Panel/PanelActions.js +38 -23
  12. package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +2 -2
  13. package/dist/cjs/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +4 -4
  14. package/dist/cjs/components/SaveDashboardButton/SaveDashboardButton.js +3 -61
  15. package/dist/cjs/components/Variables/ListVariableListBox.js +6 -6
  16. package/dist/cjs/components/Variables/Variable.js +3 -3
  17. package/dist/cjs/components/index.js +2 -0
  18. package/dist/cjs/constants/defaults.js +32 -0
  19. package/dist/cjs/constants/index.js +1 -0
  20. package/dist/cjs/constants/user-interface-text.js +1 -0
  21. package/dist/cjs/context/DashboardProvider/DashboardProvider.js +8 -4
  22. package/dist/cjs/context/DashboardProvider/dashboard-provider-api.js +16 -0
  23. package/dist/cjs/context/DashboardProvider/index.js +7 -0
  24. package/dist/cjs/context/DashboardProvider/links-slice.js +32 -0
  25. package/dist/cjs/context/DashboardProvider/panel-group-slice.js +2 -2
  26. package/dist/cjs/context/DashboardProvider/use-save-dashboard.js +104 -0
  27. package/dist/cjs/context/DatasourceStoreProvider.js +3 -9
  28. package/dist/cjs/context/VariableProvider/VariableProvider.js +7 -6
  29. package/dist/cjs/context/VariableProvider/hydrationUtils.js +3 -3
  30. package/dist/cjs/context/useDashboard.js +7 -4
  31. package/dist/cjs/index.js +3 -0
  32. package/dist/cjs/keyboard-shortcuts/PanelFocusProvider.js +157 -0
  33. package/dist/cjs/keyboard-shortcuts/default-shortcuts/dashboard.js +75 -0
  34. package/dist/cjs/keyboard-shortcuts/default-shortcuts/global.js +121 -0
  35. package/dist/cjs/keyboard-shortcuts/default-shortcuts/index.js +33 -0
  36. package/dist/cjs/keyboard-shortcuts/default-shortcuts/panel.js +90 -0
  37. package/dist/cjs/keyboard-shortcuts/default-shortcuts/time-range.js +142 -0
  38. package/dist/cjs/keyboard-shortcuts/events.js +93 -0
  39. package/dist/cjs/keyboard-shortcuts/index.js +92 -0
  40. package/dist/cjs/keyboard-shortcuts/types.js +42 -0
  41. package/dist/cjs/keyboard-shortcuts/utils.js +87 -0
  42. package/dist/cjs/model/DashboardResource.js +16 -0
  43. package/dist/cjs/model/PanelGroupDefinition.js +25 -0
  44. package/dist/cjs/model/VariableDefinition.js +16 -0
  45. package/dist/cjs/model/index.js +31 -0
  46. package/dist/cjs/test/render.js +18 -3
  47. package/dist/cjs/views/ViewDashboard/DashboardApp.js +17 -2
  48. package/dist/cjs/views/ViewDashboard/ViewDashboard.js +5 -4
  49. package/dist/components/Dashboard/Dashboard.d.ts.map +1 -1
  50. package/dist/components/Dashboard/Dashboard.js.map +1 -1
  51. package/dist/components/DashboardLinks/DashboardLinksEditor.d.ts +9 -0
  52. package/dist/components/DashboardLinks/DashboardLinksEditor.d.ts.map +1 -0
  53. package/dist/components/DashboardLinks/DashboardLinksEditor.js +353 -0
  54. package/dist/components/DashboardLinks/DashboardLinksEditor.js.map +1 -0
  55. package/dist/components/DashboardLinks/EditDashboardLinksButton.d.ts +18 -0
  56. package/dist/components/DashboardLinks/EditDashboardLinksButton.d.ts.map +1 -0
  57. package/dist/components/DashboardLinks/EditDashboardLinksButton.js +68 -0
  58. package/dist/components/DashboardLinks/EditDashboardLinksButton.js.map +1 -0
  59. package/dist/components/DashboardLinks/index.d.ts +3 -0
  60. package/dist/components/DashboardLinks/index.d.ts.map +1 -0
  61. package/dist/components/DashboardLinks/index.js +16 -0
  62. package/dist/components/DashboardLinks/index.js.map +1 -0
  63. package/dist/components/DashboardShortcuts/index.d.ts +3 -0
  64. package/dist/components/DashboardShortcuts/index.d.ts.map +1 -0
  65. package/dist/components/DashboardShortcuts/index.js +15 -0
  66. package/dist/components/DashboardShortcuts/index.js.map +1 -0
  67. package/dist/components/DashboardShortcuts/useDashboardShortcuts.d.ts +12 -0
  68. package/dist/components/DashboardShortcuts/useDashboardShortcuts.d.ts.map +1 -0
  69. package/dist/components/DashboardShortcuts/useDashboardShortcuts.js +365 -0
  70. package/dist/components/DashboardShortcuts/useDashboardShortcuts.js.map +1 -0
  71. package/dist/components/DashboardToolbar/DashboardToolbar.d.ts +1 -0
  72. package/dist/components/DashboardToolbar/DashboardToolbar.d.ts.map +1 -1
  73. package/dist/components/DashboardToolbar/DashboardToolbar.js +17 -2
  74. package/dist/components/DashboardToolbar/DashboardToolbar.js.map +1 -1
  75. package/dist/components/Datasources/DatasourceEditor.d.ts +1 -1
  76. package/dist/components/Datasources/DatasourceEditor.d.ts.map +1 -1
  77. package/dist/components/Datasources/DatasourceEditor.js.map +1 -1
  78. package/dist/components/Datasources/EditDatasourcesButton.d.ts.map +1 -1
  79. package/dist/components/Datasources/EditDatasourcesButton.js +1 -7
  80. package/dist/components/Datasources/EditDatasourcesButton.js.map +1 -1
  81. package/dist/components/DownloadButton/serializeDashboard.d.ts +2 -2
  82. package/dist/components/DownloadButton/serializeDashboard.d.ts.map +1 -1
  83. package/dist/components/DownloadButton/serializeDashboard.js.map +1 -1
  84. package/dist/components/GridLayout/GridItemContent.d.ts +1 -1
  85. package/dist/components/GridLayout/GridItemContent.d.ts.map +1 -1
  86. package/dist/components/GridLayout/GridItemContent.js +21 -8
  87. package/dist/components/GridLayout/GridItemContent.js.map +1 -1
  88. package/dist/components/GridLayout/GridLayout.d.ts +1 -1
  89. package/dist/components/GridLayout/GridLayout.d.ts.map +1 -1
  90. package/dist/components/GridLayout/GridLayout.js.map +1 -1
  91. package/dist/components/GridLayout/GridTitle.d.ts +1 -1
  92. package/dist/components/GridLayout/GridTitle.js.map +1 -1
  93. package/dist/components/GridLayout/Row.d.ts +2 -1
  94. package/dist/components/GridLayout/Row.d.ts.map +1 -1
  95. package/dist/components/GridLayout/Row.js.map +1 -1
  96. package/dist/components/LeaveDialog/LeaveDialog.d.ts +3 -3
  97. package/dist/components/LeaveDialog/LeaveDialog.d.ts.map +1 -1
  98. package/dist/components/LeaveDialog/LeaveDialog.js.map +1 -1
  99. package/dist/components/LinksDisplay/LinksDisplay.d.ts +10 -0
  100. package/dist/components/LinksDisplay/LinksDisplay.d.ts.map +1 -0
  101. package/dist/components/{Panel/PanelLinks.js → LinksDisplay/LinksDisplay.js} +59 -10
  102. package/dist/components/LinksDisplay/LinksDisplay.js.map +1 -0
  103. package/dist/components/LinksDisplay/index.d.ts +2 -0
  104. package/dist/components/LinksDisplay/index.d.ts.map +1 -0
  105. package/dist/components/LinksDisplay/index.js +15 -0
  106. package/dist/components/LinksDisplay/index.js.map +1 -0
  107. package/dist/components/Panel/Panel.d.ts +2 -1
  108. package/dist/components/Panel/Panel.d.ts.map +1 -1
  109. package/dist/components/Panel/Panel.js.map +1 -1
  110. package/dist/components/Panel/PanelActions.d.ts +1 -1
  111. package/dist/components/Panel/PanelActions.d.ts.map +1 -1
  112. package/dist/components/Panel/PanelActions.js +39 -24
  113. package/dist/components/Panel/PanelActions.js.map +1 -1
  114. package/dist/components/Panel/PanelContent.d.ts +1 -1
  115. package/dist/components/Panel/PanelContent.js.map +1 -1
  116. package/dist/components/Panel/PanelHeader.d.ts +1 -1
  117. package/dist/components/Panel/PanelHeader.js.map +1 -1
  118. package/dist/components/Panel/PanelPluginLoader.d.ts +1 -1
  119. package/dist/components/Panel/PanelPluginLoader.js.map +1 -1
  120. package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -1
  121. package/dist/components/PanelDrawer/PanelEditorForm.d.ts +2 -1
  122. package/dist/components/PanelDrawer/PanelEditorForm.d.ts.map +1 -1
  123. package/dist/components/PanelDrawer/PanelEditorForm.js +2 -2
  124. package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -1
  125. package/dist/components/PanelDrawer/PanelPreview.d.ts +1 -1
  126. package/dist/components/PanelDrawer/PanelPreview.js.map +1 -1
  127. package/dist/components/PanelDrawer/PanelQueriesSharedControls.d.ts +1 -1
  128. package/dist/components/PanelDrawer/PanelQueriesSharedControls.js.map +1 -1
  129. package/dist/components/PanelDrawer/usePanelEditor.d.ts +1 -1
  130. package/dist/components/PanelDrawer/usePanelEditor.js.map +1 -1
  131. package/dist/components/QuerySummaryTable/QuerySummaryTable.js.map +1 -1
  132. package/dist/components/QueryViewerDialog/QueryViewerDialog.d.ts +1 -1
  133. package/dist/components/QueryViewerDialog/QueryViewerDialog.js.map +1 -1
  134. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +1 -1
  135. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js.map +1 -1
  136. package/dist/components/SaveDashboardButton/SaveDashboardButton.d.ts.map +1 -1
  137. package/dist/components/SaveDashboardButton/SaveDashboardButton.js +4 -62
  138. package/dist/components/SaveDashboardButton/SaveDashboardButton.js.map +1 -1
  139. package/dist/components/Variables/BuiltinVariableAccordions.d.ts +1 -1
  140. package/dist/components/Variables/BuiltinVariableAccordions.js.map +1 -1
  141. package/dist/components/Variables/EditVariablesButton.d.ts.map +1 -1
  142. package/dist/components/Variables/EditVariablesButton.js.map +1 -1
  143. package/dist/components/Variables/ListVariableListBox.js +1 -1
  144. package/dist/components/Variables/ListVariableListBox.js.map +1 -1
  145. package/dist/components/Variables/Variable.d.ts +1 -1
  146. package/dist/components/Variables/Variable.js +1 -1
  147. package/dist/components/Variables/Variable.js.map +1 -1
  148. package/dist/components/Variables/VariableEditor.d.ts +2 -1
  149. package/dist/components/Variables/VariableEditor.d.ts.map +1 -1
  150. package/dist/components/Variables/VariableEditor.js.map +1 -1
  151. package/dist/components/Variables/VariableList.d.ts +1 -1
  152. package/dist/components/Variables/VariableList.d.ts.map +1 -1
  153. package/dist/components/Variables/VariableList.js.map +1 -1
  154. package/dist/components/index.d.ts +2 -0
  155. package/dist/components/index.d.ts.map +1 -1
  156. package/dist/components/index.js +2 -0
  157. package/dist/components/index.js.map +1 -1
  158. package/dist/constants/defaults.d.ts +4 -0
  159. package/dist/constants/defaults.d.ts.map +1 -0
  160. package/dist/constants/defaults.js +16 -0
  161. package/dist/constants/defaults.js.map +1 -0
  162. package/dist/constants/index.d.ts +1 -0
  163. package/dist/constants/index.d.ts.map +1 -1
  164. package/dist/constants/index.js +1 -0
  165. package/dist/constants/index.js.map +1 -1
  166. package/dist/constants/user-interface-text.d.ts +1 -0
  167. package/dist/constants/user-interface-text.d.ts.map +1 -1
  168. package/dist/constants/user-interface-text.js +1 -0
  169. package/dist/constants/user-interface-text.js.map +1 -1
  170. package/dist/context/DashboardProvider/DashboardProvider.d.ts +8 -6
  171. package/dist/context/DashboardProvider/DashboardProvider.d.ts.map +1 -1
  172. package/dist/context/DashboardProvider/DashboardProvider.js +6 -2
  173. package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -1
  174. package/dist/context/DashboardProvider/common.d.ts +3 -2
  175. package/dist/context/DashboardProvider/common.d.ts.map +1 -1
  176. package/dist/context/DashboardProvider/common.js.map +1 -1
  177. package/dist/context/DashboardProvider/dashboard-provider-api.d.ts +14 -2
  178. package/dist/context/DashboardProvider/dashboard-provider-api.d.ts.map +1 -1
  179. package/dist/context/DashboardProvider/dashboard-provider-api.js +14 -0
  180. package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -1
  181. package/dist/context/DashboardProvider/delete-panel-group-slice.d.ts +1 -1
  182. package/dist/context/DashboardProvider/delete-panel-group-slice.js.map +1 -1
  183. package/dist/context/DashboardProvider/delete-panel-slice.d.ts +1 -1
  184. package/dist/context/DashboardProvider/delete-panel-slice.d.ts.map +1 -1
  185. package/dist/context/DashboardProvider/delete-panel-slice.js.map +1 -1
  186. package/dist/context/DashboardProvider/duplicate-panel-slice.d.ts +1 -1
  187. package/dist/context/DashboardProvider/duplicate-panel-slice.d.ts.map +1 -1
  188. package/dist/context/DashboardProvider/duplicate-panel-slice.js.map +1 -1
  189. package/dist/context/DashboardProvider/index.d.ts +2 -0
  190. package/dist/context/DashboardProvider/index.d.ts.map +1 -1
  191. package/dist/context/DashboardProvider/index.js +1 -0
  192. package/dist/context/DashboardProvider/index.js.map +1 -1
  193. package/dist/context/DashboardProvider/links-slice.d.ts +19 -0
  194. package/dist/context/DashboardProvider/links-slice.d.ts.map +1 -0
  195. package/dist/context/DashboardProvider/links-slice.js +27 -0
  196. package/dist/context/DashboardProvider/links-slice.js.map +1 -0
  197. package/dist/context/DashboardProvider/panel-editor-slice.d.ts +3 -1
  198. package/dist/context/DashboardProvider/panel-editor-slice.d.ts.map +1 -1
  199. package/dist/context/DashboardProvider/panel-editor-slice.js.map +1 -1
  200. package/dist/context/DashboardProvider/panel-group-editor-slice.d.ts +1 -1
  201. package/dist/context/DashboardProvider/panel-group-editor-slice.js.map +1 -1
  202. package/dist/context/DashboardProvider/panel-group-slice.d.ts +2 -1
  203. package/dist/context/DashboardProvider/panel-group-slice.d.ts.map +1 -1
  204. package/dist/context/DashboardProvider/panel-group-slice.js +1 -1
  205. package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -1
  206. package/dist/context/DashboardProvider/panel-slice.d.ts +1 -1
  207. package/dist/context/DashboardProvider/panel-slice.js.map +1 -1
  208. package/dist/context/DashboardProvider/use-save-dashboard.d.ts +25 -0
  209. package/dist/context/DashboardProvider/use-save-dashboard.d.ts.map +1 -0
  210. package/dist/context/DashboardProvider/use-save-dashboard.js +105 -0
  211. package/dist/context/DashboardProvider/use-save-dashboard.js.map +1 -0
  212. package/dist/context/DashboardProvider/view-panel-slice.d.ts +1 -1
  213. package/dist/context/DashboardProvider/view-panel-slice.d.ts.map +1 -1
  214. package/dist/context/DashboardProvider/view-panel-slice.js.map +1 -1
  215. package/dist/context/DatasourceStoreProvider.d.ts +4 -2
  216. package/dist/context/DatasourceStoreProvider.d.ts.map +1 -1
  217. package/dist/context/DatasourceStoreProvider.js +3 -9
  218. package/dist/context/DatasourceStoreProvider.js.map +1 -1
  219. package/dist/context/VariableProvider/VariableProvider.d.ts +2 -1
  220. package/dist/context/VariableProvider/VariableProvider.d.ts.map +1 -1
  221. package/dist/context/VariableProvider/VariableProvider.js +2 -1
  222. package/dist/context/VariableProvider/VariableProvider.js.map +1 -1
  223. package/dist/context/VariableProvider/hydrationUtils.d.ts +2 -1
  224. package/dist/context/VariableProvider/hydrationUtils.d.ts.map +1 -1
  225. package/dist/context/VariableProvider/hydrationUtils.js +1 -1
  226. package/dist/context/VariableProvider/hydrationUtils.js.map +1 -1
  227. package/dist/context/VariableProvider/query-params.d.ts +1 -1
  228. package/dist/context/VariableProvider/query-params.js.map +1 -1
  229. package/dist/context/VariableProvider/utils.d.ts +2 -1
  230. package/dist/context/VariableProvider/utils.d.ts.map +1 -1
  231. package/dist/context/VariableProvider/utils.js.map +1 -1
  232. package/dist/context/useDashboard.d.ts +10 -3
  233. package/dist/context/useDashboard.d.ts.map +1 -1
  234. package/dist/context/useDashboard.js +6 -3
  235. package/dist/context/useDashboard.js.map +1 -1
  236. package/dist/index.d.ts +3 -0
  237. package/dist/index.d.ts.map +1 -1
  238. package/dist/index.js +3 -0
  239. package/dist/index.js.map +1 -1
  240. package/dist/keyboard-shortcuts/PanelFocusProvider.d.ts +12 -0
  241. package/dist/keyboard-shortcuts/PanelFocusProvider.d.ts.map +1 -0
  242. package/dist/keyboard-shortcuts/PanelFocusProvider.js +97 -0
  243. package/dist/keyboard-shortcuts/PanelFocusProvider.js.map +1 -0
  244. package/dist/keyboard-shortcuts/default-shortcuts/dashboard.d.ts +6 -0
  245. package/dist/keyboard-shortcuts/default-shortcuts/dashboard.d.ts.map +1 -0
  246. package/dist/keyboard-shortcuts/default-shortcuts/dashboard.js +53 -0
  247. package/dist/keyboard-shortcuts/default-shortcuts/dashboard.js.map +1 -0
  248. package/dist/keyboard-shortcuts/default-shortcuts/global.d.ts +9 -0
  249. package/dist/keyboard-shortcuts/default-shortcuts/global.d.ts.map +1 -0
  250. package/dist/keyboard-shortcuts/default-shortcuts/global.js +90 -0
  251. package/dist/keyboard-shortcuts/default-shortcuts/global.js.map +1 -0
  252. package/dist/keyboard-shortcuts/default-shortcuts/index.d.ts +5 -0
  253. package/dist/keyboard-shortcuts/default-shortcuts/index.d.ts.map +1 -0
  254. package/dist/keyboard-shortcuts/default-shortcuts/index.js +18 -0
  255. package/dist/keyboard-shortcuts/default-shortcuts/index.js.map +1 -0
  256. package/dist/keyboard-shortcuts/default-shortcuts/panel.d.ts +7 -0
  257. package/dist/keyboard-shortcuts/default-shortcuts/panel.d.ts.map +1 -0
  258. package/dist/keyboard-shortcuts/default-shortcuts/panel.js +65 -0
  259. package/dist/keyboard-shortcuts/default-shortcuts/panel.js.map +1 -0
  260. package/dist/keyboard-shortcuts/default-shortcuts/time-range.d.ts +10 -0
  261. package/dist/keyboard-shortcuts/default-shortcuts/time-range.d.ts.map +1 -0
  262. package/dist/keyboard-shortcuts/default-shortcuts/time-range.js +108 -0
  263. package/dist/keyboard-shortcuts/default-shortcuts/time-range.js.map +1 -0
  264. package/dist/keyboard-shortcuts/events.d.ts +18 -0
  265. package/dist/keyboard-shortcuts/events.d.ts.map +1 -0
  266. package/dist/keyboard-shortcuts/events.js +35 -0
  267. package/dist/keyboard-shortcuts/events.js.map +1 -0
  268. package/dist/keyboard-shortcuts/index.d.ts +9 -0
  269. package/dist/keyboard-shortcuts/index.d.ts.map +1 -0
  270. package/dist/keyboard-shortcuts/index.js +21 -0
  271. package/dist/keyboard-shortcuts/index.js.map +1 -0
  272. package/dist/keyboard-shortcuts/types.d.ts +37 -0
  273. package/dist/keyboard-shortcuts/types.d.ts.map +1 -0
  274. package/dist/keyboard-shortcuts/types.js +26 -0
  275. package/dist/keyboard-shortcuts/types.js.map +1 -0
  276. package/dist/keyboard-shortcuts/utils.d.ts +20 -0
  277. package/dist/keyboard-shortcuts/utils.d.ts.map +1 -0
  278. package/dist/keyboard-shortcuts/utils.js +64 -0
  279. package/dist/keyboard-shortcuts/utils.js.map +1 -0
  280. package/dist/model/DashboardResource.d.ts +15 -0
  281. package/dist/model/DashboardResource.d.ts.map +1 -0
  282. package/dist/model/DashboardResource.js +18 -0
  283. package/dist/model/DashboardResource.js.map +1 -0
  284. package/dist/model/PanelGroupDefinition.d.ts +59 -0
  285. package/dist/model/PanelGroupDefinition.d.ts.map +1 -0
  286. package/dist/model/PanelGroupDefinition.js +19 -0
  287. package/dist/model/PanelGroupDefinition.js.map +1 -0
  288. package/dist/model/VariableDefinition.d.ts +50 -0
  289. package/dist/model/VariableDefinition.d.ts.map +1 -0
  290. package/dist/model/VariableDefinition.js +20 -0
  291. package/dist/model/VariableDefinition.js.map +1 -0
  292. package/dist/model/index.d.ts +3 -0
  293. package/dist/model/index.d.ts.map +1 -0
  294. package/dist/model/index.js +16 -0
  295. package/dist/model/index.js.map +1 -0
  296. package/dist/test/dashboard-provider.d.ts +1 -1
  297. package/dist/test/dashboard-provider.d.ts.map +1 -1
  298. package/dist/test/dashboard-provider.js.map +1 -1
  299. package/dist/test/plugin-registry.js.map +1 -1
  300. package/dist/test/render.d.ts.map +1 -1
  301. package/dist/test/render.js +18 -3
  302. package/dist/test/render.js.map +1 -1
  303. package/dist/test/testDashboard.d.ts +11 -2
  304. package/dist/test/testDashboard.d.ts.map +1 -1
  305. package/dist/test/testDashboard.js.map +1 -1
  306. package/dist/utils/panelUtils.d.ts +1 -1
  307. package/dist/utils/panelUtils.d.ts.map +1 -1
  308. package/dist/utils/panelUtils.js.map +1 -1
  309. package/dist/views/ViewDashboard/DashboardApp.d.ts +5 -3
  310. package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -1
  311. package/dist/views/ViewDashboard/DashboardApp.js +18 -3
  312. package/dist/views/ViewDashboard/DashboardApp.js.map +1 -1
  313. package/dist/views/ViewDashboard/ViewDashboard.d.ts.map +1 -1
  314. package/dist/views/ViewDashboard/ViewDashboard.js +3 -2
  315. package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -1
  316. package/package.json +5 -3
  317. package/dist/components/Panel/PanelLinks.d.ts +0 -6
  318. package/dist/components/Panel/PanelLinks.d.ts.map +0 -1
  319. package/dist/components/Panel/PanelLinks.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Variables/VariableList.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box } from '@mui/material';\nimport { VariableDefinition, VariableSpec, ExternalVariableDefinition } from '@perses-dev/core';\nimport { ReactElement } from 'react';\nimport { useExternalVariableDefinitions, useVariableDefinitionAndState, useVariableDefinitions } from '../../context';\nimport { MAX_VARIABLE_WIDTH, MIN_VARIABLE_WIDTH } from '../../constants';\nimport { Variable } from './Variable';\n\nexport function VariableList(): ReactElement {\n const variableDefinitions: VariableDefinition[] = useVariableDefinitions();\n const externalVariableDefinitions: ExternalVariableDefinition[] = useExternalVariableDefinitions();\n\n return (\n <>\n {externalVariableDefinitions\n .slice()\n .reverse() // We reverse to have the most prioritized on top\n .map((def) =>\n def.definitions.map((v) => (\n <VariableListItem key={v.spec.name + def.source} spec={v.spec} source={def.source} />\n ))\n )}\n {variableDefinitions.map((v) => (\n <VariableListItem key={v.spec.name} spec={v.spec} />\n ))}\n </>\n );\n}\n\nexport function VariableListItem({ spec, source }: { spec: VariableSpec; source?: string }): ReactElement | null {\n const ctx = useVariableDefinitionAndState(spec.name, source);\n if (ctx.state?.overridden) {\n return null;\n }\n return (\n <Box\n key={spec.name + (source ?? '')}\n display={spec.display?.hidden ? 'none' : undefined}\n minWidth={`${MIN_VARIABLE_WIDTH}px`}\n maxWidth={`${MAX_VARIABLE_WIDTH}px`}\n flexShrink={0}\n data-testid={'variable-' + spec.name}\n >\n <Variable key={spec.name + (source ?? '')} name={spec.name} source={source} />\n </Box>\n );\n}\n"],"names":["Box","useExternalVariableDefinitions","useVariableDefinitionAndState","useVariableDefinitions","MAX_VARIABLE_WIDTH","MIN_VARIABLE_WIDTH","Variable","VariableList","variableDefinitions","externalVariableDefinitions","slice","reverse","map","def","definitions","v","VariableListItem","spec","source","name","ctx","state","overridden","display","hidden","undefined","minWidth","maxWidth","flexShrink","data-testid"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,GAAG,QAAQ,gBAAgB;AAGpC,SAASC,8BAA8B,EAAEC,6BAA6B,EAAEC,sBAAsB,QAAQ,gBAAgB;AACtH,SAASC,kBAAkB,EAAEC,kBAAkB,QAAQ,kBAAkB;AACzE,SAASC,QAAQ,QAAQ,aAAa;AAEtC,OAAO,SAASC;IACd,MAAMC,sBAA4CL;IAClD,MAAMM,8BAA4DR;IAElE,qBACE;;YACGQ,4BACEC,KAAK,GACLC,OAAO,GAAG,iDAAiD;aAC3DC,GAAG,CAAC,CAACC,MACJA,IAAIC,WAAW,CAACF,GAAG,CAAC,CAACG,kBACnB,KAACC;wBAAgDC,MAAMF,EAAEE,IAAI;wBAAEC,QAAQL,IAAIK,MAAM;uBAA1DH,EAAEE,IAAI,CAACE,IAAI,GAAGN,IAAIK,MAAM;YAGpDV,oBAAoBI,GAAG,CAAC,CAACG,kBACxB,KAACC;oBAAmCC,MAAMF,EAAEE,IAAI;mBAAzBF,EAAEE,IAAI,CAACE,IAAI;;;AAI1C;AAEA,OAAO,SAASH,iBAAiB,EAAEC,IAAI,EAAEC,MAAM,EAA2C;IACxF,MAAME,MAAMlB,8BAA8Be,KAAKE,IAAI,EAAED;IACrD,IAAIE,IAAIC,KAAK,EAAEC,YAAY;QACzB,OAAO;IACT;IACA,qBACE,KAACtB;QAECuB,SAASN,KAAKM,OAAO,EAAEC,SAAS,SAASC;QACzCC,UAAU,GAAGrB,mBAAmB,EAAE,CAAC;QACnCsB,UAAU,GAAGvB,mBAAmB,EAAE,CAAC;QACnCwB,YAAY;QACZC,eAAa,cAAcZ,KAAKE,IAAI;kBAEpC,cAAA,KAACb;YAA0Ca,MAAMF,KAAKE,IAAI;YAAED,QAAQA;WAArDD,KAAKE,IAAI,GAAID,CAAAA,UAAU,EAAC;OAPlCD,KAAKE,IAAI,GAAID,CAAAA,UAAU,EAAC;AAUnC"}
1
+ {"version":3,"sources":["../../../src/components/Variables/VariableList.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box } from '@mui/material';\nimport { VariableDefinition, VariableSpec } from '@perses-dev/spec';\nimport { ReactElement } from 'react';\nimport { ExternalVariableDefinition } from '../../model/VariableDefinition';\nimport { useExternalVariableDefinitions, useVariableDefinitionAndState, useVariableDefinitions } from '../../context';\nimport { MAX_VARIABLE_WIDTH, MIN_VARIABLE_WIDTH } from '../../constants';\nimport { Variable } from './Variable';\n\nexport function VariableList(): ReactElement {\n const variableDefinitions: VariableDefinition[] = useVariableDefinitions();\n const externalVariableDefinitions: ExternalVariableDefinition[] = useExternalVariableDefinitions();\n\n return (\n <>\n {externalVariableDefinitions\n .slice()\n .reverse() // We reverse to have the most prioritized on top\n .map((def) =>\n def.definitions.map((v) => (\n <VariableListItem key={v.spec.name + def.source} spec={v.spec} source={def.source} />\n ))\n )}\n {variableDefinitions.map((v) => (\n <VariableListItem key={v.spec.name} spec={v.spec} />\n ))}\n </>\n );\n}\n\nexport function VariableListItem({ spec, source }: { spec: VariableSpec; source?: string }): ReactElement | null {\n const ctx = useVariableDefinitionAndState(spec.name, source);\n if (ctx.state?.overridden) {\n return null;\n }\n return (\n <Box\n key={spec.name + (source ?? '')}\n display={spec.display?.hidden ? 'none' : undefined}\n minWidth={`${MIN_VARIABLE_WIDTH}px`}\n maxWidth={`${MAX_VARIABLE_WIDTH}px`}\n flexShrink={0}\n data-testid={'variable-' + spec.name}\n >\n <Variable key={spec.name + (source ?? '')} name={spec.name} source={source} />\n </Box>\n );\n}\n"],"names":["Box","useExternalVariableDefinitions","useVariableDefinitionAndState","useVariableDefinitions","MAX_VARIABLE_WIDTH","MIN_VARIABLE_WIDTH","Variable","VariableList","variableDefinitions","externalVariableDefinitions","slice","reverse","map","def","definitions","v","VariableListItem","spec","source","name","ctx","state","overridden","display","hidden","undefined","minWidth","maxWidth","flexShrink","data-testid"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,GAAG,QAAQ,gBAAgB;AAIpC,SAASC,8BAA8B,EAAEC,6BAA6B,EAAEC,sBAAsB,QAAQ,gBAAgB;AACtH,SAASC,kBAAkB,EAAEC,kBAAkB,QAAQ,kBAAkB;AACzE,SAASC,QAAQ,QAAQ,aAAa;AAEtC,OAAO,SAASC;IACd,MAAMC,sBAA4CL;IAClD,MAAMM,8BAA4DR;IAElE,qBACE;;YACGQ,4BACEC,KAAK,GACLC,OAAO,GAAG,iDAAiD;aAC3DC,GAAG,CAAC,CAACC,MACJA,IAAIC,WAAW,CAACF,GAAG,CAAC,CAACG,kBACnB,KAACC;wBAAgDC,MAAMF,EAAEE,IAAI;wBAAEC,QAAQL,IAAIK,MAAM;uBAA1DH,EAAEE,IAAI,CAACE,IAAI,GAAGN,IAAIK,MAAM;YAGpDV,oBAAoBI,GAAG,CAAC,CAACG,kBACxB,KAACC;oBAAmCC,MAAMF,EAAEE,IAAI;mBAAzBF,EAAEE,IAAI,CAACE,IAAI;;;AAI1C;AAEA,OAAO,SAASH,iBAAiB,EAAEC,IAAI,EAAEC,MAAM,EAA2C;IACxF,MAAME,MAAMlB,8BAA8Be,KAAKE,IAAI,EAAED;IACrD,IAAIE,IAAIC,KAAK,EAAEC,YAAY;QACzB,OAAO;IACT;IACA,qBACE,KAACtB;QAECuB,SAASN,KAAKM,OAAO,EAAEC,SAAS,SAASC;QACzCC,UAAU,GAAGrB,mBAAmB,EAAE,CAAC;QACnCsB,UAAU,GAAGvB,mBAAmB,EAAE,CAAC;QACnCwB,YAAY;QACZC,eAAa,cAAcZ,KAAKE,IAAI;kBAEpC,cAAA,KAACb;YAA0Ca,MAAMF,KAAKE,IAAI;YAAED,QAAQA;WAArDD,KAAKE,IAAI,GAAID,CAAAA,UAAU,EAAC;OAPlCD,KAAKE,IAAI,GAAID,CAAAA,UAAU,EAAC;AAUnC"}
@@ -1,6 +1,8 @@
1
1
  export * from './AddGroupButton';
2
2
  export * from './AddPanelButton';
3
3
  export * from './Dashboard';
4
+ export * from './DashboardLinks';
5
+ export * from './DashboardShortcuts';
4
6
  export * from './DashboardToolbar';
5
7
  export * from './DashboardStickyToolbar';
6
8
  export * from './Datasources';
@@ -1 +1 @@
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,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oCAAoC,CAAC;AACnD,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iCAAiC,CAAC;AAChD,cAAc,uBAAuB,CAAC;AACtC,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,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oCAAoC,CAAC;AACnD,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iCAAiC,CAAC;AAChD,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC"}
@@ -13,6 +13,8 @@
13
13
  export * from './AddGroupButton';
14
14
  export * from './AddPanelButton';
15
15
  export * from './Dashboard';
16
+ export * from './DashboardLinks';
17
+ export * from './DashboardShortcuts';
16
18
  export * from './DashboardToolbar';
17
19
  export * from './DashboardStickyToolbar';
18
20
  export * from './Datasources';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/index.ts"],"sourcesContent":["// Copyright 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 './DashboardStickyToolbar';\nexport * from './Datasources';\nexport * from './DeletePanelDialog';\nexport * from './DeletePanelGroupDialog';\nexport * from './DiscardChangesConfirmationDialog';\nexport * from './DownloadButton';\nexport * from './EditJsonDialog';\nexport * from './EditJsonButton';\nexport * from './EmptyDashboard';\nexport * from './GridLayout';\nexport * from './LeaveDialog';\nexport * from './Panel';\nexport * from './PanelDrawer';\nexport * from './PanelGroupDialog';\nexport * from './QuerySummaryTable';\nexport * from './QueryViewerDialog';\nexport * from './SaveChangesConfirmationDialog';\nexport * from './SaveDashboardButton';\nexport * from './Variables';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,mBAAmB;AACjC,cAAc,mBAAmB;AACjC,cAAc,cAAc;AAC5B,cAAc,qBAAqB;AACnC,cAAc,2BAA2B;AACzC,cAAc,gBAAgB;AAC9B,cAAc,sBAAsB;AACpC,cAAc,2BAA2B;AACzC,cAAc,qCAAqC;AACnD,cAAc,mBAAmB;AACjC,cAAc,mBAAmB;AACjC,cAAc,mBAAmB;AACjC,cAAc,mBAAmB;AACjC,cAAc,eAAe;AAC7B,cAAc,gBAAgB;AAC9B,cAAc,UAAU;AACxB,cAAc,gBAAgB;AAC9B,cAAc,qBAAqB;AACnC,cAAc,sBAAsB;AACpC,cAAc,sBAAsB;AACpC,cAAc,kCAAkC;AAChD,cAAc,wBAAwB;AACtC,cAAc,cAAc"}
1
+ {"version":3,"sources":["../../src/components/index.ts"],"sourcesContent":["// Copyright 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 './DashboardLinks';\nexport * from './DashboardShortcuts';\nexport * from './DashboardToolbar';\nexport * from './DashboardStickyToolbar';\nexport * from './Datasources';\nexport * from './DeletePanelDialog';\nexport * from './DeletePanelGroupDialog';\nexport * from './DiscardChangesConfirmationDialog';\nexport * from './DownloadButton';\nexport * from './EditJsonDialog';\nexport * from './EditJsonButton';\nexport * from './EmptyDashboard';\nexport * from './GridLayout';\nexport * from './LeaveDialog';\nexport * from './Panel';\nexport * from './PanelDrawer';\nexport * from './PanelGroupDialog';\nexport * from './QuerySummaryTable';\nexport * from './QueryViewerDialog';\nexport * from './SaveChangesConfirmationDialog';\nexport * from './SaveDashboardButton';\nexport * from './Variables';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,mBAAmB;AACjC,cAAc,mBAAmB;AACjC,cAAc,cAAc;AAC5B,cAAc,mBAAmB;AACjC,cAAc,uBAAuB;AACrC,cAAc,qBAAqB;AACnC,cAAc,2BAA2B;AACzC,cAAc,gBAAgB;AAC9B,cAAc,sBAAsB;AACpC,cAAc,2BAA2B;AACzC,cAAc,qCAAqC;AACnD,cAAc,mBAAmB;AACjC,cAAc,mBAAmB;AACjC,cAAc,mBAAmB;AACjC,cAAc,mBAAmB;AACjC,cAAc,eAAe;AAC7B,cAAc,gBAAgB;AAC9B,cAAc,UAAU;AACxB,cAAc,gBAAgB;AAC9B,cAAc,qBAAqB;AACnC,cAAc,sBAAsB;AACpC,cAAc,sBAAsB;AACpC,cAAc,kCAAkC;AAChD,cAAc,wBAAwB;AACtC,cAAc,cAAc"}
@@ -0,0 +1,4 @@
1
+ import { DurationString } from '@perses-dev/spec';
2
+ export declare const DEFAULT_DASHBOARD_DURATION: DurationString;
3
+ export declare const DEFAULT_REFRESH_INTERVAL: DurationString;
4
+ //# sourceMappingURL=defaults.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/constants/defaults.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,eAAO,MAAM,0BAA0B,EAAE,cAAqB,CAAC;AAE/D,eAAO,MAAM,wBAAwB,EAAE,cAAqB,CAAC"}
@@ -0,0 +1,16 @@
1
+ // Copyright 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 DEFAULT_DASHBOARD_DURATION = '1h';
14
+ export const DEFAULT_REFRESH_INTERVAL = '0s';
15
+
16
+ //# sourceMappingURL=defaults.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/constants/defaults.ts"],"sourcesContent":["// Copyright 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 { DurationString } from '@perses-dev/spec';\n\nexport const DEFAULT_DASHBOARD_DURATION: DurationString = '1h';\n\nexport const DEFAULT_REFRESH_INTERVAL: DurationString = '0s';\n"],"names":["DEFAULT_DASHBOARD_DURATION","DEFAULT_REFRESH_INTERVAL"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,OAAO,MAAMA,6BAA6C,KAAK;AAE/D,OAAO,MAAMC,2BAA2C,KAAK"}
@@ -1,4 +1,5 @@
1
1
  export * from './grid-layout-config';
2
2
  export * from './styles';
3
3
  export * from './user-interface-text';
4
+ export * from './defaults';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":"AAaA,cAAc,sBAAsB,CAAC;AACrC,cAAc,UAAU,CAAC;AACzB,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":"AAaA,cAAc,sBAAsB,CAAC;AACrC,cAAc,UAAU,CAAC;AACzB,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC"}
@@ -13,5 +13,6 @@
13
13
  export * from './grid-layout-config';
14
14
  export * from './styles';
15
15
  export * from './user-interface-text';
16
+ export * from './defaults';
16
17
 
17
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/constants/index.ts"],"sourcesContent":["// Copyright 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 './styles';\nexport * from './user-interface-text';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,uBAAuB;AACrC,cAAc,WAAW;AACzB,cAAc,wBAAwB"}
1
+ {"version":3,"sources":["../../src/constants/index.ts"],"sourcesContent":["// Copyright 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 './styles';\nexport * from './user-interface-text';\nexport * from './defaults';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,uBAAuB;AACrC,cAAc,WAAW;AACzB,cAAc,wBAAwB;AACtC,cAAc,aAAa"}
@@ -3,6 +3,7 @@ export declare const TOOLTIP_TEXT: {
3
3
  addGroup: string;
4
4
  editDatasources: string;
5
5
  editJson: string;
6
+ editLinks: string;
6
7
  editVariables: string;
7
8
  viewJson: string;
8
9
  addPanelToGroup: string;
@@ -1 +1 @@
1
- {"version":3,"file":"user-interface-text.d.ts","sourceRoot":"","sources":["../../src/constants/user-interface-text.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;CAwBxB,CAAC;AAEF,eAAO,MAAM,eAAe;iCAEG,MAAM,KAAG,MAAM;6BACnB,MAAM,KAAG,MAAM;2BACjB,MAAM,KAAG,MAAM;+BACX,MAAM,KAAG,MAAM;6BACjB,MAAM,KAAG,MAAM;4BAEhB,MAAM,KAAG,MAAM;4BAEf,MAAM,KAAG,MAAM;iCACV,MAAM,KAAG,MAAM;8BAClB,MAAM,KAAG,MAAM;mCACV,MAAM,KAAG,MAAM;4BAEtB,MAAM,KAAG,MAAM;gCACX,MAAM,KAAG,MAAM;CAE5C,CAAC"}
1
+ {"version":3,"file":"user-interface-text.d.ts","sourceRoot":"","sources":["../../src/constants/user-interface-text.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;CAyBxB,CAAC;AAEF,eAAO,MAAM,eAAe;iCAEG,MAAM,KAAG,MAAM;6BACnB,MAAM,KAAG,MAAM;2BACjB,MAAM,KAAG,MAAM;+BACX,MAAM,KAAG,MAAM;6BACjB,MAAM,KAAG,MAAM;4BAEhB,MAAM,KAAG,MAAM;4BAEf,MAAM,KAAG,MAAM;iCACV,MAAM,KAAG,MAAM;8BAClB,MAAM,KAAG,MAAM;mCACV,MAAM,KAAG,MAAM;4BAEtB,MAAM,KAAG,MAAM;gCACX,MAAM,KAAG,MAAM;CAE5C,CAAC"}
@@ -16,6 +16,7 @@ export const TOOLTIP_TEXT = {
16
16
  addGroup: 'Add panel group',
17
17
  editDatasources: 'Edit datasources',
18
18
  editJson: 'Edit JSON',
19
+ editLinks: 'Edit links',
19
20
  editVariables: 'Edit variables',
20
21
  viewJson: 'View JSON',
21
22
  // Group buttons
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/constants/user-interface-text.ts"],"sourcesContent":["// Copyright 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 editDatasources: 'Edit datasources',\n editJson: 'Edit JSON',\n editVariables: 'Edit variables',\n viewJson: 'View JSON',\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 viewPanel: 'Toggle View Mode',\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 queryView: 'Open query view',\n};\n\nexport const ARIA_LABEL_TEXT = {\n // Group buttons\n addPanelToGroup: (groupName: string): string => `add panel to group ${groupName}`,\n deleteGroup: (groupName: string): string => `delete group ${groupName}`,\n editGroup: (groupName: string): string => `edit group ${groupName}`,\n moveGroupDown: (groupName: string): string => `move group ${groupName} down`,\n moveGroupUp: (groupName: string): string => `move group ${groupName} up`,\n // Panel buttons\n viewPanel: (panelName?: string): string =>\n panelName ? `toggle panel ${panelName} view mode` : 'toggle panel view mode',\n editPanel: (panelName?: string): string => (panelName ? `edit panel ${panelName}` : 'edit panel'),\n duplicatePanel: (panelName?: string): string => (panelName ? `duplicate panel ${panelName}` : 'duplicate panel'),\n deletePanel: (panelName?: string): string => (panelName ? `delete panel ${panelName}` : 'delete panel'),\n showPanelActions: (panelName?: string): string =>\n panelName ? `show panel actions for ${panelName}` : 'show panel actions',\n movePanel: (panelName?: string): string => (panelName ? `move panel ${panelName}` : 'move panel'),\n openQueryView: (panelName?: string): string =>\n panelName ? `open query view for panel ${panelName}` : 'open query view for panel',\n};\n"],"names":["TOOLTIP_TEXT","addPanel","addGroup","editDatasources","editJson","editVariables","viewJson","addPanelToGroup","deleteGroup","editGroup","moveGroupDown","moveGroupUp","viewPanel","editPanel","duplicatePanel","deletePanel","movePanel","refreshVariableValues","copyVariableValues","queryView","ARIA_LABEL_TEXT","groupName","panelName","showPanelActions","openQueryView"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACt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AAE"}
1
+ {"version":3,"sources":["../../src/constants/user-interface-text.ts"],"sourcesContent":["// Copyright 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 editDatasources: 'Edit datasources',\n editJson: 'Edit JSON',\n editLinks: 'Edit links',\n editVariables: 'Edit variables',\n viewJson: 'View JSON',\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 viewPanel: 'Toggle View Mode',\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 queryView: 'Open query view',\n};\n\nexport const ARIA_LABEL_TEXT = {\n // Group buttons\n addPanelToGroup: (groupName: string): string => `add panel to group ${groupName}`,\n deleteGroup: (groupName: string): string => `delete group ${groupName}`,\n editGroup: (groupName: string): string => `edit group ${groupName}`,\n moveGroupDown: (groupName: string): string => `move group ${groupName} down`,\n moveGroupUp: (groupName: string): string => `move group ${groupName} up`,\n // Panel buttons\n viewPanel: (panelName?: string): string =>\n panelName ? `toggle panel ${panelName} view mode` : 'toggle panel view mode',\n editPanel: (panelName?: string): string => (panelName ? `edit panel ${panelName}` : 'edit panel'),\n duplicatePanel: (panelName?: string): string => (panelName ? `duplicate panel ${panelName}` : 'duplicate panel'),\n deletePanel: (panelName?: string): string => (panelName ? `delete panel ${panelName}` : 'delete panel'),\n showPanelActions: (panelName?: string): string =>\n panelName ? `show panel actions for ${panelName}` : 'show panel actions',\n movePanel: (panelName?: string): string => (panelName ? `move panel ${panelName}` : 'move panel'),\n openQueryView: (panelName?: string): string =>\n panelName ? `open query view for panel ${panelName}` : 'open query view for panel',\n};\n"],"names":["TOOLTIP_TEXT","addPanel","addGroup","editDatasources","editJson","editLinks","editVariables","viewJson","addPanelToGroup","deleteGroup","editGroup","moveGroupDown","moveGroupUp","viewPanel","editPanel","duplicatePanel","deletePanel","movePanel","refreshVariableValues","copyVariableValues","queryView","ARIA_LABEL_TEXT","groupName","panelName","showPanelActions","openQueryView"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,OAAO,MAAMA,eAAe;IAC1B,kBAAkB;IAClBC,UAAU;IACVC,UAAU;IACVC,iBAAiB;IACjBC,UAAU;IACVC,WAAW;IACXC,eAAe;IACfC,UAAU;IACV,gBAAgB;IAChBC,iBAAiB;IACjBC,aAAa;IACbC,WAAW;IACXC,eAAe;IACfC,aAAa;IACb,gBAAgB;IAChBC,WAAW;IACXC,WAAW;IACXC,gBAAgB;IAChBC,aAAa;IACbC,WAAW;IACX,0BAA0B;IAC1BC,uBAAuB;IACvBC,oBAAoB;IACpBC,WAAW;AACb,EAAE;AAEF,OAAO,MAAMC,kBAAkB;IAC7B,gBAAgB;IAChBb,iBAAiB,CAACc,YAA8B,CAAC,mBAAmB,EAAEA,WAAW;IACjFb,aAAa,CAACa,YAA8B,CAAC,aAAa,EAAEA,WAAW;IACvEZ,WAAW,CAACY,YAA8B,CAAC,WAAW,EAAEA,WAAW;IACnEX,eAAe,CAACW,YAA8B,CAAC,WAAW,EAAEA,UAAU,KAAK,CAAC;IAC5EV,aAAa,CAACU,YAA8B,CAAC,WAAW,EAAEA,UAAU,GAAG,CAAC;IACxE,gBAAgB;IAChBT,WAAW,CAACU,YACVA,YAAY,CAAC,aAAa,EAAEA,UAAU,UAAU,CAAC,GAAG;IACtDT,WAAW,CAACS,YAAgCA,YAAY,CAAC,WAAW,EAAEA,WAAW,GAAG;IACpFR,gBAAgB,CAACQ,YAAgCA,YAAY,CAAC,gBAAgB,EAAEA,WAAW,GAAG;IAC9FP,aAAa,CAACO,YAAgCA,YAAY,CAAC,aAAa,EAAEA,WAAW,GAAG;IACxFC,kBAAkB,CAACD,YACjBA,YAAY,CAAC,uBAAuB,EAAEA,WAAW,GAAG;IACtDN,WAAW,CAACM,YAAgCA,YAAY,CAAC,WAAW,EAAEA,WAAW,GAAG;IACpFE,eAAe,CAACF,YACdA,YAAY,CAAC,0BAA0B,EAAEA,WAAW,GAAG;AAC3D,EAAE"}
@@ -1,6 +1,7 @@
1
1
  import type { StoreApi } from 'zustand';
2
2
  import { ReactElement, ReactNode } from 'react';
3
- import { DashboardResource, Display, ProjectMetadata, DurationString, DatasourceSpec, EphemeralDashboardResource } from '@perses-dev/core';
3
+ import { Display, DurationString, DatasourceSpec } from '@perses-dev/spec';
4
+ import { DashboardMetaData, DashboardKind, DashboardResource } from '../../model/DashboardResource';
4
5
  import { PanelGroupEditorSlice } from './panel-group-editor-slice';
5
6
  import { PanelGroupSlice } from './panel-group-slice';
6
7
  import { PanelEditorSlice } from './panel-editor-slice';
@@ -12,12 +13,13 @@ import { SaveChangesConfirmationDialogSlice } from './save-changes-dialog-slice'
12
13
  import { DuplicatePanelSlice } from './duplicate-panel-slice';
13
14
  import { EditJsonDialogSlice } from './edit-json-dialog-slice';
14
15
  import { ViewPanelSlice, VirtualPanelRef } from './view-panel-slice';
15
- export interface DashboardStoreState extends PanelGroupSlice, PanelSlice, PanelGroupEditorSlice, DeletePanelGroupSlice, PanelEditorSlice, DeletePanelSlice, DiscardChangesConfirmationDialogSlice, DuplicatePanelSlice, EditJsonDialogSlice, SaveChangesConfirmationDialogSlice, ViewPanelSlice {
16
+ import { LinksSlice } from './links-slice';
17
+ export interface DashboardStoreState extends PanelGroupSlice, PanelSlice, PanelGroupEditorSlice, DeletePanelGroupSlice, PanelEditorSlice, DeletePanelSlice, DiscardChangesConfirmationDialogSlice, DuplicatePanelSlice, EditJsonDialogSlice, SaveChangesConfirmationDialogSlice, ViewPanelSlice, LinksSlice {
16
18
  isEditMode: boolean;
17
19
  setEditMode: (isEditMode: boolean) => void;
18
- setDashboard: (dashboard: DashboardResource | EphemeralDashboardResource) => void;
19
- kind: DashboardResource['kind'] | EphemeralDashboardResource['kind'];
20
- metadata: ProjectMetadata;
20
+ setDashboard: (dashboard: DashboardResource) => void;
21
+ kind: DashboardKind;
22
+ metadata: DashboardMetaData;
21
23
  duration: DurationString;
22
24
  refreshInterval: DurationString;
23
25
  display?: Display;
@@ -27,7 +29,7 @@ export interface DashboardStoreState extends PanelGroupSlice, PanelSlice, PanelG
27
29
  export declare const DashboardContext: import("react").Context<StoreApi<DashboardStoreState> | undefined>;
28
30
  export declare function useDashboardStore<T>(selector: (state: DashboardStoreState) => T): T;
29
31
  export interface DashboardStoreProps {
30
- dashboardResource: DashboardResource | EphemeralDashboardResource;
32
+ dashboardResource: DashboardResource;
31
33
  isEditMode?: boolean;
32
34
  viewPanelRef?: VirtualPanelRef;
33
35
  setViewPanelRef?: (viewPanelRef: VirtualPanelRef | undefined) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"DashboardProvider.d.ts","sourceRoot":"","sources":["../../../src/context/DashboardProvider/DashboardProvider.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAIxC,OAAO,EAAiB,YAAY,EAAE,SAAS,EAAgD,MAAM,OAAO,CAAC;AAC7G,OAAO,EACL,iBAAiB,EACjB,OAAO,EACP,eAAe,EACf,cAAc,EAEd,cAAc,EACd,0BAA0B,EAC3B,MAAM,kBAAkB,CAAC;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C,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,eAAe,CAAC;IAC/B,eAAe,CAAC,EAAE,CAAC,YAAY,EAAE,eAAe,GAAG,SAAS,KAAK,IAAI,CAAC;CACvE;AAED,MAAM,WAAW,sBAAsB;IACrC,YAAY,EAAE,mBAAmB,CAAC;IAClC,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,GAAG,YAAY,CA0B7E"}
@@ -17,8 +17,8 @@ import { devtools } from 'zustand/middleware';
17
17
  import { immer } from 'zustand/middleware/immer';
18
18
  import { shallow } from 'zustand/shallow';
19
19
  import { createContext, useCallback, useContext, useEffect, useState } from 'react';
20
- import { DEFAULT_REFRESH_INTERVAL } from '@perses-dev/core';
21
20
  import { usePlugin, usePluginRegistry } from '@perses-dev/plugin-system';
21
+ import { DEFAULT_REFRESH_INTERVAL } from '../../constants';
22
22
  import { createPanelGroupEditorSlice } from './panel-group-editor-slice';
23
23
  import { convertLayoutsToPanelGroups, createPanelGroupSlice } from './panel-group-slice';
24
24
  import { createPanelEditorSlice } from './panel-editor-slice';
@@ -31,6 +31,7 @@ import { createDuplicatePanelSlice } from './duplicate-panel-slice';
31
31
  import { createEditJsonDialogSlice } from './edit-json-dialog-slice';
32
32
  import { createPanelDefinition } from './common';
33
33
  import { createViewPanelSlice } from './view-panel-slice';
34
+ import { createLinksSlice } from './links-slice';
34
35
  export const DashboardContext = /*#__PURE__*/ createContext(undefined);
35
36
  export function useDashboardStore(selector) {
36
37
  const store = useContext(DashboardContext);
@@ -71,6 +72,7 @@ export function DashboardProvider(props) {
71
72
  function initStore(props) {
72
73
  const { initialState: { dashboardResource, isEditMode, viewPanelRef, setViewPanelRef } } = props;
73
74
  const { kind, metadata, spec: { display, duration, refreshInterval = DEFAULT_REFRESH_INTERVAL, datasources, layouts = [], panels = {} } } = dashboardResource;
75
+ const links = dashboardResource.spec.links ?? [];
74
76
  const ttl = 'ttl' in dashboardResource.spec ? dashboardResource.spec.ttl : undefined;
75
77
  const store = createStore()(immer(devtools((...args)=>{
76
78
  const [set] = args;
@@ -83,6 +85,7 @@ function initStore(props) {
83
85
  ...createDeletePanelSlice()(...args),
84
86
  ...createDuplicatePanelSlice()(...args),
85
87
  ...createViewPanelSlice(viewPanelRef, setViewPanelRef)(...args),
88
+ /* Links */ ...createLinksSlice(links)(...args),
86
89
  /* General */ ...createDiscardChangesDialogSlice(...args),
87
90
  ...createEditJsonDialogSlice(...args),
88
91
  ...createSaveChangesDialogSlice(...args),
@@ -99,7 +102,7 @@ function initStore(props) {
99
102
  isEditMode
100
103
  });
101
104
  },
102
- setDashboard: ({ kind, metadata, spec: { display, panels = {}, layouts = [], duration, refreshInterval, datasources = {} } })=>{
105
+ setDashboard: ({ kind, metadata, spec: { display, panels = {}, layouts = [], duration, refreshInterval, datasources = {}, links = [] } })=>{
103
106
  set((state)=>{
104
107
  state.kind = kind;
105
108
  state.metadata = metadata;
@@ -111,6 +114,7 @@ function initStore(props) {
111
114
  state.duration = duration;
112
115
  state.refreshInterval = refreshInterval ?? DEFAULT_REFRESH_INTERVAL;
113
116
  state.datasources = datasources;
117
+ state.links = links;
114
118
  // TODO: add ttl here to e.g allow edition from JSON view, but probably requires quite some refactoring
115
119
  });
116
120
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/context/DashboardProvider/DashboardProvider.tsx"],"sourcesContent":["// Copyright 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 } from 'zustand';\nimport { useStoreWithEqualityFn } from 'zustand/traditional';\nimport type { StoreApi } from 'zustand';\nimport { devtools } from 'zustand/middleware';\nimport { immer } from 'zustand/middleware/immer';\nimport { shallow } from 'zustand/shallow';\nimport { createContext, ReactElement, ReactNode, useCallback, useContext, useEffect, useState } from 'react';\nimport {\n DashboardResource,\n Display,\n ProjectMetadata,\n DurationString,\n DEFAULT_REFRESH_INTERVAL,\n DatasourceSpec,\n EphemeralDashboardResource,\n} 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 { createSaveChangesDialogSlice, SaveChangesConfirmationDialogSlice } from './save-changes-dialog-slice';\nimport { createDuplicatePanelSlice, DuplicatePanelSlice } from './duplicate-panel-slice';\nimport { createEditJsonDialogSlice, EditJsonDialogSlice } from './edit-json-dialog-slice';\nimport { createPanelDefinition } from './common';\nimport { createViewPanelSlice, ViewPanelSlice, VirtualPanelRef } from './view-panel-slice';\n\nexport interface DashboardStoreState\n extends PanelGroupSlice,\n PanelSlice,\n PanelGroupEditorSlice,\n DeletePanelGroupSlice,\n PanelEditorSlice,\n DeletePanelSlice,\n DiscardChangesConfirmationDialogSlice,\n DuplicatePanelSlice,\n EditJsonDialogSlice,\n SaveChangesConfirmationDialogSlice,\n ViewPanelSlice {\n isEditMode: boolean;\n setEditMode: (isEditMode: boolean) => void;\n setDashboard: (dashboard: DashboardResource | EphemeralDashboardResource) => void;\n kind: DashboardResource['kind'] | EphemeralDashboardResource['kind'];\n metadata: ProjectMetadata;\n duration: DurationString;\n refreshInterval: DurationString;\n display?: Display;\n datasources?: Record<string, DatasourceSpec>;\n ttl?: DurationString;\n}\n\nexport const DashboardContext = createContext<StoreApi<DashboardStoreState> | undefined>(undefined);\n\nexport function useDashboardStore<T>(selector: (state: DashboardStoreState) => T): 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 useStoreWithEqualityFn(store, selector, shallow);\n}\n\nexport interface DashboardStoreProps {\n dashboardResource: DashboardResource | EphemeralDashboardResource;\n isEditMode?: boolean;\n viewPanelRef?: VirtualPanelRef;\n setViewPanelRef?: (viewPanelRef: VirtualPanelRef | undefined) => void;\n}\n\nexport interface DashboardProviderProps {\n initialState: DashboardStoreProps;\n children?: ReactNode;\n}\n\nexport function DashboardProvider(props: DashboardProviderProps): ReactElement {\n // Prevent calling createDashboardStore every time it rerenders\n const createDashboardStore = useCallback(initStore, [props]);\n const [store] = useState(createDashboardStore(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 useEffect(() => {\n if (plugin === undefined) return;\n const defaultPanelSpec = plugin.createInitialOptions ? plugin.createInitialOptions() : {};\n // set default panel kind, spec, and queries for add panel editor\n store.setState({\n initialValues: {\n panelDefinition: createPanelDefinition(defaultPanelKind, defaultPanelSpec),\n },\n });\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): StoreApi<DashboardStoreState> {\n const {\n initialState: { dashboardResource, isEditMode, viewPanelRef, setViewPanelRef },\n } = props;\n\n const {\n kind,\n metadata,\n spec: { display, duration, refreshInterval = DEFAULT_REFRESH_INTERVAL, datasources, layouts = [], panels = {} },\n } = dashboardResource;\n\n const ttl = 'ttl' in dashboardResource.spec ? dashboardResource.spec.ttl : undefined;\n\n const store = createStore<DashboardStoreState>()(\n immer(\n devtools((...args) => {\n const [set] = args;\n return {\n /* Groups */\n ...createPanelGroupSlice(layouts)(...args),\n ...createPanelGroupEditorSlice(...args),\n ...createDeletePanelGroupSlice(...args),\n /* Panels */\n ...createPanelSlice(panels)(...args),\n ...createPanelEditorSlice()(...args),\n ...createDeletePanelSlice()(...args),\n ...createDuplicatePanelSlice()(...args),\n ...createViewPanelSlice(viewPanelRef, setViewPanelRef)(...args),\n /* General */\n ...createDiscardChangesDialogSlice(...args),\n ...createEditJsonDialogSlice(...args),\n ...createSaveChangesDialogSlice(...args),\n kind,\n metadata,\n display,\n duration,\n refreshInterval,\n datasources,\n ttl,\n isEditMode: !!isEditMode,\n setEditMode: (isEditMode: boolean): void => {\n set({ isEditMode });\n },\n setDashboard: ({\n kind,\n metadata,\n spec: { display, panels = {}, layouts = [], duration, refreshInterval, datasources = {} },\n }): void => {\n set((state) => {\n state.kind = kind;\n state.metadata = metadata;\n state.display = display;\n state.panels = panels;\n const { panelGroups, panelGroupOrder } = convertLayoutsToPanelGroups(layouts);\n state.panelGroups = panelGroups;\n state.panelGroupOrder = panelGroupOrder;\n state.duration = duration;\n state.refreshInterval = refreshInterval ?? DEFAULT_REFRESH_INTERVAL;\n state.datasources = datasources;\n // TODO: add ttl here to e.g allow edition from JSON view, but probably requires quite some refactoring\n });\n },\n };\n })\n )\n );\n\n return store;\n}\n"],"names":["createStore","useStoreWithEqualityFn","devtools","immer","shallow","createContext","useCallback","useContext","useEffect","useState","DEFAULT_REFRESH_INTERVAL","usePlugin","usePluginRegistry","createPanelGroupEditorSlice","convertLayoutsToPanelGroups","createPanelGroupSlice","createPanelEditorSlice","createPanelSlice","createDeletePanelGroupSlice","createDeletePanelSlice","createDiscardChangesDialogSlice","createSaveChangesDialogSlice","createDuplicatePanelSlice","createEditJsonDialogSlice","createPanelDefinition","createViewPanelSlice","DashboardContext","undefined","useDashboardStore","selector","store","Error","DashboardProvider","props","createDashboardStore","initStore","defaultPluginKinds","defaultPanelKind","data","plugin","defaultPanelSpec","createInitialOptions","setState","initialValues","panelDefinition","Provider","value","children","initialState","dashboardResource","isEditMode","viewPanelRef","setViewPanelRef","kind","metadata","spec","display","duration","refreshInterval","datasources","layouts","panels","ttl","args","set","setEditMode","setDashboard","state","panelGroups","panelGroupOrder"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,WAAW,QAAQ,UAAU;AACtC,SAASC,sBAAsB,QAAQ,sBAAsB;AAE7D,SAASC,QAAQ,QAAQ,qBAAqB;AAC9C,SAASC,KAAK,QAAQ,2BAA2B;AACjD,SAASC,OAAO,QAAQ,kBAAkB;AAC1C,SAASC,aAAa,EAA2BC,WAAW,EAAEC,UAAU,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,QAAQ;AAC7G,SAKEC,wBAAwB,QAGnB,mBAAmB;AAC1B,SAASC,SAAS,EAAEC,iBAAiB,QAAQ,4BAA4B;AACzE,SAASC,2BAA2B,QAA+B,6BAA6B;AAChG,SAASC,2BAA2B,EAAEC,qBAAqB,QAAyB,sBAAsB;AAC1G,SAASC,sBAAsB,QAA0B,uBAAuB;AAChF,SAASC,gBAAgB,QAAoB,gBAAgB;AAC7D,SAASC,2BAA2B,QAA+B,6BAA6B;AAChG,SAASC,sBAAsB,QAA0B,uBAAuB;AAChF,SAASC,+BAA+B,QAA+C,iCAAiC;AACxH,SAASC,4BAA4B,QAA4C,8BAA8B;AAC/G,SAASC,yBAAyB,QAA6B,0BAA0B;AACzF,SAASC,yBAAyB,QAA6B,2BAA2B;AAC1F,SAASC,qBAAqB,QAAQ,WAAW;AACjD,SAASC,oBAAoB,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A;gBACpB,uGAAuG;gBACzG;YACF;QACF;IACF;IAIJ,OAAO7B;AACT"}
1
+ {"version":3,"sources":["../../../src/context/DashboardProvider/DashboardProvider.tsx"],"sourcesContent":["// Copyright 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 } from 'zustand';\nimport { useStoreWithEqualityFn } from 'zustand/traditional';\nimport type { StoreApi } from 'zustand';\nimport { devtools } from 'zustand/middleware';\nimport { immer } from 'zustand/middleware/immer';\nimport { shallow } from 'zustand/shallow';\nimport { createContext, ReactElement, ReactNode, useCallback, useContext, useEffect, useState } from 'react';\nimport { Display, DurationString, DatasourceSpec } from '@perses-dev/spec';\nimport { usePlugin, usePluginRegistry } from '@perses-dev/plugin-system';\nimport { DashboardMetaData, DashboardKind, DashboardResource } from '../../model/DashboardResource';\nimport { DEFAULT_REFRESH_INTERVAL } from '../../constants';\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 { createSaveChangesDialogSlice, SaveChangesConfirmationDialogSlice } from './save-changes-dialog-slice';\nimport { createDuplicatePanelSlice, DuplicatePanelSlice } from './duplicate-panel-slice';\nimport { createEditJsonDialogSlice, EditJsonDialogSlice } from './edit-json-dialog-slice';\nimport { createPanelDefinition } from './common';\nimport { createViewPanelSlice, ViewPanelSlice, VirtualPanelRef } from './view-panel-slice';\nimport { createLinksSlice, LinksSlice } from './links-slice';\n\nexport interface DashboardStoreState\n extends PanelGroupSlice,\n PanelSlice,\n PanelGroupEditorSlice,\n DeletePanelGroupSlice,\n PanelEditorSlice,\n DeletePanelSlice,\n DiscardChangesConfirmationDialogSlice,\n DuplicatePanelSlice,\n EditJsonDialogSlice,\n SaveChangesConfirmationDialogSlice,\n ViewPanelSlice,\n LinksSlice {\n isEditMode: boolean;\n setEditMode: (isEditMode: boolean) => void;\n setDashboard: (dashboard: DashboardResource) => void;\n kind: DashboardKind;\n metadata: DashboardMetaData;\n duration: DurationString;\n refreshInterval: DurationString;\n display?: Display;\n datasources?: Record<string, DatasourceSpec>;\n ttl?: DurationString;\n}\n\nexport const DashboardContext = createContext<StoreApi<DashboardStoreState> | undefined>(undefined);\n\nexport function useDashboardStore<T>(selector: (state: DashboardStoreState) => T): 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 useStoreWithEqualityFn(store, selector, shallow);\n}\n\nexport interface DashboardStoreProps {\n dashboardResource: DashboardResource;\n isEditMode?: boolean;\n viewPanelRef?: VirtualPanelRef;\n setViewPanelRef?: (viewPanelRef: VirtualPanelRef | undefined) => void;\n}\n\nexport interface DashboardProviderProps {\n initialState: DashboardStoreProps;\n children?: ReactNode;\n}\n\nexport function DashboardProvider(props: DashboardProviderProps): ReactElement {\n // Prevent calling createDashboardStore every time it rerenders\n const createDashboardStore = useCallback(initStore, [props]);\n const [store] = useState(createDashboardStore(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 useEffect(() => {\n if (plugin === undefined) return;\n const defaultPanelSpec = plugin.createInitialOptions ? plugin.createInitialOptions() : {};\n // set default panel kind, spec, and queries for add panel editor\n store.setState({\n initialValues: {\n panelDefinition: createPanelDefinition(defaultPanelKind, defaultPanelSpec),\n },\n });\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): StoreApi<DashboardStoreState> {\n const {\n initialState: { dashboardResource, isEditMode, viewPanelRef, setViewPanelRef },\n } = props;\n\n const {\n kind,\n metadata,\n spec: { display, duration, refreshInterval = DEFAULT_REFRESH_INTERVAL, datasources, layouts = [], panels = {} },\n } = dashboardResource;\n\n const links = dashboardResource.spec.links ?? [];\n\n const ttl = 'ttl' in dashboardResource.spec ? (dashboardResource.spec.ttl as DurationString) : undefined;\n\n const store = createStore<DashboardStoreState>()(\n immer(\n devtools((...args) => {\n const [set] = args;\n return {\n /* Groups */\n ...createPanelGroupSlice(layouts)(...args),\n ...createPanelGroupEditorSlice(...args),\n ...createDeletePanelGroupSlice(...args),\n /* Panels */\n ...createPanelSlice(panels)(...args),\n ...createPanelEditorSlice()(...args),\n ...createDeletePanelSlice()(...args),\n ...createDuplicatePanelSlice()(...args),\n ...createViewPanelSlice(viewPanelRef, setViewPanelRef)(...args),\n /* Links */\n ...createLinksSlice(links)(...args),\n /* General */\n ...createDiscardChangesDialogSlice(...args),\n ...createEditJsonDialogSlice(...args),\n ...createSaveChangesDialogSlice(...args),\n kind,\n metadata,\n display,\n duration,\n refreshInterval,\n datasources,\n ttl,\n isEditMode: !!isEditMode,\n setEditMode: (isEditMode: boolean): void => {\n set({ isEditMode });\n },\n setDashboard: ({\n kind,\n metadata,\n spec: { display, panels = {}, layouts = [], duration, refreshInterval, datasources = {}, links = [] },\n }): void => {\n set((state) => {\n state.kind = kind;\n state.metadata = metadata;\n state.display = display;\n state.panels = panels;\n const { panelGroups, panelGroupOrder } = convertLayoutsToPanelGroups(layouts);\n state.panelGroups = panelGroups;\n state.panelGroupOrder = panelGroupOrder;\n state.duration = duration;\n state.refreshInterval = refreshInterval ?? DEFAULT_REFRESH_INTERVAL;\n state.datasources = datasources;\n state.links = links;\n // TODO: add ttl here to e.g allow edition from JSON view, but probably requires quite some refactoring\n });\n },\n };\n })\n )\n );\n\n return store;\n}\n"],"names":["createStore","useStoreWithEqualityFn","devtools","immer","shallow","createContext","useCallback","useContext","useEffect","useState","usePlugin","usePluginRegistry","DEFAULT_REFRESH_INTERVAL","createPanelGroupEditorSlice","convertLayoutsToPanelGroups","createPanelGroupSlice","createPanelEditorSlice","createPanelSlice","createDeletePanelGroupSlice","createDeletePanelSlice","createDiscardChangesDialogSlice","createSaveChangesDialogSlice","createDuplicatePanelSlice","createEditJsonDialogSlice","createPanelDefinition","createViewPanelSlice","createLinksSlice","DashboardContext","undefined","useDashboardStore","selector","store","Error","DashboardProvider","props","createDashboardStore","initStore","defaultPluginKinds","defaultPanelKind","data","plugin","defaultPanelSpec","createInitialOptions","setState","initialValues","panelDefinition","Provider","value","children","initialState","dashboardResource","isEditMode","viewPanelRef","setViewPanelRef","kind","metadata","spec","display","duration","refreshInterval","datasources","layouts","panels","links","ttl","args","set","setEditMode","setDashboard","state","panelGroups","panelGroupOrder"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,WAAW,QAAQ,UAAU;AACtC,SAASC,sBAAsB,QAAQ,sBAAsB;AAE7D,SAASC,QAAQ,QAAQ,qBAAqB;AAC9C,SAASC,KAAK,QAAQ,2BAA2B;AACjD,SAASC,OAAO,QAAQ,kBAAkB;AAC1C,SAASC,aAAa,EAA2BC,WAAW,EAAEC,UAAU,EAAE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C3C,GAAG1C,6BAA6B0C,KAAK;YACrC,GAAG5C,gCAAgC4C,KAAK;YACxCX;YACAC;YACAE;YACAC;YACAC;YACAC;YACAI;YACAb,YAAY,CAAC,CAACA;YACdgB,aAAa,CAAChB;gBACZe,IAAI;oBAAEf;gBAAW;YACnB;YACAiB,cAAc,CAAC,EACbd,IAAI,EACJC,QAAQ,EACRC,MAAM,EAAEC,OAAO,EAAEK,SAAS,CAAC,CAAC,EAAED,UAAU,EAAE,EAAEH,QAAQ,EAAEC,eAAe,EAAEC,cAAc,CAAC,CAAC,EAAEG,QAAQ,EAAE,EAAE,EACtG;gBACCG,IAAI,CAACG;oBACHA,MAAMf,IAAI,GAAGA;oBACbe,MAAMd,QAAQ,GAAGA;oBACjBc,MAAMZ,OAAO,GAAGA;oBAChBY,MAAMP,MAAM,GAAGA;oBACf,MAAM,EAAEQ,WAAW,EAAEC,eAAe,EAAE,GAAGzD,4BAA4B+C;oBACrEQ,MAAMC,WAAW,GAAGA;oBACpBD,MAAME,eAAe,GAAGA;oBACxBF,MAAMX,QAAQ,GAAGA;oBACjBW,MAAMV,eAAe,GAAGA,mBAAmB/C;oBAC3CyD,MAAMT,WAAW,GAAGA;oBACpBS,MAAMN,KAAK,GAAGA;gBACd,uGAAuG;gBACzG;YACF;QACF;IACF;IAIJ,OAAOhC;AACT"}
@@ -1,5 +1,6 @@
1
- import { DashboardResource, EphemeralDashboardResource, PanelDefinition, UnknownSpec } from '@perses-dev/core';
2
- export type OnSaveDashboard = (dashboard: DashboardResource | EphemeralDashboardResource) => Promise<unknown>;
1
+ import { PanelDefinition, UnknownSpec } from '@perses-dev/spec';
2
+ import { DashboardResource } from '../../model';
3
+ export type OnSaveDashboard = (dashboard: DashboardResource) => Promise<unknown>;
3
4
  /**
4
5
  * The middleware applied to the DashboardStore (can be used as generic argument in StateCreator).
5
6
  */
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/context/DashboardProvider/common.ts"],"names":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AAG,eAAe,CAehH"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/context/DashboardProvider/common.ts"],"sourcesContent":["// Copyright 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 { DashboardResource, EphemeralDashboardResource, PanelDefinition, UnknownSpec } from '@perses-dev/core';\n\nexport type OnSaveDashboard = (dashboard: DashboardResource | EphemeralDashboardResource) => Promise<unknown>;\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 | undefined;\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(): number {\n if (globalThis.dashboardStoreId === undefined) {\n globalThis.dashboardStoreId = 0;\n }\n return globalThis.dashboardStoreId++;\n}\n\n// Helper function to create initial PanelDefinitions\nexport function createPanelDefinition(defaultPanelKind?: string, defaultPanelSpec?: UnknownSpec): PanelDefinition {\n return {\n kind: 'Panel',\n spec: {\n display: {\n name: '',\n description: undefined,\n },\n plugin: {\n kind: defaultPanelKind ?? '',\n spec: defaultPanelSpec ?? {},\n },\n queries: [],\n },\n };\n}\n"],"names":["generateId","globalThis","dashboardStoreId","undefined","createPanelDefinition","defaultPanelKind","defaultPanelSpec","kind","spec","display","name","description","plugin","queries"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAgBjC;;CAEC,GACD,OAAO,SAASA;IACd,IAAIC,WAAWC,gBAAgB,KAAKC,WAAW;QAC7CF,WAAWC,gBAAgB,GAAG;IAChC;IACA,OAAOD,WAAWC,gBAAgB;AACpC;AAEA,qDAAqD;AACrD,OAAO,SAASE,sBAAsBC,gBAAyB,EAAEC,gBAA8B;IAC7F,OAAO;QACLC,MAAM;QACNC,MAAM;YACJC,SAAS;gBACPC,MAAM;gBACNC,aAAaR;YACf;YACAS,QAAQ;gBACNL,MAAMF,oBAAoB;gBAC1BG,MAAMF,oBAAoB,CAAC;YAC7B;YACAO,SAAS,EAAE;QACb;IACF;AACF"}
1
+ {"version":3,"sources":["../../../src/context/DashboardProvider/common.ts"],"sourcesContent":["// Copyright 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 { PanelDefinition, UnknownSpec } from '@perses-dev/spec';\nimport { DashboardResource } from '../../model';\n\nexport type OnSaveDashboard = (dashboard: DashboardResource) => Promise<unknown>;\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 | undefined;\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(): number {\n if (globalThis.dashboardStoreId === undefined) {\n globalThis.dashboardStoreId = 0;\n }\n return globalThis.dashboardStoreId++;\n}\n\n// Helper function to create initial PanelDefinitions\nexport function createPanelDefinition(defaultPanelKind?: string, defaultPanelSpec?: UnknownSpec): PanelDefinition {\n return {\n kind: 'Panel',\n spec: {\n display: {\n name: '',\n description: undefined,\n },\n plugin: {\n kind: defaultPanelKind ?? '',\n spec: defaultPanelSpec ?? {},\n },\n queries: [],\n },\n };\n}\n"],"names":["generateId","globalThis","dashboardStoreId","undefined","createPanelDefinition","defaultPanelKind","defaultPanelSpec","kind","spec","display","name","description","plugin","queries"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAiBjC;;CAEC,GACD,OAAO,SAASA;IACd,IAAIC,WAAWC,gBAAgB,KAAKC,WAAW;QAC7CF,WAAWC,gBAAgB,GAAG;IAChC;IACA,OAAOD,WAAWC,gBAAgB;AACpC;AAEA,qDAAqD;AACrD,OAAO,SAASE,sBAAsBC,gBAAyB,EAAEC,gBAA8B;IAC7F,OAAO;QACLC,MAAM;QACNC,MAAM;YACJC,SAAS;gBACPC,MAAM;gBACNC,aAAaR;YACf;YACAS,QAAQ;gBACNL,MAAMF,oBAAoB;gBAC1BG,MAAMF,oBAAoB,CAAC;YAC7B;YACAO,SAAS,EAAE;QACb;IACF;AACF"}
@@ -1,4 +1,5 @@
1
- import { DashboardResource, DurationString, EphemeralDashboardResource, PanelDefinition, PanelGroupId, PanelGroupDefinition, PanelGroupItemId, PanelGroupItemLayout } from '@perses-dev/core';
1
+ import { DurationString, Link, PanelDefinition, PanelGroupId } from '@perses-dev/spec';
2
+ import { DashboardResource, PanelGroupDefinition, PanelGroupItemId, PanelGroupItemLayout } from '../../model';
2
3
  import { DeletePanelGroupDialogState } from './delete-panel-group-slice';
3
4
  import { PanelGroupEditor } from './panel-group-editor-slice';
4
5
  import { PanelEditorState } from './panel-editor-slice';
@@ -17,8 +18,19 @@ export declare function useEditMode(): {
17
18
  export declare function useDashboardActions(): {
18
19
  openAddPanelGroup: () => void;
19
20
  openAddPanel: () => void;
20
- setDashboard: (dashboard: DashboardResource | EphemeralDashboardResource) => void;
21
+ setDashboard: (dashboard: DashboardResource) => void;
21
22
  };
23
+ /**
24
+ * Returns the dashboard links.
25
+ */
26
+ export declare function useDashboardLinks(): Link[];
27
+ export interface DashboardLinksActions {
28
+ setLinks?: (links: Link[]) => void;
29
+ }
30
+ /**
31
+ * Returns actions that can be performed on dashboard links.
32
+ */
33
+ export declare function useDashboardLinksActions(): DashboardLinksActions;
22
34
  /**
23
35
  * Returns an array of PanelGroupIds in the order they appear in the dashboard.
24
36
  */
@@ -1 +1 @@
1
- {"version":3,"file":"dashboard-provider-api.d.ts","sourceRoot":"","sources":["../../../src/context/DashboardProvider/dashboard-provider-api.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,0BAA0B,EAC1B,eAAe,EACf,YAAY,EACZ,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,kCAAkC,EAAE,MAAM,6BAA6B,CAAC;AACjF,OAAO,EAAE,qCAAqC,EAAE,MAAM,gCAAgC,CAAC;AACvF,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAMpD,wBAAgB,WAAW,IAAI;IAAE,WAAW,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;IAAC,UAAU,EAAE,OAAO,CAAA;CAAE,CAEjG;AAWD;;GAEG;AACH,wBAAgB,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CACpC,gCAAgC,EAAE,qCAAqC,KACpE,IAAI,CAAC;CACX,CAEA;AAWD;;GAEG;AACH,wBAAgB,iBAAiB,IAAI;IACnC,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B,mBAAmB,EAAE,MAAM,IAAI,CAAC;IAChC,cAAc,EAAE,mBAAmB,GAAG,SAAS,CAAC;CACjD,CAEA"}
1
+ {"version":3,"file":"dashboard-provider-api.d.ts","sourceRoot":"","sources":["../../../src/context/DashboardProvider/dashboard-provider-api.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAE9G,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,kCAAkC,EAAE,MAAM,6BAA6B,CAAC;AACjF,OAAO,EAAE,qCAAqC,EAAE,MAAM,gCAAgC,CAAC;AACvF,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAMpD,wBAAgB,WAAW,IAAI;IAAE,WAAW,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;IAAC,UAAU,EAAE,OAAO,CAAA;CAAE,CAEjG;AAWD;;GAEG;AACH,wBAAgB,mBAAmB,IAAI;IACrC,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAC9B,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,YAAY,EAAE,CAAC,SAAS,EAAE,iBAAiB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,SAAS,CAAC;IACpF,qCAAqC,EAAE,MAAM,IAAI,CAAC;IAClD,oCAAoC,EAAE,CACpC,gCAAgC,EAAE,qCAAqC,KACpE,IAAI,CAAC;CACX,CAEA;AAWD;;GAEG;AACH,wBAAgB,iBAAiB,IAAI;IACnC,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B,mBAAmB,EAAE,MAAM,IAAI,CAAC;IAChC,cAAc,EAAE,mBAAmB,GAAG,SAAS,CAAC;CACjD,CAEA"}
@@ -34,6 +34,20 @@ const selectDashboardActions = ({ setDashboard, openAddPanelGroup, openAddPanel
34
34
  openAddPanel: ()=>openAddPanel()
35
35
  };
36
36
  }
37
+ const selectDashboardLinks = (state)=>state.links;
38
+ /**
39
+ * Returns the dashboard links.
40
+ */ export function useDashboardLinks() {
41
+ return useDashboardStore(selectDashboardLinks) ?? [];
42
+ }
43
+ const selectDashboardLinksActions = (state)=>({
44
+ setLinks: state.setLinks
45
+ });
46
+ /**
47
+ * Returns actions that can be performed on dashboard links.
48
+ */ export function useDashboardLinksActions() {
49
+ return useDashboardStore(selectDashboardLinksActions);
50
+ }
37
51
  const selectPanelGroupOrder = (state)=>state.panelGroupOrder;
38
52
  /**
39
53
  * Returns an array of PanelGroupIds in the order they appear in the dashboard.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/context/DashboardProvider/dashboard-provider-api.ts"],"sourcesContent":["// Copyright 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 { useCallback, useMemo } from 'react';\nimport {\n DashboardResource,\n DurationString,\n EphemeralDashboardResource,\n PanelDefinition,\n PanelGroupId,\n PanelGroupDefinition,\n PanelGroupItemId,\n PanelGroupItemLayout,\n} from '@perses-dev/core';\nimport { DashboardStoreState, useDashboardStore } from './DashboardProvider';\nimport { DeletePanelGroupDialogState } from './delete-panel-group-slice';\nimport { PanelGroupEditor } from './panel-group-editor-slice';\nimport { PanelEditorState } from './panel-editor-slice';\nimport { DeletePanelDialogState } from './delete-panel-slice';\nimport { SaveChangesConfirmationDialogState } from './save-changes-dialog-slice';\nimport { DiscardChangesConfirmationDialogState } from './discard-changes-dialog-slice';\nimport { EditJsonDialogState } from './edit-json-dialog-slice';\nimport { ViewPanelSlice } from './view-panel-slice';\n\nconst selectEditMode: ({ isEditMode, setEditMode }: DashboardStoreState) => {\n setEditMode: (isEditMode: boolean) => void;\n isEditMode: boolean;\n} = ({ isEditMode, setEditMode }: DashboardStoreState) => ({ isEditMode, setEditMode });\nexport function useEditMode(): { setEditMode: (isEditMode: boolean) => void; isEditMode: boolean } {\n return useDashboardStore(selectEditMode);\n}\n\nconst selectDashboardActions: ({ setDashboard, openAddPanelGroup, openAddPanel }: DashboardStoreState) => {\n openAddPanelGroup: () => void;\n openAddPanel: (panelGroupId?: PanelGroupId) => void;\n setDashboard: (dashboard: DashboardResource | EphemeralDashboardResource) => void;\n} = ({ setDashboard, openAddPanelGroup, openAddPanel }: DashboardStoreState) => ({\n setDashboard,\n openAddPanelGroup,\n openAddPanel,\n});\n/**\n * Returns actions that can be performed on the current dashboard.\n */\nexport function useDashboardActions(): {\n openAddPanelGroup: () => void;\n openAddPanel: () => void;\n setDashboard: (dashboard: DashboardResource | EphemeralDashboardResource) => void;\n} {\n const { setDashboard, openAddPanelGroup, openAddPanel } = useDashboardStore(selectDashboardActions);\n return {\n setDashboard,\n openAddPanelGroup: () => openAddPanelGroup(),\n openAddPanel: () => openAddPanel(),\n };\n}\n\nconst selectPanelGroupOrder = (state: DashboardStoreState): number[] => state.panelGroupOrder;\n/**\n * Returns an array of PanelGroupIds in the order they appear in the dashboard.\n */\nexport function usePanelGroupIds(): number[] {\n return useDashboardStore(selectPanelGroupOrder);\n}\n\nconst selectPanelGroups: (state: DashboardStoreState) => Record<number, PanelGroupDefinition> = (\n state: DashboardStoreState\n) => state.panelGroups;\n/**\n * Returns an array of PanelGroupDefinitions in the order they appear in the dashboard.\n */\nexport function useListPanelGroups(): PanelGroupDefinition[] {\n const panelGroupIds = usePanelGroupIds();\n const panelGroups = useDashboardStore(selectPanelGroups);\n return useMemo(() => {\n return panelGroupIds.map((id) => {\n const group = panelGroups[id];\n if (group === undefined) {\n throw new Error(`Invalid panel group Id found ${id}`);\n }\n return group;\n });\n }, [panelGroupIds, panelGroups]);\n}\n\n/**\n * Gets a specific panel group by its id. Throws if the panel group does not exist.\n */\nexport function usePanelGroup(panelGroupId: PanelGroupId): PanelGroupDefinition {\n const panelGroup = useDashboardStore(useCallback((state) => state.panelGroups[panelGroupId], [panelGroupId]));\n if (panelGroup === undefined) {\n throw new Error(`Panel group with Id ${panelGroupId} was not found`);\n }\n return panelGroup;\n}\n\nconst selectPanelGroupActions: ({\n openEditPanelGroup,\n deletePanelGroup,\n openAddPanel,\n updatePanelGroupLayouts,\n}: DashboardStoreState) => {\n updatePanelGroupLayouts: (panelGroupId: PanelGroupId, itemLayouts: PanelGroupDefinition['itemLayouts']) => void;\n openEditPanelGroup: (panelGroupId: PanelGroupId) => void;\n openAddPanel: (panelGroupId?: PanelGroupId) => void;\n deletePanelGroup: (panelGroupId: PanelGroupId) => void;\n} = ({ openEditPanelGroup, deletePanelGroup, openAddPanel, updatePanelGroupLayouts }: DashboardStoreState) => ({\n openEditPanelGroup,\n deletePanelGroup,\n openAddPanel,\n updatePanelGroupLayouts,\n});\n/**\n * Returns actions that can be performed on the given panel group.\n */\nexport function usePanelGroupActions(panelGroupId: PanelGroupId): {\n updatePanelGroupLayouts: (itemLayouts: PanelGroupItemLayout[]) => void;\n openEditPanelGroup: () => void;\n openAddPanel: () => void;\n moveDown: (() => void) | undefined;\n deletePanelGroup: () => void;\n moveUp: (() => void) | undefined;\n} {\n const { moveUp, moveDown } = useMovePanelGroup(panelGroupId);\n const { openEditPanelGroup, deletePanelGroup, openAddPanel, updatePanelGroupLayouts } =\n useDashboardStore(selectPanelGroupActions);\n\n return {\n openEditPanelGroup: () => openEditPanelGroup(panelGroupId),\n deletePanelGroup: () => deletePanelGroup(panelGroupId),\n openAddPanel: () => openAddPanel(panelGroupId),\n moveUp,\n moveDown,\n updatePanelGroupLayouts: (itemLayouts: PanelGroupItemLayout[]) =>\n updatePanelGroupLayouts(panelGroupId, itemLayouts),\n };\n}\n\nconst selectSwapPanelGroups: (state: DashboardStoreState) => (xIndex: number, yIndex: number) => void = (\n state: DashboardStoreState\n) => state.swapPanelGroups;\nconst selectPanelGroupsLength: (state: DashboardStoreState) => number = (state: DashboardStoreState) =>\n state.panelGroupOrder.length;\n/**\n * Returns functions for moving a panel group up or down. A function will be undefined if the panel group can't be\n * moved in that direction.\n */\nfunction useMovePanelGroup(panelGroupId: PanelGroupId): {\n moveDown: (() => void) | undefined;\n moveUp: (() => void) | undefined;\n} {\n const currentIndex = useDashboardStore(\n useCallback((store) => store.panelGroupOrder.findIndex((id) => id === panelGroupId), [panelGroupId])\n );\n const panelGroupsLength = useDashboardStore(selectPanelGroupsLength);\n const swapPanelGroups = useDashboardStore(selectSwapPanelGroups);\n\n if (currentIndex < 0) {\n throw new Error(`Could not find panel group with Id ${panelGroupId} in order array`);\n }\n\n const moveUp: () => void = () => swapPanelGroups(currentIndex, currentIndex - 1);\n const moveDown: () => void = () => swapPanelGroups(currentIndex, currentIndex + 1);\n return {\n moveUp: currentIndex > 0 ? moveUp : undefined,\n moveDown: currentIndex < panelGroupsLength - 1 ? moveDown : undefined,\n };\n}\n\nconst selectPanelGroupEditor: (state: DashboardStoreState) => PanelGroupEditor | undefined = (\n state: DashboardStoreState\n) => state.panelGroupEditor;\n/**\n * Gets the Panel Group editor state.\n */\nexport function usePanelGroupEditor(): PanelGroupEditor | undefined {\n return useDashboardStore(selectPanelGroupEditor);\n}\n\nconst selectDeletePanelGroupDialog: ({\n deletePanelGroupDialog,\n openDeletePanelGroupDialog,\n closeDeletePanelGroupDialog,\n deletePanelGroup,\n}: DashboardStoreState) => {\n deletePanelGroupDialog: DeletePanelGroupDialogState | undefined;\n closeDeletePanelGroupDialog: () => void;\n openDeletePanelGroupDialog: (panelGroupId: PanelGroupId) => void;\n deletePanelGroup: (panelGroupId: PanelGroupId) => void;\n} = ({\n deletePanelGroupDialog,\n openDeletePanelGroupDialog,\n closeDeletePanelGroupDialog,\n deletePanelGroup,\n}: DashboardStoreState) => ({\n deletePanelGroupDialog,\n openDeletePanelGroupDialog,\n closeDeletePanelGroupDialog,\n deletePanelGroup,\n});\n/**\n * Gets the Delete Panel Group dialog state.\n */\nexport function useDeletePanelGroupDialog(): {\n deletePanelGroupDialog: DeletePanelGroupDialogState | undefined;\n closeDeletePanelGroupDialog: () => void;\n openDeletePanelGroupDialog: (panelGroupId: PanelGroupId) => void;\n deletePanelGroup: (panelGroupId: PanelGroupId) => void;\n} {\n const { deletePanelGroupDialog, openDeletePanelGroupDialog, closeDeletePanelGroupDialog, deletePanelGroup } =\n useDashboardStore(selectDeletePanelGroupDialog);\n return {\n deletePanelGroupDialog,\n deletePanelGroup,\n openDeletePanelGroupDialog,\n closeDeletePanelGroupDialog: () => closeDeletePanelGroupDialog(),\n };\n}\n\nexport function usePanelKey(panelGroupItemId?: PanelGroupItemId): string | undefined {\n const panelKey = useDashboardStore(\n useCallback(\n (store) => {\n if (panelGroupItemId === undefined) {\n return undefined;\n }\n\n return store.panelGroups[panelGroupItemId.panelGroupId]?.itemPanelKeys[panelGroupItemId.panelGroupItemLayoutId];\n },\n [panelGroupItemId]\n )\n );\n return panelKey;\n}\n\n/**\n * Gets an individual panel in the store. Throws if the panel can't be found.\n */\nexport function usePanel(panelGroupItemId: PanelGroupItemId): PanelDefinition {\n const { panelGroupId, panelGroupItemLayoutId: panelGroupLayoutId } = panelGroupItemId;\n const panel = useDashboardStore(\n useCallback(\n (store) => {\n const panelKey = store.panelGroups[panelGroupId]?.itemPanelKeys[panelGroupLayoutId];\n if (panelKey === undefined) return;\n return store.panels[panelKey];\n },\n [panelGroupId, panelGroupLayoutId]\n )\n );\n\n if (panel === undefined) {\n throw new Error(`Could not find panel for Id ${panelGroupItemId}`);\n }\n return panel;\n}\n\nconst selectPanelActions: ({\n openEditPanel,\n openDeletePanelDialog,\n duplicatePanel,\n setViewPanel,\n}: DashboardStoreState) => {\n openDeletePanelDialog: (panelGroupItemId: PanelGroupItemId) => void;\n duplicatePanel: (panelGroupItemId: PanelGroupItemId) => void;\n openEditPanel: (panelGroupItemId: PanelGroupItemId) => void;\n setViewPanel: (panelGroupItemId?: PanelGroupItemId) => void;\n} = ({ openEditPanel, openDeletePanelDialog, duplicatePanel, setViewPanel }: DashboardStoreState) => ({\n openEditPanel,\n openDeletePanelDialog,\n duplicatePanel,\n setViewPanel,\n});\n\n/**\n * Returns actions that can be performed on the given Panel.\n */\nexport function usePanelActions(panelGroupItemId: PanelGroupItemId): {\n openDeletePanelDialog: () => void;\n duplicatePanel: () => void;\n openEditPanel: () => void;\n viewPanel: (panelGroupItemId?: PanelGroupItemId) => void;\n} {\n const { openEditPanel, openDeletePanelDialog, duplicatePanel, setViewPanel } = useDashboardStore(selectPanelActions);\n return {\n openEditPanel: () => openEditPanel(panelGroupItemId),\n openDeletePanelDialog: () => openDeletePanelDialog(panelGroupItemId),\n duplicatePanel: () => duplicatePanel(panelGroupItemId),\n viewPanel: (panelGroupItemId?: PanelGroupItemId) => setViewPanel(panelGroupItemId),\n };\n}\n\nconst selectPanelEditor: (state: DashboardStoreState) => PanelEditorState | undefined = (state: DashboardStoreState) =>\n state.panelEditor;\n/**\n * Gets the state for the Panel Editor.\n */\nexport function usePanelEditor(): PanelEditorState | undefined {\n return useDashboardStore(selectPanelEditor);\n}\n\nconst selectDeletePanelDialog: ({ deletePanelDialog, deletePanel, closeDeletePanelDialog }: DashboardStoreState) => {\n deletePanelDialog: DeletePanelDialogState | undefined;\n closeDeletePanelDialog: () => void;\n deletePanel: (panelGroupItemId: PanelGroupItemId) => void;\n} = ({ deletePanelDialog, deletePanel, closeDeletePanelDialog }: DashboardStoreState) => ({\n deletePanelDialog,\n deletePanel,\n closeDeletePanelDialog,\n});\n\n/**\n * Gets the state for the Delete Panel dialog.\n */\nexport function useDeletePanelDialog(): {\n deletePanelDialog: DeletePanelDialogState | undefined;\n closeDeletePanelDialog: () => void;\n deletePanel: (panelGroupItemId: PanelGroupItemId) => void;\n} {\n // TODO: Refactor similar to other dialogs/editors so these are on the editor state itself\n return useDashboardStore(selectDeletePanelDialog);\n}\n\nconst selectDashboardDuration: (state: DashboardStoreState) => DurationString = (state: DashboardStoreState) =>\n state.duration;\nexport function useDashboardDuration(): DurationString {\n return useDashboardStore(selectDashboardDuration);\n}\n\nconst selectViewPanel: (state: DashboardStoreState) => {\n setViewPanel: DashboardStoreState['setViewPanel'];\n getViewPanel: DashboardStoreState['getViewPanel'];\n viewPanelId: DashboardStoreState['viewPanel']['panelGroupItemId'];\n} = (state: DashboardStoreState) => ({\n setViewPanel: state.setViewPanel,\n getViewPanel: state.getViewPanel,\n viewPanelId: state.getViewPanel(),\n});\n/**\n * Returns actions related to the ViewPanel.\n */\nexport function useViewPanel(): {\n setViewPanel: ViewPanelSlice['setViewPanel'];\n getViewPanel: ViewPanelSlice['getViewPanel'];\n viewPanelId: ViewPanelSlice['viewPanel']['panelGroupItemId'];\n} {\n return useDashboardStore(selectViewPanel);\n}\n\nconst selectViewPanelGroup: (state: DashboardStoreState) => PanelGroupItemId | undefined = (\n state: DashboardStoreState\n) => state.getViewPanel();\n/**\n * Gets the Panel Group for the view panel.\n */\nexport function useViewPanelGroup(): PanelGroupItemId | undefined {\n return useDashboardStore(selectViewPanelGroup);\n}\n\nconst selectSaveChangesConfirmationDialog: ({\n saveChangesConfirmationDialog,\n openSaveChangesConfirmationDialog,\n closeSaveChangesConfirmationDialog,\n}: DashboardStoreState) => {\n closeSaveChangesConfirmationDialog: () => void;\n openSaveChangesConfirmationDialog: (saveChangesConfirmationDialog: SaveChangesConfirmationDialogState) => void;\n saveChangesConfirmationDialog: SaveChangesConfirmationDialogState | undefined;\n} = ({\n saveChangesConfirmationDialog,\n openSaveChangesConfirmationDialog,\n closeSaveChangesConfirmationDialog,\n}: DashboardStoreState) => ({\n saveChangesConfirmationDialog,\n openSaveChangesConfirmationDialog,\n closeSaveChangesConfirmationDialog,\n});\nexport function useSaveChangesConfirmationDialog(): {\n closeSaveChangesConfirmationDialog: () => void;\n openSaveChangesConfirmationDialog: (saveChangesConfirmationDialog: SaveChangesConfirmationDialogState) => void;\n saveChangesConfirmationDialog: SaveChangesConfirmationDialogState | undefined;\n} {\n return useDashboardStore(selectSaveChangesConfirmationDialog);\n}\n\nconst selectDiscardChangesConfirmationDialog: ({\n discardChangesConfirmationDialog,\n openDiscardChangesConfirmationDialog,\n closeDiscardChangesConfirmationDialog,\n}: DashboardStoreState) => {\n discardChangesConfirmationDialog: DiscardChangesConfirmationDialogState | undefined;\n closeDiscardChangesConfirmationDialog: () => void;\n openDiscardChangesConfirmationDialog: (\n discardChangesConfirmationDialog: DiscardChangesConfirmationDialogState\n ) => void;\n} = ({\n discardChangesConfirmationDialog,\n openDiscardChangesConfirmationDialog,\n closeDiscardChangesConfirmationDialog,\n}: DashboardStoreState) => ({\n discardChangesConfirmationDialog,\n openDiscardChangesConfirmationDialog,\n closeDiscardChangesConfirmationDialog,\n});\nexport function useDiscardChangesConfirmationDialog(): {\n discardChangesConfirmationDialog: DiscardChangesConfirmationDialogState | undefined;\n closeDiscardChangesConfirmationDialog: () => void;\n openDiscardChangesConfirmationDialog: (\n discardChangesConfirmationDialog: DiscardChangesConfirmationDialogState\n ) => void;\n} {\n return useDashboardStore(selectDiscardChangesConfirmationDialog);\n}\n\nconst selectEditJsonDialog: ({ editJsonDialog, openEditJsonDialog, closeEditJsonDialog }: DashboardStoreState) => {\n openEditJsonDialog: () => void;\n closeEditJsonDialog: () => void;\n editJsonDialog: EditJsonDialogState | undefined;\n} = ({ editJsonDialog, openEditJsonDialog, closeEditJsonDialog }: DashboardStoreState) => ({\n editJsonDialog,\n openEditJsonDialog,\n closeEditJsonDialog,\n});\n/**\n * Gets the state for the edit JSON dialog.\n */\nexport function useEditJsonDialog(): {\n openEditJsonDialog: () => void;\n closeEditJsonDialog: () => void;\n editJsonDialog: EditJsonDialogState | undefined;\n} {\n return useDashboardStore(selectEditJsonDialog);\n}\n"],"names":["useCallback","useMemo","useDashboardStore","selectEditMode","isEditMode","setEditMode","useEditMode","selectDashboardActions","setDashboard","openAddPanelGroup","openAddPanel","useDashboardActions","selectPanelGroupOrder","state","panelGroupOrder","usePanelGroupIds","selectPanelGroups","panelGroups","useListPanelGroups","panelGroupIds","map","id","group","undefined","Error","usePanelGroup","panelGroupId","panelGroup","selectPanelGroupActions","openEditPanelGroup","deletePanelGroup","updatePanelGroupLayouts","usePanelGroupActions","moveUp","moveDown","useMovePanelGroup","itemLayouts","selectSwapPanelGroups","swapPanelGroups","selectPanelGroupsLength","length","currentIndex","store","findIndex","panelGroupsLength","selectPanelGroupEditor","panelGroupEditor","usePanelGroupEditor","selectDeletePanelGroupDialog","deletePanelGroupDialog","openDeletePanelGroupDialog","closeDeletePanelGroupDialog","useDeletePanelGroupDialog","usePanelKey","panelGroupItemId","panelKey","itemPanelKeys","panelGroupItemLayoutId","usePanel","panelGroupLayoutId","panel","panels","selectPanelActions","openEditPanel","openDeletePanelDialog","duplicatePanel","setViewPanel","usePanelActions","viewPanel","selectPanelEditor","panelEditor","usePanelEditor","selectDeletePanelDialog","deletePanelDialog","deletePanel","closeDeletePanelDialog","useDeletePanelDialog","selectDashboardDuration","duration","useDashboardDuration","selectViewPanel","getViewPanel","viewPanelId","useViewPanel","selectViewPanelGroup","useViewPanelGroup","selectSaveChangesConfirmationDialog","saveChangesConfirmationDialog","openSaveChangesConfirmationDialog","closeSaveChangesConfirmationDialog","useSaveChangesConfirmationDialog","selectDiscardChangesConfirmationDialog","discardChangesConfirmationDialog","openDiscardChangesConfirmationDialog","closeDiscardChangesConfirmationDialog","useDiscardChangesConfirmationDialog","selectEditJsonDialog","editJsonDialog","openEditJsonDialog","closeEditJsonDialog","useEditJsonDialog"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,WAAW,EAAEC,OAAO,QAAQ,QAAQ;AAW7C,SAA8BC,iBAAiB,QAAQ,sBAAsB;AAU7E,MAAMC,iBAGF,CAAC,EAAEC,UAAU,EAAEC,WAAW,EAAuB,GAAM,CAAA;QAAED;QAAYC;IAAY,CAAA;AACrF,OAAO,SAASC;IACd,OAAOJ,kBAAkBC;AAC3B;AAEA,MAAMI,yBAIF,CAAC,EAAEC,YAAY,EAAEC,iBAAiB,EAAEC,YAAY,EAAuB,GAAM,CAAA;QAC/EF;QACAC;QACAC;IACF,CAAA;AACA;;CAEC,GACD,OAAO,SAASC;IAKd,MAAM,EAAEH,YAAY,EAAEC,iBAAiB,EAAEC,YAAY,EAAE,GAAGR,kBAAkBK;IAC5E,OAAO;QACLC;QACAC,mBAAmB,IAAMA;QACzBC,cAAc,IAAMA;IACtB;AACF;AAEA,MAAME,wBAAwB,CAACC,QAAyCA,MAAMC,eAAe;AAC7F;;CAEC,GACD,OAAO,SAASC;IACd,OAAOb,kBAAkBU;AAC3B;AAEA,MAAMI,oBAA0F,CAC9FH,QACGA,MAAMI,WAAW;AACtB;;CAEC,GACD,OAAO,SAASC;IACd,MAAMC,gBAAgBJ;IACtB,MAAME,cAAcf,kBAAkBc;IACtC,OAAOf,QAAQ;QACb,OAAOkB,cAAcC,GAAG,CAAC,CAACC;YACxB,MAAMC,QAAQL,WAAW,CAACI,GAAG;YAC7B,IAAIC,UAAUC,WAAW;gBAC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YAAY;IACjC,CAAA;AACA;;CAEC,GACD,OAAO,SAASE;IAKd,OAAOjF,kBAAkB8E;AAC3B;AAEA,MAAMI,uBAAqF,CACzFvE,QACGA,MAAMoE,YAAY;AACvB;;CAEC,GACD,OAAO,SAASI;IACd,OAAOnF,kBAAkBkF;AAC3B;AAEA,MAAME,sCAQF,CAAC,EACHC,6BAA6B,EAC7BC,iCAAiC,EACjCC,kCAAkC,EACd,GAAM,CAAA;QAC1BF;QACAC;QACAC;IACF,CAAA;AACA,OAAO,SAASC;IAKd,OAAOxF,kBAAkBoF;AAC3B;AAEA,MAAMK,yCAUF,CAAC,EACHC,gCAAgC,EAChCC,oCAAoC,EACpCC,qCAAqC,EACjB,GAAM,CAAA;QAC1BF;QACAC;QACAC;IACF,CAAA;AACA,OAAO,SAASC;IAOd,OAAO7F,kBAAkByF;AAC3B;AAEA,MAAMK,uBAIF,CAAC,EAAEC,cAAc,EAAEC,kBAAkB,EAAEC,mBAAmB,EAAuB,GAAM,CAAA;QACzFF;QACAC;QACAC;IACF,CAAA;AACA;;CAEC,GACD,OAAO,SAASC;IAKd,OAAOlG,kBAAkB8F;AAC3B"}
1
+ {"version":3,"sources":["../../../src/context/DashboardProvider/dashboard-provider-api.ts"],"sourcesContent":["// Copyright 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 { useCallback, useMemo } from 'react';\nimport { DurationString, Link, PanelDefinition, PanelGroupId } from '@perses-dev/spec';\nimport { DashboardResource, PanelGroupDefinition, PanelGroupItemId, PanelGroupItemLayout } from '../../model';\nimport { DashboardStoreState, useDashboardStore } from './DashboardProvider';\nimport { DeletePanelGroupDialogState } from './delete-panel-group-slice';\nimport { PanelGroupEditor } from './panel-group-editor-slice';\nimport { PanelEditorState } from './panel-editor-slice';\nimport { DeletePanelDialogState } from './delete-panel-slice';\nimport { SaveChangesConfirmationDialogState } from './save-changes-dialog-slice';\nimport { DiscardChangesConfirmationDialogState } from './discard-changes-dialog-slice';\nimport { EditJsonDialogState } from './edit-json-dialog-slice';\nimport { ViewPanelSlice } from './view-panel-slice';\n\nconst selectEditMode: ({ isEditMode, setEditMode }: DashboardStoreState) => {\n setEditMode: (isEditMode: boolean) => void;\n isEditMode: boolean;\n} = ({ isEditMode, setEditMode }: DashboardStoreState) => ({ isEditMode, setEditMode });\nexport function useEditMode(): { setEditMode: (isEditMode: boolean) => void; isEditMode: boolean } {\n return useDashboardStore(selectEditMode);\n}\n\nconst selectDashboardActions: ({ setDashboard, openAddPanelGroup, openAddPanel }: DashboardStoreState) => {\n openAddPanelGroup: () => void;\n openAddPanel: (panelGroupId?: PanelGroupId) => void;\n setDashboard: (dashboard: DashboardResource) => void;\n} = ({ setDashboard, openAddPanelGroup, openAddPanel }: DashboardStoreState) => ({\n setDashboard,\n openAddPanelGroup,\n openAddPanel,\n});\n/**\n * Returns actions that can be performed on the current dashboard.\n */\nexport function useDashboardActions(): {\n openAddPanelGroup: () => void;\n openAddPanel: () => void;\n setDashboard: (dashboard: DashboardResource) => void;\n} {\n const { setDashboard, openAddPanelGroup, openAddPanel } = useDashboardStore(selectDashboardActions);\n return {\n setDashboard,\n openAddPanelGroup: () => openAddPanelGroup(),\n openAddPanel: () => openAddPanel(),\n };\n}\n\nconst selectDashboardLinks: (state: DashboardStoreState) => Link[] | undefined = (state: DashboardStoreState) =>\n state.links;\n/**\n * Returns the dashboard links.\n */\nexport function useDashboardLinks(): Link[] {\n return useDashboardStore(selectDashboardLinks) ?? [];\n}\n\nexport interface DashboardLinksActions {\n setLinks?: (links: Link[]) => void;\n}\n\nconst selectDashboardLinksActions: (state: DashboardStoreState) => DashboardLinksActions = (\n state: DashboardStoreState\n) => ({\n setLinks: state.setLinks,\n});\n/**\n * Returns actions that can be performed on dashboard links.\n */\nexport function useDashboardLinksActions(): DashboardLinksActions {\n return useDashboardStore(selectDashboardLinksActions);\n}\n\nconst selectPanelGroupOrder = (state: DashboardStoreState): number[] => state.panelGroupOrder;\n/**\n * Returns an array of PanelGroupIds in the order they appear in the dashboard.\n */\nexport function usePanelGroupIds(): number[] {\n return useDashboardStore(selectPanelGroupOrder);\n}\n\nconst selectPanelGroups: (state: DashboardStoreState) => Record<number, PanelGroupDefinition> = (\n state: DashboardStoreState\n) => state.panelGroups;\n/**\n * Returns an array of PanelGroupDefinitions in the order they appear in the dashboard.\n */\nexport function useListPanelGroups(): PanelGroupDefinition[] {\n const panelGroupIds = usePanelGroupIds();\n const panelGroups = useDashboardStore(selectPanelGroups);\n return useMemo(() => {\n return panelGroupIds.map((id) => {\n const group = panelGroups[id];\n if (group === undefined) {\n throw new Error(`Invalid panel group Id found ${id}`);\n }\n return group;\n });\n }, [panelGroupIds, panelGroups]);\n}\n\n/**\n * Gets a specific panel group by its id. Throws if the panel group does not exist.\n */\nexport function usePanelGroup(panelGroupId: PanelGroupId): PanelGroupDefinition {\n const panelGroup = useDashboardStore(useCallback((state) => state.panelGroups[panelGroupId], [panelGroupId]));\n if (panelGroup === undefined) {\n throw new Error(`Panel group with Id ${panelGroupId} was not found`);\n }\n return panelGroup;\n}\n\nconst selectPanelGroupActions: ({\n openEditPanelGroup,\n deletePanelGroup,\n openAddPanel,\n updatePanelGroupLayouts,\n}: DashboardStoreState) => {\n updatePanelGroupLayouts: (panelGroupId: PanelGroupId, itemLayouts: PanelGroupDefinition['itemLayouts']) => void;\n openEditPanelGroup: (panelGroupId: PanelGroupId) => void;\n openAddPanel: (panelGroupId?: PanelGroupId) => void;\n deletePanelGroup: (panelGroupId: PanelGroupId) => void;\n} = ({ openEditPanelGroup, deletePanelGroup, openAddPanel, updatePanelGroupLayouts }: DashboardStoreState) => ({\n openEditPanelGroup,\n deletePanelGroup,\n openAddPanel,\n updatePanelGroupLayouts,\n});\n/**\n * Returns actions that can be performed on the given panel group.\n */\nexport function usePanelGroupActions(panelGroupId: PanelGroupId): {\n updatePanelGroupLayouts: (itemLayouts: PanelGroupItemLayout[]) => void;\n openEditPanelGroup: () => void;\n openAddPanel: () => void;\n moveDown: (() => void) | undefined;\n deletePanelGroup: () => void;\n moveUp: (() => void) | undefined;\n} {\n const { moveUp, moveDown } = useMovePanelGroup(panelGroupId);\n const { openEditPanelGroup, deletePanelGroup, openAddPanel, updatePanelGroupLayouts } =\n useDashboardStore(selectPanelGroupActions);\n\n return {\n openEditPanelGroup: () => openEditPanelGroup(panelGroupId),\n deletePanelGroup: () => deletePanelGroup(panelGroupId),\n openAddPanel: () => openAddPanel(panelGroupId),\n moveUp,\n moveDown,\n updatePanelGroupLayouts: (itemLayouts: PanelGroupItemLayout[]) =>\n updatePanelGroupLayouts(panelGroupId, itemLayouts),\n };\n}\n\nconst selectSwapPanelGroups: (state: DashboardStoreState) => (xIndex: number, yIndex: number) => void = (\n state: DashboardStoreState\n) => state.swapPanelGroups;\nconst selectPanelGroupsLength: (state: DashboardStoreState) => number = (state: DashboardStoreState) =>\n state.panelGroupOrder.length;\n/**\n * Returns functions for moving a panel group up or down. A function will be undefined if the panel group can't be\n * moved in that direction.\n */\nfunction useMovePanelGroup(panelGroupId: PanelGroupId): {\n moveDown: (() => void) | undefined;\n moveUp: (() => void) | undefined;\n} {\n const currentIndex = useDashboardStore(\n useCallback((store) => store.panelGroupOrder.findIndex((id) => id === panelGroupId), [panelGroupId])\n );\n const panelGroupsLength = useDashboardStore(selectPanelGroupsLength);\n const swapPanelGroups = useDashboardStore(selectSwapPanelGroups);\n\n if (currentIndex < 0) {\n throw new Error(`Could not find panel group with Id ${panelGroupId} in order array`);\n }\n\n const moveUp: () => void = () => swapPanelGroups(currentIndex, currentIndex - 1);\n const moveDown: () => void = () => swapPanelGroups(currentIndex, currentIndex + 1);\n return {\n moveUp: currentIndex > 0 ? moveUp : undefined,\n moveDown: currentIndex < panelGroupsLength - 1 ? moveDown : undefined,\n };\n}\n\nconst selectPanelGroupEditor: (state: DashboardStoreState) => PanelGroupEditor | undefined = (\n state: DashboardStoreState\n) => state.panelGroupEditor;\n/**\n * Gets the Panel Group editor state.\n */\nexport function usePanelGroupEditor(): PanelGroupEditor | undefined {\n return useDashboardStore(selectPanelGroupEditor);\n}\n\nconst selectDeletePanelGroupDialog: ({\n deletePanelGroupDialog,\n openDeletePanelGroupDialog,\n closeDeletePanelGroupDialog,\n deletePanelGroup,\n}: DashboardStoreState) => {\n deletePanelGroupDialog: DeletePanelGroupDialogState | undefined;\n closeDeletePanelGroupDialog: () => void;\n openDeletePanelGroupDialog: (panelGroupId: PanelGroupId) => void;\n deletePanelGroup: (panelGroupId: PanelGroupId) => void;\n} = ({\n deletePanelGroupDialog,\n openDeletePanelGroupDialog,\n closeDeletePanelGroupDialog,\n deletePanelGroup,\n}: DashboardStoreState) => ({\n deletePanelGroupDialog,\n openDeletePanelGroupDialog,\n closeDeletePanelGroupDialog,\n deletePanelGroup,\n});\n/**\n * Gets the Delete Panel Group dialog state.\n */\nexport function useDeletePanelGroupDialog(): {\n deletePanelGroupDialog: DeletePanelGroupDialogState | undefined;\n closeDeletePanelGroupDialog: () => void;\n openDeletePanelGroupDialog: (panelGroupId: PanelGroupId) => void;\n deletePanelGroup: (panelGroupId: PanelGroupId) => void;\n} {\n const { deletePanelGroupDialog, openDeletePanelGroupDialog, closeDeletePanelGroupDialog, deletePanelGroup } =\n useDashboardStore(selectDeletePanelGroupDialog);\n return {\n deletePanelGroupDialog,\n deletePanelGroup,\n openDeletePanelGroupDialog,\n closeDeletePanelGroupDialog: () => closeDeletePanelGroupDialog(),\n };\n}\n\nexport function usePanelKey(panelGroupItemId?: PanelGroupItemId): string | undefined {\n const panelKey = useDashboardStore(\n useCallback(\n (store) => {\n if (panelGroupItemId === undefined) {\n return undefined;\n }\n\n return store.panelGroups[panelGroupItemId.panelGroupId]?.itemPanelKeys[panelGroupItemId.panelGroupItemLayoutId];\n },\n [panelGroupItemId]\n )\n );\n return panelKey;\n}\n\n/**\n * Gets an individual panel in the store. Throws if the panel can't be found.\n */\nexport function usePanel(panelGroupItemId: PanelGroupItemId): PanelDefinition {\n const { panelGroupId, panelGroupItemLayoutId: panelGroupLayoutId } = panelGroupItemId;\n const panel = useDashboardStore(\n useCallback(\n (store) => {\n const panelKey = store.panelGroups[panelGroupId]?.itemPanelKeys[panelGroupLayoutId];\n if (panelKey === undefined) return;\n return store.panels[panelKey];\n },\n [panelGroupId, panelGroupLayoutId]\n )\n );\n\n if (panel === undefined) {\n throw new Error(`Could not find panel for Id ${panelGroupItemId}`);\n }\n return panel;\n}\n\nconst selectPanelActions: ({\n openEditPanel,\n openDeletePanelDialog,\n duplicatePanel,\n setViewPanel,\n}: DashboardStoreState) => {\n openDeletePanelDialog: (panelGroupItemId: PanelGroupItemId) => void;\n duplicatePanel: (panelGroupItemId: PanelGroupItemId) => void;\n openEditPanel: (panelGroupItemId: PanelGroupItemId) => void;\n setViewPanel: (panelGroupItemId?: PanelGroupItemId) => void;\n} = ({ openEditPanel, openDeletePanelDialog, duplicatePanel, setViewPanel }: DashboardStoreState) => ({\n openEditPanel,\n openDeletePanelDialog,\n duplicatePanel,\n setViewPanel,\n});\n\n/**\n * Returns actions that can be performed on the given Panel.\n */\nexport function usePanelActions(panelGroupItemId: PanelGroupItemId): {\n openDeletePanelDialog: () => void;\n duplicatePanel: () => void;\n openEditPanel: () => void;\n viewPanel: (panelGroupItemId?: PanelGroupItemId) => void;\n} {\n const { openEditPanel, openDeletePanelDialog, duplicatePanel, setViewPanel } = useDashboardStore(selectPanelActions);\n return {\n openEditPanel: () => openEditPanel(panelGroupItemId),\n openDeletePanelDialog: () => openDeletePanelDialog(panelGroupItemId),\n duplicatePanel: () => duplicatePanel(panelGroupItemId),\n viewPanel: (panelGroupItemId?: PanelGroupItemId) => setViewPanel(panelGroupItemId),\n };\n}\n\nconst selectPanelEditor: (state: DashboardStoreState) => PanelEditorState | undefined = (state: DashboardStoreState) =>\n state.panelEditor;\n/**\n * Gets the state for the Panel Editor.\n */\nexport function usePanelEditor(): PanelEditorState | undefined {\n return useDashboardStore(selectPanelEditor);\n}\n\nconst selectDeletePanelDialog: ({ deletePanelDialog, deletePanel, closeDeletePanelDialog }: DashboardStoreState) => {\n deletePanelDialog: DeletePanelDialogState | undefined;\n closeDeletePanelDialog: () => void;\n deletePanel: (panelGroupItemId: PanelGroupItemId) => void;\n} = ({ deletePanelDialog, deletePanel, closeDeletePanelDialog }: DashboardStoreState) => ({\n deletePanelDialog,\n deletePanel,\n closeDeletePanelDialog,\n});\n\n/**\n * Gets the state for the Delete Panel dialog.\n */\nexport function useDeletePanelDialog(): {\n deletePanelDialog: DeletePanelDialogState | undefined;\n closeDeletePanelDialog: () => void;\n deletePanel: (panelGroupItemId: PanelGroupItemId) => void;\n} {\n // TODO: Refactor similar to other dialogs/editors so these are on the editor state itself\n return useDashboardStore(selectDeletePanelDialog);\n}\n\nconst selectDashboardDuration: (state: DashboardStoreState) => DurationString = (state: DashboardStoreState) =>\n state.duration;\nexport function useDashboardDuration(): DurationString {\n return useDashboardStore(selectDashboardDuration);\n}\n\nconst selectViewPanel: (state: DashboardStoreState) => {\n setViewPanel: DashboardStoreState['setViewPanel'];\n getViewPanel: DashboardStoreState['getViewPanel'];\n viewPanelId: DashboardStoreState['viewPanel']['panelGroupItemId'];\n} = (state: DashboardStoreState) => ({\n setViewPanel: state.setViewPanel,\n getViewPanel: state.getViewPanel,\n viewPanelId: state.getViewPanel(),\n});\n/**\n * Returns actions related to the ViewPanel.\n */\nexport function useViewPanel(): {\n setViewPanel: ViewPanelSlice['setViewPanel'];\n getViewPanel: ViewPanelSlice['getViewPanel'];\n viewPanelId: ViewPanelSlice['viewPanel']['panelGroupItemId'];\n} {\n return useDashboardStore(selectViewPanel);\n}\n\nconst selectViewPanelGroup: (state: DashboardStoreState) => PanelGroupItemId | undefined = (\n state: DashboardStoreState\n) => state.getViewPanel();\n/**\n * Gets the Panel Group for the view panel.\n */\nexport function useViewPanelGroup(): PanelGroupItemId | undefined {\n return useDashboardStore(selectViewPanelGroup);\n}\n\nconst selectSaveChangesConfirmationDialog: ({\n saveChangesConfirmationDialog,\n openSaveChangesConfirmationDialog,\n closeSaveChangesConfirmationDialog,\n}: DashboardStoreState) => {\n closeSaveChangesConfirmationDialog: () => void;\n openSaveChangesConfirmationDialog: (saveChangesConfirmationDialog: SaveChangesConfirmationDialogState) => void;\n saveChangesConfirmationDialog: SaveChangesConfirmationDialogState | undefined;\n} = ({\n saveChangesConfirmationDialog,\n openSaveChangesConfirmationDialog,\n closeSaveChangesConfirmationDialog,\n}: DashboardStoreState) => ({\n saveChangesConfirmationDialog,\n openSaveChangesConfirmationDialog,\n closeSaveChangesConfirmationDialog,\n});\nexport function useSaveChangesConfirmationDialog(): {\n closeSaveChangesConfirmationDialog: () => void;\n openSaveChangesConfirmationDialog: (saveChangesConfirmationDialog: SaveChangesConfirmationDialogState) => void;\n saveChangesConfirmationDialog: SaveChangesConfirmationDialogState | undefined;\n} {\n return useDashboardStore(selectSaveChangesConfirmationDialog);\n}\n\nconst selectDiscardChangesConfirmationDialog: ({\n discardChangesConfirmationDialog,\n openDiscardChangesConfirmationDialog,\n closeDiscardChangesConfirmationDialog,\n}: DashboardStoreState) => {\n discardChangesConfirmationDialog: DiscardChangesConfirmationDialogState | undefined;\n closeDiscardChangesConfirmationDialog: () => void;\n openDiscardChangesConfirmationDialog: (\n discardChangesConfirmationDialog: DiscardChangesConfirmationDialogState\n ) => void;\n} = ({\n discardChangesConfirmationDialog,\n openDiscardChangesConfirmationDialog,\n closeDiscardChangesConfirmationDialog,\n}: DashboardStoreState) => ({\n discardChangesConfirmationDialog,\n openDiscardChangesConfirmationDialog,\n closeDiscardChangesConfirmationDialog,\n});\nexport function useDiscardChangesConfirmationDialog(): {\n discardChangesConfirmationDialog: DiscardChangesConfirmationDialogState | undefined;\n closeDiscardChangesConfirmationDialog: () => void;\n openDiscardChangesConfirmationDialog: (\n discardChangesConfirmationDialog: DiscardChangesConfirmationDialogState\n ) => void;\n} {\n return useDashboardStore(selectDiscardChangesConfirmationDialog);\n}\n\nconst selectEditJsonDialog: ({ editJsonDialog, openEditJsonDialog, closeEditJsonDialog }: DashboardStoreState) => {\n openEditJsonDialog: () => void;\n closeEditJsonDialog: () => void;\n editJsonDialog: EditJsonDialogState | undefined;\n} = ({ editJsonDialog, openEditJsonDialog, closeEditJsonDialog }: DashboardStoreState) => ({\n editJsonDialog,\n openEditJsonDialog,\n closeEditJsonDialog,\n});\n/**\n * Gets the state for the edit JSON dialog.\n */\nexport function useEditJsonDialog(): {\n openEditJsonDialog: () => void;\n closeEditJsonDialog: () => void;\n editJsonDialog: EditJsonDialogState | undefined;\n} {\n return useDashboardStore(selectEditJsonDialog);\n}\n"],"names":["useCallback","useMemo","useDashboardStore","selectEditMode","isEditMode","setEditMode","useEditMode","selectDashboardActions","setDashboard","openAddPanelGroup","openAddPanel","useDashboardActions","selectDashboardLinks","state","links","useDashboardLinks","selectDashboardLinksActions","setLinks","useDashboardLinksActions","selectPanelGroupOrder","panelGroupOrder","usePanelGroupIds","selectPanelGroups","panelGroups","useListPanelGroups","panelGroupIds","map","id","group","undefined","Error","usePanelGroup","panelGroupId","panelGroup","selectPanelGroupActions","openEditPanelGroup","deletePanelGroup","updatePanelGroupLayouts","usePanelGroupActions","moveUp","moveDown","useMovePanelGroup","itemLayouts","selectSwapPanelGroups","swapPanelGroups","selectPanelGroupsLength","length","currentIndex","store","findIndex","panelGroupsLength","selectPanelGroupEditor","panelGroupEditor","usePanelGroupEditor","selectDeletePanelGroupDialog","deletePanelGroupDialog","openDeletePanelGroupDialog","closeDeletePanelGroupDialog","useDeletePanelGroupDialog","usePanelKey","panelGroupItemId","panelKey","itemPanelKeys","panelGroupItemLayoutId","usePanel","panelGroupLayoutId","panel","panels","selectPanelActions","openEditPanel","openDeletePanelDialog","duplicatePanel","setViewPanel","usePanelActions","viewPanel","selectPanelEditor","panelEditor","usePanelEditor","selectDeletePanelDialog","deletePanelDialog","deletePanel","closeDeletePanelDialog","useDeletePanelDialog","selectDashboardDuration","duration","useDashboardDuration","selectViewPanel","getViewPanel","viewPanelId","useViewPanel","selectViewPanelGroup","useViewPanelGroup","selectSaveChangesConfirmationDialog","saveChangesConfirmationDialog","openSaveChangesConfirmationDialog","closeSaveChangesConfirmationDialog","useSaveChangesConfirmationDialog","selectDiscardChangesConfirmationDialog","discardChangesConfirmationDialog","openDiscardChangesConfirmationDialog","closeDiscardChangesConfirmationDialog","useDiscardChangesConfirmationDialog","selectEditJsonDialog","editJsonDialog","openEditJsonDialog","closeEditJsonDialog","useEditJsonDialog"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,WAAW,EAAEC,OAAO,QAAQ,QAAQ;AAG7C,SAA8BC,iBAAiB,QAAQ,sBAAsB;AAU7E,MAAMC,iBAGF,CAAC,EAAEC,UAAU,EAAEC,WAAW,EAAuB,GAAM,CAAA;QAAED;QAAYC;IAAY,CAAA;AACrF,OAAO,SAASC;IACd,OAAOJ,kBAAkBC;AAC3B;AAEA,MAAMI,yBAIF,CAAC,EAAEC,YAAY,EAAEC,iBAAiB,EAAEC,YAAY,EAAuB,GAAM,CAAA;QAC/EF;QACAC;QACAC;IACF,CAAA;AACA;;CAEC,GACD,OAAO,SAASC;IAKd,MAAM,EAAEH,YAAY,EAAEC,iBAAiB,EAAEC,YAAY,EAAE,GAAGR,kBAAkBK;IAC5E,OAAO;QACLC;QACAC,mBAAmB,IAAMA;QACzBC,cAAc,IAAMA;IACtB;AACF;AAEA,MAAME,uBAA2E,CAACC,QAChFA,MAAMC,KAAK;AACb;;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AACA;;CAEC,GACD,OAAO,SAASC;IAKd,OAAOxG,kBAAkBoG;AAC3B"}
@@ -1,5 +1,5 @@
1
1
  import { StateCreator } from 'zustand';
2
- import { PanelGroupId } from '@perses-dev/core';
2
+ import { PanelGroupId } from '@perses-dev/spec';
3
3
  import { Middleware } from './common';
4
4
  import { PanelGroupSlice } from './panel-group-slice';
5
5
  import { PanelSlice } from './panel-slice';