@perses-dev/dashboards 0.0.0-snapshot-scatterplot-fix-imports-95e1b59 → 0.0.0-snapshot-histogram-types-78c5104

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 (366) hide show
  1. package/dist/cjs/components/Dashboard/Dashboard.js +8 -1
  2. package/dist/cjs/components/DashboardStickyToolbar/DashboardStickyToolbar.js +2 -2
  3. package/dist/cjs/components/DashboardToolbar/DashboardToolbar.js +4 -4
  4. package/dist/cjs/components/Datasources/DatasourceEditor.js +18 -18
  5. package/dist/cjs/components/Datasources/EditDatasourcesButton.js +2 -5
  6. package/dist/cjs/components/DeletePanelDialog/DeletePanelDialog.js +2 -0
  7. package/dist/cjs/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +5 -4
  8. package/dist/cjs/components/DownloadButton/DownloadButton.js +135 -29
  9. package/dist/cjs/components/EditJsonDialog/EditJsonDialog.js +10 -13
  10. package/dist/cjs/components/EmptyDashboard/EmptyDashboard.js +2 -2
  11. package/dist/cjs/components/GridLayout/GridContainer.js +15 -10
  12. package/dist/cjs/components/GridLayout/GridItemContent.js +20 -4
  13. package/dist/cjs/components/GridLayout/GridLayout.js +57 -12
  14. package/dist/cjs/components/GridLayout/GridTitle.js +3 -3
  15. package/dist/cjs/{validation/panel.js → components/Panel/HeaderIconButton.js} +8 -10
  16. package/dist/cjs/components/Panel/Panel.js +19 -11
  17. package/dist/cjs/components/Panel/PanelActions.js +365 -0
  18. package/dist/cjs/components/Panel/PanelContent.js +59 -13
  19. package/dist/cjs/components/Panel/PanelHeader.js +14 -117
  20. package/dist/cjs/components/Panel/PanelLinks.js +136 -0
  21. package/dist/cjs/components/Panel/PanelPluginLoader.js +56 -0
  22. package/dist/cjs/components/Panel/index.js +1 -0
  23. package/dist/cjs/components/PanelDrawer/PanelDrawer.js +9 -6
  24. package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +81 -67
  25. package/dist/cjs/components/PanelDrawer/PanelPreview.js +7 -3
  26. package/dist/cjs/components/PanelDrawer/usePanelEditor.js +9 -6
  27. package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.js +1 -1
  28. package/dist/cjs/components/QuerySummaryTable/QuerySummaryTable.js +3 -5
  29. package/dist/cjs/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +4 -6
  30. package/dist/cjs/components/SaveDashboardButton/SaveDashboardButton.js +2 -2
  31. package/dist/cjs/components/Variables/BuiltinVariableAccordions.js +7 -14
  32. package/dist/cjs/components/Variables/EditVariablesButton.js +4 -4
  33. package/dist/cjs/components/Variables/{TemplateVariable.js → Variable.js} +52 -60
  34. package/dist/cjs/components/Variables/VariableEditor.js +34 -40
  35. package/dist/cjs/components/Variables/VariableList.js +23 -22
  36. package/dist/cjs/components/Variables/index.js +2 -2
  37. package/dist/cjs/constants/styles.js +19 -7
  38. package/dist/cjs/constants/user-interface-text.js +3 -1
  39. package/dist/cjs/context/DashboardProvider/DashboardProvider.js +10 -8
  40. package/dist/cjs/context/DashboardProvider/DashboardProviderWithQueryParams.js +36 -0
  41. package/dist/cjs/context/DashboardProvider/common.js +2 -2
  42. package/dist/cjs/context/DashboardProvider/dashboard-provider-api.js +25 -6
  43. package/dist/cjs/context/DashboardProvider/delete-panel-slice.js +1 -2
  44. package/dist/cjs/context/DashboardProvider/panel-editor-slice.js +7 -10
  45. package/dist/cjs/context/DashboardProvider/panel-group-editor-slice.js +1 -2
  46. package/dist/cjs/context/DashboardProvider/panel-group-slice.js +8 -3
  47. package/dist/cjs/context/DashboardProvider/view-panel-slice.js +79 -0
  48. package/dist/cjs/context/DatasourceStoreProvider.js +18 -23
  49. package/dist/cjs/context/{TemplateVariableProvider/TemplateVariableProvider.js → VariableProvider/VariableProvider.js} +76 -87
  50. package/dist/cjs/context/{TemplateVariableProvider → VariableProvider}/hydrationUtils.js +11 -14
  51. package/dist/cjs/{validation → context/VariableProvider}/index.js +2 -2
  52. package/dist/cjs/context/{TemplateVariableProvider → VariableProvider}/query-params.js +1 -1
  53. package/dist/cjs/context/{TemplateVariableProvider → VariableProvider}/utils.js +3 -3
  54. package/dist/cjs/context/index.js +2 -2
  55. package/dist/cjs/context/useDashboard.js +4 -4
  56. package/dist/cjs/test/datasource-provider.js +1 -1
  57. package/dist/cjs/test/plugin-registry.js +8 -3
  58. package/dist/cjs/test/render.js +13 -11
  59. package/dist/cjs/views/ViewDashboard/DashboardApp.js +6 -4
  60. package/dist/cjs/views/ViewDashboard/ViewDashboard.js +10 -9
  61. package/dist/components/AddGroupButton/AddGroupButton.d.ts +2 -1
  62. package/dist/components/AddGroupButton/AddGroupButton.d.ts.map +1 -1
  63. package/dist/components/AddGroupButton/AddGroupButton.js.map +1 -1
  64. package/dist/components/AddPanelButton/AddPanelButton.d.ts +2 -1
  65. package/dist/components/AddPanelButton/AddPanelButton.d.ts.map +1 -1
  66. package/dist/components/AddPanelButton/AddPanelButton.js.map +1 -1
  67. package/dist/components/Dashboard/Dashboard.d.ts +2 -1
  68. package/dist/components/Dashboard/Dashboard.d.ts.map +1 -1
  69. package/dist/components/Dashboard/Dashboard.js +8 -1
  70. package/dist/components/Dashboard/Dashboard.js.map +1 -1
  71. package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.d.ts +2 -1
  72. package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.d.ts.map +1 -1
  73. package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js +3 -3
  74. package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js.map +1 -1
  75. package/dist/components/DashboardToolbar/DashboardToolbar.d.ts +4 -2
  76. package/dist/components/DashboardToolbar/DashboardToolbar.d.ts.map +1 -1
  77. package/dist/components/DashboardToolbar/DashboardToolbar.js +4 -4
  78. package/dist/components/DashboardToolbar/DashboardToolbar.js.map +1 -1
  79. package/dist/components/Datasources/DatasourceEditor.d.ts +2 -1
  80. package/dist/components/Datasources/DatasourceEditor.d.ts.map +1 -1
  81. package/dist/components/Datasources/DatasourceEditor.js +19 -19
  82. package/dist/components/Datasources/DatasourceEditor.js.map +1 -1
  83. package/dist/components/Datasources/EditDatasourcesButton.d.ts +2 -1
  84. package/dist/components/Datasources/EditDatasourcesButton.d.ts.map +1 -1
  85. package/dist/components/Datasources/EditDatasourcesButton.js +2 -5
  86. package/dist/components/Datasources/EditDatasourcesButton.js.map +1 -1
  87. package/dist/components/DeletePanelDialog/DeletePanelDialog.d.ts +2 -1
  88. package/dist/components/DeletePanelDialog/DeletePanelDialog.d.ts.map +1 -1
  89. package/dist/components/DeletePanelDialog/DeletePanelDialog.js +3 -1
  90. package/dist/components/DeletePanelDialog/DeletePanelDialog.js.map +1 -1
  91. package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.d.ts +2 -1
  92. package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.d.ts.map +1 -1
  93. package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +6 -5
  94. package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js.map +1 -1
  95. package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.d.ts +2 -1
  96. package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.d.ts.map +1 -1
  97. package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js.map +1 -1
  98. package/dist/components/DownloadButton/DownloadButton.d.ts +2 -5
  99. package/dist/components/DownloadButton/DownloadButton.d.ts.map +1 -1
  100. package/dist/components/DownloadButton/DownloadButton.js +94 -29
  101. package/dist/components/DownloadButton/DownloadButton.js.map +1 -1
  102. package/dist/components/EditButton/EditButton.d.ts +2 -1
  103. package/dist/components/EditButton/EditButton.d.ts.map +1 -1
  104. package/dist/components/EditButton/EditButton.js.map +1 -1
  105. package/dist/components/EditJsonButton/EditJsonButton.d.ts +2 -1
  106. package/dist/components/EditJsonButton/EditJsonButton.d.ts.map +1 -1
  107. package/dist/components/EditJsonButton/EditJsonButton.js.map +1 -1
  108. package/dist/components/EditJsonDialog/EditJsonDialog.d.ts +2 -1
  109. package/dist/components/EditJsonDialog/EditJsonDialog.d.ts.map +1 -1
  110. package/dist/components/EditJsonDialog/EditJsonDialog.js +7 -10
  111. package/dist/components/EditJsonDialog/EditJsonDialog.js.map +1 -1
  112. package/dist/components/EmptyDashboard/EmptyDashboard.d.ts +3 -3
  113. package/dist/components/EmptyDashboard/EmptyDashboard.d.ts.map +1 -1
  114. package/dist/components/EmptyDashboard/EmptyDashboard.js +2 -2
  115. package/dist/components/EmptyDashboard/EmptyDashboard.js.map +1 -1
  116. package/dist/components/GridLayout/GridContainer.d.ts +5 -3
  117. package/dist/components/GridLayout/GridContainer.d.ts.map +1 -1
  118. package/dist/components/GridLayout/GridContainer.js +15 -10
  119. package/dist/components/GridLayout/GridContainer.js.map +1 -1
  120. package/dist/components/GridLayout/GridItemContent.d.ts +2 -1
  121. package/dist/components/GridLayout/GridItemContent.d.ts.map +1 -1
  122. package/dist/components/GridLayout/GridItemContent.js +22 -6
  123. package/dist/components/GridLayout/GridItemContent.js.map +1 -1
  124. package/dist/components/GridLayout/GridLayout.d.ts +4 -2
  125. package/dist/components/GridLayout/GridLayout.d.ts.map +1 -1
  126. package/dist/components/GridLayout/GridLayout.js +59 -14
  127. package/dist/components/GridLayout/GridLayout.js.map +1 -1
  128. package/dist/components/GridLayout/GridTitle.d.ts +3 -2
  129. package/dist/components/GridLayout/GridTitle.d.ts.map +1 -1
  130. package/dist/components/GridLayout/GridTitle.js +3 -3
  131. package/dist/components/GridLayout/GridTitle.js.map +1 -1
  132. package/dist/components/Panel/HeaderIconButton.d.ts +5 -0
  133. package/dist/components/Panel/HeaderIconButton.d.ts.map +1 -0
  134. package/dist/{stories/decorators/index.js → components/Panel/HeaderIconButton.js} +7 -6
  135. package/dist/components/Panel/HeaderIconButton.js.map +1 -0
  136. package/dist/components/Panel/Panel.d.ts +16 -5
  137. package/dist/components/Panel/Panel.d.ts.map +1 -1
  138. package/dist/components/Panel/Panel.js +25 -12
  139. package/dist/components/Panel/Panel.js.map +1 -1
  140. package/dist/components/Panel/PanelActions.d.ts +22 -0
  141. package/dist/components/Panel/PanelActions.d.ts.map +1 -0
  142. package/dist/components/Panel/PanelActions.js +352 -0
  143. package/dist/components/Panel/PanelActions.js.map +1 -0
  144. package/dist/components/Panel/PanelContent.d.ts +7 -5
  145. package/dist/components/Panel/PanelContent.d.ts.map +1 -1
  146. package/dist/components/Panel/PanelContent.js +61 -15
  147. package/dist/components/Panel/PanelContent.js.map +1 -1
  148. package/dist/components/Panel/PanelHeader.d.ts +10 -8
  149. package/dist/components/Panel/PanelHeader.d.ts.map +1 -1
  150. package/dist/components/Panel/PanelHeader.js +18 -116
  151. package/dist/components/Panel/PanelHeader.js.map +1 -1
  152. package/dist/components/Panel/PanelLinks.d.ts +6 -0
  153. package/dist/components/Panel/PanelLinks.d.ts.map +1 -0
  154. package/dist/components/Panel/PanelLinks.js +123 -0
  155. package/dist/components/Panel/PanelLinks.js.map +1 -0
  156. package/dist/components/Panel/PanelPluginLoader.d.ts +13 -0
  157. package/dist/components/Panel/PanelPluginLoader.d.ts.map +1 -0
  158. package/dist/components/Panel/PanelPluginLoader.js +51 -0
  159. package/dist/components/Panel/PanelPluginLoader.js.map +1 -0
  160. package/dist/components/Panel/index.d.ts +1 -0
  161. package/dist/components/Panel/index.d.ts.map +1 -1
  162. package/dist/components/Panel/index.js +1 -0
  163. package/dist/components/Panel/index.js.map +1 -1
  164. package/dist/components/PanelDrawer/PanelDrawer.d.ts +2 -1
  165. package/dist/components/PanelDrawer/PanelDrawer.d.ts.map +1 -1
  166. package/dist/components/PanelDrawer/PanelDrawer.js +10 -7
  167. package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -1
  168. package/dist/components/PanelDrawer/PanelEditorForm.d.ts +3 -3
  169. package/dist/components/PanelDrawer/PanelEditorForm.d.ts.map +1 -1
  170. package/dist/components/PanelDrawer/PanelEditorForm.js +84 -70
  171. package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -1
  172. package/dist/components/PanelDrawer/PanelPreview.d.ts +3 -2
  173. package/dist/components/PanelDrawer/PanelPreview.d.ts.map +1 -1
  174. package/dist/components/PanelDrawer/PanelPreview.js +8 -4
  175. package/dist/components/PanelDrawer/PanelPreview.js.map +1 -1
  176. package/dist/components/PanelDrawer/usePanelEditor.d.ts +12 -10
  177. package/dist/components/PanelDrawer/usePanelEditor.d.ts.map +1 -1
  178. package/dist/components/PanelDrawer/usePanelEditor.js +9 -6
  179. package/dist/components/PanelDrawer/usePanelEditor.js.map +1 -1
  180. package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts +2 -1
  181. package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts.map +1 -1
  182. package/dist/components/PanelGroupDialog/PanelGroupDialog.js +1 -1
  183. package/dist/components/PanelGroupDialog/PanelGroupDialog.js.map +1 -1
  184. package/dist/components/PanelGroupDialog/PanelGroupEditorForm.d.ts +2 -1
  185. package/dist/components/PanelGroupDialog/PanelGroupEditorForm.d.ts.map +1 -1
  186. package/dist/components/PanelGroupDialog/PanelGroupEditorForm.js.map +1 -1
  187. package/dist/components/QuerySummaryTable/QuerySummaryTable.d.ts +2 -1
  188. package/dist/components/QuerySummaryTable/QuerySummaryTable.d.ts.map +1 -1
  189. package/dist/components/QuerySummaryTable/QuerySummaryTable.js +3 -5
  190. package/dist/components/QuerySummaryTable/QuerySummaryTable.js.map +1 -1
  191. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.d.ts +2 -1
  192. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.d.ts.map +1 -1
  193. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +5 -7
  194. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js.map +1 -1
  195. package/dist/components/SaveDashboardButton/SaveDashboardButton.d.ts +2 -1
  196. package/dist/components/SaveDashboardButton/SaveDashboardButton.d.ts.map +1 -1
  197. package/dist/components/SaveDashboardButton/SaveDashboardButton.js +3 -3
  198. package/dist/components/SaveDashboardButton/SaveDashboardButton.js.map +1 -1
  199. package/dist/components/Variables/BuiltinVariableAccordions.d.ts +2 -1
  200. package/dist/components/Variables/BuiltinVariableAccordions.d.ts.map +1 -1
  201. package/dist/components/Variables/BuiltinVariableAccordions.js +7 -14
  202. package/dist/components/Variables/BuiltinVariableAccordions.js.map +1 -1
  203. package/dist/components/Variables/EditVariablesButton.d.ts +2 -1
  204. package/dist/components/Variables/EditVariablesButton.d.ts.map +1 -1
  205. package/dist/components/Variables/EditVariablesButton.js +5 -5
  206. package/dist/components/Variables/EditVariablesButton.js.map +1 -1
  207. package/dist/components/Variables/{TemplateVariable.d.ts → Variable.d.ts} +6 -5
  208. package/dist/components/Variables/Variable.d.ts.map +1 -0
  209. package/dist/components/Variables/{TemplateVariable.js → Variable.js} +53 -61
  210. package/dist/components/Variables/Variable.js.map +1 -0
  211. package/dist/components/Variables/VariableEditor.d.ts +3 -2
  212. package/dist/components/Variables/VariableEditor.d.ts.map +1 -1
  213. package/dist/components/Variables/VariableEditor.js +35 -41
  214. package/dist/components/Variables/VariableEditor.js.map +1 -1
  215. package/dist/components/Variables/VariableList.d.ts +4 -3
  216. package/dist/components/Variables/VariableList.d.ts.map +1 -1
  217. package/dist/components/Variables/VariableList.js +21 -20
  218. package/dist/components/Variables/VariableList.js.map +1 -1
  219. package/dist/components/Variables/index.d.ts +1 -1
  220. package/dist/components/Variables/index.d.ts.map +1 -1
  221. package/dist/components/Variables/index.js +2 -2
  222. package/dist/components/Variables/index.js.map +1 -1
  223. package/dist/constants/styles.d.ts +5 -2
  224. package/dist/constants/styles.d.ts.map +1 -1
  225. package/dist/constants/styles.js +6 -3
  226. package/dist/constants/styles.js.map +1 -1
  227. package/dist/constants/user-interface-text.d.ts +3 -1
  228. package/dist/constants/user-interface-text.d.ts.map +1 -1
  229. package/dist/constants/user-interface-text.js +3 -1
  230. package/dist/constants/user-interface-text.js.map +1 -1
  231. package/dist/context/DashboardProvider/DashboardProvider.d.ts +6 -3
  232. package/dist/context/DashboardProvider/DashboardProvider.d.ts.map +1 -1
  233. package/dist/context/DashboardProvider/DashboardProvider.js +11 -9
  234. package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -1
  235. package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.d.ts +4 -0
  236. package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.d.ts.map +1 -0
  237. package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.js +28 -0
  238. package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.js.map +1 -0
  239. package/dist/context/DashboardProvider/common.d.ts.map +1 -1
  240. package/dist/context/DashboardProvider/common.js +2 -2
  241. package/dist/context/DashboardProvider/common.js.map +1 -1
  242. package/dist/context/DashboardProvider/dashboard-provider-api.d.ts +45 -23
  243. package/dist/context/DashboardProvider/dashboard-provider-api.d.ts.map +1 -1
  244. package/dist/context/DashboardProvider/dashboard-provider-api.js +23 -6
  245. package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -1
  246. package/dist/context/DashboardProvider/delete-panel-group-slice.d.ts +2 -1
  247. package/dist/context/DashboardProvider/delete-panel-group-slice.d.ts.map +1 -1
  248. package/dist/context/DashboardProvider/delete-panel-group-slice.js.map +1 -1
  249. package/dist/context/DashboardProvider/delete-panel-slice.js +1 -2
  250. package/dist/context/DashboardProvider/delete-panel-slice.js.map +1 -1
  251. package/dist/context/DashboardProvider/discard-changes-dialog-slice.js.map +1 -1
  252. package/dist/context/DashboardProvider/duplicate-panel-slice.js.map +1 -1
  253. package/dist/context/DashboardProvider/edit-json-dialog-slice.js.map +1 -1
  254. package/dist/context/DashboardProvider/index.d.ts +1 -2
  255. package/dist/context/DashboardProvider/index.d.ts.map +1 -1
  256. package/dist/context/DashboardProvider/index.js.map +1 -1
  257. package/dist/context/DashboardProvider/panel-editor-slice.d.ts +2 -9
  258. package/dist/context/DashboardProvider/panel-editor-slice.d.ts.map +1 -1
  259. package/dist/context/DashboardProvider/panel-editor-slice.js +4 -7
  260. package/dist/context/DashboardProvider/panel-editor-slice.js.map +1 -1
  261. package/dist/context/DashboardProvider/panel-group-editor-slice.d.ts +2 -1
  262. package/dist/context/DashboardProvider/panel-group-editor-slice.d.ts.map +1 -1
  263. package/dist/context/DashboardProvider/panel-group-editor-slice.js +1 -2
  264. package/dist/context/DashboardProvider/panel-group-editor-slice.js.map +1 -1
  265. package/dist/context/DashboardProvider/panel-group-slice.d.ts +3 -3
  266. package/dist/context/DashboardProvider/panel-group-slice.d.ts.map +1 -1
  267. package/dist/context/DashboardProvider/panel-group-slice.js +7 -3
  268. package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -1
  269. package/dist/context/DashboardProvider/save-changes-dialog-slice.js.map +1 -1
  270. package/dist/context/DashboardProvider/view-panel-slice.d.ts +21 -0
  271. package/dist/context/DashboardProvider/view-panel-slice.d.ts.map +1 -0
  272. package/dist/context/DashboardProvider/view-panel-slice.js +73 -0
  273. package/dist/context/DashboardProvider/view-panel-slice.js.map +1 -0
  274. package/dist/context/DatasourceStoreProvider.d.ts +7 -7
  275. package/dist/context/DatasourceStoreProvider.d.ts.map +1 -1
  276. package/dist/context/DatasourceStoreProvider.js +18 -23
  277. package/dist/context/DatasourceStoreProvider.js.map +1 -1
  278. package/dist/context/VariableProvider/VariableProvider.d.ts +119 -0
  279. package/dist/context/VariableProvider/VariableProvider.d.ts.map +1 -0
  280. package/dist/context/{TemplateVariableProvider/TemplateVariableProvider.js → VariableProvider/VariableProvider.js} +62 -64
  281. package/dist/context/VariableProvider/VariableProvider.js.map +1 -0
  282. package/dist/context/{TemplateVariableProvider → VariableProvider}/hydrationUtils.d.ts +1 -1
  283. package/dist/context/VariableProvider/hydrationUtils.d.ts.map +1 -0
  284. package/dist/context/{TemplateVariableProvider → VariableProvider}/hydrationUtils.js +9 -12
  285. package/dist/context/VariableProvider/hydrationUtils.js.map +1 -0
  286. package/dist/context/VariableProvider/index.d.ts +2 -0
  287. package/dist/context/VariableProvider/index.d.ts.map +1 -0
  288. package/dist/{validation → context/VariableProvider}/index.js +2 -2
  289. package/dist/context/VariableProvider/index.js.map +1 -0
  290. package/dist/context/{TemplateVariableProvider → VariableProvider}/query-params.d.ts +2 -6
  291. package/dist/context/VariableProvider/query-params.d.ts.map +1 -0
  292. package/dist/context/{TemplateVariableProvider → VariableProvider}/query-params.js +1 -1
  293. package/dist/context/VariableProvider/query-params.js.map +1 -0
  294. package/dist/context/{TemplateVariableProvider → VariableProvider}/utils.d.ts +1 -1
  295. package/dist/context/VariableProvider/utils.d.ts.map +1 -0
  296. package/dist/context/{TemplateVariableProvider → VariableProvider}/utils.js +3 -3
  297. package/dist/context/VariableProvider/utils.js.map +1 -0
  298. package/dist/context/index.d.ts +1 -1
  299. package/dist/context/index.d.ts.map +1 -1
  300. package/dist/context/index.js +2 -2
  301. package/dist/context/index.js.map +1 -1
  302. package/dist/context/useDashboard.d.ts.map +1 -1
  303. package/dist/context/useDashboard.js +4 -4
  304. package/dist/context/useDashboard.js.map +1 -1
  305. package/dist/test/dashboard-provider.d.ts +1 -1
  306. package/dist/test/dashboard-provider.d.ts.map +1 -1
  307. package/dist/test/dashboard-provider.js.map +1 -1
  308. package/dist/test/datasource-provider.d.ts +3 -3
  309. package/dist/test/datasource-provider.d.ts.map +1 -1
  310. package/dist/test/datasource-provider.js +1 -1
  311. package/dist/test/datasource-provider.js.map +1 -1
  312. package/dist/test/plugin-registry.d.ts.map +1 -1
  313. package/dist/test/plugin-registry.js +8 -3
  314. package/dist/test/plugin-registry.js.map +1 -1
  315. package/dist/test/render.d.ts +2 -2
  316. package/dist/test/render.d.ts.map +1 -1
  317. package/dist/test/render.js +9 -7
  318. package/dist/test/render.js.map +1 -1
  319. package/dist/utils/panelUtils.d.ts.map +1 -1
  320. package/dist/utils/panelUtils.js.map +1 -1
  321. package/dist/views/ViewDashboard/DashboardApp.d.ts +4 -2
  322. package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -1
  323. package/dist/views/ViewDashboard/DashboardApp.js +6 -4
  324. package/dist/views/ViewDashboard/DashboardApp.js.map +1 -1
  325. package/dist/views/ViewDashboard/ViewDashboard.d.ts +4 -3
  326. package/dist/views/ViewDashboard/ViewDashboard.d.ts.map +1 -1
  327. package/dist/views/ViewDashboard/ViewDashboard.js +11 -10
  328. package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -1
  329. package/package.json +12 -12
  330. package/dist/cjs/context/TemplateVariableProvider/index.js +0 -30
  331. package/dist/cjs/stories/decorators/WithDashboard.js +0 -41
  332. package/dist/cjs/stories/decorators/WithDatasourceStore.js +0 -39
  333. package/dist/cjs/stories/decorators/WithTemplateVariables.js +0 -37
  334. package/dist/cjs/stories/decorators/constants.js +0 -39
  335. package/dist/cjs/stories/decorators/index.js +0 -33
  336. package/dist/components/Variables/TemplateVariable.d.ts.map +0 -1
  337. package/dist/components/Variables/TemplateVariable.js.map +0 -1
  338. package/dist/context/TemplateVariableProvider/TemplateVariableProvider.d.ts +0 -77
  339. package/dist/context/TemplateVariableProvider/TemplateVariableProvider.d.ts.map +0 -1
  340. package/dist/context/TemplateVariableProvider/TemplateVariableProvider.js.map +0 -1
  341. package/dist/context/TemplateVariableProvider/hydrationUtils.d.ts.map +0 -1
  342. package/dist/context/TemplateVariableProvider/hydrationUtils.js.map +0 -1
  343. package/dist/context/TemplateVariableProvider/index.d.ts +0 -2
  344. package/dist/context/TemplateVariableProvider/index.d.ts.map +0 -1
  345. package/dist/context/TemplateVariableProvider/index.js +0 -15
  346. package/dist/context/TemplateVariableProvider/index.js.map +0 -1
  347. package/dist/context/TemplateVariableProvider/query-params.d.ts.map +0 -1
  348. package/dist/context/TemplateVariableProvider/query-params.js.map +0 -1
  349. package/dist/context/TemplateVariableProvider/utils.d.ts.map +0 -1
  350. package/dist/context/TemplateVariableProvider/utils.js.map +0 -1
  351. package/dist/stories/decorators/WithDashboard.js +0 -33
  352. package/dist/stories/decorators/WithDashboard.js.map +0 -1
  353. package/dist/stories/decorators/WithDatasourceStore.js +0 -31
  354. package/dist/stories/decorators/WithDatasourceStore.js.map +0 -1
  355. package/dist/stories/decorators/WithTemplateVariables.js +0 -29
  356. package/dist/stories/decorators/WithTemplateVariables.js.map +0 -1
  357. package/dist/stories/decorators/constants.js +0 -31
  358. package/dist/stories/decorators/constants.js.map +0 -1
  359. package/dist/stories/decorators/index.js.map +0 -1
  360. package/dist/validation/index.d.ts +0 -2
  361. package/dist/validation/index.d.ts.map +0 -1
  362. package/dist/validation/index.js.map +0 -1
  363. package/dist/validation/panel.d.ts +0 -19
  364. package/dist/validation/panel.d.ts.map +0 -1
  365. package/dist/validation/panel.js +0 -21
  366. package/dist/validation/panel.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Datasources/EditDatasourcesButton.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { useState } from 'react';\nimport { Button } from '@mui/material';\nimport PencilIcon from 'mdi-material-ui/PencilOutline';\nimport { Drawer, InfoTooltip } from '@perses-dev/components';\nimport { DashboardResource, DatasourceSpec, EphemeralDashboardResource } from '@perses-dev/core';\nimport { useDatasourceStore } from '@perses-dev/plugin-system';\nimport { TOOLTIP_TEXT, editButtonStyle } from '../../constants';\nimport { useDashboard } from '../../context';\nimport { DatasourceEditor } from './DatasourceEditor';\n\nexport function EditDatasourcesButton() {\n const [isDatasourceEditorOpen, setIsDatasourceEditorOpen] = useState(false);\n const { getLocalDatasources, setLocalDatasources, getSavedDatasources, setSavedDatasources } = useDatasourceStore();\n const localDatasources: Record<string, DatasourceSpec> = getLocalDatasources();\n const savedDatasources: Record<string, DatasourceSpec> = getSavedDatasources();\n const { dashboard, setDashboard } = useDashboard();\n\n const openDatasourceEditor = () => {\n setIsDatasourceEditorOpen(true);\n };\n\n const closeDatasourceEditor = () => {\n setIsDatasourceEditorOpen(false);\n };\n\n const handleChangeDatasources = (datasources: Record<string, DatasourceSpec>) => {\n // Calculates the new list of datasources that are allowed to be used.\n const newSavedDatasources: Record<string, DatasourceSpec> = Object.keys(datasources)\n .filter((key) => {\n // Datasources are allowed to be used if a) they are direct, or b) they are proxied, and their\n // proxy is the same as what we have saved.\n const isDirect = 'directUrl' in (datasources[key]?.plugin?.spec ?? {});\n const isSavedProxy =\n !isDirect &&\n !('directUrl' in (savedDatasources[key]?.plugin?.spec ?? {})) &&\n datasources[key]?.plugin?.spec?.proxy === savedDatasources[key]?.plugin?.spec?.proxy;\n\n return isDirect || isSavedProxy;\n })\n .reduce(\n (obj, key) => {\n obj[key] = datasources[key] as DatasourceSpec;\n\n return obj;\n },\n {} as Record<string, DatasourceSpec>\n );\n\n setDashboard(\n dashboard.kind === 'Dashboard'\n ? ({\n ...dashboard,\n spec: {\n ...dashboard.spec,\n datasources: datasources,\n },\n } as DashboardResource)\n : ({\n ...dashboard,\n spec: {\n ...dashboard.spec,\n datasources: datasources,\n },\n } as EphemeralDashboardResource)\n );\n setSavedDatasources(newSavedDatasources);\n setLocalDatasources(datasources);\n setIsDatasourceEditorOpen(false);\n };\n\n return (\n <>\n <InfoTooltip description={TOOLTIP_TEXT.editDatasources}>\n <Button\n startIcon={<PencilIcon />}\n onClick={openDatasourceEditor}\n aria-label={TOOLTIP_TEXT.editDatasources}\n variant=\"text\"\n color=\"primary\"\n sx={editButtonStyle}\n >\n Datasources\n </Button>\n </InfoTooltip>\n <Drawer\n isOpen={isDatasourceEditorOpen}\n onClose={closeDatasourceEditor}\n PaperProps={{ sx: { width: '50%' } }}\n data-testid=\"datasource-editor\"\n >\n <DatasourceEditor\n datasources={localDatasources}\n onCancel={closeDatasourceEditor}\n onChange={handleChangeDatasources}\n />\n </Drawer>\n </>\n );\n}\n"],"names":["useState","Button","PencilIcon","Drawer","InfoTooltip","useDatasourceStore","TOOLTIP_TEXT","editButtonStyle","useDashboard","DatasourceEditor","EditDatasourcesButton","isDatasourceEditorOpen","setIsDatasourceEditorOpen","getLocalDatasources","setLocalDatasources","getSavedDatasources","setSavedDatasources","localDatasources","savedDatasources","dashboard","setDashboard","openDatasourceEditor","closeDatasourceEditor","handleChangeDatasources","datasources","newSavedDatasources","Object","keys","filter","key","isDirect","plugin","spec","isSavedProxy","proxy","reduce","obj","kind","description","editDatasources","startIcon","onClick","aria-label","variant","color","sx","isOpen","onClose","PaperProps","width","data-testid","onCancel","onChange"],"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,QAAQ,QAAQ,QAAQ;AACjC,SAASC,MAAM,QAAQ,gBAAgB;AACvC,OAAOC,gBAAgB,gCAAgC;AACvD,SAASC,MAAM,EAAEC,WAAW,QAAQ,yBAAyB;AAE7D,SAASC,kBAAkB,QAAQ,4BAA4B;AAC/D,SAASC,YAAY,EAAEC,eAAe,QAAQ,kBAAkB;AAChE,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,gBAAgB,QAAQ,qBAAqB;AAEtD,OAAO,SAASC;IACd,MAAM,CAACC,wBAAwBC,0BAA0B,GAAGZ,SAAS;IACrE,MAAM,EAAEa,mBAAmB,EAAEC,mBAAmB,EAAEC,mBAAmB,EAAEC,mBAAmB,EAAE,GAAGX;IAC/F,MAAMY,mBAAmDJ;IACzD,MAAMK,mBAAmDH;IACzD,MAAM,EAAEI,SAAS,EAAEC,YAAY,EAAE,GAAGZ;IAEpC,MAAMa,uBAAuB;QAC3BT,0BAA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AM;gBACJ,GAAGb,UAAUa,IAAI;gBACjBR,aAAaA;YACf;QACF,IACC;YACC,GAAGL,SAAS;YACZa,MAAM;gBACJ,GAAGb,UAAUa,IAAI;gBACjBR,aAAaA;YACf;QACF;QAENR,oBAAoBS;QACpBX,oBAAoBU;QACpBZ,0BAA0B;IAC5B;IAEA,qBACE;;0BACE,KAACR;gBAAYkC,aAAahC,aAAaiC,eAAe;0BACpD,cAAA,KAACtC;oBACCuC,yBAAW,KAACtC;oBACZuC,SAASpB;oBACTqB,cAAYpC,aAAaiC,eAAe;oBACxCI,SAAQ;oBACRC,OAAM;oBACNC,IAAItC;8BACL;;;0BAIH,KAACJ;gBACC2C,QAAQnC;gBACRoC,SAASzB;gBACT0B,YAAY;oBAAEH,IAAI;wBAAEI,OAAO;oBAAM;gBAAE;gBACnCC,eAAY;0BAEZ,cAAA,KAACzC;oBACCe,aAAaP;oBACbkC,UAAU7B;oBACV8B,UAAU7B;;;;;AAKpB"}
1
+ {"version":3,"sources":["../../../src/components/Datasources/EditDatasourcesButton.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 { ReactElement, useState } from 'react';\nimport { Button } from '@mui/material';\nimport PencilIcon from 'mdi-material-ui/PencilOutline';\nimport { Drawer, InfoTooltip } from '@perses-dev/components';\nimport { DashboardResource, DatasourceSpec, EphemeralDashboardResource } from '@perses-dev/core';\nimport { useDatasourceStore } from '@perses-dev/plugin-system';\nimport { TOOLTIP_TEXT, editButtonStyle } from '../../constants';\nimport { useDashboard } from '../../context';\nimport { DatasourceEditor } from './DatasourceEditor';\n\nexport function EditDatasourcesButton(): ReactElement {\n const [isDatasourceEditorOpen, setIsDatasourceEditorOpen] = useState(false);\n const { getLocalDatasources, setLocalDatasources, getSavedDatasources, setSavedDatasources } = useDatasourceStore();\n const localDatasources: Record<string, DatasourceSpec> = getLocalDatasources();\n const savedDatasources: Record<string, DatasourceSpec> = getSavedDatasources();\n const { dashboard, setDashboard } = useDashboard();\n\n const openDatasourceEditor = (): void => {\n setIsDatasourceEditorOpen(true);\n };\n\n const closeDatasourceEditor = (): void => {\n setIsDatasourceEditorOpen(false);\n };\n\n const handleChangeDatasources = (datasources: Record<string, DatasourceSpec>): void => {\n // Calculates the new list of datasources that are allowed to be used.\n const newSavedDatasources: Record<string, DatasourceSpec> = Object.keys(datasources)\n .filter((key) => {\n // Datasources are allowed to be used if a) they are direct, or b) they are proxied, and their\n // proxy is the same as what we have saved.\n const isDirect = 'directUrl' in (datasources[key]?.plugin?.spec ?? {});\n const isSavedProxy =\n !isDirect &&\n !('directUrl' in (savedDatasources[key]?.plugin?.spec ?? {})) &&\n datasources[key]?.plugin?.spec?.proxy === savedDatasources[key]?.plugin?.spec?.proxy;\n\n return isDirect || isSavedProxy;\n })\n .reduce(\n (obj, key) => {\n obj[key] = datasources[key] as DatasourceSpec;\n\n return obj;\n },\n {} as Record<string, DatasourceSpec>\n );\n\n setDashboard(\n dashboard.kind === 'Dashboard'\n ? ({\n ...dashboard,\n spec: {\n ...dashboard.spec,\n datasources: datasources,\n },\n } as DashboardResource)\n : ({\n ...dashboard,\n spec: {\n ...dashboard.spec,\n datasources: datasources,\n },\n } as EphemeralDashboardResource)\n );\n setSavedDatasources(newSavedDatasources);\n setLocalDatasources(datasources);\n setIsDatasourceEditorOpen(false);\n };\n\n return (\n <>\n <InfoTooltip description={TOOLTIP_TEXT.editDatasources}>\n <Button\n startIcon={<PencilIcon />}\n onClick={openDatasourceEditor}\n aria-label={TOOLTIP_TEXT.editDatasources}\n variant=\"text\"\n color=\"primary\"\n sx={editButtonStyle}\n >\n Datasources\n </Button>\n </InfoTooltip>\n <Drawer\n isOpen={isDatasourceEditorOpen}\n onClose={closeDatasourceEditor}\n PaperProps={{ sx: { width: '50%' } }}\n data-testid=\"datasource-editor\"\n >\n <DatasourceEditor\n datasources={localDatasources}\n onCancel={closeDatasourceEditor}\n onChange={handleChangeDatasources}\n />\n </Drawer>\n </>\n );\n}\n"],"names":["useState","Button","PencilIcon","Drawer","InfoTooltip","useDatasourceStore","TOOLTIP_TEXT","editButtonStyle","useDashboard","DatasourceEditor","EditDatasourcesButton","isDatasourceEditorOpen","setIsDatasourceEditorOpen","getLocalDatasources","setLocalDatasources","getSavedDatasources","setSavedDatasources","localDatasources","savedDatasources","dashboard","setDashboard","openDatasourceEditor","closeDatasourceEditor","handleChangeDatasources","datasources","newSavedDatasources","Object","keys","filter","key","isDirect","plugin","spec","isSavedProxy","proxy","reduce","obj","kind","description","editDatasources","startIcon","onClick","aria-label","variant","color","sx","isOpen","onClose","PaperProps","width","data-testid","onCancel","onChange"],"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,SAAuBA,QAAQ,QAAQ,QAAQ;AAC/C,SAASC,MAAM,QAAQ,gBAAgB;AACvC,OAAOC,gBAAgB,gCAAgC;AACvD,SAASC,MAAM,EAAEC,WAAW,QAAQ,yBAAyB;AAE7D,SAASC,kBAAkB,QAAQ,4BAA4B;AAC/D,SAASC,YAAY,EAAEC,eAAe,QAAQ,kBAAkB;AAChE,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,gBAAgB,QAAQ,qBAAqB;AAEtD,OAAO,SAASC;IACd,MAAM,CAACC,wBAAwBC,0BAA0B,GAAGZ,SAAS;IACrE,MAAM,EAAEa,mBAAmB,EAAEC,mBAAmB,EAAEC,mBAAmB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;oBACRC,OAAM;oBACNC,IAAItC;8BACL;;;0BAIH,KAACJ;gBACC2C,QAAQnC;gBACRoC,SAASzB;gBACT0B,YAAY;oBAAEH,IAAI;wBAAEI,OAAO;oBAAM;gBAAE;gBACnCC,eAAY;0BAEZ,cAAA,KAACzC;oBACCe,aAAaP;oBACbkC,UAAU7B;oBACV8B,UAAU7B;;;;;AAKpB"}
@@ -1,2 +1,3 @@
1
- export declare const DeletePanelDialog: () => import("react/jsx-runtime").JSX.Element;
1
+ import { ReactElement } from 'react';
2
+ export declare const DeletePanelDialog: () => ReactElement;
2
3
  //# sourceMappingURL=DeletePanelDialog.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DeletePanelDialog.d.ts","sourceRoot":"","sources":["../../../src/components/DeletePanelDialog/DeletePanelDialog.tsx"],"names":[],"mappings":"AAiBA,eAAO,MAAM,iBAAiB,+CAS7B,CAAC"}
1
+ {"version":3,"file":"DeletePanelDialog.d.ts","sourceRoot":"","sources":["../../../src/components/DeletePanelDialog/DeletePanelDialog.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAa,YAAY,EAAE,MAAM,OAAO,CAAC;AAIhD,eAAO,MAAM,iBAAiB,QAAO,YASpC,CAAC"}
@@ -12,7 +12,7 @@
12
12
  // limitations under the License.
13
13
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
14
  import { Dialog } from '@perses-dev/components';
15
- import { useDeletePanelDialog } from '../../context';
15
+ import { useDeletePanelDialog, useViewPanel } from '../../context';
16
16
  export const DeletePanelDialog = ()=>{
17
17
  const { deletePanelDialog, closeDeletePanelDialog } = useDeletePanelDialog();
18
18
  return /*#__PURE__*/ _jsxs(Dialog, {
@@ -30,11 +30,13 @@ export const DeletePanelDialog = ()=>{
30
30
  };
31
31
  const DeletePanelForm = ({ deletePanelDialog })=>{
32
32
  const { deletePanel, closeDeletePanelDialog } = useDeletePanelDialog();
33
+ const { setViewPanel } = useViewPanel();
33
34
  const handleDelete = (e)=>{
34
35
  e.preventDefault();
35
36
  const { panelGroupItemId } = deletePanelDialog;
36
37
  deletePanel(panelGroupItemId);
37
38
  closeDeletePanelDialog();
39
+ setViewPanel(undefined);
38
40
  };
39
41
  return /*#__PURE__*/ _jsxs("form", {
40
42
  onSubmit: handleDelete,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/DeletePanelDialog/DeletePanelDialog.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 { FormEvent } from 'react';\nimport { Dialog } from '@perses-dev/components';\nimport { useDeletePanelDialog, DeletePanelDialogState } from '../../context';\n\nexport const DeletePanelDialog = () => {\n const { deletePanelDialog, closeDeletePanelDialog } = useDeletePanelDialog();\n\n return (\n <Dialog open={deletePanelDialog !== undefined}>\n <Dialog.Header onClose={() => closeDeletePanelDialog()}>Delete Panel</Dialog.Header>\n {deletePanelDialog && <DeletePanelForm deletePanelDialog={deletePanelDialog} />}\n </Dialog>\n );\n};\n\ninterface DeletePanelFormProps {\n deletePanelDialog: DeletePanelDialogState;\n}\n\nconst DeletePanelForm = ({ deletePanelDialog }: DeletePanelFormProps) => {\n const { deletePanel, closeDeletePanelDialog } = useDeletePanelDialog();\n\n const handleDelete = (e: FormEvent) => {\n e.preventDefault();\n const { panelGroupItemId } = deletePanelDialog;\n deletePanel(panelGroupItemId);\n closeDeletePanelDialog();\n };\n return (\n <form onSubmit={handleDelete}>\n <Dialog.Content>\n Are you sure you want to delete {deletePanelDialog.panelName} from {deletePanelDialog.panelGroupName}? This\n action cannot be undone.\n </Dialog.Content>\n <Dialog.Actions>\n <Dialog.PrimaryButton>Delete</Dialog.PrimaryButton>\n <Dialog.SecondaryButton onClick={() => closeDeletePanelDialog()}>Cancel</Dialog.SecondaryButton>\n </Dialog.Actions>\n </form>\n );\n};\n"],"names":["Dialog","useDeletePanelDialog","DeletePanelDialog","deletePanelDialog","closeDeletePanelDialog","open","undefined","Header","onClose","DeletePanelForm","deletePanel","handleDelete","e","preventDefault","panelGroupItemId","form","onSubmit","Content","panelName","panelGroupName","Actions","PrimaryButton","SecondaryButton","onClick"],"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,MAAM,QAAQ,yBAAyB;AAChD,SAASC,oBAAoB,QAAgC,gBAAgB;AAE7E,OAAO,MAAMC,oBAAoB;IAC/B,MAAM,EAAEC,iBAAiB,EAAEC,sBAAsB,EAAE,GAAGH;IAEtD,qBACE,MAACD;QAAOK,MAAMF,sBAAsBG;;0BAClC,KAACN,OAAOO,MAAM;gBAACC,SAAS,IAAMJ;0BAA0B;;YACvDD,mCAAqB,KAACM;gBAAgBN,mBAAmBA;;;;AAGhE,EAAE;AAMF,MAAMM,kBAAkB,CAAC,EAAEN,iBAAiB,EAAwB;IAClE,MAAM,EAAEO,WAAW,EAAEN,sBAAsB,EAAE,GAAGH;IAEhD,MAAMU,eAAe,CAACC;QACpBA,EAAEC,cAAc;QAChB,MAAM,EAAEC,gBAAgB,EAAE,GAAGX;QAC7BO,YAAYI;QACZV;IACF;IACA,qBACE,MAACW;QAAKC,UAAUL;;0BACd,MAACX,OAAOiB,OAAO;;oBAAC;oBACmBd,kBAAkBe,SAAS;oBAAC;oBAAOf,kBAAkBgB,cAAc;oBAAC;;;0BAGvG,MAACnB,OAAOoB,OAAO;;kCACb,KAACpB,OAAOqB,aAAa;kCAAC;;kCACtB,KAACrB,OAAOsB,eAAe;wBAACC,SAAS,IAAMnB;kCAA0B;;;;;;AAIzE"}
1
+ {"version":3,"sources":["../../../src/components/DeletePanelDialog/DeletePanelDialog.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 { FormEvent, ReactElement } from 'react';\nimport { Dialog } from '@perses-dev/components';\nimport { useDeletePanelDialog, DeletePanelDialogState, useViewPanel } from '../../context';\n\nexport const DeletePanelDialog = (): ReactElement => {\n const { deletePanelDialog, closeDeletePanelDialog } = useDeletePanelDialog();\n\n return (\n <Dialog open={deletePanelDialog !== undefined}>\n <Dialog.Header onClose={() => closeDeletePanelDialog()}>Delete Panel</Dialog.Header>\n {deletePanelDialog && <DeletePanelForm deletePanelDialog={deletePanelDialog} />}\n </Dialog>\n );\n};\n\ninterface DeletePanelFormProps {\n deletePanelDialog: DeletePanelDialogState;\n}\n\nconst DeletePanelForm = ({ deletePanelDialog }: DeletePanelFormProps): ReactElement => {\n const { deletePanel, closeDeletePanelDialog } = useDeletePanelDialog();\n const { setViewPanel } = useViewPanel();\n\n const handleDelete = (e: FormEvent): void => {\n e.preventDefault();\n const { panelGroupItemId } = deletePanelDialog;\n deletePanel(panelGroupItemId);\n closeDeletePanelDialog();\n setViewPanel(undefined);\n };\n\n return (\n <form onSubmit={handleDelete}>\n <Dialog.Content>\n Are you sure you want to delete {deletePanelDialog.panelName} from {deletePanelDialog.panelGroupName}? This\n action cannot be undone.\n </Dialog.Content>\n <Dialog.Actions>\n <Dialog.PrimaryButton>Delete</Dialog.PrimaryButton>\n <Dialog.SecondaryButton onClick={() => closeDeletePanelDialog()}>Cancel</Dialog.SecondaryButton>\n </Dialog.Actions>\n </form>\n );\n};\n"],"names":["Dialog","useDeletePanelDialog","useViewPanel","DeletePanelDialog","deletePanelDialog","closeDeletePanelDialog","open","undefined","Header","onClose","DeletePanelForm","deletePanel","setViewPanel","handleDelete","e","preventDefault","panelGroupItemId","form","onSubmit","Content","panelName","panelGroupName","Actions","PrimaryButton","SecondaryButton","onClick"],"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,MAAM,QAAQ,yBAAyB;AAChD,SAASC,oBAAoB,EAA0BC,YAAY,QAAQ,gBAAgB;AAE3F,OAAO,MAAMC,oBAAoB;IAC/B,MAAM,EAAEC,iBAAiB,EAAEC,sBAAsB,EAAE,GAAGJ;IAEtD,qBACE,MAACD;QAAOM,MAAMF,sBAAsBG;;0BAClC,KAACP,OAAOQ,MAAM;gBAACC,SAAS,IAAMJ;0BAA0B;;YACvDD,mCAAqB,KAACM;gBAAgBN,mBAAmBA;;;;AAGhE,EAAE;AAMF,MAAMM,kBAAkB,CAAC,EAAEN,iBAAiB,EAAwB;IAClE,MAAM,EAAEO,WAAW,EAAEN,sBAAsB,EAAE,GAAGJ;IAChD,MAAM,EAAEW,YAAY,EAAE,GAAGV;IAEzB,MAAMW,eAAe,CAACC;QACpBA,EAAEC,cAAc;QAChB,MAAM,EAAEC,gBAAgB,EAAE,GAAGZ;QAC7BO,YAAYK;QACZX;QACAO,aAAaL;IACf;IAEA,qBACE,MAACU;QAAKC,UAAUL;;0BACd,MAACb,OAAOmB,OAAO;;oBAAC;oBACmBf,kBAAkBgB,SAAS;oBAAC;oBAAOhB,kBAAkBiB,cAAc;oBAAC;;;0BAGvG,MAACrB,OAAOsB,OAAO;;kCACb,KAACtB,OAAOuB,aAAa;kCAAC;;kCACtB,KAACvB,OAAOwB,eAAe;wBAACC,SAAS,IAAMpB;kCAA0B;;;;;;AAIzE"}
@@ -1,2 +1,3 @@
1
- export declare const DeletePanelGroupDialog: () => import("react/jsx-runtime").JSX.Element;
1
+ import { ReactElement } from 'react';
2
+ export declare const DeletePanelGroupDialog: () => ReactElement;
2
3
  //# sourceMappingURL=DeletePanelGroupDialog.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DeletePanelGroupDialog.d.ts","sourceRoot":"","sources":["../../../src/components/DeletePanelGroupDialog/DeletePanelGroupDialog.tsx"],"names":[],"mappings":"AAkBA,eAAO,MAAM,sBAAsB,+CA4ClC,CAAC"}
1
+ {"version":3,"file":"DeletePanelGroupDialog.d.ts","sourceRoot":"","sources":["../../../src/components/DeletePanelGroupDialog/DeletePanelGroupDialog.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAa,YAAY,EAAE,MAAM,OAAO,CAAC;AAKhD,eAAO,MAAM,sBAAsB,QAAO,YA6CzC,CAAC"}
@@ -13,19 +13,20 @@
13
13
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
14
  import { IconButton, Dialog, DialogTitle, DialogContent, DialogActions, Button } from '@mui/material';
15
15
  import CloseIcon from 'mdi-material-ui/Close';
16
- import { useDeletePanelGroupDialog } from '../../context';
16
+ import { useDeletePanelGroupDialog, useViewPanel } from '../../context';
17
17
  export const DeletePanelGroupDialog = ()=>{
18
18
  const { deletePanelGroupDialog, closeDeletePanelGroupDialog, deletePanelGroup } = useDeletePanelGroupDialog();
19
- const panelGroupId = deletePanelGroupDialog === null || deletePanelGroupDialog === void 0 ? void 0 : deletePanelGroupDialog.panelGroupId;
19
+ const { setViewPanel } = useViewPanel();
20
+ const panelGroupId = deletePanelGroupDialog?.panelGroupId;
20
21
  const handleDelete = (e)=>{
21
22
  e.preventDefault();
22
- if (panelGroupId == undefined) {
23
+ if (panelGroupId === undefined) {
23
24
  throw new Error('group index is undefined');
24
25
  }
25
26
  deletePanelGroup(panelGroupId);
26
27
  closeDeletePanelGroupDialog();
28
+ setViewPanel(undefined);
27
29
  };
28
- var _deletePanelGroupDialog_panelGroupName;
29
30
  return /*#__PURE__*/ _jsxs(Dialog, {
30
31
  open: deletePanelGroupDialog !== undefined,
31
32
  children: [
@@ -52,7 +53,7 @@ export const DeletePanelGroupDialog = ()=>{
52
53
  },
53
54
  children: [
54
55
  "Are you sure you want to delete ",
55
- (_deletePanelGroupDialog_panelGroupName = deletePanelGroupDialog === null || deletePanelGroupDialog === void 0 ? void 0 : deletePanelGroupDialog.panelGroupName) !== null && _deletePanelGroupDialog_panelGroupName !== void 0 ? _deletePanelGroupDialog_panelGroupName : 'panel group',
56
+ deletePanelGroupDialog?.panelGroupName ?? 'panel group',
56
57
  "? This will delete all the panels within the group."
57
58
  ]
58
59
  }),
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/DeletePanelGroupDialog/DeletePanelGroupDialog.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 { FormEvent } from 'react';\nimport { IconButton, Dialog, DialogTitle, DialogContent, DialogActions, Button } from '@mui/material';\nimport CloseIcon from 'mdi-material-ui/Close';\nimport { useDeletePanelGroupDialog } from '../../context';\n\nexport const DeletePanelGroupDialog = () => {\n const { deletePanelGroupDialog, closeDeletePanelGroupDialog, deletePanelGroup } = useDeletePanelGroupDialog();\n\n const panelGroupId = deletePanelGroupDialog?.panelGroupId;\n\n const handleDelete = (e: FormEvent) => {\n e.preventDefault();\n if (panelGroupId == undefined) {\n throw new Error('group index is undefined');\n }\n deletePanelGroup(panelGroupId);\n closeDeletePanelGroupDialog();\n };\n\n return (\n <Dialog open={deletePanelGroupDialog !== undefined}>\n <DialogTitle>Delete Panel Group</DialogTitle>\n <IconButton\n aria-label=\"Close\"\n onClick={() => closeDeletePanelGroupDialog()}\n sx={(theme) => ({\n position: 'absolute',\n top: theme.spacing(0.5),\n right: theme.spacing(0.5),\n })}\n >\n <CloseIcon />\n </IconButton>\n <form onSubmit={handleDelete}>\n <DialogContent dividers sx={{ width: '500px' }}>\n Are you sure you want to delete {deletePanelGroupDialog?.panelGroupName ?? 'panel group'}? This will delete\n all the panels within the group.\n </DialogContent>\n <DialogActions>\n <Button variant=\"contained\" type=\"submit\">\n Delete\n </Button>\n <Button variant=\"outlined\" color=\"secondary\" onClick={() => closeDeletePanelGroupDialog()}>\n Cancel\n </Button>\n </DialogActions>\n </form>\n </Dialog>\n );\n};\n"],"names":["IconButton","Dialog","DialogTitle","DialogContent","DialogActions","Button","CloseIcon","useDeletePanelGroupDialog","DeletePanelGroupDialog","deletePanelGroupDialog","closeDeletePanelGroupDialog","deletePanelGroup","panelGroupId","handleDelete","e","preventDefault","undefined","Error","open","aria-label","onClick","sx","theme","position","top","spacing","right","form","onSubmit","dividers","width","panelGroupName","variant","type","color"],"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,UAAU,EAAEC,MAAM,EAAEC,WAAW,EAAEC,aAAa,EAAEC,aAAa,EAAEC,MAAM,QAAQ,gBAAgB;AACtG,OAAOC,eAAe,wBAAwB;AAC9C,SAASC,yBAAyB,QAAQ,gBAAgB;AAE1D,OAAO,MAAMC,yBAAyB;IACpC,MAAM,EAAEC,sBAAsB,EAAEC,2BAA2B,EAAEC,gBAAgB,EAAE,GAAGJ;IAElF,MAAMK,eAAeH,mCAAAA,6CAAAA,uBAAwBG,YAAY;IAEzD,MAAMC,eAAe,CAACC;QACpBA,EAAEC,cAAc;QAChB,IAAIH,gBAAgBI,WAAW;YAC7B,MAAM,IAAIC,MAAM;QAClB;QACAN,iBAAiBC;QACjBF;IACF;QAkByCD;IAhBzC,qBACE,MAACR;QAAOiB,MAAMT,2BAA2BO;;0BACvC,KAACd;0BAAY;;0BACb,KAACF;gBACCmB,cAAW;gBACXC,SAAS,IAAMV;gBACfW,IAAI,CAACC,QAAW,CAAA;wBACdC,UAAU;wBACVC,KAAKF,MAAMG,OAAO,CAAC;wBACnBC,OAAOJ,MAAMG,OAAO,CAAC;oBACvB,CAAA;0BAEA,cAAA,KAACnB;;0BAEH,MAACqB;gBAAKC,UAAUf;;kCACd,MAACV;wBAAc0B,QAAQ;wBAACR,IAAI;4BAAES,OAAO;wBAAQ;;4BAAG;4BACbrB,CAAAA,yCAAAA,mCAAAA,6CAAAA,uBAAwBsB,cAAc,cAAtCtB,oDAAAA,yCAA0C;4BAAc;;;kCAG3F,MAACL;;0CACC,KAACC;gCAAO2B,SAAQ;gCAAYC,MAAK;0CAAS;;0CAG1C,KAAC5B;gCAAO2B,SAAQ;gCAAWE,OAAM;gCAAYd,SAAS,IAAMV;0CAA+B;;;;;;;;AAOrG,EAAE"}
1
+ {"version":3,"sources":["../../../src/components/DeletePanelGroupDialog/DeletePanelGroupDialog.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 { FormEvent, ReactElement } from 'react';\nimport { IconButton, Dialog, DialogTitle, DialogContent, DialogActions, Button } from '@mui/material';\nimport CloseIcon from 'mdi-material-ui/Close';\nimport { useDeletePanelGroupDialog, useViewPanel } from '../../context';\n\nexport const DeletePanelGroupDialog = (): ReactElement => {\n const { deletePanelGroupDialog, closeDeletePanelGroupDialog, deletePanelGroup } = useDeletePanelGroupDialog();\n const { setViewPanel } = useViewPanel();\n const panelGroupId = deletePanelGroupDialog?.panelGroupId;\n\n const handleDelete = (e: FormEvent): void => {\n e.preventDefault();\n if (panelGroupId === undefined) {\n throw new Error('group index is undefined');\n }\n deletePanelGroup(panelGroupId);\n closeDeletePanelGroupDialog();\n setViewPanel(undefined);\n };\n\n return (\n <Dialog open={deletePanelGroupDialog !== undefined}>\n <DialogTitle>Delete Panel Group</DialogTitle>\n <IconButton\n aria-label=\"Close\"\n onClick={() => closeDeletePanelGroupDialog()}\n sx={(theme) => ({\n position: 'absolute',\n top: theme.spacing(0.5),\n right: theme.spacing(0.5),\n })}\n >\n <CloseIcon />\n </IconButton>\n <form onSubmit={handleDelete}>\n <DialogContent dividers sx={{ width: '500px' }}>\n Are you sure you want to delete {deletePanelGroupDialog?.panelGroupName ?? 'panel group'}? This will delete\n all the panels within the group.\n </DialogContent>\n <DialogActions>\n <Button variant=\"contained\" type=\"submit\">\n Delete\n </Button>\n <Button variant=\"outlined\" color=\"secondary\" onClick={() => closeDeletePanelGroupDialog()}>\n Cancel\n </Button>\n </DialogActions>\n </form>\n </Dialog>\n );\n};\n"],"names":["IconButton","Dialog","DialogTitle","DialogContent","DialogActions","Button","CloseIcon","useDeletePanelGroupDialog","useViewPanel","DeletePanelGroupDialog","deletePanelGroupDialog","closeDeletePanelGroupDialog","deletePanelGroup","setViewPanel","panelGroupId","handleDelete","e","preventDefault","undefined","Error","open","aria-label","onClick","sx","theme","position","top","spacing","right","form","onSubmit","dividers","width","panelGroupName","variant","type","color"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C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Dialog: () => import("react/jsx-runtime").JSX.Element | null;
1
+ import { ReactElement } from 'react';
2
+ export declare const DashboardDiscardChangesConfirmationDialog: () => ReactElement | null;
2
3
  //# sourceMappingURL=DiscardChangesConfirmationDialog.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DiscardChangesConfirmationDialog.d.ts","sourceRoot":"","sources":["../../../src/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.tsx"],"names":[],"mappings":"AAgBA,eAAO,MAAM,yCAAyC,sDAgBrD,CAAC"}
1
+ {"version":3,"file":"DiscardChangesConfirmationDialog.d.ts","sourceRoot":"","sources":["../../../src/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAGrC,eAAO,MAAM,yCAAyC,QAAO,YAAY,GAAG,IAgB3E,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.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 { DiscardChangesConfirmationDialog } from '@perses-dev/components';\nimport { useDiscardChangesConfirmationDialog } from '../../context';\n\nexport const DashboardDiscardChangesConfirmationDialog = () => {\n const { discardChangesConfirmationDialog: dialog } = useDiscardChangesConfirmationDialog();\n if (dialog === undefined) {\n return null;\n }\n return (\n <DiscardChangesConfirmationDialog\n description={\n dialog.description ||\n 'You have unsaved changes in this dashboard. Are you sure you want to discard these changes? Changes cannot be recovered.'\n }\n isOpen={true}\n onCancel={dialog.onCancel}\n onDiscardChanges={dialog.onDiscardChanges}\n />\n );\n};\n"],"names":["DiscardChangesConfirmationDialog","useDiscardChangesConfirmationDialog","DashboardDiscardChangesConfirmationDialog","discardChangesConfirmationDialog","dialog","undefined","description","isOpen","onCancel","onDiscardChanges"],"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,gCAAgC,QAAQ,yBAAyB;AAC1E,SAASC,mCAAmC,QAAQ,gBAAgB;AAEpE,OAAO,MAAMC,4CAA4C;IACvD,MAAM,EAAEC,kCAAkCC,MAAM,EAAE,GAAGH;IACrD,IAAIG,WAAWC,WAAW;QACxB,OAAO;IACT;IACA,qBACE,KAACL;QACCM,aACEF,OAAOE,WAAW,IAClB;QAEFC,QAAQ;QACRC,UAAUJ,OAAOI,QAAQ;QACzBC,kBAAkBL,OAAOK,gBAAgB;;AAG/C,EAAE"}
1
+ {"version":3,"sources":["../../../src/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.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 { DiscardChangesConfirmationDialog } from '@perses-dev/components';\nimport { ReactElement } from 'react';\nimport { useDiscardChangesConfirmationDialog } from '../../context';\n\nexport const DashboardDiscardChangesConfirmationDialog = (): ReactElement | null => {\n const { discardChangesConfirmationDialog: dialog } = useDiscardChangesConfirmationDialog();\n if (dialog === undefined) {\n return null;\n }\n return (\n <DiscardChangesConfirmationDialog\n description={\n dialog.description ||\n 'You have unsaved changes in this dashboard. Are you sure you want to discard these changes? Changes cannot be recovered.'\n }\n isOpen={true}\n onCancel={dialog.onCancel}\n onDiscardChanges={dialog.onDiscardChanges}\n />\n );\n};\n"],"names":["DiscardChangesConfirmationDialog","useDiscardChangesConfirmationDialog","DashboardDiscardChangesConfirmationDialog","discardChangesConfirmationDialog","dialog","undefined","description","isOpen","onCancel","onDiscardChanges"],"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,gCAAgC,QAAQ,yBAAyB;AAE1E,SAASC,mCAAmC,QAAQ,gBAAgB;AAEpE,OAAO,MAAMC,4CAA4C;IACvD,MAAM,EAAEC,kCAAkCC,MAAM,EAAE,GAAGH;IACrD,IAAIG,WAAWC,WAAW;QACxB,OAAO;IACT;IACA,qBACE,KAACL;QACCM,aACEF,OAAOE,WAAW,IAClB;QAEFC,QAAQ;QACRC,UAAUJ,OAAOI,QAAQ;QACzBC,kBAAkBL,OAAOK,gBAAgB;;AAG/C,EAAE"}
@@ -1,6 +1,3 @@
1
- interface DownloadButtonProps {
2
- heightPx?: number;
3
- }
4
- export declare function DownloadButton({ heightPx }: DownloadButtonProps): import("react/jsx-runtime").JSX.Element;
5
- export {};
1
+ import { ReactElement } from 'react';
2
+ export declare function DownloadButton(): ReactElement;
6
3
  //# sourceMappingURL=DownloadButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DownloadButton.d.ts","sourceRoot":"","sources":["../../../src/components/DownloadButton/DownloadButton.tsx"],"names":[],"mappings":"AAmBA,UAAU,mBAAmB;IAE3B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAGD,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE,mBAAmB,2CAiC/D"}
1
+ {"version":3,"file":"DownloadButton.d.ts","sourceRoot":"","sources":["../../../src/components/DownloadButton/DownloadButton.tsx"],"names":[],"mappings":"AAgBA,OAAc,EAAE,YAAY,EAAU,MAAM,OAAO,CAAC;AAKpD,wBAAgB,cAAc,IAAI,YAAY,CAgG7C"}
@@ -11,49 +11,114 @@
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
13
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
14
- import { useRef } from 'react';
14
+ import { ClickAwayListener, Menu, MenuItem, MenuList } from '@mui/material';
15
+ import { ToolbarIconButton } from '@perses-dev/components';
15
16
  import DownloadIcon from 'mdi-material-ui/DownloadOutline';
16
- import { InfoTooltip, ToolbarIconButton } from '@perses-dev/components';
17
- import { TOOLTIP_TEXT } from '../../constants';
17
+ import React, { useRef } from 'react';
18
+ import { stringify } from 'yaml';
18
19
  import { useDashboard } from '../../context';
19
20
  // Button that enables downloading the dashboard as a JSON file
20
- export function DownloadButton({ heightPx }) {
21
+ export function DownloadButton() {
21
22
  const { dashboard } = useDashboard();
22
23
  const hiddenLinkRef = useRef(null);
23
- const height = heightPx === undefined ? undefined : `${heightPx}px`;
24
- const onDownloadButtonClick = ()=>{
25
- if (!hiddenLinkRef || !hiddenLinkRef.current) return;
26
- // Create blob URL
27
- const hiddenLinkUrl = URL.createObjectURL(new Blob([
28
- JSON.stringify(dashboard)
29
- ], {
30
- type: 'application/json'
31
- }));
32
- // Simulate click
33
- hiddenLinkRef.current.href = hiddenLinkUrl;
34
- hiddenLinkRef.current.click();
35
- // Remove blob URL (for memory management)
36
- URL.revokeObjectURL(hiddenLinkUrl);
24
+ const [anchorEl, setAnchorEl] = React.useState(null);
25
+ const open = Boolean(anchorEl);
26
+ const handleClick = (event)=>{
27
+ setAnchorEl(event.currentTarget);
37
28
  };
29
+ const handleItemClick = (format, shape)=>()=>{
30
+ setAnchorEl(null);
31
+ let type, content = '';
32
+ switch(format){
33
+ case 'json':
34
+ type = 'application/json';
35
+ content = JSON.stringify(dashboard, null, 2);
36
+ break;
37
+ case 'yaml':
38
+ {
39
+ type = 'application/yaml';
40
+ if (shape === 'cr') {
41
+ const name = dashboard.metadata.name.toLowerCase().replace(/[^a-z0-9-]/g, '-');
42
+ content = stringify({
43
+ apiVersion: 'perses.dev/v1alpha1',
44
+ kind: 'PersesDashboard',
45
+ metadata: {
46
+ labels: {
47
+ 'app.kubernetes.io/name': 'perses-dashboard',
48
+ 'app.kubernetes.io/instance': name,
49
+ 'app.kubernetes.io/part-of': 'perses-operator'
50
+ },
51
+ name
52
+ },
53
+ namespace: dashboard.metadata.project,
54
+ spec: dashboard.spec
55
+ });
56
+ } else {
57
+ content = stringify(dashboard);
58
+ }
59
+ }
60
+ break;
61
+ }
62
+ if (!hiddenLinkRef || !hiddenLinkRef.current) return;
63
+ // Create blob URL
64
+ const hiddenLinkUrl = URL.createObjectURL(new Blob([
65
+ content
66
+ ], {
67
+ type
68
+ }));
69
+ // Simulate click
70
+ hiddenLinkRef.current.download = `${dashboard.metadata.name}${shape === 'cr' ? '-cr' : ''}.${format}`;
71
+ hiddenLinkRef.current.href = hiddenLinkUrl;
72
+ hiddenLinkRef.current.click();
73
+ // Remove blob URL (for memory management)
74
+ URL.revokeObjectURL(hiddenLinkUrl);
75
+ };
38
76
  return /*#__PURE__*/ _jsxs(_Fragment, {
39
77
  children: [
40
- /*#__PURE__*/ _jsx(InfoTooltip, {
41
- description: TOOLTIP_TEXT.downloadDashboard,
42
- children: /*#__PURE__*/ _jsx(ToolbarIconButton, {
43
- "aria-label": TOOLTIP_TEXT.downloadDashboard,
44
- onClick: onDownloadButtonClick,
45
- sx: {
46
- height
47
- },
48
- children: /*#__PURE__*/ _jsx(DownloadIcon, {})
78
+ /*#__PURE__*/ _jsx(ToolbarIconButton, {
79
+ id: "download-dashboard-button",
80
+ "aria-controls": open ? 'basic-menu' : undefined,
81
+ "aria-haspopup": "true",
82
+ "aria-expanded": open ? 'true' : undefined,
83
+ onClick: handleClick,
84
+ children: /*#__PURE__*/ _jsx(DownloadIcon, {})
85
+ }),
86
+ /*#__PURE__*/ _jsx(Menu, {
87
+ id: "download-dashboard-formats",
88
+ anchorEl: anchorEl,
89
+ open: open,
90
+ hideBackdrop: true,
91
+ onClose: ()=>setAnchorEl(null),
92
+ MenuListProps: {
93
+ 'aria-labelledby': 'download-dashboard-button'
94
+ },
95
+ children: /*#__PURE__*/ _jsx("div", {
96
+ children: /*#__PURE__*/ _jsx(ClickAwayListener, {
97
+ onClickAway: ()=>setAnchorEl(null),
98
+ children: /*#__PURE__*/ _jsxs(MenuList, {
99
+ children: [
100
+ /*#__PURE__*/ _jsx(MenuItem, {
101
+ onClick: handleItemClick('json'),
102
+ children: "JSON"
103
+ }),
104
+ /*#__PURE__*/ _jsx(MenuItem, {
105
+ onClick: handleItemClick('yaml'),
106
+ children: "YAML"
107
+ }),
108
+ /*#__PURE__*/ _jsx(MenuItem, {
109
+ onClick: handleItemClick('yaml', 'cr'),
110
+ children: "YAML (CR)"
111
+ })
112
+ ]
113
+ })
114
+ })
49
115
  })
50
116
  }),
51
117
  /*#__PURE__*/ _jsx("a", {
52
118
  ref: hiddenLinkRef,
53
119
  style: {
54
120
  display: 'none'
55
- },
56
- download: `${dashboard.metadata.name}.json`
121
+ }
57
122
  })
58
123
  ]
59
124
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/DownloadButton/DownloadButton.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 { useRef } from 'react';\nimport DownloadIcon from 'mdi-material-ui/DownloadOutline';\nimport { InfoTooltip, ToolbarIconButton } from '@perses-dev/components';\nimport { TOOLTIP_TEXT } from '../../constants';\nimport { useDashboard } from '../../context';\n\ninterface DownloadButtonProps {\n // The button look best at heights >= 28 pixels\n heightPx?: number;\n}\n\n// Button that enables downloading the dashboard as a JSON file\nexport function DownloadButton({ heightPx }: DownloadButtonProps) {\n const { dashboard } = useDashboard();\n const hiddenLinkRef = useRef<HTMLAnchorElement>(null);\n const height = heightPx === undefined ? undefined : `${heightPx}px`;\n\n const onDownloadButtonClick = () => {\n if (!hiddenLinkRef || !hiddenLinkRef.current) return;\n // Create blob URL\n const hiddenLinkUrl = URL.createObjectURL(\n new Blob([JSON.stringify(dashboard)], {\n type: 'application/json',\n })\n );\n // Simulate click\n hiddenLinkRef.current.href = hiddenLinkUrl;\n hiddenLinkRef.current.click();\n // Remove blob URL (for memory management)\n URL.revokeObjectURL(hiddenLinkUrl);\n };\n\n return (\n <>\n <InfoTooltip description={TOOLTIP_TEXT.downloadDashboard}>\n <ToolbarIconButton aria-label={TOOLTIP_TEXT.downloadDashboard} onClick={onDownloadButtonClick} sx={{ height }}>\n <DownloadIcon />\n </ToolbarIconButton>\n </InfoTooltip>\n {/* Hidden link to download the dashboard as a JSON file */}\n {/* eslint-disable jsx-a11y/anchor-has-content */}\n {/* eslint-disable jsx-a11y/anchor-is-valid */}\n <a ref={hiddenLinkRef} style={{ display: 'none' }} download={`${dashboard.metadata.name}.json`} />\n </>\n );\n}\n"],"names":["useRef","DownloadIcon","InfoTooltip","ToolbarIconButton","TOOLTIP_TEXT","useDashboard","DownloadButton","heightPx","dashboard","hiddenLinkRef","height","undefined","onDownloadButtonClick","current","hiddenLinkUrl","URL","createObjectURL","Blob","JSON","stringify","type","href","click","revokeObjectURL","description","downloadDashboard","aria-label","onClick","sx","a","ref","style","display","download","metadata","name"],"mappings":"AAAA,oCAAoC;AACpC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":3,"sources":["../../../src/components/DownloadButton/DownloadButton.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 { ClickAwayListener, Menu, MenuItem, MenuList } from '@mui/material';\nimport { ToolbarIconButton } from '@perses-dev/components';\nimport DownloadIcon from 'mdi-material-ui/DownloadOutline';\nimport React, { ReactElement, useRef } from 'react';\nimport { stringify } from 'yaml';\nimport { useDashboard } from '../../context';\n\n// Button that enables downloading the dashboard as a JSON file\nexport function DownloadButton(): ReactElement {\n const { dashboard } = useDashboard();\n const hiddenLinkRef = useRef<HTMLAnchorElement>(null);\n const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null);\n const open = Boolean(anchorEl);\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>): void => {\n setAnchorEl(event.currentTarget);\n };\n const handleItemClick = (format: 'json' | 'yaml', shape?: 'cr') => (): void => {\n setAnchorEl(null);\n\n let type,\n content = '';\n\n switch (format) {\n case 'json':\n type = 'application/json';\n content = JSON.stringify(dashboard, null, 2);\n break;\n case 'yaml':\n {\n type = 'application/yaml';\n\n if (shape === 'cr') {\n const name = dashboard.metadata.name.toLowerCase().replace(/[^a-z0-9-]/g, '-');\n content = stringify({\n apiVersion: 'perses.dev/v1alpha1',\n kind: 'PersesDashboard',\n metadata: {\n labels: {\n 'app.kubernetes.io/name': 'perses-dashboard',\n 'app.kubernetes.io/instance': name,\n 'app.kubernetes.io/part-of': 'perses-operator',\n },\n name,\n },\n namespace: dashboard.metadata.project,\n spec: dashboard.spec,\n });\n } else {\n content = stringify(dashboard);\n }\n }\n break;\n }\n\n if (!hiddenLinkRef || !hiddenLinkRef.current) return;\n // Create blob URL\n const hiddenLinkUrl = URL.createObjectURL(new Blob([content], { type }));\n // Simulate click\n hiddenLinkRef.current.download = `${dashboard.metadata.name}${shape === 'cr' ? '-cr' : ''}.${format}`;\n hiddenLinkRef.current.href = hiddenLinkUrl;\n hiddenLinkRef.current.click();\n // Remove blob URL (for memory management)\n URL.revokeObjectURL(hiddenLinkUrl);\n };\n\n return (\n <>\n <ToolbarIconButton\n id=\"download-dashboard-button\"\n aria-controls={open ? 'basic-menu' : undefined}\n aria-haspopup=\"true\"\n aria-expanded={open ? 'true' : undefined}\n onClick={handleClick}\n >\n <DownloadIcon />\n </ToolbarIconButton>\n\n <Menu\n id=\"download-dashboard-formats\"\n anchorEl={anchorEl}\n open={open}\n hideBackdrop={true}\n onClose={() => setAnchorEl(null)}\n MenuListProps={{\n 'aria-labelledby': 'download-dashboard-button',\n }}\n >\n <div>\n <ClickAwayListener onClickAway={() => setAnchorEl(null)}>\n <MenuList>\n <MenuItem onClick={handleItemClick('json')}>JSON</MenuItem>\n <MenuItem onClick={handleItemClick('yaml')}>YAML</MenuItem>\n <MenuItem onClick={handleItemClick('yaml', 'cr')}>YAML (CR)</MenuItem>\n </MenuList>\n </ClickAwayListener>\n </div>\n </Menu>\n\n {/* Hidden link to download the dashboard as a JSON or YAML file */}\n {/* eslint-disable jsx-a11y/anchor-has-content */}\n {/* eslint-disable jsx-a11y/anchor-is-valid */}\n <a ref={hiddenLinkRef} style={{ display: 'none' }} />\n </>\n );\n}\n"],"names":["ClickAwayListener","Menu","MenuItem","MenuList","ToolbarIconButton","DownloadIcon","React","useRef","stringify","useDashboard","DownloadButton","dashboard","hiddenLinkRef","anchorEl","setAnchorEl","useState","open","Boolean","handleClick","event","currentTarget","handleItemClick","format","shape","type","content","JSON","name","metadata","toLowerCase","replace","apiVersion","kind","labels","namespace","project","spec","current","hiddenLinkUrl","URL","createObjectURL","Blob","download","href","click","revokeObjectURL","id","aria-controls","undefined","aria-haspopup","aria-expanded","onClick","hideBackdrop","onClose","MenuListProps","div","onClickAway","a","ref","style","display"],"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,iBAAiB,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,QAAQ,QAAQ,gBAAgB;AAC5E,SAASC,iBAAiB,QAAQ,yBAAyB;AAC3D,OAAOC,kBAAkB,kCAAkC;AAC3D,OAAOC,SAAuBC,MAAM,QAAQ,QAAQ;AACpD,SAASC,SAAS,QAAQ,OAAO;AACjC,SAASC,YAAY,QAAQ,gBAAgB;AAE7C,+DAA+D;AAC/D,OAAO,SAASC;IACd,MAAM,EAAEC,SAAS,EAAE,GAAGF;IACtB,MAAMG,gBAAgBL,OAA0B;IAChD,MAAM,CAACM,UAAUC,YAAY,GAAGR,MAAMS,QAAQ,CAAqB;IACnE,MAAMC,OAAOC,QAAQJ;IACrB,MAAMK,cAAc,CAACC;QACnBL,YAAYK,MAAMC,aAAa;IACjC;IACA,MAAMC,kBAAkB,CAACC,QAAyBC,QAAiB;YACjET,YAAY;YAEZ,IAAIU,MACFC,UAAU;YAEZ,OAAQH;gBACN,KAAK;oBACHE,OAAO;oBACPC,UAAUC,KAAKlB,SAAS,CAACG,WAAW,MAAM;oBAC1C;gBACF,KAAK;oBACH;wBACEa,OAAO;wBAEP,IAAID,UAAU,MAAM;4BAClB,MAAMI,OAAOhB,UAAUiB,QAAQ,CAACD,IAAI,CAACE,WAAW,GAAGC,OAAO,CAAC,eAAe;4BAC1EL,UAAUjB,UAAU;gCAClBuB,YAAY;gCACZC,MAAM;gCACNJ,UAAU;oCACRK,QAAQ;wCACN,0BAA0B;wCAC1B,8BAA8BN;wCAC9B,6BAA6B;oCAC/B;oCACAA;gCACF;gCACAO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2
  export interface EditButtonProps {
2
3
  /**
3
4
  * The label used inside the button.
@@ -8,5 +9,5 @@ export interface EditButtonProps {
8
9
  */
9
10
  onClick: () => void;
10
11
  }
11
- export declare const EditButton: ({ label, onClick }: EditButtonProps) => import("react/jsx-runtime").JSX.Element;
12
+ export declare const EditButton: ({ label, onClick }: EditButtonProps) => ReactElement;
12
13
  //# sourceMappingURL=EditButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EditButton.d.ts","sourceRoot":"","sources":["../../../src/components/EditButton/EditButton.tsx"],"names":[],"mappings":"AAgBA,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,eAAO,MAAM,UAAU,uBAAiC,eAAe,4CAYtE,CAAC"}
1
+ {"version":3,"file":"EditButton.d.ts","sourceRoot":"","sources":["../../../src/components/EditButton/EditButton.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAErC,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,eAAO,MAAM,UAAU,uBAAiC,eAAe,KAAG,YAYzE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/EditButton/EditButton.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Button } from '@mui/material';\nimport PencilIcon from 'mdi-material-ui/PencilOutline';\n\nexport interface EditButtonProps {\n /**\n * The label used inside the button.\n */\n label?: string;\n\n /**\n * Handler that puts the dashboard into editing mode.\n */\n onClick: () => void;\n}\n\nexport const EditButton = ({ label = 'Edit', onClick }: EditButtonProps) => {\n return (\n <Button\n onClick={onClick}\n startIcon={<PencilIcon />}\n variant=\"outlined\"\n color=\"secondary\"\n sx={{ whiteSpace: 'nowrap', minWidth: 'auto' }}\n >\n {label}\n </Button>\n );\n};\n"],"names":["Button","PencilIcon","EditButton","label","onClick","startIcon","variant","color","sx","whiteSpace","minWidth"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,MAAM,QAAQ,gBAAgB;AACvC,OAAOC,gBAAgB,gCAAgC;AAcvD,OAAO,MAAMC,aAAa,CAAC,EAAEC,QAAQ,MAAM,EAAEC,OAAO,EAAmB;IACrE,qBACE,KAACJ;QACCI,SAASA;QACTC,yBAAW,KAACJ;QACZK,SAAQ;QACRC,OAAM;QACNC,IAAI;YAAEC,YAAY;YAAUC,UAAU;QAAO;kBAE5CP;;AAGP,EAAE"}
1
+ {"version":3,"sources":["../../../src/components/EditButton/EditButton.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Button } from '@mui/material';\nimport PencilIcon from 'mdi-material-ui/PencilOutline';\nimport { ReactElement } from 'react';\n\nexport interface EditButtonProps {\n /**\n * The label used inside the button.\n */\n label?: string;\n\n /**\n * Handler that puts the dashboard into editing mode.\n */\n onClick: () => void;\n}\n\nexport const EditButton = ({ label = 'Edit', onClick }: EditButtonProps): ReactElement => {\n return (\n <Button\n onClick={onClick}\n startIcon={<PencilIcon />}\n variant=\"outlined\"\n color=\"secondary\"\n sx={{ whiteSpace: 'nowrap', minWidth: 'auto' }}\n >\n {label}\n </Button>\n );\n};\n"],"names":["Button","PencilIcon","EditButton","label","onClick","startIcon","variant","color","sx","whiteSpace","minWidth"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,MAAM,QAAQ,gBAAgB;AACvC,OAAOC,gBAAgB,gCAAgC;AAevD,OAAO,MAAMC,aAAa,CAAC,EAAEC,QAAQ,MAAM,EAAEC,OAAO,EAAmB;IACrE,qBACE,KAACJ;QACCI,SAASA;QACTC,yBAAW,KAACJ;QACZK,SAAQ;QACRC,OAAM;QACNC,IAAI;YAAEC,YAAY;YAAUC,UAAU;QAAO;kBAE5CP;;AAGP,EAAE"}
@@ -1,5 +1,6 @@
1
+ import { ReactElement } from 'react';
1
2
  export interface EditJsonButtonProps {
2
3
  isReadonly: boolean;
3
4
  }
4
- export declare const EditJsonButton: (props: EditJsonButtonProps) => import("react/jsx-runtime").JSX.Element;
5
+ export declare const EditJsonButton: (props: EditJsonButtonProps) => ReactElement;
5
6
  //# sourceMappingURL=EditJsonButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EditJsonButton.d.ts","sourceRoot":"","sources":["../../../src/components/EditJsonButton/EditJsonButton.tsx"],"names":[],"mappings":"AAkBA,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,cAAc,UAAW,mBAAmB,4CAaxD,CAAC"}
1
+ {"version":3,"file":"EditJsonButton.d.ts","sourceRoot":"","sources":["../../../src/components/EditJsonButton/EditJsonButton.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAIrC,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,cAAc,UAAW,mBAAmB,KAAG,YAa3D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/EditJsonButton/EditJsonButton.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 CodeIcon from 'mdi-material-ui/CodeBraces';\nimport { InfoTooltip, ToolbarIconButton } from '@perses-dev/components';\nimport { TOOLTIP_TEXT } from '../../constants';\nimport { useEditJsonDialog } from '../../context';\n\nexport interface EditJsonButtonProps {\n isReadonly: boolean;\n}\n\nexport const EditJsonButton = (props: EditJsonButtonProps) => {\n const { isReadonly } = props;\n const { openEditJsonDialog } = useEditJsonDialog();\n\n const info = isReadonly ? TOOLTIP_TEXT.viewJson : TOOLTIP_TEXT.editJson;\n\n return (\n <InfoTooltip description={info}>\n <ToolbarIconButton aria-label={info} variant=\"outlined\" onClick={() => openEditJsonDialog()}>\n <CodeIcon />\n </ToolbarIconButton>\n </InfoTooltip>\n );\n};\n"],"names":["CodeIcon","InfoTooltip","ToolbarIconButton","TOOLTIP_TEXT","useEditJsonDialog","EditJsonButton","props","isReadonly","openEditJsonDialog","info","viewJson","editJson","description","aria-label","variant","onClick"],"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,OAAOA,cAAc,6BAA6B;AAClD,SAASC,WAAW,EAAEC,iBAAiB,QAAQ,yBAAyB;AACxE,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SAASC,iBAAiB,QAAQ,gBAAgB;AAMlD,OAAO,MAAMC,iBAAiB,CAACC;IAC7B,MAAM,EAAEC,UAAU,EAAE,GAAGD;IACvB,MAAM,EAAEE,kBAAkB,EAAE,GAAGJ;IAE/B,MAAMK,OAAOF,aAAaJ,aAAaO,QAAQ,GAAGP,aAAaQ,QAAQ;IAEvE,qBACE,KAACV;QAAYW,aAAaH;kBACxB,cAAA,KAACP;YAAkBW,cAAYJ;YAAMK,SAAQ;YAAWC,SAAS,IAAMP;sBACrE,cAAA,KAACR;;;AAIT,EAAE"}
1
+ {"version":3,"sources":["../../../src/components/EditJsonButton/EditJsonButton.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 CodeIcon from 'mdi-material-ui/CodeBraces';\nimport { InfoTooltip, ToolbarIconButton } from '@perses-dev/components';\nimport { ReactElement } from 'react';\nimport { TOOLTIP_TEXT } from '../../constants';\nimport { useEditJsonDialog } from '../../context';\n\nexport interface EditJsonButtonProps {\n isReadonly: boolean;\n}\n\nexport const EditJsonButton = (props: EditJsonButtonProps): ReactElement => {\n const { isReadonly } = props;\n const { openEditJsonDialog } = useEditJsonDialog();\n\n const info = isReadonly ? TOOLTIP_TEXT.viewJson : TOOLTIP_TEXT.editJson;\n\n return (\n <InfoTooltip description={info}>\n <ToolbarIconButton aria-label={info} variant=\"outlined\" onClick={() => openEditJsonDialog()}>\n <CodeIcon />\n </ToolbarIconButton>\n </InfoTooltip>\n );\n};\n"],"names":["CodeIcon","InfoTooltip","ToolbarIconButton","TOOLTIP_TEXT","useEditJsonDialog","EditJsonButton","props","isReadonly","openEditJsonDialog","info","viewJson","editJson","description","aria-label","variant","onClick"],"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,OAAOA,cAAc,6BAA6B;AAClD,SAASC,WAAW,EAAEC,iBAAiB,QAAQ,yBAAyB;AAExE,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SAASC,iBAAiB,QAAQ,gBAAgB;AAMlD,OAAO,MAAMC,iBAAiB,CAACC;IAC7B,MAAM,EAAEC,UAAU,EAAE,GAAGD;IACvB,MAAM,EAAEE,kBAAkB,EAAE,GAAGJ;IAE/B,MAAMK,OAAOF,aAAaJ,aAAaO,QAAQ,GAAGP,aAAaQ,QAAQ;IAEvE,qBACE,KAACV;QAAYW,aAAaH;kBACxB,cAAA,KAACP;YAAkBW,cAAYJ;YAAMK,SAAQ;YAAWC,SAAS,IAAMP;sBACrE,cAAA,KAACR;;;AAIT,EAAE"}
@@ -1,6 +1,7 @@
1
+ import { ReactElement } from 'react';
1
2
  export interface EditJsonDialogProps {
2
3
  isReadonly: boolean;
3
4
  disableMetadataEdition?: boolean;
4
5
  }
5
- export declare const EditJsonDialog: (props: EditJsonDialogProps) => import("react/jsx-runtime").JSX.Element;
6
+ export declare const EditJsonDialog: (props: EditJsonDialogProps) => ReactElement;
6
7
  //# sourceMappingURL=EditJsonDialog.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EditJsonDialog.d.ts","sourceRoot":"","sources":["../../../src/components/EditJsonDialog/EditJsonDialog.tsx"],"names":[],"mappings":"AAoBA,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,OAAO,CAAC;IACpB,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC;AAED,eAAO,MAAM,cAAc,UAAW,mBAAmB,4CAYxD,CAAC"}
1
+ {"version":3,"file":"EditJsonDialog.d.ts","sourceRoot":"","sources":["../../../src/components/EditJsonDialog/EditJsonDialog.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAa,YAAY,EAAY,MAAM,OAAO,CAAC;AAM1D,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,OAAO,CAAC;IACpB,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC;AAED,eAAO,MAAM,cAAc,UAAW,mBAAmB,KAAG,YAY3D,CAAC"}
@@ -15,13 +15,12 @@ import { useState } from 'react';
15
15
  import { Alert, FormControl } from '@mui/material';
16
16
  import { Dialog, JSONEditor } from '@perses-dev/components';
17
17
  import { useDatasourceStore, useTimeRange } from '@perses-dev/plugin-system';
18
- import { useEditJsonDialog } from '../../context/DashboardProvider';
19
- import { useDashboard } from '../../context/useDashboard';
18
+ import { useEditJsonDialog, useDashboard } from '../../context';
20
19
  export const EditJsonDialog = (props)=>{
21
20
  const { isReadonly, disableMetadataEdition } = props;
22
21
  const { editJsonDialog, closeEditJsonDialog } = useEditJsonDialog();
23
22
  return /*#__PURE__*/ _jsxs(Dialog, {
24
- open: !!(editJsonDialog === null || editJsonDialog === void 0 ? void 0 : editJsonDialog.isOpen),
23
+ open: !!editJsonDialog?.isOpen,
25
24
  scroll: "paper",
26
25
  fullWidth: true,
27
26
  maxWidth: "lg",
@@ -33,7 +32,7 @@ export const EditJsonDialog = (props)=>{
33
32
  " Dashboard JSON"
34
33
  ]
35
34
  }),
36
- (editJsonDialog === null || editJsonDialog === void 0 ? void 0 : editJsonDialog.isOpen) && /*#__PURE__*/ _jsx(EditJsonDialogForm, {
35
+ editJsonDialog?.isOpen && /*#__PURE__*/ _jsx(EditJsonDialogForm, {
37
36
  isReadonly: isReadonly,
38
37
  disableMetadataEdition: disableMetadataEdition
39
38
  })
@@ -53,17 +52,15 @@ const EditJsonDialogForm = (props)=>{
53
52
  setTimeRange({
54
53
  pastDuration: draftDashboard.spec.duration
55
54
  });
56
- var _draftDashboard_spec_refreshInterval;
57
- setRefreshInterval((_draftDashboard_spec_refreshInterval = draftDashboard.spec.refreshInterval) !== null && _draftDashboard_spec_refreshInterval !== void 0 ? _draftDashboard_spec_refreshInterval : '0s');
58
- var _draftDashboard_spec_datasources;
59
- setLocalDatasources((_draftDashboard_spec_datasources = draftDashboard.spec.datasources) !== null && _draftDashboard_spec_datasources !== void 0 ? _draftDashboard_spec_datasources : {});
55
+ setRefreshInterval(draftDashboard.spec.refreshInterval ?? '0s');
56
+ setLocalDatasources(draftDashboard.spec.datasources ?? {});
60
57
  closeEditJsonDialog();
61
58
  };
62
59
  const completeDraftDashboard = (dashboard)=>{
63
60
  try {
64
- const json = JSON.parse(dashboard !== null && dashboard !== void 0 ? dashboard : '{}');
61
+ const json = JSON.parse(dashboard ?? '{}');
65
62
  setDraftDashboard(json);
66
- } catch (e) {
63
+ } catch (_) {
67
64
  // do nothing
68
65
  }
69
66
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/EditJsonDialog/EditJsonDialog.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 { FormEvent, useState } from 'react';\nimport { Alert, FormControl } from '@mui/material';\nimport { Dialog, JSONEditor } from '@perses-dev/components';\nimport { useDatasourceStore, useTimeRange } from '@perses-dev/plugin-system';\nimport { useEditJsonDialog } from '../../context/DashboardProvider';\nimport { useDashboard } from '../../context/useDashboard';\n\nexport interface EditJsonDialogProps {\n isReadonly: boolean;\n disableMetadataEdition?: boolean;\n}\n\nexport const EditJsonDialog = (props: EditJsonDialogProps) => {\n const { isReadonly, disableMetadataEdition } = props;\n const { editJsonDialog, closeEditJsonDialog } = useEditJsonDialog();\n\n return (\n <Dialog open={!!editJsonDialog?.isOpen} scroll=\"paper\" fullWidth maxWidth=\"lg\">\n <Dialog.Header onClose={() => closeEditJsonDialog()}>{!isReadonly && 'Edit '} Dashboard JSON</Dialog.Header>\n {editJsonDialog?.isOpen && (\n <EditJsonDialogForm isReadonly={isReadonly} disableMetadataEdition={disableMetadataEdition} />\n )}\n </Dialog>\n );\n};\n\nconst EditJsonDialogForm = (props: EditJsonDialogProps) => {\n const { isReadonly, disableMetadataEdition } = props;\n const { closeEditJsonDialog } = useEditJsonDialog();\n const { setTimeRange, setRefreshInterval } = useTimeRange();\n const { dashboard, setDashboard } = useDashboard();\n const { setLocalDatasources } = useDatasourceStore();\n const [draftDashboard, setDraftDashboard] = useState(dashboard);\n\n const handleApply = (e: FormEvent) => {\n e.preventDefault();\n setDashboard(draftDashboard);\n setTimeRange({ pastDuration: draftDashboard.spec.duration });\n setRefreshInterval(draftDashboard.spec.refreshInterval ?? '0s');\n setLocalDatasources(draftDashboard.spec.datasources ?? {});\n closeEditJsonDialog();\n };\n\n const completeDraftDashboard = (dashboard: string | undefined) => {\n try {\n const json = JSON.parse(dashboard ?? '{}');\n setDraftDashboard(json);\n } catch (e) {\n // do nothing\n }\n };\n\n return (\n <Dialog.Form onSubmit={handleApply}>\n <Dialog.Content sx={{ width: '100%' }}>\n {disableMetadataEdition && !isReadonly && (\n <Alert sx={{ marginBottom: (theme) => theme.spacing(1) }} severity=\"warning\">\n Metadata cannot be modified or saved.\n </Alert>\n )}\n {draftDashboard.kind === 'EphemeralDashboard' && (\n <Alert sx={{ marginBottom: 1 }} severity=\"warning\">\n Time-to-live cannot be modified or saved from here. Go to the project view to modify it.\n </Alert>\n )}\n <FormControl fullWidth>\n <JSONEditor\n minHeight=\"300px\"\n maxHeight=\"70vh\"\n value={draftDashboard}\n onChange={(value: string) => completeDraftDashboard(value)}\n readOnly={isReadonly}\n />\n </FormControl>\n </Dialog.Content>\n {!isReadonly && (\n <Dialog.Actions>\n <Dialog.PrimaryButton onClick={handleApply}>Apply</Dialog.PrimaryButton>\n </Dialog.Actions>\n )}\n </Dialog.Form>\n );\n};\n"],"names":["useState","Alert","FormControl","Dialog","JSONEditor","useDatasourceStore","useTimeRange","useEditJsonDialog","useDashboard","EditJsonDialog","props","isReadonly","disableMetadataEdition","editJsonDialog","closeEditJsonDialog","open","isOpen","scroll","fullWidth","maxWidth","Header","onClose","EditJsonDialogForm","setTimeRange","setRefreshInterval","dashboard","setDashboard","setLocalDatasources","draftDashboard","setDraftDashboard","handleApply","e","preventDefault","pastDuration","spec","duration","refreshInterval","datasources","completeDraftDashboard","json","JSON","parse","Form","onSubmit","Content","sx","width","marginBottom","theme","spacing","severity","kind","minHeight","maxHeight","value","onChange","readOnly","Actions","PrimaryButton","onClick"],"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,SAAoBA,QAAQ,QAAQ,QAAQ;AAC5C,SAASC,KAAK,EAAEC,WAAW,QAAQ,gBAAgB;AACnD,SAASC,MAAM,EAAEC,UAAU,QAAQ,yBAAyB;AAC5D,SAASC,kBAAkB,EAAEC,YAAY,QAAQ,4BAA4B;AAC7E,SAASC,iBAAiB,QAAQ,kCA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BAAAA,uBAAAA,YAAa;YACrCI,kBAAkBU;QACpB,EAAE,OAAOR,GAAG;QACV,aAAa;QACf;IACF;IAEA,qBACE,MAAC5B,OAAOuC,IAAI;QAACC,UAAUb;;0BACrB,MAAC3B,OAAOyC,OAAO;gBAACC,IAAI;oBAAEC,OAAO;gBAAO;;oBACjClC,0BAA0B,CAACD,4BAC1B,KAACV;wBAAM4C,IAAI;4BAAEE,cAAc,CAACC,QAAUA,MAAMC,OAAO,CAAC;wBAAG;wBAAGC,UAAS;kCAAU;;oBAI9EtB,eAAeuB,IAAI,KAAK,sCACvB,KAAClD;wBAAM4C,IAAI;4BAAEE,cAAc;wBAAE;wBAAGG,UAAS;kCAAU;;kCAIrD,KAAChD;wBAAYgB,SAAS;kCACpB,cAAA,KAACd;4BACCgD,WAAU;4BACVC,WAAU;4BACVC,OAAO1B;4BACP2B,UAAU,CAACD,QAAkBhB,uBAAuBgB;4BACpDE,UAAU7C;;;;;YAIf,CAACA,4BACA,KAACR,OAAOsD,OAAO;0BACb,cAAA,KAACtD,OAAOuD,aAAa;oBAACC,SAAS7B;8BAAa;;;;;AAKtD"}
1
+ {"version":3,"sources":["../../../src/components/EditJsonDialog/EditJsonDialog.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 { FormEvent, ReactElement, useState } from 'react';\nimport { Alert, FormControl } from '@mui/material';\nimport { Dialog, JSONEditor } from '@perses-dev/components';\nimport { useDatasourceStore, useTimeRange } from '@perses-dev/plugin-system';\nimport { useEditJsonDialog, useDashboard } from '../../context';\n\nexport interface EditJsonDialogProps {\n isReadonly: boolean;\n disableMetadataEdition?: boolean;\n}\n\nexport const EditJsonDialog = (props: EditJsonDialogProps): ReactElement => {\n const { isReadonly, disableMetadataEdition } = props;\n const { editJsonDialog, closeEditJsonDialog } = useEditJsonDialog();\n\n return (\n <Dialog open={!!editJsonDialog?.isOpen} scroll=\"paper\" fullWidth maxWidth=\"lg\">\n <Dialog.Header onClose={() => closeEditJsonDialog()}>{!isReadonly && 'Edit '} Dashboard JSON</Dialog.Header>\n {editJsonDialog?.isOpen && (\n <EditJsonDialogForm isReadonly={isReadonly} disableMetadataEdition={disableMetadataEdition} />\n )}\n </Dialog>\n );\n};\n\nconst EditJsonDialogForm = (props: EditJsonDialogProps): ReactElement => {\n const { isReadonly, disableMetadataEdition } = props;\n const { closeEditJsonDialog } = useEditJsonDialog();\n const { setTimeRange, setRefreshInterval } = useTimeRange();\n const { dashboard, setDashboard } = useDashboard();\n const { setLocalDatasources } = useDatasourceStore();\n const [draftDashboard, setDraftDashboard] = useState(dashboard);\n\n const handleApply = (e: FormEvent): void => {\n e.preventDefault();\n setDashboard(draftDashboard);\n setTimeRange({ pastDuration: draftDashboard.spec.duration });\n setRefreshInterval(draftDashboard.spec.refreshInterval ?? '0s');\n setLocalDatasources(draftDashboard.spec.datasources ?? {});\n closeEditJsonDialog();\n };\n\n const completeDraftDashboard = (dashboard: string | undefined): void => {\n try {\n const json = JSON.parse(dashboard ?? '{}');\n setDraftDashboard(json);\n } catch (_) {\n // do nothing\n }\n };\n\n return (\n <Dialog.Form onSubmit={handleApply}>\n <Dialog.Content sx={{ width: '100%' }}>\n {disableMetadataEdition && !isReadonly && (\n <Alert sx={{ marginBottom: (theme) => theme.spacing(1) }} severity=\"warning\">\n Metadata cannot be modified or saved.\n </Alert>\n )}\n {draftDashboard.kind === 'EphemeralDashboard' && (\n <Alert sx={{ marginBottom: 1 }} severity=\"warning\">\n Time-to-live cannot be modified or saved from here. Go to the project view to modify it.\n </Alert>\n )}\n <FormControl fullWidth>\n <JSONEditor\n minHeight=\"300px\"\n maxHeight=\"70vh\"\n value={draftDashboard}\n onChange={(value: string) => completeDraftDashboard(value)}\n readOnly={isReadonly}\n />\n </FormControl>\n </Dialog.Content>\n {!isReadonly && (\n <Dialog.Actions>\n <Dialog.PrimaryButton onClick={handleApply}>Apply</Dialog.PrimaryButton>\n </Dialog.Actions>\n )}\n </Dialog.Form>\n );\n};\n"],"names":["useState","Alert","FormControl","Dialog","JSONEditor","useDatasourceStore","useTimeRange","useEditJsonDialog","useDashboard","EditJsonDialog","props","isReadonly","disableMetadataEdition","editJsonDialog","closeEditJsonDialog","open","isOpen","scroll","fullWidth","maxWidth","Header","onClose","EditJsonDialogForm","setTimeRange","setRefreshInterval","dashboard","setDashboard","setLocalDatasources","draftDashboard","setDraftDashboard","handleApply","e","preventDefault","pastDuration","spec","duration","refreshInterval","datasources","completeDraftDashboard","json","JSON","parse","_","Form","onSubmit","Content","sx","width","marginBottom","theme","spacing","severity","kind","minHeight","maxHeight","value","onChange","readOnly","Actions","PrimaryButton","onClick"],"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,SAAkCA,QAAQ,QAAQ,QAAQ;AAC1D,SAASC,KAAK,EAAEC,WAAW,QAAQ,gBAAgB;AACnD,SAASC,MAAM,EAAEC,UAAU,QAAQ,yBAAyB;AAC5D,SAASC,kBAAkB,EAAEC,YAAY,QAAQ,4BAA4B;AAC7E,SAASC,iBAAiB,EAAEC,YAAY,QAAQ,gBAAgB;AAOhE,OAAO,MAAMC,iBAAiB,CAACC;IAC7B,MAAM,EAAEC,UAAU,EAAEC,sBAAsB,EAAE,GAAGF;IAC/C,MAAM,EAAEG,cAAc,EAAEC,mBAAmB,EAAE,GAAGP;IAEhD,qBACE,MAACJ;QAAOY,MAAM,C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nD;wBAAM6C,IAAI;4BAAEE,cAAc;wBAAE;wBAAGG,UAAS;kCAAU;;kCAIrD,KAACjD;wBAAYgB,SAAS;kCACpB,cAAA,KAACd;4BACCiD,WAAU;4BACVC,WAAU;4BACVC,OAAO3B;4BACP4B,UAAU,CAACD,QAAkBjB,uBAAuBiB;4BACpDE,UAAU9C;;;;;YAIf,CAACA,4BACA,KAACR,OAAOuD,OAAO;0BACb,cAAA,KAACvD,OAAOwD,aAAa;oBAACC,SAAS9B;8BAAa;;;;;AAKtD"}
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import { ReactElement, ReactNode } from 'react';
2
2
  export interface EmptyDashboardProps {
3
3
  /**
4
4
  * The title, which should be relatively short text.
@@ -7,7 +7,7 @@ export interface EmptyDashboardProps {
7
7
  /**
8
8
  * Imagery to display above the title.
9
9
  */
10
- image?: React.ReactNode;
10
+ image?: ReactNode;
11
11
  /**
12
12
  * Descriptive text, which can be a bit longer.
13
13
  */
@@ -33,5 +33,5 @@ export interface EmptyDashboardProps {
33
33
  /**
34
34
  * Communicate that a dashboard is empty and prompt the user to get started.
35
35
  */
36
- export declare const EmptyDashboard: ({ title, image, description, additionalText, actions, onEditButtonClick, }: EmptyDashboardProps) => import("react/jsx-runtime").JSX.Element;
36
+ export declare const EmptyDashboard: ({ title, image, description, additionalText, actions, onEditButtonClick, }: EmptyDashboardProps) => ReactElement;
37
37
  //# sourceMappingURL=EmptyDashboard.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EmptyDashboard.d.ts","sourceRoot":"","sources":["../../../src/components/EmptyDashboard/EmptyDashboard.tsx"],"names":[],"mappings":";AAmBA,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAExB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC;IAEhC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;CAChC;AAmDD;;GAEG;AACH,eAAO,MAAM,cAAc,+EAOxB,mBAAmB,4CA2BrB,CAAC"}
1
+ {"version":3,"file":"EmptyDashboard.d.ts","sourceRoot":"","sources":["../../../src/components/EmptyDashboard/EmptyDashboard.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMhD,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAElB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC;IAEhC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;CAChC;AAuDD;;GAEG;AACH,eAAO,MAAM,cAAc,+EAOxB,mBAAmB,KAAG,YA2BxB,CAAC"}