@perses-dev/dashboards 0.39.0 → 0.40.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 (287) hide show
  1. package/dist/cjs/components/AddGroupButton/AddGroupButton.js +9 -7
  2. package/dist/cjs/components/AddGroupButton/index.js +10 -8
  3. package/dist/cjs/components/AddPanelButton/AddPanelButton.js +9 -7
  4. package/dist/cjs/components/AddPanelButton/index.js +10 -8
  5. package/dist/cjs/components/Dashboard/Dashboard.js +11 -9
  6. package/dist/cjs/components/Dashboard/index.js +10 -8
  7. package/dist/cjs/components/DashboardStickyToolbar/DashboardStickyToolbar.js +18 -16
  8. package/dist/cjs/components/DashboardStickyToolbar/index.js +10 -8
  9. package/dist/cjs/components/DashboardToolbar/DashboardToolbar.js +43 -41
  10. package/dist/cjs/components/DashboardToolbar/index.js +10 -8
  11. package/dist/cjs/components/DeletePanelDialog/DeletePanelDialog.js +12 -10
  12. package/dist/cjs/components/DeletePanelDialog/index.js +10 -8
  13. package/dist/cjs/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +17 -15
  14. package/dist/cjs/components/DeletePanelGroupDialog/index.js +10 -8
  15. package/dist/cjs/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js +5 -3
  16. package/dist/cjs/components/DiscardChangesConfirmationDialog/index.js +10 -8
  17. package/dist/cjs/components/DownloadButton/DownloadButton.js +12 -10
  18. package/dist/cjs/components/DownloadButton/index.js +10 -8
  19. package/dist/cjs/components/EditButton/EditButton.js +8 -6
  20. package/dist/cjs/components/EditButton/index.js +10 -8
  21. package/dist/cjs/components/EditJsonButton/EditJsonButton.js +10 -8
  22. package/dist/cjs/components/EditJsonButton/index.js +10 -8
  23. package/dist/cjs/components/EditJsonDialog/EditJsonDialog.js +29 -23
  24. package/dist/cjs/components/EditJsonDialog/index.js +10 -8
  25. package/dist/cjs/components/EmptyDashboard/EmptyDashboard.js +18 -16
  26. package/dist/cjs/components/EmptyDashboard/index.js +10 -8
  27. package/dist/cjs/components/GridLayout/GridContainer.js +5 -3
  28. package/dist/cjs/components/GridLayout/GridItemContent.js +33 -14
  29. package/dist/cjs/components/GridLayout/GridLayout.js +18 -16
  30. package/dist/cjs/components/GridLayout/GridTitle.js +35 -33
  31. package/dist/cjs/components/GridLayout/index.js +13 -11
  32. package/dist/cjs/components/Panel/Panel.js +17 -22
  33. package/dist/cjs/components/Panel/PanelContent.js +8 -6
  34. package/dist/cjs/components/Panel/PanelHeader.js +33 -31
  35. package/dist/cjs/components/Panel/index.js +10 -8
  36. package/dist/cjs/components/PanelDrawer/PanelDrawer.js +25 -77
  37. package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +269 -141
  38. package/dist/cjs/components/PanelDrawer/PanelPreview.js +11 -9
  39. package/dist/cjs/components/PanelDrawer/index.js +10 -8
  40. package/dist/cjs/components/PanelDrawer/usePanelEditor.js +3 -1
  41. package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.js +18 -16
  42. package/dist/cjs/components/PanelGroupDialog/PanelGroupEditorForm.js +15 -11
  43. package/dist/cjs/components/PanelGroupDialog/index.js +10 -8
  44. package/dist/cjs/components/QuerySummaryTable/QuerySummaryTable.js +46 -44
  45. package/dist/cjs/components/QuerySummaryTable/index.js +10 -8
  46. package/dist/cjs/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +23 -21
  47. package/dist/cjs/components/SaveChangesConfirmationDialog/index.js +10 -8
  48. package/dist/cjs/components/SaveDashboardButton/SaveDashboardButton.js +8 -8
  49. package/dist/cjs/components/SaveDashboardButton/index.js +10 -8
  50. package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +40 -16
  51. package/dist/cjs/components/TimeRangeControls/index.js +10 -8
  52. package/dist/cjs/components/ToolbarIconButton/ToolbarIconButton.js +5 -3
  53. package/dist/cjs/components/ToolbarIconButton/index.js +10 -8
  54. package/dist/cjs/components/Variables/BuiltinVariableAccordions.js +140 -0
  55. package/dist/cjs/components/Variables/EditVariablesButton.js +16 -11
  56. package/dist/cjs/components/Variables/TemplateVariable.js +116 -69
  57. package/dist/cjs/components/Variables/VariableEditor.js +280 -204
  58. package/dist/cjs/components/Variables/VariableList.js +19 -15
  59. package/dist/cjs/components/Variables/index.js +14 -11
  60. package/dist/cjs/components/index.js +31 -29
  61. package/dist/cjs/constants/grid-layout-config.js +6 -2
  62. package/dist/cjs/constants/index.js +11 -9
  63. package/dist/cjs/constants/user-interface-text.js +6 -2
  64. package/dist/cjs/context/DashboardProvider/DashboardProvider.js +40 -34
  65. package/dist/cjs/context/DashboardProvider/common.js +6 -2
  66. package/dist/cjs/context/DashboardProvider/dashboard-provider-api.js +70 -38
  67. package/dist/cjs/context/DashboardProvider/delete-panel-group-slice.js +3 -1
  68. package/dist/cjs/context/DashboardProvider/delete-panel-slice.js +5 -3
  69. package/dist/cjs/context/DashboardProvider/discard-changes-dialog-slice.js +3 -1
  70. package/dist/cjs/context/DashboardProvider/duplicate-panel-slice.js +3 -1
  71. package/dist/cjs/context/DashboardProvider/edit-json-dialog-slice.js +3 -1
  72. package/dist/cjs/context/DashboardProvider/index.js +12 -10
  73. package/dist/cjs/context/DashboardProvider/panel-editor-slice.js +13 -11
  74. package/dist/cjs/context/DashboardProvider/panel-group-editor-slice.js +8 -6
  75. package/dist/cjs/context/DashboardProvider/panel-group-slice.js +15 -7
  76. package/dist/cjs/context/DashboardProvider/panel-slice.js +3 -1
  77. package/dist/cjs/context/DashboardProvider/save-changes-dialog-slice.js +3 -1
  78. package/dist/cjs/context/DatasourceStoreProvider.js +114 -45
  79. package/dist/cjs/context/TemplateVariableProvider/TemplateVariableProvider.js +125 -34
  80. package/dist/cjs/context/TemplateVariableProvider/hydrationUtils.js +12 -10
  81. package/dist/cjs/context/TemplateVariableProvider/index.js +10 -8
  82. package/dist/cjs/context/TemplateVariableProvider/query-params.js +17 -7
  83. package/dist/cjs/context/TemplateVariableProvider/utils.js +15 -7
  84. package/dist/cjs/context/index.js +13 -11
  85. package/dist/cjs/context/useDashboard.js +8 -6
  86. package/dist/cjs/index.js +12 -10
  87. package/dist/cjs/stories/decorators/WithDashboard.js +6 -4
  88. package/dist/cjs/stories/decorators/WithDatasourceStore.js +6 -4
  89. package/dist/cjs/stories/decorators/WithTemplateVariables.js +6 -4
  90. package/dist/cjs/stories/decorators/constants.js +5 -3
  91. package/dist/cjs/stories/decorators/index.js +13 -11
  92. package/dist/cjs/test/dashboard-provider.js +8 -4
  93. package/dist/cjs/test/datasource-provider.js +16 -12
  94. package/dist/cjs/test/index.js +13 -11
  95. package/dist/cjs/test/plugin-registry.js +6 -4
  96. package/dist/cjs/test/render.js +27 -20
  97. package/dist/cjs/test/setup-tests.js +2 -2
  98. package/dist/cjs/test/testDashboard.js +13 -11
  99. package/dist/cjs/utils/index.js +11 -9
  100. package/dist/cjs/utils/panelUtils.js +9 -3
  101. package/dist/cjs/utils/time.js +5 -3
  102. package/dist/cjs/validation/index.js +30 -0
  103. package/dist/cjs/validation/panel.js +29 -0
  104. package/dist/cjs/views/ViewDashboard/DashboardApp.js +20 -16
  105. package/dist/cjs/views/ViewDashboard/ViewDashboard.js +63 -19
  106. package/dist/cjs/views/ViewDashboard/index.js +10 -8
  107. package/dist/cjs/views/index.js +10 -8
  108. package/dist/components/AddGroupButton/AddGroupButton.js.map +1 -1
  109. package/dist/components/AddGroupButton/index.js.map +1 -1
  110. package/dist/components/AddPanelButton/AddPanelButton.js.map +1 -1
  111. package/dist/components/AddPanelButton/index.js.map +1 -1
  112. package/dist/components/Dashboard/Dashboard.js.map +1 -1
  113. package/dist/components/Dashboard/index.js.map +1 -1
  114. package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js.map +1 -1
  115. package/dist/components/DashboardStickyToolbar/index.js.map +1 -1
  116. package/dist/components/DashboardToolbar/DashboardToolbar.js +1 -1
  117. package/dist/components/DashboardToolbar/DashboardToolbar.js.map +1 -1
  118. package/dist/components/DashboardToolbar/index.js.map +1 -1
  119. package/dist/components/DeletePanelDialog/DeletePanelDialog.js.map +1 -1
  120. package/dist/components/DeletePanelDialog/index.js.map +1 -1
  121. package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +2 -2
  122. package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js.map +1 -1
  123. package/dist/components/DeletePanelGroupDialog/index.js.map +1 -1
  124. package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js.map +1 -1
  125. package/dist/components/DiscardChangesConfirmationDialog/index.js.map +1 -1
  126. package/dist/components/DownloadButton/DownloadButton.js.map +1 -1
  127. package/dist/components/DownloadButton/index.js.map +1 -1
  128. package/dist/components/EditButton/EditButton.js.map +1 -1
  129. package/dist/components/EditButton/index.js.map +1 -1
  130. package/dist/components/EditJsonButton/EditJsonButton.js.map +1 -1
  131. package/dist/components/EditJsonButton/index.js.map +1 -1
  132. package/dist/components/EditJsonDialog/EditJsonDialog.d.ts +4 -1
  133. package/dist/components/EditJsonDialog/EditJsonDialog.d.ts.map +1 -1
  134. package/dist/components/EditJsonDialog/EditJsonDialog.js +12 -8
  135. package/dist/components/EditJsonDialog/EditJsonDialog.js.map +1 -1
  136. package/dist/components/EditJsonDialog/index.js.map +1 -1
  137. package/dist/components/EmptyDashboard/EmptyDashboard.js.map +1 -1
  138. package/dist/components/EmptyDashboard/index.js.map +1 -1
  139. package/dist/components/GridLayout/GridContainer.js.map +1 -1
  140. package/dist/components/GridLayout/GridItemContent.d.ts.map +1 -1
  141. package/dist/components/GridLayout/GridItemContent.js +27 -10
  142. package/dist/components/GridLayout/GridItemContent.js.map +1 -1
  143. package/dist/components/GridLayout/GridLayout.js +2 -2
  144. package/dist/components/GridLayout/GridLayout.js.map +1 -1
  145. package/dist/components/GridLayout/GridTitle.js.map +1 -1
  146. package/dist/components/GridLayout/index.js.map +1 -1
  147. package/dist/components/Panel/Panel.d.ts.map +1 -1
  148. package/dist/components/Panel/Panel.js +4 -11
  149. package/dist/components/Panel/Panel.js.map +1 -1
  150. package/dist/components/Panel/PanelContent.js.map +1 -1
  151. package/dist/components/Panel/PanelHeader.js.map +1 -1
  152. package/dist/components/Panel/index.js.map +1 -1
  153. package/dist/components/PanelDrawer/PanelDrawer.d.ts.map +1 -1
  154. package/dist/components/PanelDrawer/PanelDrawer.js +22 -76
  155. package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -1
  156. package/dist/components/PanelDrawer/PanelEditorForm.d.ts +4 -1
  157. package/dist/components/PanelDrawer/PanelEditorForm.d.ts.map +1 -1
  158. package/dist/components/PanelDrawer/PanelEditorForm.js +223 -138
  159. package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -1
  160. package/dist/components/PanelDrawer/PanelPreview.js +2 -2
  161. package/dist/components/PanelDrawer/PanelPreview.js.map +1 -1
  162. package/dist/components/PanelDrawer/index.js.map +1 -1
  163. package/dist/components/PanelDrawer/usePanelEditor.js.map +1 -1
  164. package/dist/components/PanelGroupDialog/PanelGroupDialog.js.map +1 -1
  165. package/dist/components/PanelGroupDialog/PanelGroupEditorForm.js.map +1 -1
  166. package/dist/components/PanelGroupDialog/index.js.map +1 -1
  167. package/dist/components/QuerySummaryTable/QuerySummaryTable.js +4 -4
  168. package/dist/components/QuerySummaryTable/QuerySummaryTable.js.map +1 -1
  169. package/dist/components/QuerySummaryTable/index.js.map +1 -1
  170. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +4 -4
  171. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js.map +1 -1
  172. package/dist/components/SaveChangesConfirmationDialog/index.js.map +1 -1
  173. package/dist/components/SaveDashboardButton/SaveDashboardButton.d.ts.map +1 -1
  174. package/dist/components/SaveDashboardButton/SaveDashboardButton.js +1 -3
  175. package/dist/components/SaveDashboardButton/SaveDashboardButton.js.map +1 -1
  176. package/dist/components/SaveDashboardButton/index.js.map +1 -1
  177. package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -1
  178. package/dist/components/TimeRangeControls/TimeRangeControls.js +19 -1
  179. package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
  180. package/dist/components/TimeRangeControls/index.js.map +1 -1
  181. package/dist/components/ToolbarIconButton/ToolbarIconButton.js.map +1 -1
  182. package/dist/components/ToolbarIconButton/index.js.map +1 -1
  183. package/dist/components/Variables/BuiltinVariableAccordions.d.ts +8 -0
  184. package/dist/components/Variables/BuiltinVariableAccordions.d.ts.map +1 -0
  185. package/dist/components/Variables/BuiltinVariableAccordions.js +127 -0
  186. package/dist/components/Variables/BuiltinVariableAccordions.js.map +1 -0
  187. package/dist/components/Variables/EditVariablesButton.d.ts.map +1 -1
  188. package/dist/components/Variables/EditVariablesButton.js +3 -0
  189. package/dist/components/Variables/EditVariablesButton.js.map +1 -1
  190. package/dist/components/Variables/TemplateVariable.d.ts +10 -1
  191. package/dist/components/Variables/TemplateVariable.d.ts.map +1 -1
  192. package/dist/components/Variables/TemplateVariable.js +91 -54
  193. package/dist/components/Variables/TemplateVariable.js.map +1 -1
  194. package/dist/components/Variables/VariableEditor.d.ts +2 -1
  195. package/dist/components/Variables/VariableEditor.d.ts.map +1 -1
  196. package/dist/components/Variables/VariableEditor.js +229 -157
  197. package/dist/components/Variables/VariableEditor.js.map +1 -1
  198. package/dist/components/Variables/VariableList.js +6 -6
  199. package/dist/components/Variables/VariableList.js.map +1 -1
  200. package/dist/components/Variables/index.d.ts +1 -0
  201. package/dist/components/Variables/index.d.ts.map +1 -1
  202. package/dist/components/Variables/index.js +1 -0
  203. package/dist/components/Variables/index.js.map +1 -1
  204. package/dist/components/index.js.map +1 -1
  205. package/dist/constants/grid-layout-config.js.map +1 -1
  206. package/dist/constants/index.js.map +1 -1
  207. package/dist/constants/user-interface-text.js.map +1 -1
  208. package/dist/context/DashboardProvider/DashboardProvider.js +5 -5
  209. package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -1
  210. package/dist/context/DashboardProvider/common.js.map +1 -1
  211. package/dist/context/DashboardProvider/dashboard-provider-api.js +2 -2
  212. package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -1
  213. package/dist/context/DashboardProvider/delete-panel-group-slice.js.map +1 -1
  214. package/dist/context/DashboardProvider/delete-panel-slice.js +2 -2
  215. package/dist/context/DashboardProvider/delete-panel-slice.js.map +1 -1
  216. package/dist/context/DashboardProvider/discard-changes-dialog-slice.js.map +1 -1
  217. package/dist/context/DashboardProvider/duplicate-panel-slice.js.map +1 -1
  218. package/dist/context/DashboardProvider/edit-json-dialog-slice.js.map +1 -1
  219. package/dist/context/DashboardProvider/index.js.map +1 -1
  220. package/dist/context/DashboardProvider/panel-editor-slice.d.ts +2 -1
  221. package/dist/context/DashboardProvider/panel-editor-slice.d.ts.map +1 -1
  222. package/dist/context/DashboardProvider/panel-editor-slice.js +7 -7
  223. package/dist/context/DashboardProvider/panel-editor-slice.js.map +1 -1
  224. package/dist/context/DashboardProvider/panel-group-editor-slice.js +2 -2
  225. package/dist/context/DashboardProvider/panel-group-editor-slice.js.map +1 -1
  226. package/dist/context/DashboardProvider/panel-group-slice.js +3 -3
  227. package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -1
  228. package/dist/context/DashboardProvider/panel-slice.js.map +1 -1
  229. package/dist/context/DashboardProvider/save-changes-dialog-slice.js.map +1 -1
  230. package/dist/context/DatasourceStoreProvider.d.ts +14 -10
  231. package/dist/context/DatasourceStoreProvider.d.ts.map +1 -1
  232. package/dist/context/DatasourceStoreProvider.js +107 -40
  233. package/dist/context/DatasourceStoreProvider.js.map +1 -1
  234. package/dist/context/TemplateVariableProvider/TemplateVariableProvider.d.ts +10 -4
  235. package/dist/context/TemplateVariableProvider/TemplateVariableProvider.d.ts.map +1 -1
  236. package/dist/context/TemplateVariableProvider/TemplateVariableProvider.js +93 -18
  237. package/dist/context/TemplateVariableProvider/TemplateVariableProvider.js.map +1 -1
  238. package/dist/context/TemplateVariableProvider/hydrationUtils.js +7 -7
  239. package/dist/context/TemplateVariableProvider/hydrationUtils.js.map +1 -1
  240. package/dist/context/TemplateVariableProvider/index.js.map +1 -1
  241. package/dist/context/TemplateVariableProvider/query-params.js.map +1 -1
  242. package/dist/context/TemplateVariableProvider/utils.js +3 -3
  243. package/dist/context/TemplateVariableProvider/utils.js.map +1 -1
  244. package/dist/context/index.js.map +1 -1
  245. package/dist/context/useDashboard.js +1 -1
  246. package/dist/context/useDashboard.js.map +1 -1
  247. package/dist/index.js.map +1 -1
  248. package/dist/stories/decorators/WithDashboard.js.map +1 -1
  249. package/dist/stories/decorators/WithDatasourceStore.js.map +1 -1
  250. package/dist/stories/decorators/WithTemplateVariables.js.map +1 -1
  251. package/dist/stories/decorators/constants.js +2 -2
  252. package/dist/stories/decorators/constants.js.map +1 -1
  253. package/dist/stories/decorators/index.js.map +1 -1
  254. package/dist/test/dashboard-provider.js.map +1 -1
  255. package/dist/test/datasource-provider.d.ts.map +1 -1
  256. package/dist/test/datasource-provider.js +5 -7
  257. package/dist/test/datasource-provider.js.map +1 -1
  258. package/dist/test/index.js.map +1 -1
  259. package/dist/test/plugin-registry.js.map +1 -1
  260. package/dist/test/render.d.ts.map +1 -1
  261. package/dist/test/render.js +6 -1
  262. package/dist/test/render.js.map +1 -1
  263. package/dist/test/setup-tests.js.map +1 -1
  264. package/dist/test/testDashboard.js +10 -10
  265. package/dist/test/testDashboard.js.map +1 -1
  266. package/dist/utils/index.js.map +1 -1
  267. package/dist/utils/panelUtils.js.map +1 -1
  268. package/dist/utils/time.js.map +1 -1
  269. package/dist/validation/index.d.ts +2 -0
  270. package/dist/validation/index.d.ts.map +1 -0
  271. package/dist/validation/index.js +15 -0
  272. package/dist/validation/index.js.map +1 -0
  273. package/dist/validation/panel.d.ts +19 -0
  274. package/dist/validation/panel.d.ts.map +1 -0
  275. package/dist/validation/panel.js +21 -0
  276. package/dist/validation/panel.js.map +1 -0
  277. package/dist/views/ViewDashboard/DashboardApp.d.ts +1 -0
  278. package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -1
  279. package/dist/views/ViewDashboard/DashboardApp.js +4 -2
  280. package/dist/views/ViewDashboard/DashboardApp.js.map +1 -1
  281. package/dist/views/ViewDashboard/ViewDashboard.d.ts +1 -0
  282. package/dist/views/ViewDashboard/ViewDashboard.d.ts.map +1 -1
  283. package/dist/views/ViewDashboard/ViewDashboard.js +49 -7
  284. package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -1
  285. package/dist/views/ViewDashboard/index.js.map +1 -1
  286. package/dist/views/index.js.map +1 -1
  287. package/package.json +8 -7
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/context/DashboardProvider/delete-panel-slice.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { StateCreator } from 'zustand';\nimport { Middleware } from './common';\nimport { PanelGroupSlice, PanelGroupItemId } from './panel-group-slice';\nimport { PanelSlice } from './panel-slice';\n\n/**\n * Slice that handles the visual editor state and actions for deleting Panels.\n */\nexport interface DeletePanelSlice {\n /**\n * Delete panels\n */\n deletePanel: (panelGroupItemId: PanelGroupItemId) => void;\n\n /**\n * State for the delete panel dialog when it's open, otherwise undefined when it's closed.\n */\n deletePanelDialog?: DeletePanelDialogState;\n\n /**\n * Open delete panel dialog\n */\n openDeletePanelDialog: (panelGroupItemId: PanelGroupItemId) => void;\n\n /**\n * Close delete panel dialog\n */\n closeDeletePanelDialog: () => void;\n}\n\nexport interface DeletePanelDialogState {\n panelGroupItemId: PanelGroupItemId;\n panelName: string;\n panelGroupName: string;\n}\n\n/**\n * Curried function for creating the PanelDeleteSlice.\n */\nexport function createDeletePanelSlice(): StateCreator<\n // Actions in here need to modify both Panels and Panel Groups state\n DeletePanelSlice & PanelSlice & PanelGroupSlice,\n Middleware,\n [],\n DeletePanelSlice\n> {\n // Return the state creator function for Zustand that uses the panels provided as intitial state\n return (set, get) => ({\n deletePanel(panelGroupItemId: PanelGroupItemId) {\n set((draft) => {\n const { panelGroupId, panelGroupItemLayoutId: panelGroupLayoutId } = panelGroupItemId;\n const existingGroup = draft.panelGroups[panelGroupId];\n if (existingGroup === undefined) {\n throw new Error(`Missing panel group ${panelGroupId}`);\n }\n const existingLayoutIdx = existingGroup.itemLayouts.findIndex((layout) => layout.i === panelGroupLayoutId);\n const existingPanelKey = existingGroup.itemPanelKeys[panelGroupLayoutId];\n if (existingLayoutIdx === -1 || existingPanelKey === undefined) {\n throw new Error(`Missing panel group item ${panelGroupLayoutId}`);\n }\n\n // remove panel from panel group\n existingGroup.itemLayouts.splice(existingLayoutIdx, 1);\n delete existingGroup.itemPanelKeys[panelGroupLayoutId];\n\n // See if panel key is still used and if not, delete it\n if (isPanelKeyStillUsed(draft.panelGroups, existingPanelKey) === false) {\n delete draft.panels[existingPanelKey];\n }\n });\n },\n\n openDeletePanelDialog(panelGroupItemId: PanelGroupItemId) {\n const { panelGroupId, panelGroupItemLayoutId: panelGroupLayoutId } = panelGroupItemId;\n\n const { panels, panelGroups } = get();\n const panelGroup = panelGroups[panelGroupId];\n if (panelGroup === undefined) {\n throw new Error(`Panel group not found ${panelGroupId}`);\n }\n\n const panelKey = panelGroup.itemPanelKeys[panelGroupLayoutId];\n if (panelKey === undefined) {\n throw new Error(`Could not find Panel Group item ${panelGroupLayoutId}`);\n }\n\n const panel = panels[panelKey];\n if (panel === undefined) {\n throw new Error(`Could not find panel ${panelKey}`);\n }\n\n set((state) => {\n state.deletePanelDialog = {\n panelGroupItemId: panelGroupItemId,\n panelName: panel.spec.display.name,\n panelGroupName: panelGroup.title ?? '',\n };\n });\n },\n\n closeDeletePanelDialog() {\n set((state) => {\n state.deletePanelDialog = undefined;\n });\n },\n });\n}\n\n// Helper function to determine if a panel key is still being used somewhere in Panel Groups\nfunction isPanelKeyStillUsed(panelGroups: PanelGroupSlice['panelGroups'], panelKey: string) {\n for (const group of Object.values(panelGroups)) {\n const found = Object.values(group.itemPanelKeys).find((key) => key === panelKey);\n if (found !== undefined) {\n return true;\n }\n }\n return false;\n}\n"],"names":["createDeletePanelSlice","set","get","deletePanel","panelGroupItemId","draft","panelGroupId","panelGroupItemLayoutId","panelGroupLayoutId","existingGroup","panelGroups","undefined","Error","existingLayoutIdx","itemLayouts","findIndex","layout","i","existingPanelKey","itemPanelKeys","splice","isPanelKeyStillUsed","panels","openDeletePanelDialog","panelGroup","panelKey","panel","state","deletePanelDialog","panelName","spec","display","name","panelGroupName","title","closeDeletePanelDialog","group","Object","values","found","find","key"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAsCjC;;CAEC,GACD,OAAO,SAASA,sBAAsB,GAMpC;IACA,gGAAgG;IAChG,OAAO,CAACC,GAAG,EAAEC,GAAG,GAAM,CAAA;YACpBC,WAAW,EAACC,gBAAkC,EAAE;gBAC9CH,GAAG,CAAC,CAACI,KAAK,GAAK;oBACb,MAAM,EAAEC,YAAY,CAAA,EAAEC,sBAAsB,EAAEC,kBAAkB,CAAA,EAAE,GAAGJ,gBAAgB,AAAC;oBACtF,MAAMK,aAAa,GAAGJ,KAAK,CAACK,WAAW,CAACJ,YAAY,CAAC,AAAC;oBACtD,IAAIG,aAAa,KAAKE,SAAS,EAAE;wBAC/B,MAAM,IAAIC,KAAK,CAAC,CAAC,oBAAoB,EAAEN,YAAY,CAAC,CAAC,CAAC,CAAC;oBACzD,CAAC;oBACD,MAAMO,iBAAiB,GAAGJ,aAAa,CAACK,WAAW,CAACC,SAAS,CAAC,CAACC,MAAM,GAAKA,MAAM,C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sources":["../../../src/context/DashboardProvider/delete-panel-slice.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { StateCreator } from 'zustand';\nimport { Middleware } from './common';\nimport { PanelGroupSlice, PanelGroupItemId } from './panel-group-slice';\nimport { PanelSlice } from './panel-slice';\n\n/**\n * Slice that handles the visual editor state and actions for deleting Panels.\n */\nexport interface DeletePanelSlice {\n /**\n * Delete panels\n */\n deletePanel: (panelGroupItemId: PanelGroupItemId) => void;\n\n /**\n * State for the delete panel dialog when it's open, otherwise undefined when it's closed.\n */\n deletePanelDialog?: DeletePanelDialogState;\n\n /**\n * Open delete panel dialog\n */\n openDeletePanelDialog: (panelGroupItemId: PanelGroupItemId) => void;\n\n /**\n * Close delete panel dialog\n */\n closeDeletePanelDialog: () => void;\n}\n\nexport interface DeletePanelDialogState {\n panelGroupItemId: PanelGroupItemId;\n panelName: string;\n panelGroupName: string;\n}\n\n/**\n * Curried function for creating the PanelDeleteSlice.\n */\nexport function createDeletePanelSlice(): StateCreator<\n // Actions in here need to modify both Panels and Panel Groups state\n DeletePanelSlice & PanelSlice & PanelGroupSlice,\n Middleware,\n [],\n DeletePanelSlice\n> {\n // Return the state creator function for Zustand that uses the panels provided as intitial state\n return (set, get) => ({\n deletePanel(panelGroupItemId: PanelGroupItemId) {\n set((draft) => {\n const { panelGroupId, panelGroupItemLayoutId: panelGroupLayoutId } = panelGroupItemId;\n const existingGroup = draft.panelGroups[panelGroupId];\n if (existingGroup === undefined) {\n throw new Error(`Missing panel group ${panelGroupId}`);\n }\n const existingLayoutIdx = existingGroup.itemLayouts.findIndex((layout) => layout.i === panelGroupLayoutId);\n const existingPanelKey = existingGroup.itemPanelKeys[panelGroupLayoutId];\n if (existingLayoutIdx === -1 || existingPanelKey === undefined) {\n throw new Error(`Missing panel group item ${panelGroupLayoutId}`);\n }\n\n // remove panel from panel group\n existingGroup.itemLayouts.splice(existingLayoutIdx, 1);\n delete existingGroup.itemPanelKeys[panelGroupLayoutId];\n\n // See if panel key is still used and if not, delete it\n if (isPanelKeyStillUsed(draft.panelGroups, existingPanelKey) === false) {\n delete draft.panels[existingPanelKey];\n }\n });\n },\n\n openDeletePanelDialog(panelGroupItemId: PanelGroupItemId) {\n const { panelGroupId, panelGroupItemLayoutId: panelGroupLayoutId } = panelGroupItemId;\n\n const { panels, panelGroups } = get();\n const panelGroup = panelGroups[panelGroupId];\n if (panelGroup === undefined) {\n throw new Error(`Panel group not found ${panelGroupId}`);\n }\n\n const panelKey = panelGroup.itemPanelKeys[panelGroupLayoutId];\n if (panelKey === undefined) {\n throw new Error(`Could not find Panel Group item ${panelGroupLayoutId}`);\n }\n\n const panel = panels[panelKey];\n if (panel === undefined) {\n throw new Error(`Could not find panel ${panelKey}`);\n }\n\n set((state) => {\n state.deletePanelDialog = {\n panelGroupItemId: panelGroupItemId,\n panelName: panel.spec.display.name,\n panelGroupName: panelGroup.title ?? '',\n };\n });\n },\n\n closeDeletePanelDialog() {\n set((state) => {\n state.deletePanelDialog = undefined;\n });\n },\n });\n}\n\n// Helper function to determine if a panel key is still being used somewhere in Panel Groups\nfunction isPanelKeyStillUsed(panelGroups: PanelGroupSlice['panelGroups'], panelKey: string) {\n for (const group of Object.values(panelGroups)) {\n const found = Object.values(group.itemPanelKeys).find((key) => key === panelKey);\n if (found !== undefined) {\n return true;\n }\n }\n return false;\n}\n"],"names":["createDeletePanelSlice","set","get","deletePanel","panelGroupItemId","draft","panelGroupId","panelGroupItemLayoutId","panelGroupLayoutId","existingGroup","panelGroups","undefined","Error","existingLayoutIdx","itemLayouts","findIndex","layout","i","existingPanelKey","itemPanelKeys","splice","isPanelKeyStillUsed","panels","openDeletePanelDialog","panelGroup","panelKey","panel","state","deletePanelDialog","panelName","spec","display","name","panelGroupName","title","closeDeletePanelDialog","group","Object","values","found","find","key"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAsCjC;;CAEC,GACD,OAAO,SAASA;IAOd,gGAAgG;IAChG,OAAO,CAACC,KAAKC,MAAS,CAAA;YACpBC,aAAYC,gBAAkC;gBAC5CH,IAAI,CAACI;oBACH,MAAM,EAAEC,aAAY,EAAEC,wBAAwBC,mBAAkB,EAAE,GAAGJ;oBACrE,MAAMK,gBAAgBJ,MAAMK,WAAW,CAACJ,aAAa;oBACrD,IAAIG,kBAAkBE,WAAW;wBAC/B,MAAM,IAAIC,MAAM,CAAC,oBAAoB,EAAEN,aAAa,CAAC;oBACvD;oBACA,MAAMO,oBAAoBJ,cAAcK,YAAYC,UAAU,CAACC,SAAWA,OAAOC,MAAMT;oBACvF,MAAMU,mBAAmBT,cAAcU,aAAa,CAACX,mBAAmB;oBACxE,IAAIK,sBAAsB,CAAC,KAAKK,qBAAqBP,WAAW;wBAC9D,MAAM,IAAIC,MAAM,CAAC,yBAAyB,EAAEJ,mBAAmB,CAAC;oBAClE;oBAEA,gCAAgC;oBAChCC,cAAcK,YAAYM,OAAOP,mBAAmB;oBACpD,OAAOJ,cAAcU,aAAa,CAACX,mBAAmB;oBAEtD,uDAAuD;oBACvD,IAAIa,oBAAoBhB,MAAMK,aAAaQ,sBAAsB,OAAO;wBACtE,OAAOb,MAAMiB,MAAM,CAACJ,iBAAiB;oBACvC;gBACF;YACF;YAEAK,uBAAsBnB,gBAAkC;gBACtD,MAAM,EAAEE,aAAY,EAAEC,wBAAwBC,mBAAkB,EAAE,GAAGJ;gBAErE,MAAM,EAAEkB,OAAM,EAAEZ,YAAW,EAAE,GAAGR;gBAChC,MAAMsB,aAAad,WAAW,CAACJ,aAAa;gBAC5C,IAAIkB,eAAeb,WAAW;oBAC5B,MAAM,IAAIC,MAAM,CAAC,sBAAsB,EAAEN,aAAa,CAAC;gBACzD;gBAEA,MAAMmB,WAAWD,WAAWL,aAAa,CAACX,mBAAmB;gBAC7D,IAAIiB,aAAad,WAAW;oBAC1B,MAAM,IAAIC,MAAM,CAAC,gCAAgC,EAAEJ,mBAAmB,CAAC;gBACzE;gBAEA,MAAMkB,QAAQJ,MAAM,CAACG,SAAS;gBAC9B,IAAIC,UAAUf,WAAW;oBACvB,MAAM,IAAIC,MAAM,CAAC,qBAAqB,EAAEa,SAAS,CAAC;gBACpD;gBAEAxB,IAAI,CAAC0B;wBAIeH;oBAHlBG,MAAMC,oBAAoB;wBACxBxB,kBAAkBA;wBAClByB,WAAWH,MAAMI,KAAKC,QAAQC;wBAC9BC,gBAAgBT,CAAAA,oBAAAA,WAAWU,mBAAXV,+BAAAA,oBAAoB;oBACtC;gBACF;YACF;YAEAW;gBACElC,IAAI,CAAC0B;oBACHA,MAAMC,oBAAoBjB;gBAC5B;YACF;QACF,CAAA;AACF;AAEA,4FAA4F;AAC5F,SAASU,oBAAoBX,WAA2C,EAAEe,QAAgB;IACxF,KAAK,MAAMW,SAASC,OAAOC,OAAO5B,aAAc;QAC9C,MAAM6B,QAAQF,OAAOC,OAAOF,MAAMjB,eAAeqB,KAAK,CAACC,MAAQA,QAAQhB;QACvE,IAAIc,UAAU5B,WAAW;YACvB,OAAO;QACT;IACF;IACA,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/context/DashboardProvider/discard-changes-dialog-slice.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { StateCreator } from 'zustand';\nimport { Middleware } from './common';\n\nexport interface DiscardChangesConfirmationDialogSlice {\n discardChangesConfirmationDialog?: DiscardChangesConfirmationDialogState;\n openDiscardChangesConfirmationDialog: (\n discardChangesConfirmationDialog: DiscardChangesConfirmationDialogState\n ) => void;\n closeDiscardChangesConfirmationDialog: () => void;\n}\n\nexport interface DiscardChangesConfirmationDialogState {\n onDiscardChanges: () => void;\n onCancel: () => void;\n description?: string;\n}\n\nexport const createDiscardChangesDialogSlice: StateCreator<\n DiscardChangesConfirmationDialogSlice,\n Middleware,\n [],\n DiscardChangesConfirmationDialogSlice\n> = (set) => ({\n isOpen: false,\n\n openDiscardChangesConfirmationDialog(dialog) {\n set((state) => {\n state.discardChangesConfirmationDialog = dialog;\n });\n },\n\n closeDiscardChangesConfirmationDialog() {\n set((state) => {\n state.discardChangesConfirmationDialog = undefined;\n });\n },\n});\n"],"names":["createDiscardChangesDialogSlice","set","isOpen","openDiscardChangesConfirmationDialog","dialog","state","discardChangesConfirmationDialog","closeDiscardChangesConfirmationDialog","undefined"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAmBjC,OAAO,MAAMA,+BAA+B,GAKxC,CAACC,GAAG,GAAM,CAAA;QACZC,MAAM,EAAE,KAAK;QAEbC,oCAAoC,EAACC,MAAM,EAAE;YAC3CH,GAAG,CAAC,CAACI,KAAK,GAAK;gBACbA,KAAK,CAACC,gCAAgC,GAAGF,MAAM,CAAC;YAClD,CAAC,CAAC,CAAC;QACL,CAAC;QAEDG,qCAAqC,IAAG;YACtCN,GAAG,CAAC,CAACI,KAAK,GAAK;gBACbA,KAAK,CAACC,gCAAgC,GAAGE,SAAS,CAAC;YACrD,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAA,AAAC,CAAC"}
1
+ {"version":3,"sources":["../../../src/context/DashboardProvider/discard-changes-dialog-slice.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { StateCreator } from 'zustand';\nimport { Middleware } from './common';\n\nexport interface DiscardChangesConfirmationDialogSlice {\n discardChangesConfirmationDialog?: DiscardChangesConfirmationDialogState;\n openDiscardChangesConfirmationDialog: (\n discardChangesConfirmationDialog: DiscardChangesConfirmationDialogState\n ) => void;\n closeDiscardChangesConfirmationDialog: () => void;\n}\n\nexport interface DiscardChangesConfirmationDialogState {\n onDiscardChanges: () => void;\n onCancel: () => void;\n description?: string;\n}\n\nexport const createDiscardChangesDialogSlice: StateCreator<\n DiscardChangesConfirmationDialogSlice,\n Middleware,\n [],\n DiscardChangesConfirmationDialogSlice\n> = (set) => ({\n isOpen: false,\n\n openDiscardChangesConfirmationDialog(dialog) {\n set((state) => {\n state.discardChangesConfirmationDialog = dialog;\n });\n },\n\n closeDiscardChangesConfirmationDialog() {\n set((state) => {\n state.discardChangesConfirmationDialog = undefined;\n });\n },\n});\n"],"names":["createDiscardChangesDialogSlice","set","isOpen","openDiscardChangesConfirmationDialog","dialog","state","discardChangesConfirmationDialog","closeDiscardChangesConfirmationDialog","undefined"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAmBjC,OAAO,MAAMA,kCAKT,CAACC,MAAS,CAAA;QACZC,QAAQ;QAERC,sCAAqCC,MAAM;YACzCH,IAAI,CAACI;gBACHA,MAAMC,mCAAmCF;YAC3C;QACF;QAEAG;YACEN,IAAI,CAACI;gBACHA,MAAMC,mCAAmCE;YAC3C;QACF;IACF,CAAA,EAAG"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/context/DashboardProvider/duplicate-panel-slice.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { StateCreator } from 'zustand';\nimport { getValidPanelKey, insertPanelInLayout, UnpositionedPanelGroupItemLayout } from '../../utils/panelUtils';\nimport { generateId, Middleware } from './common';\nimport { PanelGroupSlice, PanelGroupItemId } from './panel-group-slice';\nimport { PanelSlice } from './panel-slice';\n\n/**\n * Slice that handles duplicating Panels.\n */\nexport interface DuplicatePanelSlice {\n /**\n * Duplicate panel.\n */\n duplicatePanel: (panelGroupItemId: PanelGroupItemId) => void;\n}\n\n/**\n * Curried function for duplicating a panel.\n */\nexport function createDuplicatePanelSlice(): StateCreator<\n // Actions in here need to modify both Panels and Panel Groups state\n DuplicatePanelSlice & PanelSlice & PanelGroupSlice,\n Middleware,\n [],\n DuplicatePanelSlice\n> {\n return (set) => ({\n duplicatePanel(panelGroupItemId: PanelGroupItemId) {\n set((state) => {\n const panels = state.panels;\n\n // Figure out the panel key at that location\n const { panelGroupId, panelGroupItemLayoutId: panelGroupLayoutId } = panelGroupItemId;\n const group = state.panelGroups[panelGroupId];\n if (group === undefined) {\n throw new Error(`Missing panel group ${panelGroupId}`);\n }\n const panelKey = group.itemPanelKeys[panelGroupLayoutId];\n if (panelKey === undefined) {\n throw new Error(`Could not find Panel Group item ${panelGroupItemId}`);\n }\n\n // Find the panel to edit\n const panelToDupe = panels[panelKey];\n if (panelToDupe === undefined) {\n throw new Error(`Cannot find Panel with key '${panelKey}'`);\n }\n\n // Find the layout for the item being duped\n const matchingLayout = group.itemLayouts.find((itemLayout) => {\n return itemLayout.i === panelGroupLayoutId;\n });\n\n if (matchingLayout === undefined) {\n throw new Error(`Cannot find layout for Panel with key '${panelKey}'`);\n }\n\n const dupePanelKey = getValidPanelKey(panelKey, panels);\n\n state.panels[dupePanelKey] = panelToDupe;\n\n const duplicateLayout: UnpositionedPanelGroupItemLayout = {\n i: generateId().toString(),\n w: matchingLayout.w,\n h: matchingLayout.h,\n };\n\n group.itemLayouts = insertPanelInLayout(duplicateLayout, matchingLayout, group.itemLayouts);\n\n group.itemPanelKeys[duplicateLayout.i] = dupePanelKey;\n });\n },\n });\n}\n"],"names":["getValidPanelKey","insertPanelInLayout","generateId","createDuplicatePanelSlice","set","duplicatePanel","panelGroupItemId","state","panels","panelGroupId","panelGroupItemLayoutId","panelGroupLayoutId","group","panelGroups","undefined","Error","panelKey","itemPanelKeys","panelToDupe","matchingLayout","itemLayouts","find","itemLayout","i","dupePanelKey","duplicateLayout","toString","w","h"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAASA,gBAAgB,EAAEC,mBAAmB,QAA0C,wBAAwB,CAAC;AACjH,SAASC,UAAU,QAAoB,UAAU,CAAC;AAclD;;CAEC,GACD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AAC,CAAC,CAAC,CAAC,CAAC;oBACzE,CAAC;oBAED,MAAMQ,YAAY,GAAGxB,gBAAgB,CAACgB,QAAQ,EAAER,MAAM,CAAC,AAAC;oBAExDD,KAAK,CAACC,MAAM,CAACgB,YAAY,CAAC,GAAGN,WAAW,CAAC;oBAEzC,MAAMO,eAAe,GAAqC;wBACxDF,CAAC,EAAErB,UAAU,EAAE,CAACwB,QAAQ,EAAE;wBAC1BC,CAAC,EAAER,cAAc,CAACQ,CAAC;wBACnBC,CAAC,EAAET,cAAc,CAACS,CAAC;qBACpB,AAAC;oBAEFhB,KAAK,CAACQ,WAAW,GAAGnB,mBAAmB,CAACwB,eAAe,EAAEN,cAAc,EAAEP,KAAK,CAACQ,WAAW,CAAC,CAAC;oBAE5FR,KAAK,CAACK,aAAa,CAACQ,eAAe,CAACF,CAAC,CAAC,GAAGC,YAAY,CAAC;gBACxD,CAAC,CAAC,CAAC;YACL,CAAC;SACF,CAAA,AAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"sources":["../../../src/context/DashboardProvider/duplicate-panel-slice.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { StateCreator } from 'zustand';\nimport { getValidPanelKey, insertPanelInLayout, UnpositionedPanelGroupItemLayout } from '../../utils/panelUtils';\nimport { generateId, Middleware } from './common';\nimport { PanelGroupSlice, PanelGroupItemId } from './panel-group-slice';\nimport { PanelSlice } from './panel-slice';\n\n/**\n * Slice that handles duplicating Panels.\n */\nexport interface DuplicatePanelSlice {\n /**\n * Duplicate panel.\n */\n duplicatePanel: (panelGroupItemId: PanelGroupItemId) => void;\n}\n\n/**\n * Curried function for duplicating a panel.\n */\nexport function createDuplicatePanelSlice(): StateCreator<\n // Actions in here need to modify both Panels and Panel Groups state\n DuplicatePanelSlice & PanelSlice & PanelGroupSlice,\n Middleware,\n [],\n DuplicatePanelSlice\n> {\n return (set) => ({\n duplicatePanel(panelGroupItemId: PanelGroupItemId) {\n set((state) => {\n const panels = state.panels;\n\n // Figure out the panel key at that location\n const { panelGroupId, panelGroupItemLayoutId: panelGroupLayoutId } = panelGroupItemId;\n const group = state.panelGroups[panelGroupId];\n if (group === undefined) {\n throw new Error(`Missing panel group ${panelGroupId}`);\n }\n const panelKey = group.itemPanelKeys[panelGroupLayoutId];\n if (panelKey === undefined) {\n throw new Error(`Could not find Panel Group item ${panelGroupItemId}`);\n }\n\n // Find the panel to edit\n const panelToDupe = panels[panelKey];\n if (panelToDupe === undefined) {\n throw new Error(`Cannot find Panel with key '${panelKey}'`);\n }\n\n // Find the layout for the item being duped\n const matchingLayout = group.itemLayouts.find((itemLayout) => {\n return itemLayout.i === panelGroupLayoutId;\n });\n\n if (matchingLayout === undefined) {\n throw new Error(`Cannot find layout for Panel with key '${panelKey}'`);\n }\n\n const dupePanelKey = getValidPanelKey(panelKey, panels);\n\n state.panels[dupePanelKey] = panelToDupe;\n\n const duplicateLayout: UnpositionedPanelGroupItemLayout = {\n i: generateId().toString(),\n w: matchingLayout.w,\n h: matchingLayout.h,\n };\n\n group.itemLayouts = insertPanelInLayout(duplicateLayout, matchingLayout, group.itemLayouts);\n\n group.itemPanelKeys[duplicateLayout.i] = dupePanelKey;\n });\n },\n });\n}\n"],"names":["getValidPanelKey","insertPanelInLayout","generateId","createDuplicatePanelSlice","set","duplicatePanel","panelGroupItemId","state","panels","panelGroupId","panelGroupItemLayoutId","panelGroupLayoutId","group","panelGroups","undefined","Error","panelKey","itemPanelKeys","panelToDupe","matchingLayout","itemLayouts","find","itemLayout","i","dupePanelKey","duplicateLayout","toString","w","h"],"mappings":"AAAA,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AoD;wBACxDF,GAAGrB,aAAawB;wBAChBC,GAAGR,eAAeQ;wBAClBC,GAAGT,eAAeS;oBACpB;oBAEAhB,MAAMQ,cAAcnB,oBAAoBwB,iBAAiBN,gBAAgBP,MAAMQ;oBAE/ER,MAAMK,aAAa,CAACQ,gBAAgBF,EAAE,GAAGC;gBAC3C;YACF;QACF,CAAA;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/context/DashboardProvider/edit-json-dialog-slice.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { StateCreator } from 'zustand';\nimport { Middleware } from './common';\n\nexport interface EditJsonDialogSlice {\n editJsonDialog?: EditJsonDialogState;\n openEditJsonDialog: () => void;\n closeEditJsonDialog: () => void;\n}\n\nexport interface EditJsonDialogState {\n isOpen: boolean;\n}\n\nexport const createEditJsonDialogSlice: StateCreator<EditJsonDialogSlice, Middleware, [], EditJsonDialogSlice> = (\n set\n) => ({\n openEditJsonDialog() {\n set((state) => {\n state.editJsonDialog = {\n isOpen: true,\n };\n });\n },\n\n closeEditJsonDialog() {\n set((state) => {\n state.editJsonDialog = {\n isOpen: false,\n };\n });\n },\n});\n"],"names":["createEditJsonDialogSlice","set","openEditJsonDialog","state","editJsonDialog","isOpen","closeEditJsonDialog"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAejC,OAAO,MAAMA,yBAAyB,GAA2E,CAC/GC,GAAG,GACC,CAAA;QACJC,kBAAkB,IAAG;YACnBD,GAAG,CAAC,CAACE,KAAK,GAAK;gBACbA,KAAK,CAACC,cAAc,GAAG;oBACrBC,MAAM,EAAE,IAAI;iBACb,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;QAEDC,mBAAmB,IAAG;YACpBL,GAAG,CAAC,CAACE,KAAK,GAAK;gBACbA,KAAK,CAACC,cAAc,GAAG;oBACrBC,MAAM,EAAE,KAAK;iBACd,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAA,AAAC,CAAC"}
1
+ {"version":3,"sources":["../../../src/context/DashboardProvider/edit-json-dialog-slice.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { StateCreator } from 'zustand';\nimport { Middleware } from './common';\n\nexport interface EditJsonDialogSlice {\n editJsonDialog?: EditJsonDialogState;\n openEditJsonDialog: () => void;\n closeEditJsonDialog: () => void;\n}\n\nexport interface EditJsonDialogState {\n isOpen: boolean;\n}\n\nexport const createEditJsonDialogSlice: StateCreator<EditJsonDialogSlice, Middleware, [], EditJsonDialogSlice> = (\n set\n) => ({\n openEditJsonDialog() {\n set((state) => {\n state.editJsonDialog = {\n isOpen: true,\n };\n });\n },\n\n closeEditJsonDialog() {\n set((state) => {\n state.editJsonDialog = {\n isOpen: false,\n };\n });\n },\n});\n"],"names":["createEditJsonDialogSlice","set","openEditJsonDialog","state","editJsonDialog","isOpen","closeEditJsonDialog"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAejC,OAAO,MAAMA,4BAAoG,CAC/GC,MACI,CAAA;QACJC;YACED,IAAI,CAACE;gBACHA,MAAMC,iBAAiB;oBACrBC,QAAQ;gBACV;YACF;QACF;QAEAC;YACEL,IAAI,CAACE;gBACHA,MAAMC,iBAAiB;oBACrBC,QAAQ;gBACV;YACF;QACF;IACF,CAAA,EAAG"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/context/DashboardProvider/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './common';\nexport * from './dashboard-provider-api';\nexport * from './DashboardProvider';\nexport type {\n PanelGroupId,\n PanelGroupDefinition,\n PanelGroupItemId,\n PanelGroupItemLayoutId as PanelGroupLayoutId,\n PanelGroupItemLayout,\n} from './panel-group-slice';\nexport type { PanelGroupEditor, PanelGroupEditorValues } from './panel-group-editor-slice';\nexport type { DeletePanelDialogState } from './delete-panel-slice';\nexport type { DiscardChangesConfirmationDialogState } from './discard-changes-dialog-slice';\nexport type { PanelEditorValues } from './panel-editor-slice';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,UAAU,CAAC;AACzB,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"sources":["../../../src/context/DashboardProvider/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './common';\nexport * from './dashboard-provider-api';\nexport * from './DashboardProvider';\nexport type {\n PanelGroupId,\n PanelGroupDefinition,\n PanelGroupItemId,\n PanelGroupItemLayoutId as PanelGroupLayoutId,\n PanelGroupItemLayout,\n} from './panel-group-slice';\nexport type { PanelGroupEditor, PanelGroupEditorValues } from './panel-group-editor-slice';\nexport type { DeletePanelDialogState } from './delete-panel-slice';\nexport type { DiscardChangesConfirmationDialogState } from './discard-changes-dialog-slice';\nexport type { PanelEditorValues } from './panel-editor-slice';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,WAAW;AACzB,cAAc,2BAA2B;AACzC,cAAc,sBAAsB"}
@@ -1,5 +1,6 @@
1
1
  import { PanelDefinition } from '@perses-dev/core';
2
2
  import { StateCreator } from 'zustand';
3
+ import { Action } from '@perses-dev/plugin-system';
3
4
  import { Middleware } from './common';
4
5
  import { PanelGroupSlice, PanelGroupItemId, PanelGroupId } from './panel-group-slice';
5
6
  import { PanelSlice } from './panel-slice';
@@ -28,7 +29,7 @@ export interface PanelEditorState {
28
29
  /**
29
30
  * Whether we're adding a new panel, or editing an existing panel.
30
31
  */
31
- mode: 'Add' | 'Edit';
32
+ mode: Action;
32
33
  /**
33
34
  * Initial values for the things that can be edited about a panel.
34
35
  */
@@ -1 +1 @@
1
- {"version":3,"file":"panel-editor-slice.d.ts","sourceRoot":"","sources":["../../../src/context/DashboardProvider/panel-editor-slice.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAAc,UAAU,EAAyB,MAAM,UAAU,CAAC;AACzE,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,YAAY,EAKb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,aAAa,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,CAAC;IAE3D;;OAEG;IACH,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAE/B;;OAEG;IACH,aAAa,EAAE,CAAC,gBAAgB,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAE5D;;OAEG;IACH,YAAY,EAAE,CAAC,YAAY,CAAC,EAAE,YAAY,KAAK,IAAI,CAAC;CACrD;AAED,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,IAAI,EAAE,KAAK,GAAG,MAAM,CAAC;IAErB;;OAEG;IACH,aAAa,EAAE,iBAAiB,CAAC;IAEjC;;OAEG;IACH,YAAY,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAEhD;;OAEG;IACH,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,YAAY,CAAC;IACtB,eAAe,EAAE,eAAe,CAAC;CAClC;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,YAAY,CAEpD,gBAAgB,GAAG,UAAU,GAAG,eAAe,EAC/C,UAAU,EACV;CAAE,EACF,gBAAgB,CACjB,CA4IA"}
1
+ {"version":3,"file":"panel-editor-slice.d.ts","sourceRoot":"","sources":["../../../src/context/DashboardProvider/panel-editor-slice.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAEnD,OAAO,EAAc,UAAU,EAAyB,MAAM,UAAU,CAAC;AACzE,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,YAAY,EAKb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,aAAa,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,CAAC;IAE3D;;OAEG;IACH,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAE/B;;OAEG;IACH,aAAa,EAAE,CAAC,gBAAgB,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAE5D;;OAEG;IACH,YAAY,EAAE,CAAC,YAAY,CAAC,EAAE,YAAY,KAAK,IAAI,CAAC;CACrD;AAED,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,aAAa,EAAE,iBAAiB,CAAC;IAEjC;;OAEG;IACH,YAAY,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAEhD;;OAEG;IACH,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,YAAY,CAAC;IACtB,eAAe,EAAE,eAAe,CAAC;CAClC;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,YAAY,CAEpD,gBAAgB,GAAG,UAAU,GAAG,eAAe,EAC/C,UAAU,EACV;CAAE,EACF,gBAAgB,CACjB,CA4IA"}
@@ -21,11 +21,11 @@ import { addPanelGroup, createEmptyPanelGroup } from './panel-group-slice';
21
21
  return {
22
22
  panelEditor: undefined,
23
23
  openEditPanel (panelGroupItemId) {
24
- var ref;
24
+ var _panelGroups_panelGroupId;
25
25
  const { panels , panelGroups } = get();
26
26
  // Figure out the panel key at that location
27
27
  const { panelGroupId , panelGroupItemLayoutId: panelGroupLayoutId } = panelGroupItemId;
28
- const panelKey = (ref = panelGroups[panelGroupId]) === null || ref === void 0 ? void 0 : ref.itemPanelKeys[panelGroupLayoutId];
28
+ const panelKey = (_panelGroups_panelGroupId = panelGroups[panelGroupId]) === null || _panelGroups_panelGroupId === void 0 ? void 0 : _panelGroups_panelGroupId.itemPanelKeys[panelGroupLayoutId];
29
29
  if (panelKey === undefined) {
30
30
  throw new Error(`Could not find Panel Group item ${panelGroupItemId}`);
31
31
  }
@@ -35,7 +35,7 @@ import { addPanelGroup, createEmptyPanelGroup } from './panel-group-slice';
35
35
  throw new Error(`Cannot find Panel with key '${panelKey}'`);
36
36
  }
37
37
  const editorState = {
38
- mode: 'Edit',
38
+ mode: 'update',
39
39
  initialValues: {
40
40
  groupId: panelGroupItemId.panelGroupId,
41
41
  panelDefinition: panelToEdit
@@ -88,7 +88,7 @@ import { addPanelGroup, createEmptyPanelGroup } from './panel-group-slice';
88
88
  });
89
89
  },
90
90
  openAddPanel (panelGroupId) {
91
- var ref;
91
+ var _get_initialValues;
92
92
  // If a panel group isn't supplied, add to the first group or create a group if there aren't any
93
93
  let newGroup = undefined;
94
94
  panelGroupId !== null && panelGroupId !== void 0 ? panelGroupId : panelGroupId = get().panelGroupOrder[0];
@@ -97,12 +97,12 @@ import { addPanelGroup, createEmptyPanelGroup } from './panel-group-slice';
97
97
  newGroup.title = 'Panel Group';
98
98
  panelGroupId = newGroup.id;
99
99
  }
100
- var ref1;
100
+ var _get_initialValues_panelDefinition;
101
101
  const editorState = {
102
- mode: 'Add',
102
+ mode: 'create',
103
103
  initialValues: {
104
104
  groupId: panelGroupId,
105
- panelDefinition: (ref1 = (ref = get().initialValues) === null || ref === void 0 ? void 0 : ref.panelDefinition) !== null && ref1 !== void 0 ? ref1 : createPanelDefinition()
105
+ panelDefinition: (_get_initialValues_panelDefinition = (_get_initialValues = get().initialValues) === null || _get_initialValues === void 0 ? void 0 : _get_initialValues.panelDefinition) !== null && _get_initialValues_panelDefinition !== void 0 ? _get_initialValues_panelDefinition : createPanelDefinition()
106
106
  },
107
107
  applyChanges: (next)=>{
108
108
  const name = next.panelDefinition.spec.display.name;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/context/DashboardProvider/panel-editor-slice.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { PanelDefinition } from '@perses-dev/core';\nimport { StateCreator } from 'zustand';\nimport { getYForNewRow, getValidPanelKey } from '../../utils/panelUtils';\nimport { generateId, Middleware, createPanelDefinition } from './common';\nimport {\n PanelGroupSlice,\n PanelGroupItemId,\n PanelGroupId,\n PanelGroupDefinition,\n PanelGroupItemLayout,\n addPanelGroup,\n createEmptyPanelGroup,\n} from './panel-group-slice';\nimport { PanelSlice } from './panel-slice';\n\n/**\n * Slice that handles the visual editor state and actions for adding or editing Panels.\n */\nexport interface PanelEditorSlice {\n /**\n * Initial values for add panel if default panel kind is defined\n */\n initialValues?: Pick<PanelEditorValues, 'panelDefinition'>;\n\n /**\n * State for the panel editor when its open, otherwise undefined when it's closed.\n */\n panelEditor?: PanelEditorState;\n\n /**\n * Opens the editor for editing an existing panel by providing its layout coordinates.\n */\n openEditPanel: (panelGroupItemId: PanelGroupItemId) => void;\n\n /**\n * Opens the editor for adding a new Panel to a panel group.\n */\n openAddPanel: (panelGroupId?: PanelGroupId) => void;\n}\n\nexport interface PanelEditorState {\n /**\n * Whether we're adding a new panel, or editing an existing panel.\n */\n mode: 'Add' | 'Edit';\n\n /**\n * Initial values for the things that can be edited about a panel.\n */\n initialValues: PanelEditorValues;\n\n /**\n * Applies changes, but doesn't close the editor.\n */\n applyChanges: (next: PanelEditorValues) => void;\n\n /**\n * Close the editor.\n */\n close: () => void;\n}\n\n/**\n * Panel values that can be edited in the panel editor.\n */\nexport interface PanelEditorValues {\n groupId: PanelGroupId;\n panelDefinition: PanelDefinition;\n}\n\n/**\n * Curried function for creating the PanelEditorSlice.\n */\nexport function createPanelEditorSlice(): StateCreator<\n // Actions in here need to modify both Panels and Panel Groups state\n PanelEditorSlice & PanelSlice & PanelGroupSlice,\n Middleware,\n [],\n PanelEditorSlice\n> {\n // Return the state creator function for Zustand that uses the panels provided as intitial state\n return (set, get) => ({\n panelEditor: undefined,\n\n openEditPanel(panelGroupItemId) {\n const { panels, panelGroups } = get();\n\n // Figure out the panel key at that location\n const { panelGroupId, panelGroupItemLayoutId: panelGroupLayoutId } = panelGroupItemId;\n const panelKey = panelGroups[panelGroupId]?.itemPanelKeys[panelGroupLayoutId];\n if (panelKey === undefined) {\n throw new Error(`Could not find Panel Group item ${panelGroupItemId}`);\n }\n\n // Find the panel to edit\n const panelToEdit = panels[panelKey];\n if (panelToEdit === undefined) {\n throw new Error(`Cannot find Panel with key '${panelKey}'`);\n }\n\n const editorState: PanelEditorState = {\n mode: 'Edit',\n initialValues: {\n groupId: panelGroupItemId.panelGroupId,\n panelDefinition: panelToEdit,\n },\n applyChanges: (next) => {\n set((state) => {\n state.panels[panelKey] = next.panelDefinition;\n\n // If the panel didn't change groups, nothing else to do\n if (next.groupId === panelGroupId) {\n return;\n }\n\n // Move panel to the new group\n const existingGroup = state.panelGroups[panelGroupId];\n if (existingGroup === undefined) {\n throw new Error(`Missing panel group ${panelGroupId}`);\n }\n\n const existingLayoutIdx = existingGroup.itemLayouts.findIndex((layout) => layout.i === panelGroupLayoutId);\n const existingLayout = existingGroup.itemLayouts[existingLayoutIdx];\n const existingPanelKey = existingGroup.itemPanelKeys[panelGroupLayoutId];\n if (existingLayoutIdx === -1 || existingLayout === undefined || existingPanelKey === undefined) {\n throw new Error(`Missing panel group item ${panelGroupLayoutId}`);\n }\n\n // Remove item from the old group\n existingGroup.itemLayouts.splice(existingLayoutIdx, 1);\n delete existingGroup.itemPanelKeys[panelGroupLayoutId];\n\n // Add item to the end of the new group\n const newGroup = state.panelGroups[next.groupId];\n if (newGroup === undefined) {\n throw new Error(`Could not find new group ${next.groupId}`);\n }\n\n newGroup.itemLayouts.push({\n i: existingLayout.i,\n x: 0,\n y: getYForNewRow(newGroup),\n w: existingLayout.w,\n h: existingLayout.h,\n });\n newGroup.itemPanelKeys[existingLayout.i] = existingPanelKey;\n });\n },\n close: () => {\n set((state) => {\n state.panelEditor = undefined;\n });\n },\n };\n\n // Open the editor with the new state\n set((state) => {\n state.panelEditor = editorState;\n });\n },\n\n openAddPanel(panelGroupId) {\n // If a panel group isn't supplied, add to the first group or create a group if there aren't any\n let newGroup: PanelGroupDefinition | undefined = undefined;\n panelGroupId ??= get().panelGroupOrder[0];\n if (panelGroupId === undefined) {\n newGroup = createEmptyPanelGroup();\n newGroup.title = 'Panel Group';\n panelGroupId = newGroup.id;\n }\n\n const editorState: PanelEditorState = {\n mode: 'Add',\n initialValues: {\n groupId: panelGroupId,\n panelDefinition: get().initialValues?.panelDefinition ?? createPanelDefinition(),\n },\n applyChanges: (next) => {\n const name = next.panelDefinition.spec.display.name;\n const panelKey = getValidPanelKey(name, get().panels);\n\n set((state) => {\n // Add a panel\n state.panels[panelKey] = next.panelDefinition;\n\n // Also add a panel group item referencing the panel\n const group = state.panelGroups[next.groupId];\n if (group === undefined) {\n throw new Error(`Missing panel group ${next.groupId}`);\n }\n const layout: PanelGroupItemLayout = {\n i: generateId().toString(),\n x: 0,\n y: getYForNewRow(group),\n w: 12,\n h: 6,\n };\n group.itemLayouts.push(layout);\n group.itemPanelKeys[layout.i] = panelKey;\n });\n },\n close: () => {\n set((state) => {\n state.panelEditor = undefined;\n });\n },\n };\n\n set((state) => {\n // Add the new panel group if one was created for the panel\n if (newGroup !== undefined) {\n addPanelGroup(state, newGroup);\n }\n\n // Open the editor with the new state\n state.panelEditor = editorState;\n });\n },\n });\n}\n"],"names":["getYForNewRow","getValidPanelKey","generateId","createPanelDefinition","addPanelGroup","createEmptyPanelGroup","createPanelEditorSlice","set","get","panelEditor","undefined","openEditPanel","panelGroupItemId","panelGroups","panels","panelGroupId","panelGroupItemLayoutId","panelGroupLayoutId","panelKey","itemPanelKeys","Error","panelToEdit","editorState","mode","initialValues","groupId","panelDefinition","applyChanges","next","state","existingGroup","existingLayoutIdx","itemLayouts","findIndex","layout","i","existingLayout","existingPanelKey","splice","newGroup","push","x","y","w","h","close","openAddPanel","panelGroupOrder","title","id","name","spec","display","group","toString"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,SAASA,aAAa,EAAEC,gBAAgB,QAAQ,wBAAwB,CAAC;AACzE,SAASC,UAAU,EAAcC,qBAAqB,QAAQ,UAAU,CAAC;AACzE,SAMEC,aAAa,EACbC,qBAAqB,QAChB,qBAAqB,CAAC;AA0D7B;;CAEC,GACD,OAAO,SAASC,sBAAsB,GAMpC;IACA,gGAAgG;IAChG,OAAO,CAACC,GAAG,EAAEC,GAAG;QAAM,OAAA;YACpBC,WAAW,EAAEC,SAAS;YAEtBC,aAAa,EA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G,CAAC,CAACsB,KAAK,GAAK;oBACb,2DAA2D;oBAC3D,IAAIU,QAAQ,KAAK7B,SAAS,EAAE;wBAC1BN,aAAa,CAACyB,KAAK,EAAEU,QAAQ,CAAC,CAAC;oBACjC,CAAC;oBAED,qCAAqC;oBACrCV,KAAK,CAACpB,WAAW,GAAGa,WAAW,CAAC;gBAClC,CAAC,CAAC,CAAC;YACL,CAAC;SACF,CAAA;KAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"sources":["../../../src/context/DashboardProvider/panel-editor-slice.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { PanelDefinition } from '@perses-dev/core';\nimport { StateCreator } from 'zustand';\nimport { Action } from '@perses-dev/plugin-system';\nimport { getYForNewRow, getValidPanelKey } from '../../utils/panelUtils';\nimport { generateId, Middleware, createPanelDefinition } from './common';\nimport {\n PanelGroupSlice,\n PanelGroupItemId,\n PanelGroupId,\n PanelGroupDefinition,\n PanelGroupItemLayout,\n addPanelGroup,\n createEmptyPanelGroup,\n} from './panel-group-slice';\nimport { PanelSlice } from './panel-slice';\n\n/**\n * Slice that handles the visual editor state and actions for adding or editing Panels.\n */\nexport interface PanelEditorSlice {\n /**\n * Initial values for add panel if default panel kind is defined\n */\n initialValues?: Pick<PanelEditorValues, 'panelDefinition'>;\n\n /**\n * State for the panel editor when its open, otherwise undefined when it's closed.\n */\n panelEditor?: PanelEditorState;\n\n /**\n * Opens the editor for editing an existing panel by providing its layout coordinates.\n */\n openEditPanel: (panelGroupItemId: PanelGroupItemId) => void;\n\n /**\n * Opens the editor for adding a new Panel to a panel group.\n */\n openAddPanel: (panelGroupId?: PanelGroupId) => void;\n}\n\nexport interface PanelEditorState {\n /**\n * Whether we're adding a new panel, or editing an existing panel.\n */\n mode: Action;\n\n /**\n * Initial values for the things that can be edited about a panel.\n */\n initialValues: PanelEditorValues;\n\n /**\n * Applies changes, but doesn't close the editor.\n */\n applyChanges: (next: PanelEditorValues) => void;\n\n /**\n * Close the editor.\n */\n close: () => void;\n}\n\n/**\n * Panel values that can be edited in the panel editor.\n */\nexport interface PanelEditorValues {\n groupId: PanelGroupId;\n panelDefinition: PanelDefinition;\n}\n\n/**\n * Curried function for creating the PanelEditorSlice.\n */\nexport function createPanelEditorSlice(): StateCreator<\n // Actions in here need to modify both Panels and Panel Groups state\n PanelEditorSlice & PanelSlice & PanelGroupSlice,\n Middleware,\n [],\n PanelEditorSlice\n> {\n // Return the state creator function for Zustand that uses the panels provided as intitial state\n return (set, get) => ({\n panelEditor: undefined,\n\n openEditPanel(panelGroupItemId) {\n const { panels, panelGroups } = get();\n\n // Figure out the panel key at that location\n const { panelGroupId, panelGroupItemLayoutId: panelGroupLayoutId } = panelGroupItemId;\n const panelKey = panelGroups[panelGroupId]?.itemPanelKeys[panelGroupLayoutId];\n if (panelKey === undefined) {\n throw new Error(`Could not find Panel Group item ${panelGroupItemId}`);\n }\n\n // Find the panel to edit\n const panelToEdit = panels[panelKey];\n if (panelToEdit === undefined) {\n throw new Error(`Cannot find Panel with key '${panelKey}'`);\n }\n\n const editorState: PanelEditorState = {\n mode: 'update',\n initialValues: {\n groupId: panelGroupItemId.panelGroupId,\n panelDefinition: panelToEdit,\n },\n applyChanges: (next) => {\n set((state) => {\n state.panels[panelKey] = next.panelDefinition;\n\n // If the panel didn't change groups, nothing else to do\n if (next.groupId === panelGroupId) {\n return;\n }\n\n // Move panel to the new group\n const existingGroup = state.panelGroups[panelGroupId];\n if (existingGroup === undefined) {\n throw new Error(`Missing panel group ${panelGroupId}`);\n }\n\n const existingLayoutIdx = existingGroup.itemLayouts.findIndex((layout) => layout.i === panelGroupLayoutId);\n const existingLayout = existingGroup.itemLayouts[existingLayoutIdx];\n const existingPanelKey = existingGroup.itemPanelKeys[panelGroupLayoutId];\n if (existingLayoutIdx === -1 || existingLayout === undefined || existingPanelKey === undefined) {\n throw new Error(`Missing panel group item ${panelGroupLayoutId}`);\n }\n\n // Remove item from the old group\n existingGroup.itemLayouts.splice(existingLayoutIdx, 1);\n delete existingGroup.itemPanelKeys[panelGroupLayoutId];\n\n // Add item to the end of the new group\n const newGroup = state.panelGroups[next.groupId];\n if (newGroup === undefined) {\n throw new Error(`Could not find new group ${next.groupId}`);\n }\n\n newGroup.itemLayouts.push({\n i: existingLayout.i,\n x: 0,\n y: getYForNewRow(newGroup),\n w: existingLayout.w,\n h: existingLayout.h,\n });\n newGroup.itemPanelKeys[existingLayout.i] = existingPanelKey;\n });\n },\n close: () => {\n set((state) => {\n state.panelEditor = undefined;\n });\n },\n };\n\n // Open the editor with the new state\n set((state) => {\n state.panelEditor = editorState;\n });\n },\n\n openAddPanel(panelGroupId) {\n // If a panel group isn't supplied, add to the first group or create a group if there aren't any\n let newGroup: PanelGroupDefinition | undefined = undefined;\n panelGroupId ??= get().panelGroupOrder[0];\n if (panelGroupId === undefined) {\n newGroup = createEmptyPanelGroup();\n newGroup.title = 'Panel Group';\n panelGroupId = newGroup.id;\n }\n\n const editorState: PanelEditorState = {\n mode: 'create',\n initialValues: {\n groupId: panelGroupId,\n panelDefinition: get().initialValues?.panelDefinition ?? createPanelDefinition(),\n },\n applyChanges: (next) => {\n const name = next.panelDefinition.spec.display.name;\n const panelKey = getValidPanelKey(name, get().panels);\n\n set((state) => {\n // Add a panel\n state.panels[panelKey] = next.panelDefinition;\n\n // Also add a panel group item referencing the panel\n const group = state.panelGroups[next.groupId];\n if (group === undefined) {\n throw new Error(`Missing panel group ${next.groupId}`);\n }\n const layout: PanelGroupItemLayout = {\n i: generateId().toString(),\n x: 0,\n y: getYForNewRow(group),\n w: 12,\n h: 6,\n };\n group.itemLayouts.push(layout);\n group.itemPanelKeys[layout.i] = panelKey;\n });\n },\n close: () => {\n set((state) => {\n state.panelEditor = undefined;\n });\n },\n };\n\n set((state) => {\n // Add the new panel group if one was created for the panel\n if (newGroup !== undefined) {\n addPanelGroup(state, newGroup);\n }\n\n // Open the editor with the new state\n state.panelEditor = editorState;\n });\n },\n });\n}\n"],"names":["getYForNewRow","getValidPanelKey","generateId","createPanelDefinition","addPanelGroup","createEmptyPanelGroup","createPanelEditorSlice","set","get","panelEditor","undefined","openEditPanel","panelGroupItemId","panelGroups","panels","panelGroupId","panelGroupItemLayoutId","panelGroupLayoutId","panelKey","itemPanelKeys","Error","panelToEdit","editorState","mode","initialValues","groupId","panelDefinition","applyChanges","next","state","existingGroup","existingLayoutIdx","itemLayouts","findIndex","layout","i","existingLayout","existingPanelKey","splice","newGroup","push","x","y","w","h","close","openAddPanel","panelGroupOrder","title","id","name","spec","display","group","toString"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAKjC,SAASA,aAAa,EAAEC,gBAAgB,QAAQ,yBAAyB;AACzE,SAASC,UAAU,EAAcC,qBAAqB,QAAQ,WAAW;AACzE,SAMEC,aAAa,EACbC,qBAAqB,QAChB,sBAAsB;AA0D7B;;CAEC,GACD,OAAO,SAASC;IAOd,gGAAgG;IAChG,OAAO,CAACC,KAAKC;QAAS,OAAA;YACpBC,aAAaC;YAEbC,eAAcC,gBAAgB;oBAKXC;gBAJjB,MAAM,EAAEC,OAAM,EAAED,YAAW,EAAE,GAAGL;gBAEhC,4CAA4C;gBAC5C,MAAM,EAAEO,aAAY,EAAEC,wBAAwBC,mBAAkB,EAAE,GAAGL;gBACrE,MAAMM,WAAWL,CAAAA,4BAAAA,WAAW,CAACE,aAAa,cAAz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CACvB,MAAM,IAAIU,MAAM,CAAC,oBAAoB,EAAEQ,KAAKH,QAAQ,CAAC;4BACvD;4BACA,MAAMS,SAA+B;gCACnCC,GAAGjC,aAAaoD;gCAChBb,GAAG;gCACHC,GAAG1C,cAAcqD;gCACjBV,GAAG;gCACHC,GAAG;4BACL;4BACAS,MAAMrB,YAAYQ,KAAKN;4BACvBmB,MAAMlC,aAAa,CAACe,OAAOC,EAAE,GAAGjB;wBAClC;oBACF;oBACA2B,OAAO;wBACLtC,IAAI,CAACsB;4BACHA,MAAMpB,cAAcC;wBACtB;oBACF;gBACF;gBAEAH,IAAI,CAACsB;oBACH,2DAA2D;oBAC3D,IAAIU,aAAa7B,WAAW;wBAC1BN,cAAcyB,OAAOU;oBACvB;oBAEA,qCAAqC;oBACrCV,MAAMpB,cAAca;gBACtB;YACF;QACF;;AACF"}
@@ -45,12 +45,12 @@ export const createPanelGroupEditorSlice = (set, get)=>({
45
45
  if (existingGroup === undefined) {
46
46
  throw new Error(`Panel group with Id ${panelGroupId} does not exist`);
47
47
  }
48
- var _title;
48
+ var _existingGroup_title;
49
49
  // Create the editor state
50
50
  const editor = {
51
51
  mode: 'Edit',
52
52
  initialValues: {
53
- title: (_title = existingGroup.title) !== null && _title !== void 0 ? _title : '',
53
+ title: (_existingGroup_title = existingGroup.title) !== null && _existingGroup_title !== void 0 ? _existingGroup_title : '',
54
54
  isCollapsed: existingGroup.isCollapsed
55
55
  },
56
56
  applyChanges (next) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/context/DashboardProvider/panel-group-editor-slice.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { StateCreator } from 'zustand';\nimport { Middleware } from './common';\nimport { PanelGroupSlice, PanelGroupId, addPanelGroup, createEmptyPanelGroup } from './panel-group-slice';\n\nexport interface PanelGroupEditor {\n mode: 'Add' | 'Edit';\n initialValues: PanelGroupEditorValues;\n applyChanges: (next: PanelGroupEditorValues) => void;\n close: () => void;\n}\n\nexport interface PanelGroupEditorValues {\n title: string;\n isCollapsed: boolean;\n}\n\n/**\n * Slice that handles the visual editor state and related actions for adding or editing Panel Groups.\n */\nexport interface PanelGroupEditorSlice {\n /**\n * State that's present when the panel group editor is open.\n */\n panelGroupEditor?: PanelGroupEditor;\n\n /**\n * Opens the panel group editor to add a new panel group.\n */\n openAddPanelGroup: () => void;\n\n /**\n * Opens the panel group editor to edit an existing panel group.\n */\n openEditPanelGroup: (panelGroupId: PanelGroupId) => void;\n}\n\nexport const createPanelGroupEditorSlice: StateCreator<\n // Actions in here need to modify Panel Group state\n PanelGroupEditorSlice & PanelGroupSlice,\n Middleware,\n [],\n PanelGroupEditorSlice\n> = (set, get) => ({\n panelGroupEditor: undefined,\n\n openAddPanelGroup: () => {\n // Create the editor state\n const editor: PanelGroupEditor = {\n mode: 'Add',\n initialValues: {\n title: '',\n isCollapsed: false,\n },\n applyChanges(next) {\n const newGroup = createEmptyPanelGroup();\n newGroup.title = next.title;\n newGroup.isCollapsed = next.isCollapsed;\n set((draft) => {\n addPanelGroup(draft, newGroup);\n });\n },\n close() {\n set((draft) => {\n draft.panelGroupEditor = undefined;\n });\n },\n };\n\n // Open the editor\n set((draft) => {\n draft.panelGroupEditor = editor;\n });\n },\n\n openEditPanelGroup: (panelGroupId) => {\n const existingGroup = get().panelGroups[panelGroupId];\n if (existingGroup === undefined) {\n throw new Error(`Panel group with Id ${panelGroupId} does not exist`);\n }\n\n // Create the editor state\n const editor: PanelGroupEditor = {\n mode: 'Edit',\n initialValues: {\n title: existingGroup.title ?? '',\n isCollapsed: existingGroup.isCollapsed,\n },\n applyChanges(next) {\n set((draft) => {\n const group = draft.panelGroups[panelGroupId];\n if (group === undefined) {\n throw new Error(`Panel group with Id ${panelGroupId} does not exist`);\n }\n group.title = next.title;\n group.isCollapsed = next.isCollapsed;\n });\n },\n close() {\n set((draft) => {\n draft.panelGroupEditor = undefined;\n });\n },\n };\n\n // Open the editor\n set((draft) => {\n draft.panelGroupEditor = editor;\n });\n },\n});\n"],"names":["addPanelGroup","createEmptyPanelGroup","createPanelGroupEditorSlice","set","get","panelGroupEditor","undefined","openAddPanelGroup","editor","mode","initialValues","title","isCollapsed","applyChanges","next","newGroup","draft","close","openEditPanelGroup","panelGroupId","existingGroup","panelGroups","Error","group"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,SAAwCA,aAAa,EAAEC,qBAAqB,QAAQ,qBAAqB,CAAC;AAkC1G,OAAO,MAAMC,2BAA2B,GAMpC,CAACC,GAAG,EAAEC,GAAG,GAAM,CAAA;QACjBC,gBAAgB,EAAEC,SAAS;QAE3BC,iBAAiB,EAAE,IAAM;YACvB,0BAA0B;YAC1B,MAAMC,MAAM,GAAqB;gBAC/BC,IAAI,EAAE,KAAK;gBACXC,aAAa,EAAE;oBACbC,KAAK,EAAE,EAAE;oBACTC,WAAW,EAAE,KAAK;iBACnB;gBACDC,YAAY,EAACC,IAAI,EAAE;oBACjB,MAAMC,QAAQ,GAAGd,qBAAqB,EAAE,AAAC;oBACzCc,QAAQ,CAACJ,KAAK,GAAGG,IAAI,CAACH,KAAK,CAAC;oBAC5BI,QAAQ,CAACH,WAAW,GAAGE,IAAI,CAACF,WAAW,CAAC;oBACxCT,GAAG,CAAC,CAACa,KAAK,GAAK;wBACbhB,aAAa,CAACgB,KAAK,EAAED,QAAQ,CAAC,CA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,WAAW,CAAC;oBACvC,CAAC,CAAC,CAAC;gBACL,CAAC;gBACDK,KAAK,IAAG;oBACNd,GAAG,CAAC,CAACa,KAAK,GAAK;wBACbA,KAAK,CAACX,gBAAgB,GAAGC,SAAS,CAAC;oBACrC,CAAC,CAAC,CAAC;gBACL,CAAC;aACF,AAAC;YAEF,kBAAkB;YAClBH,GAAG,CAAC,CAACa,KAAK,GAAK;gBACbA,KAAK,CAACX,gBAAgB,GAAGG,MAAM,CAAC;YAClC,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAA,AAAC,CAAC"}
1
+ {"version":3,"sources":["../../../src/context/DashboardProvider/panel-group-editor-slice.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { StateCreator } from 'zustand';\nimport { Middleware } from './common';\nimport { PanelGroupSlice, PanelGroupId, addPanelGroup, createEmptyPanelGroup } from './panel-group-slice';\n\nexport interface PanelGroupEditor {\n mode: 'Add' | 'Edit';\n initialValues: PanelGroupEditorValues;\n applyChanges: (next: PanelGroupEditorValues) => void;\n close: () => void;\n}\n\nexport interface PanelGroupEditorValues {\n title: string;\n isCollapsed: boolean;\n}\n\n/**\n * Slice that handles the visual editor state and related actions for adding or editing Panel Groups.\n */\nexport interface PanelGroupEditorSlice {\n /**\n * State that's present when the panel group editor is open.\n */\n panelGroupEditor?: PanelGroupEditor;\n\n /**\n * Opens the panel group editor to add a new panel group.\n */\n openAddPanelGroup: () => void;\n\n /**\n * Opens the panel group editor to edit an existing panel group.\n */\n openEditPanelGroup: (panelGroupId: PanelGroupId) => void;\n}\n\nexport const createPanelGroupEditorSlice: StateCreator<\n // Actions in here need to modify Panel Group state\n PanelGroupEditorSlice & PanelGroupSlice,\n Middleware,\n [],\n PanelGroupEditorSlice\n> = (set, get) => ({\n panelGroupEditor: undefined,\n\n openAddPanelGroup: () => {\n // Create the editor state\n const editor: PanelGroupEditor = {\n mode: 'Add',\n initialValues: {\n title: '',\n isCollapsed: false,\n },\n applyChanges(next) {\n const newGroup = createEmptyPanelGroup();\n newGroup.title = next.title;\n newGroup.isCollapsed = next.isCollapsed;\n set((draft) => {\n addPanelGroup(draft, newGroup);\n });\n },\n close() {\n set((draft) => {\n draft.panelGroupEditor = undefined;\n });\n },\n };\n\n // Open the editor\n set((draft) => {\n draft.panelGroupEditor = editor;\n });\n },\n\n openEditPanelGroup: (panelGroupId) => {\n const existingGroup = get().panelGroups[panelGroupId];\n if (existingGroup === undefined) {\n throw new Error(`Panel group with Id ${panelGroupId} does not exist`);\n }\n\n // Create the editor state\n const editor: PanelGroupEditor = {\n mode: 'Edit',\n initialValues: {\n title: existingGroup.title ?? '',\n isCollapsed: existingGroup.isCollapsed,\n },\n applyChanges(next) {\n set((draft) => {\n const group = draft.panelGroups[panelGroupId];\n if (group === undefined) {\n throw new Error(`Panel group with Id ${panelGroupId} does not exist`);\n }\n group.title = next.title;\n group.isCollapsed = next.isCollapsed;\n });\n },\n close() {\n set((draft) => {\n draft.panelGroupEditor = undefined;\n });\n },\n };\n\n // Open the editor\n set((draft) => {\n draft.panelGroupEditor = editor;\n });\n },\n});\n"],"names":["addPanelGroup","createEmptyPanelGroup","createPanelGroupEditorSlice","set","get","panelGroupEditor","undefined","openAddPanelGroup","editor","mode","initialValues","title","isCollapsed","applyChanges","next","newGroup","draft","close","openEditPanelGroup","panelGroupId","existingGroup","panelGroups","Error","group"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AAC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AmBC;oBAC3B;gBACF;YACF;YAEA,kBAAkB;YAClBH,IAAI,CAACa;gBACHA,MAAMX,mBAAmBG;YAC3B;QACF;IACF,CAAA,EAAG"}
@@ -53,7 +53,7 @@ export function convertLayoutsToPanelGroups(layouts) {
53
53
  const panelGroups = {};
54
54
  const panelGroupIdOrder = [];
55
55
  for (const layout of layouts){
56
- var ref, ref1, ref2;
56
+ var _layout_spec_display, _layout_spec_display_collapse, _layout_spec_display1;
57
57
  const itemLayouts = [];
58
58
  const itemPanelKeys = {};
59
59
  // Split layout information from panel keys to make it easier to update just layouts on move/resize of panels
@@ -72,8 +72,8 @@ export function convertLayoutsToPanelGroups(layouts) {
72
72
  const panelGroupId = generateId();
73
73
  panelGroups[panelGroupId] = {
74
74
  id: panelGroupId,
75
- isCollapsed: ((ref = layout.spec.display) === null || ref === void 0 ? void 0 : (ref1 = ref.collapse) === null || ref1 === void 0 ? void 0 : ref1.open) === false,
76
- title: (ref2 = layout.spec.display) === null || ref2 === void 0 ? void 0 : ref2.title,
75
+ isCollapsed: ((_layout_spec_display = layout.spec.display) === null || _layout_spec_display === void 0 ? void 0 : (_layout_spec_display_collapse = _layout_spec_display.collapse) === null || _layout_spec_display_collapse === void 0 ? void 0 : _layout_spec_display_collapse.open) === false,
76
+ title: (_layout_spec_display1 = layout.spec.display) === null || _layout_spec_display1 === void 0 ? void 0 : _layout_spec_display1.title,
77
77
  itemLayouts,
78
78
  itemPanelKeys
79
79
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/context/DashboardProvider/panel-group-slice.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { getPanelKeyFromRef, LayoutDefinition } from '@perses-dev/core';\nimport { WritableDraft } from 'immer/dist/internal';\nimport { Layout } from 'react-grid-layout';\nimport { StateCreator } from 'zustand';\nimport { generateId, Middleware } from './common';\n\n/**\n * Slice with the state of Panel Groups, as well as any actions that modify only Panel Group state.\n */\nexport interface PanelGroupSlice {\n /**\n * Panel groups indexed by their ID.\n */\n panelGroups: Record<PanelGroupId, PanelGroupDefinition>;\n\n /**\n * An array of panel group IDs, representing their order in the dashboard.\n */\n panelGroupOrder: PanelGroupId[];\n\n /**\n * Rearrange the order of panel groups by swapping the positions\n */\n swapPanelGroups: (xIndex: number, yIndex: number) => void;\n\n /**\n * Update the item layouts for a panel group when, for example, a panel is moved or resized.\n */\n updatePanelGroupLayouts: (panelGroupId: PanelGroupId, itemLayouts: PanelGroupDefinition['itemLayouts']) => void;\n}\n\nexport type PanelGroupId = number;\n\nexport interface PanelGroupDefinition {\n id: PanelGroupId;\n isCollapsed: boolean;\n title?: string;\n itemLayouts: PanelGroupItemLayout[];\n itemPanelKeys: Record<PanelGroupItemLayoutId, string>;\n}\n\nexport interface PanelGroupItemLayout extends Layout {\n i: PanelGroupItemLayoutId;\n}\n\nexport type PanelGroupItemLayoutId = string;\n\n/**\n * Uniquely identifies an item in a PanelGroup.\n */\nexport interface PanelGroupItemId {\n panelGroupId: PanelGroupId;\n panelGroupItemLayoutId: PanelGroupItemLayoutId;\n}\n\n/**\n * Curried function for creating a PanelGroupSlice.\n */\nexport function createPanelGroupSlice(\n layouts: LayoutDefinition[]\n): StateCreator<PanelGroupSlice, Middleware, [], PanelGroupSlice> {\n const { panelGroups, panelGroupOrder } = convertLayoutsToPanelGroups(layouts);\n\n // Return the state creator function for Zustand\n return (set) => ({\n panelGroups,\n panelGroupOrder,\n\n swapPanelGroups(x, y) {\n set((state) => {\n if (x < 0 || x >= state.panelGroupOrder.length || y < 0 || y >= state.panelGroupOrder.length) {\n throw new Error('index out of bound');\n }\n const xPanelGroup = state.panelGroupOrder[x];\n const yPanelGroup = state.panelGroupOrder[y];\n\n if (xPanelGroup === undefined || yPanelGroup === undefined) {\n throw new Error('panel group is undefined');\n }\n // assign yPanelGroup to layouts[x] and assign xGroup to layouts[y], swapping two panel groups\n [state.panelGroupOrder[x], state.panelGroupOrder[y]] = [yPanelGroup, xPanelGroup];\n });\n },\n\n updatePanelGroupLayouts(panelGroupId, itemLayouts) {\n set((state) => {\n const group = state.panelGroups[panelGroupId];\n if (group === undefined) {\n throw new Error(`Cannot find panel group ${panelGroupId}`);\n }\n group.itemLayouts = itemLayouts;\n });\n },\n });\n}\n\nexport function convertLayoutsToPanelGroups(\n layouts: LayoutDefinition[]\n): Pick<PanelGroupSlice, 'panelGroups' | 'panelGroupOrder'> {\n // Convert the initial layouts from the JSON\n const panelGroups: PanelGroupSlice['panelGroups'] = {};\n const panelGroupIdOrder: PanelGroupSlice['panelGroupOrder'] = [];\n for (const layout of layouts) {\n const itemLayouts: PanelGroupDefinition['itemLayouts'] = [];\n const itemPanelKeys: PanelGroupDefinition['itemPanelKeys'] = {};\n\n // Split layout information from panel keys to make it easier to update just layouts on move/resize of panels\n for (const item of layout.spec.items) {\n const panelGroupLayoutId = generateId().toString();\n itemLayouts.push({\n i: panelGroupLayoutId,\n w: item.width,\n h: item.height,\n x: item.x,\n y: item.y,\n });\n itemPanelKeys[panelGroupLayoutId] = getPanelKeyFromRef(item.content);\n }\n\n // Create the panel group and keep track of the ID order\n const panelGroupId = generateId();\n panelGroups[panelGroupId] = {\n id: panelGroupId,\n isCollapsed: layout.spec.display?.collapse?.open === false,\n title: layout.spec.display?.title,\n itemLayouts,\n itemPanelKeys,\n };\n panelGroupIdOrder.push(panelGroupId);\n }\n return {\n panelGroups,\n panelGroupOrder: panelGroupIdOrder,\n };\n}\n\n/**\n * Private helper function for creating an empty panel group.\n */\nexport function createEmptyPanelGroup(): PanelGroupDefinition {\n return {\n id: generateId(),\n title: undefined,\n isCollapsed: false,\n itemLayouts: [],\n itemPanelKeys: {},\n };\n}\n\n/**\n * Private helper function that modifies panel group state to add a new panel\n */\nexport function addPanelGroup(draft: WritableDraft<PanelGroupSlice>, newGroup: PanelGroupDefinition) {\n draft.panelGroups[newGroup.id] = newGroup;\n draft.panelGroupOrder.unshift(newGroup.id);\n}\n"],"names":["getPanelKeyFromRef","generateId","createPanelGroupSlice","layouts","panelGroups","panelGroupOrder","convertLayoutsToPanelGroups","set","swapPanelGroups","x","y","state","length","Error","xPanelGroup","yPanelGroup","undefined","updatePanelGroupLayouts","panelGroupId","itemLayouts","group","panelGroupIdOrder","layout","itemPanelKeys","item","spec","items","panelGroupLayoutId","toString","push","i","w","width","h","height","content","id","isCollapsed","display","collapse","open","title","createEmptyPanelGroup","addPanelGroup","draft","newGroup","unshift"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,kBAAkB,QAA0B,kBAAkB,CAAC;AAIxE,SAASC,UAAU,QAAoB,UAAU,CAAC;AAmDlD;;CAEC,GACD,OAAO,SAASC,qBAAqB,CACnCC,OAA2B,EACqC;IAChE,MAAM,EAAEC,WAAW,CAAA,EAAEC,eAAe,CAAA,EAAE,GAAGC,2BAA2B,CAACH,OAAO,CAAC,AAAC;IAE9E,gDAAgD;IAChD,OAAO,CAACI,GAAG,GAAM,CAAA;YACfH,WAAW;YACXC,eAAe;YAEfG,eAAe,EAACC,CAAC,EAAEC,CAAC,EAAE;gBACpBH,GAAG,CAAC,CAACI,KAAK,GAAK;oBACb,IAAIF,CAAC,GAAG,CAAC,IAAIA,CAAC,IAAIE,KAAK,CAACN,eAAe,CAACO,MAAM,IAAIF,CAAC,GAAG,CAAC,IAAIA,CAAC,IAAIC,KAAK,CAACN,eAAe,CAACO,MAAM,EA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qB,GAAyB;IAC5D,OAAO;QACLN,EAAE,EAAEnC,UAAU,EAAE;QAChBwC,KAAK,EAAEzB,SAAS;QAChBqB,WAAW,EAAE,KAAK;QAClBlB,WAAW,EAAE,EAAE;QACfI,aAAa,EAAE,EAAE;KAClB,CAAC;AACJ,CAAC;AAED;;CAEC,GACD,OAAO,SAASoB,aAAa,CAACC,KAAqC,EAAEC,QAA8B,EAAE;IACnGD,KAAK,CAACxC,WAAW,CAACyC,QAAQ,CAACT,EAAE,CAAC,GAAGS,QAAQ,CAAC;IAC1CD,KAAK,CAACvC,eAAe,CAACyC,OAAO,CAACD,QAAQ,CAACT,EAAE,CAAC,CAAC;AAC7C,CAAC"}
1
+ {"version":3,"sources":["../../../src/context/DashboardProvider/panel-group-slice.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { getPanelKeyFromRef, LayoutDefinition } from '@perses-dev/core';\nimport { WritableDraft } from 'immer/dist/internal';\nimport { Layout } from 'react-grid-layout';\nimport { StateCreator } from 'zustand';\nimport { generateId, Middleware } from './common';\n\n/**\n * Slice with the state of Panel Groups, as well as any actions that modify only Panel Group state.\n */\nexport interface PanelGroupSlice {\n /**\n * Panel groups indexed by their ID.\n */\n panelGroups: Record<PanelGroupId, PanelGroupDefinition>;\n\n /**\n * An array of panel group IDs, representing their order in the dashboard.\n */\n panelGroupOrder: PanelGroupId[];\n\n /**\n * Rearrange the order of panel groups by swapping the positions\n */\n swapPanelGroups: (xIndex: number, yIndex: number) => void;\n\n /**\n * Update the item layouts for a panel group when, for example, a panel is moved or resized.\n */\n updatePanelGroupLayouts: (panelGroupId: PanelGroupId, itemLayouts: PanelGroupDefinition['itemLayouts']) => void;\n}\n\nexport type PanelGroupId = number;\n\nexport interface PanelGroupDefinition {\n id: PanelGroupId;\n isCollapsed: boolean;\n title?: string;\n itemLayouts: PanelGroupItemLayout[];\n itemPanelKeys: Record<PanelGroupItemLayoutId, string>;\n}\n\nexport interface PanelGroupItemLayout extends Layout {\n i: PanelGroupItemLayoutId;\n}\n\nexport type PanelGroupItemLayoutId = string;\n\n/**\n * Uniquely identifies an item in a PanelGroup.\n */\nexport interface PanelGroupItemId {\n panelGroupId: PanelGroupId;\n panelGroupItemLayoutId: PanelGroupItemLayoutId;\n}\n\n/**\n * Curried function for creating a PanelGroupSlice.\n */\nexport function createPanelGroupSlice(\n layouts: LayoutDefinition[]\n): StateCreator<PanelGroupSlice, Middleware, [], PanelGroupSlice> {\n const { panelGroups, panelGroupOrder } = convertLayoutsToPanelGroups(layouts);\n\n // Return the state creator function for Zustand\n return (set) => ({\n panelGroups,\n panelGroupOrder,\n\n swapPanelGroups(x, y) {\n set((state) => {\n if (x < 0 || x >= state.panelGroupOrder.length || y < 0 || y >= state.panelGroupOrder.length) {\n throw new Error('index out of bound');\n }\n const xPanelGroup = state.panelGroupOrder[x];\n const yPanelGroup = state.panelGroupOrder[y];\n\n if (xPanelGroup === undefined || yPanelGroup === undefined) {\n throw new Error('panel group is undefined');\n }\n // assign yPanelGroup to layouts[x] and assign xGroup to layouts[y], swapping two panel groups\n [state.panelGroupOrder[x], state.panelGroupOrder[y]] = [yPanelGroup, xPanelGroup];\n });\n },\n\n updatePanelGroupLayouts(panelGroupId, itemLayouts) {\n set((state) => {\n const group = state.panelGroups[panelGroupId];\n if (group === undefined) {\n throw new Error(`Cannot find panel group ${panelGroupId}`);\n }\n group.itemLayouts = itemLayouts;\n });\n },\n });\n}\n\nexport function convertLayoutsToPanelGroups(\n layouts: LayoutDefinition[]\n): Pick<PanelGroupSlice, 'panelGroups' | 'panelGroupOrder'> {\n // Convert the initial layouts from the JSON\n const panelGroups: PanelGroupSlice['panelGroups'] = {};\n const panelGroupIdOrder: PanelGroupSlice['panelGroupOrder'] = [];\n for (const layout of layouts) {\n const itemLayouts: PanelGroupDefinition['itemLayouts'] = [];\n const itemPanelKeys: PanelGroupDefinition['itemPanelKeys'] = {};\n\n // Split layout information from panel keys to make it easier to update just layouts on move/resize of panels\n for (const item of layout.spec.items) {\n const panelGroupLayoutId = generateId().toString();\n itemLayouts.push({\n i: panelGroupLayoutId,\n w: item.width,\n h: item.height,\n x: item.x,\n y: item.y,\n });\n itemPanelKeys[panelGroupLayoutId] = getPanelKeyFromRef(item.content);\n }\n\n // Create the panel group and keep track of the ID order\n const panelGroupId = generateId();\n panelGroups[panelGroupId] = {\n id: panelGroupId,\n isCollapsed: layout.spec.display?.collapse?.open === false,\n title: layout.spec.display?.title,\n itemLayouts,\n itemPanelKeys,\n };\n panelGroupIdOrder.push(panelGroupId);\n }\n return {\n panelGroups,\n panelGroupOrder: panelGroupIdOrder,\n };\n}\n\n/**\n * Private helper function for creating an empty panel group.\n */\nexport function createEmptyPanelGroup(): PanelGroupDefinition {\n return {\n id: generateId(),\n title: undefined,\n isCollapsed: false,\n itemLayouts: [],\n itemPanelKeys: {},\n };\n}\n\n/**\n * Private helper function that modifies panel group state to add a new panel\n */\nexport function addPanelGroup(draft: WritableDraft<PanelGroupSlice>, newGroup: PanelGroupDefinition) {\n draft.panelGroups[newGroup.id] = newGroup;\n draft.panelGroupOrder.unshift(newGroup.id);\n}\n"],"names":["getPanelKeyFromRef","generateId","createPanelGroupSlice","layouts","panelGroups","panelGroupOrder","convertLayoutsToPanelGroups","set","swapPanelGroups","x","y","state","length","Error","xPanelGroup","yPanelGroup","undefined","updatePanelGroupLayouts","panelGroupId","itemLayouts","group","panelGroupIdOrder","layout","itemPanelKeys","item","spec","items","panelGroupLayoutId","toString","push","i","w","width","h","height","content","id","isCollapsed","display","collapse","open","title","createEmptyPanelGroup","addPanelGroup","draft","newGroup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,MAAMC,cAA8C,CAAC;IACrD,MAAMiB,oBAAwD,EAAE;IAChE,KAAK,MAAMC,UAAUnB,QAAS;YAqBbmB,qDACNA;QArBT,MAAMH,cAAmD,EAAE;QAC3D,MAAMI,gBAAuD,CAAC;QAE9D,6GAA6G;QAC7G,KAAK,MAAMC,QAAQF,OAAOG,KAAKC,MAAO;YACpC,MAAMC,qBAAqB1B,aAAa2B;YACxCT,YAAYU,KAAK;gBACfC,GAAGH;gBACHI,GAAGP,KAAKQ;gBACRC,GAAGT,KAAKU;gBACRzB,GAAGe,KAAKf;gBACRC,GAAGc,KAAKd;YACV;YACAa,aAAa,CAACI,mBAAmB,GAAG3B,mBAAmBwB,KAAKW;QAC9D;QAEA,wDAAwD;QACxD,MAAMjB,eAAejB;QACrBG,WAAW,CAACc,aAAa,GAAG;YAC1BkB,IAAIlB;YACJmB,aAAaf,CAAAA,CAAAA,uBAAAA,OAAOG,KAAKa,qBAAZhB,kCAAAA,KAAAA,IAAAA,iCAAAA,qBAAqBiB,iEAArBjB,KAAAA,kCAA+BkB,IAAH,MAAY;YACrDC,OAAOnB,CAAAA,wBAAAA,OAAOG,KAAKa,qBAAZhB,mCAAAA,KAAAA,IAAAA,sBAAqBmB;YAC5BtB;YACAI;QACF;QACAF,kBAAkBQ,KAAKX;IACzB;IACA,OAAO;QACLd;QACAC,iBAAiBgB;IACnB;AACF;AAEA;;CAEC,GACD,OAAO,SAASqB;IACd,OAAO;QACLN,IAAInC;QACJwC,OAAOzB;QACPqB,aAAa;QACblB,aAAa,EAAE;QACfI,eAAe,CAAC;IAClB;AACF;AAEA;;CAEC,GACD,OAAO,SAASoB,cAAcC,KAAqC,EAAEC,QAA8B;IACjGD,MAAMxC,WAAW,CAACyC,SAAST,GAAG,GAAGS;IACjCD,MAAMvC,gBAAgByC,QAAQD,SAAST;AACzC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/context/DashboardProvider/panel-slice.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { PanelDefinition } from '@perses-dev/core';\nimport { StateCreator } from 'zustand';\nimport { Middleware } from './common';\n\n/**\n * Slice with the state of Panels, along with any actions that modify only the Panels state.\n */\nexport interface PanelSlice {\n panels: Record<string, PanelDefinition>;\n}\n\n/**\n * Curried function for creating the PanelSlice.\n */\nexport function createPanelSlice(panels: PanelSlice['panels']): StateCreator<PanelSlice, Middleware, [], PanelSlice> {\n return () => ({\n panels,\n });\n}\n"],"names":["createPanelSlice","panels"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAajC;;CAEC,GACD,OAAO,SAASA,gBAAgB,CAACC,MAA4B,EAAwD;IACnH,OAAO,IAAO,CAAA;YACZA,MAAM;SACP,CAAA,AAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"sources":["../../../src/context/DashboardProvider/panel-slice.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { PanelDefinition } from '@perses-dev/core';\nimport { StateCreator } from 'zustand';\nimport { Middleware } from './common';\n\n/**\n * Slice with the state of Panels, along with any actions that modify only the Panels state.\n */\nexport interface PanelSlice {\n panels: Record<string, PanelDefinition>;\n}\n\n/**\n * Curried function for creating the PanelSlice.\n */\nexport function createPanelSlice(panels: PanelSlice['panels']): StateCreator<PanelSlice, Middleware, [], PanelSlice> {\n return () => ({\n panels,\n });\n}\n"],"names":["createPanelSlice","panels"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAajC;;CAEC,GACD,OAAO,SAASA,iBAAiBC,MAA4B;IAC3D,OAAO,IAAO,CAAA;YACZA;QACF,CAAA;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/context/DashboardProvider/save-changes-dialog-slice.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { StateCreator } from 'zustand';\nimport { Middleware } from './common';\n\nexport interface SaveChangesConfirmationDialogSlice {\n saveChangesConfirmationDialog?: SaveChangesConfirmationDialogState;\n openSaveChangesConfirmationDialog: (saveChangesConfirmationDialog: SaveChangesConfirmationDialogState) => void;\n closeSaveChangesConfirmationDialog: () => void;\n}\n\nexport interface SaveChangesConfirmationDialogState {\n onSaveChanges: (saveDefaultTimeRange: boolean, saveDefaultVariables: boolean) => void;\n onCancel: () => void;\n isSavedDurationModified: boolean;\n isSavedVariableModified: boolean;\n description?: string;\n}\n\nexport const createSaveChangesDialogSlice: StateCreator<\n SaveChangesConfirmationDialogSlice,\n Middleware,\n [],\n SaveChangesConfirmationDialogSlice\n> = (set) => ({\n isOpen: false,\n\n openSaveChangesConfirmationDialog(dialog) {\n set(\n (state) => {\n state.saveChangesConfirmationDialog = dialog;\n },\n false,\n 'openSaveChangesConfirmationDialog'\n );\n },\n\n closeSaveChangesConfirmationDialog() {\n set(\n (state) => {\n state.saveChangesConfirmationDialog = undefined;\n },\n false,\n 'closeSaveChangesConfirmationDialog'\n );\n },\n});\n"],"names":["createSaveChangesDialogSlice","set","isOpen","openSaveChangesConfirmationDialog","dialog","state","saveChangesConfirmationDialog","closeSaveChangesConfirmationDialog","undefined"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAmBjC,OAAO,MAAMA,4BAA4B,GAKrC,CAACC,GAAG,GAAM,CAAA;QACZC,MAAM,EAAE,KAAK;QAEbC,iCAAiC,EAACC,MAAM,EAAE;YACxCH,GAAG,CACD,CAACI,KAAK,GAAK;gBACTA,KAAK,CAACC,6BAA6B,GAAGF,MAAM,CAAC;YAC/C,CAAC,EACD,KAAK,EACL,mCAAmC,CACpC,CAAC;QACJ,CAAC;QAEDG,kCAAkC,IAAG;YACnCN,GAAG,CACD,CAACI,KAAK,GAAK;gBACTA,KAAK,CAACC,6BAA6B,GAAGE,SAAS,CAAC;YAClD,CAAC,EACD,KAAK,EACL,oCAAoC,CACrC,CAAC;QACJ,CAAC;KACF,CAAA,AAAC,CAAC"}
1
+ {"version":3,"sources":["../../../src/context/DashboardProvider/save-changes-dialog-slice.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { StateCreator } from 'zustand';\nimport { Middleware } from './common';\n\nexport interface SaveChangesConfirmationDialogSlice {\n saveChangesConfirmationDialog?: SaveChangesConfirmationDialogState;\n openSaveChangesConfirmationDialog: (saveChangesConfirmationDialog: SaveChangesConfirmationDialogState) => void;\n closeSaveChangesConfirmationDialog: () => void;\n}\n\nexport interface SaveChangesConfirmationDialogState {\n onSaveChanges: (saveDefaultTimeRange: boolean, saveDefaultVariables: boolean) => void;\n onCancel: () => void;\n isSavedDurationModified: boolean;\n isSavedVariableModified: boolean;\n description?: string;\n}\n\nexport const createSaveChangesDialogSlice: StateCreator<\n SaveChangesConfirmationDialogSlice,\n Middleware,\n [],\n SaveChangesConfirmationDialogSlice\n> = (set) => ({\n isOpen: false,\n\n openSaveChangesConfirmationDialog(dialog) {\n set(\n (state) => {\n state.saveChangesConfirmationDialog = dialog;\n },\n false,\n 'openSaveChangesConfirmationDialog'\n );\n },\n\n closeSaveChangesConfirmationDialog() {\n set(\n (state) => {\n state.saveChangesConfirmationDialog = undefined;\n },\n false,\n 'closeSaveChangesConfirmationDialog'\n );\n },\n});\n"],"names":["createSaveChangesDialogSlice","set","isOpen","openSaveChangesConfirmationDialog","dialog","state","saveChangesConfirmationDialog","closeSaveChangesConfirmationDialog","undefined"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAmBjC,OAAO,MAAMA,+BAKT,CAACC,MAAS,CAAA;QACZC,QAAQ;QAERC,mCAAkCC,MAAM;YACtCH,IACE,CAACI;gBACCA,MAAMC,gCAAgCF;YACxC,GACA,OACA;QAEJ;QAEAG;YACEN,IACE,CAACI;gBACCA,MAAMC,gCAAgCE;YACxC,GACA,OACA;QAEJ;IACF,CAAA,EAAG"}
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- import { DashboardResource, Datasource, DatasourceSelector, GlobalDatasource } from '@perses-dev/core';
2
+ import { DashboardResource, ProjectDatasource, DatasourceSelector, GlobalDatasource } from '@perses-dev/core';
3
3
  import { DatasourceClient } from '@perses-dev/plugin-system';
4
4
  export interface DatasourceStoreProviderProps {
5
5
  dashboardResource?: DashboardResource;
@@ -8,16 +8,20 @@ export interface DatasourceStoreProviderProps {
8
8
  children?: ReactNode;
9
9
  onCreate?: (client: DatasourceClient) => DatasourceClient;
10
10
  }
11
+ export declare type BuildDatasourceProxyUrlParams = {
12
+ project?: string;
13
+ dashboard?: string;
14
+ name: string;
15
+ };
16
+ export declare type BuildDatasourceProxyUrlFunc = (p: BuildDatasourceProxyUrlParams) => string;
17
+ /**
18
+ * The external API for fetching datasource resources
19
+ */
11
20
  export interface DatasourceApi {
12
- getDatasource: (project: string, selector: DatasourceSelector) => Promise<{
13
- resource: Datasource;
14
- proxyUrl: string;
15
- } | undefined>;
16
- getGlobalDatasource: (selector: DatasourceSelector) => Promise<{
17
- resource: GlobalDatasource;
18
- proxyUrl: string;
19
- } | undefined>;
20
- listDatasources: (project: string, pluginKind?: string) => Promise<Datasource[]>;
21
+ buildProxyUrl?: BuildDatasourceProxyUrlFunc;
22
+ getDatasource: (project: string, selector: DatasourceSelector) => Promise<ProjectDatasource | undefined>;
23
+ getGlobalDatasource: (selector: DatasourceSelector) => Promise<GlobalDatasource | undefined>;
24
+ listDatasources: (project: string, pluginKind?: string) => Promise<ProjectDatasource[]>;
21
25
  listGlobalDatasources: (pluginKind?: string) => Promise<GlobalDatasource[]>;
22
26
  }
23
27
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"DatasourceStoreProvider.d.ts","sourceRoot":"","sources":["../../src/context/DatasourceStoreProvider.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,SAAS,EAAwB,MAAM,OAAO,CAAC;AACxD,OAAO,EACL,iBAAiB,EAEjB,UAAU,EACV,kBAAkB,EAElB,gBAAgB,EAEjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAKL,gBAAgB,EACjB,MAAM,2BAA2B,CAAC;AAEnC,MAAM,WAAW,4BAA4B;IAC3C,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,gBAAgB,CAAC;CAC3D;AAGD,MAAM,WAAW,aAAa;IAC5B,aAAa,EAAE,CACb,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,kBAAkB,KACzB,OAAO,CAAC;QAAE,QAAQ,EAAE,UAAU,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC,CAAC;IAErE,mBAAmB,EAAE,CACnB,QAAQ,EAAE,kBAAkB,KACzB,OAAO,CAAC;QAAE,QAAQ,EAAE,gBAAgB,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC,CAAC;IAE3E,eAAe,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;IAEjF,qBAAqB,EAAE,CAAC,UAAU,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC;CAC7E;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,4BAA4B,eA4G1E"}
1
+ {"version":3,"file":"DatasourceStoreProvider.d.ts","sourceRoot":"","sources":["../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