@perses-dev/dashboards 0.0.0-snapshot-panel-extra-content-3-17f9c42 → 0.0.0-snapshot-scatter-chart-embed-8efdfab

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 (336) hide show
  1. package/dist/cjs/components/AddGroupButton/AddGroupButton.js +10 -7
  2. package/dist/cjs/components/AddGroupButton/index.js +10 -8
  3. package/dist/cjs/components/AddPanelButton/AddPanelButton.js +10 -11
  4. package/dist/cjs/components/AddPanelButton/index.js +10 -8
  5. package/dist/cjs/components/Dashboard/Dashboard.js +11 -9
  6. package/dist/cjs/components/Dashboard/index.js +10 -8
  7. package/dist/cjs/components/DashboardStickyToolbar/DashboardStickyToolbar.js +53 -22
  8. package/dist/cjs/components/DashboardStickyToolbar/index.js +10 -8
  9. package/dist/cjs/components/DashboardToolbar/DashboardToolbar.js +81 -102
  10. package/dist/cjs/components/DashboardToolbar/index.js +10 -8
  11. package/dist/cjs/components/Datasources/DatasourceEditor.js +237 -0
  12. package/dist/cjs/components/Datasources/EditDatasourcesButton.js +106 -0
  13. package/dist/cjs/components/Datasources/index.js +31 -0
  14. package/dist/cjs/components/DeletePanelDialog/DeletePanelDialog.js +12 -10
  15. package/dist/cjs/components/DeletePanelDialog/index.js +10 -8
  16. package/dist/cjs/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +17 -15
  17. package/dist/cjs/components/DeletePanelGroupDialog/index.js +10 -8
  18. package/dist/cjs/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js +5 -3
  19. package/dist/cjs/components/DiscardChangesConfirmationDialog/index.js +10 -8
  20. package/dist/cjs/components/DownloadButton/DownloadButton.js +12 -10
  21. package/dist/cjs/components/DownloadButton/index.js +10 -8
  22. package/dist/cjs/components/EditButton/EditButton.js +8 -6
  23. package/dist/cjs/components/EditButton/index.js +10 -8
  24. package/dist/cjs/components/EditJsonButton/EditJsonButton.js +15 -11
  25. package/dist/cjs/components/EditJsonButton/index.js +10 -8
  26. package/dist/cjs/components/EditJsonDialog/EditJsonDialog.js +46 -24
  27. package/dist/cjs/components/EditJsonDialog/index.js +10 -8
  28. package/dist/cjs/components/EmptyDashboard/EmptyDashboard.js +18 -16
  29. package/dist/cjs/components/EmptyDashboard/index.js +10 -8
  30. package/dist/cjs/components/GridLayout/GridContainer.js +5 -3
  31. package/dist/cjs/components/GridLayout/GridItemContent.js +33 -14
  32. package/dist/cjs/components/GridLayout/GridLayout.js +18 -16
  33. package/dist/cjs/components/GridLayout/GridTitle.js +35 -33
  34. package/dist/cjs/components/GridLayout/index.js +13 -11
  35. package/dist/cjs/components/Panel/Panel.js +18 -22
  36. package/dist/cjs/components/Panel/PanelContent.js +11 -8
  37. package/dist/cjs/components/Panel/PanelHeader.js +33 -31
  38. package/dist/cjs/components/Panel/index.js +10 -8
  39. package/dist/cjs/components/PanelDrawer/PanelDrawer.js +25 -77
  40. package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +231 -141
  41. package/dist/cjs/components/PanelDrawer/PanelPreview.js +11 -9
  42. package/dist/cjs/components/PanelDrawer/index.js +11 -8
  43. package/dist/cjs/components/PanelDrawer/usePanelEditor.js +3 -1
  44. package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.js +18 -16
  45. package/dist/cjs/components/PanelGroupDialog/PanelGroupEditorForm.js +15 -11
  46. package/dist/cjs/components/PanelGroupDialog/index.js +10 -8
  47. package/dist/cjs/components/QuerySummaryTable/QuerySummaryTable.js +47 -45
  48. package/dist/cjs/components/QuerySummaryTable/index.js +10 -8
  49. package/dist/cjs/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +23 -21
  50. package/dist/cjs/components/SaveChangesConfirmationDialog/index.js +10 -8
  51. package/dist/cjs/components/SaveDashboardButton/SaveDashboardButton.js +8 -8
  52. package/dist/cjs/components/SaveDashboardButton/index.js +10 -8
  53. package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +46 -19
  54. package/dist/cjs/components/TimeRangeControls/index.js +10 -8
  55. package/dist/cjs/components/ToolbarIconButton/ToolbarIconButton.js +5 -3
  56. package/dist/cjs/components/ToolbarIconButton/index.js +10 -8
  57. package/dist/cjs/components/Variables/BuiltinVariableAccordions.js +140 -0
  58. package/dist/cjs/components/Variables/EditVariablesButton.js +17 -15
  59. package/dist/cjs/components/Variables/TemplateVariable.js +250 -105
  60. package/dist/cjs/components/Variables/VariableEditor.js +280 -204
  61. package/dist/cjs/components/Variables/VariableList.js +23 -21
  62. package/dist/cjs/components/Variables/index.js +14 -11
  63. package/dist/cjs/components/index.js +32 -29
  64. package/dist/cjs/constants/grid-layout-config.js +6 -2
  65. package/dist/cjs/constants/index.js +12 -9
  66. package/dist/cjs/constants/styles.js +42 -0
  67. package/dist/cjs/constants/user-interface-text.js +9 -2
  68. package/dist/cjs/context/DashboardProvider/DashboardProvider.js +43 -35
  69. package/dist/cjs/context/DashboardProvider/common.js +6 -2
  70. package/dist/cjs/context/DashboardProvider/dashboard-provider-api.js +70 -38
  71. package/dist/cjs/context/DashboardProvider/delete-panel-group-slice.js +3 -1
  72. package/dist/cjs/context/DashboardProvider/delete-panel-slice.js +5 -3
  73. package/dist/cjs/context/DashboardProvider/discard-changes-dialog-slice.js +3 -1
  74. package/dist/cjs/context/DashboardProvider/duplicate-panel-slice.js +3 -1
  75. package/dist/cjs/context/DashboardProvider/edit-json-dialog-slice.js +3 -1
  76. package/dist/cjs/context/DashboardProvider/index.js +12 -10
  77. package/dist/cjs/context/DashboardProvider/panel-editor-slice.js +13 -11
  78. package/dist/cjs/context/DashboardProvider/panel-group-editor-slice.js +8 -6
  79. package/dist/cjs/context/DashboardProvider/panel-group-slice.js +15 -7
  80. package/dist/cjs/context/DashboardProvider/panel-slice.js +3 -1
  81. package/dist/cjs/context/DashboardProvider/save-changes-dialog-slice.js +3 -1
  82. package/dist/cjs/context/DatasourceStoreProvider.js +167 -46
  83. package/dist/cjs/context/TemplateVariableProvider/TemplateVariableProvider.js +141 -34
  84. package/dist/cjs/context/TemplateVariableProvider/hydrationUtils.js +12 -10
  85. package/dist/cjs/context/TemplateVariableProvider/index.js +10 -8
  86. package/dist/cjs/context/TemplateVariableProvider/query-params.js +17 -7
  87. package/dist/cjs/context/TemplateVariableProvider/utils.js +15 -7
  88. package/dist/cjs/context/index.js +13 -11
  89. package/dist/cjs/context/useDashboard.js +12 -8
  90. package/dist/cjs/index.js +12 -10
  91. package/dist/cjs/stories/decorators/WithDashboard.js +6 -4
  92. package/dist/cjs/stories/decorators/WithDatasourceStore.js +6 -4
  93. package/dist/cjs/stories/decorators/WithTemplateVariables.js +6 -4
  94. package/dist/cjs/stories/decorators/constants.js +5 -3
  95. package/dist/cjs/stories/decorators/index.js +13 -11
  96. package/dist/cjs/test/dashboard-provider.js +8 -4
  97. package/dist/cjs/test/datasource-provider.js +16 -12
  98. package/dist/cjs/test/index.js +13 -11
  99. package/dist/cjs/test/plugin-registry.js +6 -4
  100. package/dist/cjs/test/render.js +27 -20
  101. package/dist/cjs/test/setup-tests.js +2 -2
  102. package/dist/cjs/test/testDashboard.js +13 -11
  103. package/dist/cjs/utils/index.js +11 -9
  104. package/dist/cjs/utils/panelUtils.js +9 -3
  105. package/dist/cjs/utils/time.js +5 -3
  106. package/dist/cjs/validation/index.js +30 -0
  107. package/dist/cjs/validation/panel.js +29 -0
  108. package/dist/cjs/views/ViewDashboard/DashboardApp.js +30 -16
  109. package/dist/cjs/views/ViewDashboard/ViewDashboard.js +63 -20
  110. package/dist/cjs/views/ViewDashboard/index.js +10 -8
  111. package/dist/cjs/views/index.js +10 -8
  112. package/dist/components/AddGroupButton/AddGroupButton.d.ts.map +1 -1
  113. package/dist/components/AddGroupButton/AddGroupButton.js +2 -1
  114. package/dist/components/AddGroupButton/AddGroupButton.js.map +1 -1
  115. package/dist/components/AddGroupButton/index.js.map +1 -1
  116. package/dist/components/AddPanelButton/AddPanelButton.js +2 -5
  117. package/dist/components/AddPanelButton/AddPanelButton.js.map +1 -1
  118. package/dist/components/AddPanelButton/index.js.map +1 -1
  119. package/dist/components/Dashboard/Dashboard.js.map +1 -1
  120. package/dist/components/Dashboard/index.js.map +1 -1
  121. package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.d.ts.map +1 -1
  122. package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js +37 -8
  123. package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js.map +1 -1
  124. package/dist/components/DashboardStickyToolbar/index.js.map +1 -1
  125. package/dist/components/DashboardToolbar/DashboardToolbar.d.ts.map +1 -1
  126. package/dist/components/DashboardToolbar/DashboardToolbar.js +61 -84
  127. package/dist/components/DashboardToolbar/DashboardToolbar.js.map +1 -1
  128. package/dist/components/DashboardToolbar/index.js.map +1 -1
  129. package/dist/components/Datasources/DatasourceEditor.d.ts +8 -0
  130. package/dist/components/Datasources/DatasourceEditor.d.ts.map +1 -0
  131. package/dist/components/Datasources/DatasourceEditor.js +224 -0
  132. package/dist/components/Datasources/DatasourceEditor.js.map +1 -0
  133. package/dist/components/Datasources/EditDatasourcesButton.d.ts +3 -0
  134. package/dist/components/Datasources/EditDatasourcesButton.d.ts.map +1 -0
  135. package/dist/components/Datasources/EditDatasourcesButton.js +93 -0
  136. package/dist/components/Datasources/EditDatasourcesButton.js.map +1 -0
  137. package/dist/components/Datasources/index.d.ts +3 -0
  138. package/dist/components/Datasources/index.d.ts.map +1 -0
  139. package/dist/components/Datasources/index.js +16 -0
  140. package/dist/components/Datasources/index.js.map +1 -0
  141. package/dist/components/DeletePanelDialog/DeletePanelDialog.js.map +1 -1
  142. package/dist/components/DeletePanelDialog/index.js.map +1 -1
  143. package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +2 -2
  144. package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js.map +1 -1
  145. package/dist/components/DeletePanelGroupDialog/index.js.map +1 -1
  146. package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js.map +1 -1
  147. package/dist/components/DiscardChangesConfirmationDialog/index.js.map +1 -1
  148. package/dist/components/DownloadButton/DownloadButton.js.map +1 -1
  149. package/dist/components/DownloadButton/index.js.map +1 -1
  150. package/dist/components/EditButton/EditButton.js.map +1 -1
  151. package/dist/components/EditButton/index.js.map +1 -1
  152. package/dist/components/EditJsonButton/EditJsonButton.d.ts +4 -1
  153. package/dist/components/EditJsonButton/EditJsonButton.d.ts.map +1 -1
  154. package/dist/components/EditJsonButton/EditJsonButton.js +5 -3
  155. package/dist/components/EditJsonButton/EditJsonButton.js.map +1 -1
  156. package/dist/components/EditJsonButton/index.js.map +1 -1
  157. package/dist/components/EditJsonDialog/EditJsonDialog.d.ts +5 -1
  158. package/dist/components/EditJsonDialog/EditJsonDialog.d.ts.map +1 -1
  159. package/dist/components/EditJsonDialog/EditJsonDialog.js +32 -12
  160. package/dist/components/EditJsonDialog/EditJsonDialog.js.map +1 -1
  161. package/dist/components/EditJsonDialog/index.js.map +1 -1
  162. package/dist/components/EmptyDashboard/EmptyDashboard.js.map +1 -1
  163. package/dist/components/EmptyDashboard/index.js.map +1 -1
  164. package/dist/components/GridLayout/GridContainer.js.map +1 -1
  165. package/dist/components/GridLayout/GridItemContent.d.ts.map +1 -1
  166. package/dist/components/GridLayout/GridItemContent.js +27 -10
  167. package/dist/components/GridLayout/GridItemContent.js.map +1 -1
  168. package/dist/components/GridLayout/GridLayout.js +2 -2
  169. package/dist/components/GridLayout/GridLayout.js.map +1 -1
  170. package/dist/components/GridLayout/GridTitle.js.map +1 -1
  171. package/dist/components/GridLayout/index.js.map +1 -1
  172. package/dist/components/Panel/Panel.d.ts.map +1 -1
  173. package/dist/components/Panel/Panel.js +5 -11
  174. package/dist/components/Panel/Panel.js.map +1 -1
  175. package/dist/components/Panel/PanelContent.d.ts +2 -1
  176. package/dist/components/Panel/PanelContent.d.ts.map +1 -1
  177. package/dist/components/Panel/PanelContent.js +3 -2
  178. package/dist/components/Panel/PanelContent.js.map +1 -1
  179. package/dist/components/Panel/PanelHeader.js.map +1 -1
  180. package/dist/components/Panel/index.js.map +1 -1
  181. package/dist/components/PanelDrawer/PanelDrawer.d.ts.map +1 -1
  182. package/dist/components/PanelDrawer/PanelDrawer.js +22 -76
  183. package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -1
  184. package/dist/components/PanelDrawer/PanelEditorForm.d.ts +4 -1
  185. package/dist/components/PanelDrawer/PanelEditorForm.d.ts.map +1 -1
  186. package/dist/components/PanelDrawer/PanelEditorForm.js +225 -139
  187. package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -1
  188. package/dist/components/PanelDrawer/PanelPreview.d.ts.map +1 -1
  189. package/dist/components/PanelDrawer/PanelPreview.js +2 -2
  190. package/dist/components/PanelDrawer/PanelPreview.js.map +1 -1
  191. package/dist/components/PanelDrawer/index.d.ts +1 -0
  192. package/dist/components/PanelDrawer/index.d.ts.map +1 -1
  193. package/dist/components/PanelDrawer/index.js +1 -0
  194. package/dist/components/PanelDrawer/index.js.map +1 -1
  195. package/dist/components/PanelDrawer/usePanelEditor.js.map +1 -1
  196. package/dist/components/PanelGroupDialog/PanelGroupDialog.js.map +1 -1
  197. package/dist/components/PanelGroupDialog/PanelGroupEditorForm.js.map +1 -1
  198. package/dist/components/PanelGroupDialog/index.js.map +1 -1
  199. package/dist/components/QuerySummaryTable/QuerySummaryTable.js +6 -6
  200. package/dist/components/QuerySummaryTable/QuerySummaryTable.js.map +1 -1
  201. package/dist/components/QuerySummaryTable/index.js.map +1 -1
  202. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +4 -4
  203. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js.map +1 -1
  204. package/dist/components/SaveChangesConfirmationDialog/index.js.map +1 -1
  205. package/dist/components/SaveDashboardButton/SaveDashboardButton.d.ts.map +1 -1
  206. package/dist/components/SaveDashboardButton/SaveDashboardButton.js +1 -3
  207. package/dist/components/SaveDashboardButton/SaveDashboardButton.js.map +1 -1
  208. package/dist/components/SaveDashboardButton/index.js.map +1 -1
  209. package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -1
  210. package/dist/components/TimeRangeControls/TimeRangeControls.js +26 -5
  211. package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
  212. package/dist/components/TimeRangeControls/index.js.map +1 -1
  213. package/dist/components/ToolbarIconButton/ToolbarIconButton.js.map +1 -1
  214. package/dist/components/ToolbarIconButton/index.js.map +1 -1
  215. package/dist/components/Variables/BuiltinVariableAccordions.d.ts +8 -0
  216. package/dist/components/Variables/BuiltinVariableAccordions.d.ts.map +1 -0
  217. package/dist/components/Variables/BuiltinVariableAccordions.js +127 -0
  218. package/dist/components/Variables/BuiltinVariableAccordions.js.map +1 -0
  219. package/dist/components/Variables/EditVariablesButton.d.ts.map +1 -1
  220. package/dist/components/Variables/EditVariablesButton.js +5 -5
  221. package/dist/components/Variables/EditVariablesButton.js.map +1 -1
  222. package/dist/components/Variables/TemplateVariable.d.ts +10 -1
  223. package/dist/components/Variables/TemplateVariable.d.ts.map +1 -1
  224. package/dist/components/Variables/TemplateVariable.js +233 -98
  225. package/dist/components/Variables/TemplateVariable.js.map +1 -1
  226. package/dist/components/Variables/VariableEditor.d.ts +2 -1
  227. package/dist/components/Variables/VariableEditor.d.ts.map +1 -1
  228. package/dist/components/Variables/VariableEditor.js +229 -157
  229. package/dist/components/Variables/VariableEditor.js.map +1 -1
  230. package/dist/components/Variables/VariableList.d.ts.map +1 -1
  231. package/dist/components/Variables/VariableList.js +10 -12
  232. package/dist/components/Variables/VariableList.js.map +1 -1
  233. package/dist/components/Variables/index.d.ts +1 -0
  234. package/dist/components/Variables/index.d.ts.map +1 -1
  235. package/dist/components/Variables/index.js +1 -0
  236. package/dist/components/Variables/index.js.map +1 -1
  237. package/dist/components/index.d.ts +1 -0
  238. package/dist/components/index.d.ts.map +1 -1
  239. package/dist/components/index.js +1 -0
  240. package/dist/components/index.js.map +1 -1
  241. package/dist/constants/grid-layout-config.js.map +1 -1
  242. package/dist/constants/index.d.ts +1 -0
  243. package/dist/constants/index.d.ts.map +1 -1
  244. package/dist/constants/index.js +1 -0
  245. package/dist/constants/index.js.map +1 -1
  246. package/dist/constants/styles.d.ts +5 -0
  247. package/dist/constants/styles.d.ts.map +1 -0
  248. package/dist/constants/styles.js +23 -0
  249. package/dist/constants/styles.js.map +1 -0
  250. package/dist/constants/user-interface-text.d.ts +3 -0
  251. package/dist/constants/user-interface-text.d.ts.map +1 -1
  252. package/dist/constants/user-interface-text.js +3 -0
  253. package/dist/constants/user-interface-text.js.map +1 -1
  254. package/dist/context/DashboardProvider/DashboardProvider.d.ts +2 -1
  255. package/dist/context/DashboardProvider/DashboardProvider.d.ts.map +1 -1
  256. package/dist/context/DashboardProvider/DashboardProvider.js +8 -6
  257. package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -1
  258. package/dist/context/DashboardProvider/common.js.map +1 -1
  259. package/dist/context/DashboardProvider/dashboard-provider-api.js +2 -2
  260. package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -1
  261. package/dist/context/DashboardProvider/delete-panel-group-slice.js.map +1 -1
  262. package/dist/context/DashboardProvider/delete-panel-slice.js +2 -2
  263. package/dist/context/DashboardProvider/delete-panel-slice.js.map +1 -1
  264. package/dist/context/DashboardProvider/discard-changes-dialog-slice.js.map +1 -1
  265. package/dist/context/DashboardProvider/duplicate-panel-slice.js.map +1 -1
  266. package/dist/context/DashboardProvider/edit-json-dialog-slice.js.map +1 -1
  267. package/dist/context/DashboardProvider/index.js.map +1 -1
  268. package/dist/context/DashboardProvider/panel-editor-slice.d.ts +2 -2
  269. package/dist/context/DashboardProvider/panel-editor-slice.d.ts.map +1 -1
  270. package/dist/context/DashboardProvider/panel-editor-slice.js +7 -7
  271. package/dist/context/DashboardProvider/panel-editor-slice.js.map +1 -1
  272. package/dist/context/DashboardProvider/panel-group-editor-slice.js +2 -2
  273. package/dist/context/DashboardProvider/panel-group-editor-slice.js.map +1 -1
  274. package/dist/context/DashboardProvider/panel-group-slice.js +3 -3
  275. package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -1
  276. package/dist/context/DashboardProvider/panel-slice.js.map +1 -1
  277. package/dist/context/DashboardProvider/save-changes-dialog-slice.js.map +1 -1
  278. package/dist/context/DatasourceStoreProvider.d.ts +15 -10
  279. package/dist/context/DatasourceStoreProvider.d.ts.map +1 -1
  280. package/dist/context/DatasourceStoreProvider.js +161 -42
  281. package/dist/context/DatasourceStoreProvider.js.map +1 -1
  282. package/dist/context/TemplateVariableProvider/TemplateVariableProvider.d.ts +11 -4
  283. package/dist/context/TemplateVariableProvider/TemplateVariableProvider.d.ts.map +1 -1
  284. package/dist/context/TemplateVariableProvider/TemplateVariableProvider.js +106 -18
  285. package/dist/context/TemplateVariableProvider/TemplateVariableProvider.js.map +1 -1
  286. package/dist/context/TemplateVariableProvider/hydrationUtils.js +7 -7
  287. package/dist/context/TemplateVariableProvider/hydrationUtils.js.map +1 -1
  288. package/dist/context/TemplateVariableProvider/index.js.map +1 -1
  289. package/dist/context/TemplateVariableProvider/query-params.js.map +1 -1
  290. package/dist/context/TemplateVariableProvider/utils.js +3 -3
  291. package/dist/context/TemplateVariableProvider/utils.js.map +1 -1
  292. package/dist/context/index.js.map +1 -1
  293. package/dist/context/useDashboard.d.ts.map +1 -1
  294. package/dist/context/useDashboard.js +5 -3
  295. package/dist/context/useDashboard.js.map +1 -1
  296. package/dist/index.js.map +1 -1
  297. package/dist/stories/decorators/WithDashboard.js.map +1 -1
  298. package/dist/stories/decorators/WithDatasourceStore.js.map +1 -1
  299. package/dist/stories/decorators/WithTemplateVariables.js.map +1 -1
  300. package/dist/stories/decorators/constants.js +2 -2
  301. package/dist/stories/decorators/constants.js.map +1 -1
  302. package/dist/stories/decorators/index.js.map +1 -1
  303. package/dist/test/dashboard-provider.js.map +1 -1
  304. package/dist/test/datasource-provider.d.ts.map +1 -1
  305. package/dist/test/datasource-provider.js +5 -7
  306. package/dist/test/datasource-provider.js.map +1 -1
  307. package/dist/test/index.js.map +1 -1
  308. package/dist/test/plugin-registry.js.map +1 -1
  309. package/dist/test/render.d.ts.map +1 -1
  310. package/dist/test/render.js +8 -3
  311. package/dist/test/render.js.map +1 -1
  312. package/dist/test/setup-tests.js.map +1 -1
  313. package/dist/test/testDashboard.js +10 -10
  314. package/dist/test/testDashboard.js.map +1 -1
  315. package/dist/utils/index.js.map +1 -1
  316. package/dist/utils/panelUtils.js.map +1 -1
  317. package/dist/utils/time.js.map +1 -1
  318. package/dist/validation/index.d.ts +2 -0
  319. package/dist/validation/index.d.ts.map +1 -0
  320. package/dist/validation/index.js +15 -0
  321. package/dist/validation/index.js.map +1 -0
  322. package/dist/validation/panel.d.ts +19 -0
  323. package/dist/validation/panel.d.ts.map +1 -0
  324. package/dist/validation/panel.js +21 -0
  325. package/dist/validation/panel.js.map +1 -0
  326. package/dist/views/ViewDashboard/DashboardApp.d.ts +1 -0
  327. package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -1
  328. package/dist/views/ViewDashboard/DashboardApp.js +17 -5
  329. package/dist/views/ViewDashboard/DashboardApp.js.map +1 -1
  330. package/dist/views/ViewDashboard/ViewDashboard.d.ts +1 -0
  331. package/dist/views/ViewDashboard/ViewDashboard.d.ts.map +1 -1
  332. package/dist/views/ViewDashboard/ViewDashboard.js +52 -11
  333. package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -1
  334. package/dist/views/ViewDashboard/index.js.map +1 -1
  335. package/dist/views/index.js.map +1 -1
  336. package/package.json +8 -7
@@ -0,0 +1,93 @@
1
+ // Copyright 2023 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
14
+ import { useState } from 'react';
15
+ import { Button } from '@mui/material';
16
+ import PencilIcon from 'mdi-material-ui/PencilOutline';
17
+ import { Drawer, InfoTooltip } from '@perses-dev/components';
18
+ import { useDatasourceStore } from '@perses-dev/plugin-system';
19
+ import { TOOLTIP_TEXT, editButtonStyle } from '../../constants';
20
+ import { useDashboard } from '../../context';
21
+ import { DatasourceEditor } from './DatasourceEditor';
22
+ export function EditDatasourcesButton() {
23
+ const [isDatasourceEditorOpen, setIsDatasourceEditorOpen] = useState(false);
24
+ const { getLocalDatasources , setLocalDatasources , getSavedDatasources , setSavedDatasources } = useDatasourceStore();
25
+ const localDatasources = getLocalDatasources();
26
+ const savedDatasources = getSavedDatasources();
27
+ const { dashboard , setDashboard } = useDashboard();
28
+ const openDatasourceEditor = ()=>{
29
+ setIsDatasourceEditorOpen(true);
30
+ };
31
+ const closeDatasourceEditor = ()=>{
32
+ setIsDatasourceEditorOpen(false);
33
+ };
34
+ const handleChangeDatasources = (datasources)=>{
35
+ // Calculates the new list of datasources that are allowed to be used.
36
+ const newSavedDatasources = Object.keys(datasources).filter((key)=>{
37
+ var _datasources_key, _datasources_key_plugin, _savedDatasources_key, _savedDatasources_key_plugin, _datasources_key1, _datasources_key_plugin1, _datasources_key_plugin_spec, _savedDatasources_key1, _savedDatasources_key_plugin1, _savedDatasources_key_plugin_spec;
38
+ var _datasources_key_plugin_spec1;
39
+ // Datasources are allowed to be used if a) they are direct, or b) they are proxied, and their
40
+ // proxy is the same as what we have saved.
41
+ const isDirect = 'directUrl' in ((_datasources_key_plugin_spec1 = (_datasources_key = datasources[key]) === null || _datasources_key === void 0 ? void 0 : (_datasources_key_plugin = _datasources_key.plugin) === null || _datasources_key_plugin === void 0 ? void 0 : _datasources_key_plugin.spec) !== null && _datasources_key_plugin_spec1 !== void 0 ? _datasources_key_plugin_spec1 : {});
42
+ var _savedDatasources_key_plugin_spec1;
43
+ const isSavedProxy = !isDirect && !('directUrl' in ((_savedDatasources_key_plugin_spec1 = (_savedDatasources_key = savedDatasources[key]) === null || _savedDatasources_key === void 0 ? void 0 : (_savedDatasources_key_plugin = _savedDatasources_key.plugin) === null || _savedDatasources_key_plugin === void 0 ? void 0 : _savedDatasources_key_plugin.spec) !== null && _savedDatasources_key_plugin_spec1 !== void 0 ? _savedDatasources_key_plugin_spec1 : {})) && ((_datasources_key1 = datasources[key]) === null || _datasources_key1 === void 0 ? void 0 : (_datasources_key_plugin1 = _datasources_key1.plugin) === null || _datasources_key_plugin1 === void 0 ? void 0 : (_datasources_key_plugin_spec = _datasources_key_plugin1.spec) === null || _datasources_key_plugin_spec === void 0 ? void 0 : _datasources_key_plugin_spec.proxy) === ((_savedDatasources_key1 = savedDatasources[key]) === null || _savedDatasources_key1 === void 0 ? void 0 : (_savedDatasources_key_plugin1 = _savedDatasources_key1.plugin) === null || _savedDatasources_key_plugin1 === void 0 ? void 0 : (_savedDatasources_key_plugin_spec = _savedDatasources_key_plugin1.spec) === null || _savedDatasources_key_plugin_spec === void 0 ? void 0 : _savedDatasources_key_plugin_spec.proxy);
44
+ return isDirect || isSavedProxy;
45
+ }).reduce((obj, key)=>{
46
+ obj[key] = datasources[key];
47
+ return obj;
48
+ }, {});
49
+ setDashboard({
50
+ ...dashboard,
51
+ spec: {
52
+ ...dashboard.spec,
53
+ datasources: datasources
54
+ }
55
+ });
56
+ setSavedDatasources(newSavedDatasources);
57
+ setLocalDatasources(datasources);
58
+ setIsDatasourceEditorOpen(false);
59
+ };
60
+ return /*#__PURE__*/ _jsxs(_Fragment, {
61
+ children: [
62
+ /*#__PURE__*/ _jsx(InfoTooltip, {
63
+ description: TOOLTIP_TEXT.editDatasources,
64
+ children: /*#__PURE__*/ _jsx(Button, {
65
+ startIcon: /*#__PURE__*/ _jsx(PencilIcon, {}),
66
+ onClick: openDatasourceEditor,
67
+ "aria-label": TOOLTIP_TEXT.editDatasources,
68
+ variant: "text",
69
+ color: "primary",
70
+ sx: editButtonStyle,
71
+ children: "Datasources"
72
+ })
73
+ }),
74
+ /*#__PURE__*/ _jsx(Drawer, {
75
+ isOpen: isDatasourceEditorOpen,
76
+ onClose: closeDatasourceEditor,
77
+ PaperProps: {
78
+ sx: {
79
+ width: '50%'
80
+ }
81
+ },
82
+ "data-testid": "datasource-editor",
83
+ children: /*#__PURE__*/ _jsx(DatasourceEditor, {
84
+ datasources: localDatasources,
85
+ onCancel: closeDatasourceEditor,
86
+ onChange: handleChangeDatasources
87
+ })
88
+ })
89
+ ]
90
+ });
91
+ }
92
+
93
+ //# sourceMappingURL=EditDatasourcesButton.js.map
@@ -0,0 +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 { DatasourceSpec } 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((obj, key) => {\n obj[key] = datasources[key] as DatasourceSpec;\n\n return obj;\n }, {} as Record<string, DatasourceSpec>);\n\n setDashboard({\n ...dashboard,\n spec: {\n ...dashboard.spec,\n datasources: datasources,\n },\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","description","editDatasources","startIcon","onClick","aria-label","variant","color","sx","isOpen","onClose","PaperProps","width","data-testid","onCancel","onChange"],"mappings":"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"}
@@ -0,0 +1,3 @@
1
+ export * from './EditDatasourcesButton';
2
+ export * from './DatasourceEditor';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Datasources/index.ts"],"names":[],"mappings":"AAaA,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,16 @@
1
+ // Copyright 2023 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ export * from './EditDatasourcesButton';
14
+ export * from './DatasourceEditor';
15
+
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/Datasources/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './EditDatasourcesButton';\nexport * from './DatasourceEditor';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,0BAA0B;AACxC,cAAc,qBAAqB"}
@@ -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;AAEjC;AACA,SAASA,MAAM,QAAQ,wBAAwB,CAAC;AAChD,SAASC,oBAAoB,QAAgC,eAAe,CAAC;AAE7E,OAAO,MAAMC,iBAAiB,GAAG,IAAM;IACrC,MAAM,EAAEC,iBAAiB,CAAA,EAAEC,sBAAsB,CAAA,EAAE,GAAGH,oBAAoB,EAAE,AAAC;IAE7E,qBACE,MAACD,MAAM;QAACK,IAAI,EAAEF,iBAAiB,KAAKG,SAAS;;0BAC3C,KAACN,MAAM,CAACO,MAAM;gBAACC,OAAO,EAAE,IAAMJ,sBAAsB,EAAE;0BAAE,cAAY;cAAgB;YACnFD,iBAAiB,kBAAI,KAACM,eAAe;gBAACN,iBAAiB,EAAEA,iBAAiB;cAAI;;MACxE,CACT;AACJ,CAAC,CAAC;AAMF,MAAMM,eAAe,GAAG,CAAC,EAAEN,iBAAiB,CAAA,EAAwB,GAAK;IACvE,MAAM,EAAEO,WAAW,CAAA,EAAEN,sBAAsB,CAAA,EAAE,GAAGH,oBAAoB,EAAE,AAAC;IAEvE,MAAMU,YAAY,GAAG,CAACC,CAAY,GAAK;QACrCA,CAAC,CAACC,cAAc,EAAE,CAAC;QACnB,MAAM,EAAEC,gBAAgB,CAAA,EAAE,GAAGX,iBAAiB,AAAC;QAC/CO,WAAW,CAACI,gBAAgB,CAAC,CAAC;QAC9BV,sBAAsB,EAAE,CAAC;IAC3B,CAAC,AAAC;IACF,qBACE,MAACW,MAAI;QAACC,QAAQ,EAAEL,YAAY;;0BAC1B,MAACX,MAAM,CAACiB,OAAO;;oBAAC,kCACkB;oBAACd,iBAAiB,CAACe,SAAS;oBAAC,QAAM;oBAACf,iBAAiB,CAACgB,cAAc;oBAAC,iCAEvG;;cAAiB;0BACjB,MAACnB,MAAM,CAACoB,OAAO;;kCACb,KAACpB,MAAM,CAACqB,aAAa;kCAAC,QAAM;sBAAuB;kCACnD,KAACrB,MAAM,CAACsB,eAAe;wBAACC,OAAO,EAAE,IAAMnB,sBAAsB,EAAE;kCAAE,QAAM;sBAAyB;;cACjF;;MACZ,CACP;AACJ,CAAC,AAAC"}
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,kBAAiB,EAAEC,uBAAsB,EAAE,GAAGH;IAEtD,qBACE,MAACD;QAAOK,MAAMF,sBAAsBG;;0BAClC,KAACN,OAAOO;gBAAOC,SAAS,IAAMJ;0BAA0B;;YACvDD,mCAAqB,KAACM;gBAAgBN,mBAAmBA;;;;AAGhE,EAAE;AAMF,MAAMM,kBAAkB,CAAC,EAAEN,kBAAiB,EAAwB;IAClE,MAAM,EAAEO,YAAW,EAAEN,uBAAsB,EAAE,GAAGH;IAEhD,MAAMU,eAAe,CAACC;QACpBA,EAAEC;QACF,MAAM,EAAEC,iBAAgB,EAAE,GAAGX;QAC7BO,YAAYI;QACZV;IACF;IACA,qBACE,MAACW;QAAKC,UAAUL;;0BACd,MAACX,OAAOiB;;oBAAQ;oBACmBd,kBAAkBe;oBAAU;oBAAOf,kBAAkBgB;oBAAe;;;0BAGvG,MAACnB,OAAOoB;;kCACN,KAACpB,OAAOqB;kCAAc;;kCACtB,KAACrB,OAAOsB;wBAAgBC,SAAS,IAAMnB;kCAA0B;;;;;;AAIzE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/DeletePanelDialog/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './DeletePanelDialog';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"sources":["../../../src/components/DeletePanelDialog/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './DeletePanelDialog';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,sBAAsB"}
@@ -25,7 +25,7 @@ export const DeletePanelGroupDialog = ()=>{
25
25
  deletePanelGroup(panelGroupId);
26
26
  closeDeletePanelGroupDialog();
27
27
  };
28
- var ref;
28
+ var _deletePanelGroupDialog_panelGroupName;
29
29
  return /*#__PURE__*/ _jsxs(Dialog, {
30
30
  open: deletePanelGroupDialog !== undefined,
31
31
  children: [
@@ -52,7 +52,7 @@ export const DeletePanelGroupDialog = ()=>{
52
52
  },
53
53
  children: [
54
54
  "Are you sure you want to delete ",
55
- (ref = deletePanelGroupDialog === null || deletePanelGroupDialog === void 0 ? void 0 : deletePanelGroupDialog.panelGroupName) !== null && ref !== void 0 ? ref : 'panel group',
55
+ (_deletePanelGroupDialog_panelGroupName = deletePanelGroupDialog === null || deletePanelGroupDialog === void 0 ? void 0 : deletePanelGroupDialog.panelGroupName) !== null && _deletePanelGroupDialog_panelGroupName !== void 0 ? _deletePanelGroupDialog_panelGroupName : 'panel group',
56
56
  "? This will delete all the panels within the group."
57
57
  ]
58
58
  }),
@@ -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;AAEjC;AACA,SAASA,UAAU,EAAEC,MAAM,EAAEC,WAAW,EAAEC,aAAa,EAAEC,aAAa,EAAEC,MAAM,QAAQ,eAAe,CAAC;AACtG,OAAOC,SAAS,MAAM,uBAAuB,CAAC;AAC9C,SAASC,yBAAyB,QAAQ,eAAe,CAAC;AAE1D,OAAO,MAAMC,sBAAsB,GAAG,IAAM;IAC1C,MAAM,EAAEC,sBAAsB,CAAA,EAAEC,2BAA2B,CAAA,EAAEC,gBAAgB,CAAA,EAAE,GAAGJ,yBAAyB,EAAE,AAAC;IAE9G,MAAMK,YAAY,GAAGH,sBAAsB,aAAtBA,sBAAsB,WAAc,GAApCA,KAAAA,CAAoC,GAApCA,sBAAsB,CAAEG,YAAY,AAAC;IAE1D,MAAMC,YAAY,GAAG,CAACC,CAAY,GAAK;QACrCA,CAAC,CAACC,cAAc,EAAE,CAAC;QACnB,IAAIH,YAAY,IAAII,SAAS,EAAE;YAC7B,MAAM,IAAIC,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAC9C,CAAC;QACDN,gBAAgB,CAACC,YAAY,CAAC,CAAC;QAC/BF,2BAA2B,EAAE,CAAC;IAChC,CAAC,AAAC;QAkBuCD,GAAsC;IAhB/E,qBACE,MAACR,MAAM;QAACiB,IAAI,EAAET,sBAAsB,KAAKO,SAAS;;0BAChD,KAACd,WAAW;0BAAC,oBAAkB;cAAc;0BAC7C,KAACF,UAAU;gBACTmB,YAAU,EAAC,OAAO;gBAClBC,OAAO,EAAE,IAAMV,2BAA2B,EAAE;gBAC5CW,EAAE,EAAE,CAACC,KAAK,GAAM,CAAA;wBACdC,QAAQ,EAAE,UAAU;wBACpBC,GAAG,EAAEF,KAAK,CAACG,OAAO,CAAC,GAAG,CAAC;wBACvBC,KAAK,EAAEJ,KAAK,CAACG,OAAO,CAAC,GAAG,CAAC;qBAC1B,CAAA,AAAC;0BAEF,cAAA,KAACnB,SAAS,KAAG;cACF;0BACb,MAACqB,MAAI;gBAACC,QAAQ,EAAEf,YAAY;;kCAC1B,MAACV,aAAa;wBAAC0B,QAAQ;wBAACR,EAAE,EAAE;4BAAES,KAAK,EAAE,OAAO;yBAAE;;4BAAE,kCACd;4BAACrB,CAAAA,GAAsC,GAAtCA,sBAAsB,aAAtBA,sBAAsB,WAAgB,GAAtCA,KAAAA,CAAsC,GAAtCA,sBAAsB,CAAEsB,cAAc,cAAtCtB,GAAsC,cAAtCA,GAAsC,GAAI,aAAa;4BAAC,qDAE3F;;sBAAgB;kCAChB,MAACL,aAAa;;0CACZ,KAACC,MAAM;gCAAC2B,OAAO,EAAC,WAAW;gCAACC,IAAI,EAAC,QAAQ;0CAAC,QAE1C;8BAAS;0CACT,KAAC5B,MAAM;gCAAC2B,OAAO,EAAC,UAAU;gCAACE,KAAK,EAAC,WAAW;gCAACd,OAAO,EAAE,IAAMV,2BAA2B,EAAE;0CAAE,QAE3F;8BAAS;;sBACK;;cACX;;MACA,CACT;AACJ,CAAC,CAAC"}
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,uBAAsB,EAAEC,4BAA2B,EAAEC,iBAAgB,EAAE,GAAGJ;IAElF,MAAMK,eAAeH,mCAAAA,oCAAAA,KAAAA,IAAAA,uBAAwBG;IAE7C,MAAMC,eAAe,CAACC;QACpBA,EAAEC;QACF,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,QAAQ;wBACnBC,OAAOJ,MAAMG,QAAQ;oBACvB,CAAA;0BAEA,cAAA,KAACnB;;0BAEH,MAACqB;gBAAKC,UAAUf;;kCACd,MAACV;wBAAc0B,QAAQ;wBAACR,IAAI;4BAAES,OAAO;wBAAQ;;4BAAG;4BACbrB,CAAAA,yCAAAA,mCAAAA,oCAAAA,KAAAA,IAAAA,uBAAwBsB,4BAAxBtB,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 +1 @@
1
- {"version":3,"sources":["../../../src/components/DeletePanelGroupDialog/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './DeletePanelGroupDialog';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,0BAA0B,CAAC"}
1
+ {"version":3,"sources":["../../../src/components/DeletePanelGroupDialog/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './DeletePanelGroupDialog';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,2BAA2B"}
@@ -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;AAAA,SAASA,gCAAgC,QAAQ,wBAAwB,CAAC;AAC1E,SAASC,mCAAmC,QAAQ,eAAe,CAAC;AAEpE,OAAO,MAAMC,yCAAyC,GAAG,IAAM;IAC7D,MAAM,EAAEC,gCAAgC,EAAEC,MAAM,CAAA,EAAE,GAAGH,mCAAmC,EAAE,AAAC;IAC3F,IAAIG,MAAM,KAAKC,SAAS,EAAE;QACxB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,qBACE,KAACL,gCAAgC;QAC/BM,WAAW,EACTF,MAAM,CAACE,WAAW,IAClB,0HAA0H;QAE5HC,MAAM,EAAE,IAAI;QACZC,QAAQ,EAAEJ,MAAM,CAACI,QAAQ;QACzBC,gBAAgB,EAAEL,MAAM,CAACK,gBAAgB;MACzC,CACF;AACJ,CAAC,CAAC"}
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,OAAM,EAAE,GAAGH;IACrD,IAAIG,WAAWC,WAAW;QACxB,OAAO;IACT;IACA,qBACE,KAACL;QACCM,aACEF,OAAOE,eACP;QAEFC,QAAQ;QACRC,UAAUJ,OAAOI;QACjBC,kBAAkBL,OAAOK;;AAG/B,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/DiscardChangesConfirmationDialog/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './DiscardChangesConfirmationDialog';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,oCAAoC,CAAC"}
1
+ {"version":3,"sources":["../../../src/components/DiscardChangesConfirmationDialog/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './DiscardChangesConfirmationDialog';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,qCAAqC"}
@@ -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 } from '@perses-dev/components';\nimport { TOOLTIP_TEXT } from '../../constants';\nimport { useDashboard } from '../../context';\nimport { ToolbarIconButton } from '../ToolbarIconButton';\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","TOOLTIP_TEXT","useDashboard","ToolbarIconButton","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,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC;AAAA,SAASA,MAAM,QAAQ,OAAO,CAAC;AAC/B,OAAOC,YAAY,MAAM,iCAAiC,CAAC;AAC3D,SAASC,WAAW,QAAQ,wBAAwB,CAAC;AACrD,SAASC,YAAY,QAAQ,iBAAiB,CAAC;AAC/C,SAASC,YAAY,QAAQ,eAAe,CAAC;AAC7C,SAASC,iBAAiB,QAAQ,sBAAsB,CAAC;AAOzD,+DAA+D;AAC/D,OAAO,SAASC,cAAc,CAAC,EAAEC,QAAQ,CAAA,EAAuB,EAAE;IAChE,MAAM,EAAEC,SAAS,CAAA,EAAE,GAAGJ,YAAY,EAAE,AAAC;IACrC,MAAMK,aAAa,GAAGT,MAAM,CAAoB,IAAI,CAAC,AAAC;IACtD,MAAMU,MAAM,GAAGH,QAAQ,KAAKI,SAAS,GAAGA,SAAS,GAAG,CAAC,EAAEJ,QAAQ,CAAC,EAAE,CAAC,AAAC;IAEpE,MAAMK,qBAAqB,GAAG,IAAM;QAClC,IAAI,CAACH,aAAa,IAAI,CAACA,aAAa,CAACI,OAAO,EAAE,OAAO;QACrD,kBAAkB;QAClB,MAAMC,aAAa,GAAGC,GAAG,CAACC,eAAe,CACvC,IAAIC,IAAI,CAAC;YAACC,IAAI,CAACC,SAAS,CAACX,SAAS,CAAC;SAAC,EAAE;YACpCY,IAAI,EAAE,kBAAkB;SACzB,CAAC,CACH,AAAC;QACF,iBAAiB;QACjBX,aAAa,CAACI,OAAO,CAACQ,IAAI,GAAGP,aAAa,CAAC;QAC3CL,aAAa,CAACI,OAAO,CAACS,KAAK,EAAE,CAAC;QAC9B,0CAA0C;QAC1CP,GAAG,CAACQ,eAAe,CAACT,aAAa,CAAC,CAAC;IACrC,CAAC,AAAC;IAEF,qBACE;;0BACE,KAACZ,WAAW;gBAACsB,WAAW,EAAErB,YAAY,CAACsB,iBAAiB;0BACtD,cAAA,KAACpB,iBAAiB;oBAACqB,YAAU,EAAEvB,YAAY,CAACsB,iBAAiB;oBAAEE,OAAO,EAAEf,qBAAqB;oBAAEgB,EAAE,EAAE;wBAAElB,MAAM;qBAAE;8BAC3G,cAAA,KAACT,YAAY,KAAG;kBACE;cACR;0BAId,KAAC4B,GAAC;gBAACC,GAAG,EAAErB,aAAa;gBAAEsB,KAAK,EAAE;oBAAEC,OAAO,EAAE,MAAM;iBAAE;gBAAEC,QAAQ,EAAE,CAAC,EAAEzB,SAAS,CAAC0B,QAAQ,CAACC,IAAI,CAAC,KAAK,CAAC;cAAI;;MACjG,CACH;AACJ,CAAC"}
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 } from '@perses-dev/components';\nimport { TOOLTIP_TEXT } from '../../constants';\nimport { useDashboard } from '../../context';\nimport { ToolbarIconButton } from '../ToolbarIconButton';\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","TOOLTIP_TEXT","useDashboard","ToolbarIconButton","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,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,QAAQ;AAC/B,OAAOC,kBAAkB,kCAAkC;AAC3D,SAASC,WAAW,QAAQ,yBAAyB;AACrD,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,iBAAiB,QAAQ,uBAAuB;AAOzD,+DAA+D;AAC/D,OAAO,SAASC,eAAe,EAAEC,SAAQ,EAAuB;IAC9D,MAAM,EAAEC,UAAS,EAAE,GAAGJ;IACtB,MAAMK,gBAAgBT,OAA0B;IAChD,MAAMU,SAASH,aAAaI,YAAYA,YAAY,CAAC,EAAEJ,SAAS,EAAE,CAAC;IAEnE,MAAMK,wBAAwB;QAC5B,IAAI,CAACH,iBAAiB,CAACA,cAAcI,SAAS;QAC9C,kBAAkB;QAClB,MAAMC,gBAAgBC,IAAIC,gBACxB,IAAIC,KAAK;YAACC,KAAKC,UAAUX;SAAW,EAAE;YACpCY,MAAM;QACR;QAEF,iBAAiB;QACjBX,cAAcI,QAAQQ,OAAOP;QAC7BL,cAAcI,QAAQS;QACtB,0CAA0C;QAC1CP,IAAIQ,gBAAgBT;IACtB;IAEA,qBACE;;0BACE,KAACZ;gBAAYsB,aAAarB,aAAasB;0BACrC,cAAA,KAACpB;oBAAkBqB,cAAYvB,aAAasB;oBAAmBE,SAASf;oBAAuBgB,IAAI;wBAAElB;oBAAO;8BAC1G,cAAA,KAACT;;;0BAML,KAAC4B;gBAAEC,KAAKrB;gBAAesB,OAAO;oBAAEC,SAAS;gBAAO;gBAAGC,UAAU,CAAC,EAAEzB,UAAU0B,SAASC,KAAK,KAAK,CAAC;;;;AAGpG"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/DownloadButton/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './DownloadButton';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"sources":["../../../src/components/DownloadButton/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './DownloadButton';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,mBAAmB"}
@@ -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;AAAA,SAASA,MAAM,QAAQ,eAAe,CAAC;AACvC,OAAOC,UAAU,MAAM,+BAA+B,CAAC;AAcvD,OAAO,MAAMC,UAAU,GAAG,CAAC,EAAEC,KAAK,EAAG,MAAM,CAAA,EAAEC,OAAO,CAAA,EAAmB,GAAK;IAC1E,qBACE,KAACJ,MAAM;QACLI,OAAO,EAAEA,OAAO;QAChBC,SAAS,gBAAE,KAACJ,UAAU,KAAG;QACzBK,OAAO,EAAC,UAAU;QAClBC,KAAK,EAAC,WAAW;QACjBC,EAAE,EAAE;YAAEC,UAAU,EAAE,QAAQ;YAAEC,QAAQ,EAAE,MAAM;SAAE;kBAE7CP,KAAK;MACC,CACT;AACJ,CAAC,CAAC"}
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,OAAQ,OAAM,EAAEC,QAAO,EAAmB;IACrE,qBACE,KAACJ;QACCI,SAASA;QACTC,yBAAW,KAACJ;QACZK,SAAQ;QACRC,OAAM;QACNC,IAAI;YAAEC,YAAY;YAAUC,UAAU;QAAO;kBAE5CP;;AAGP,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/EditButton/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './EditButton';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,cAAc,CAAC"}
1
+ {"version":3,"sources":["../../../src/components/EditButton/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './EditButton';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,eAAe"}
@@ -1,3 +1,6 @@
1
1
  /// <reference types="react" />
2
- export declare const EditJsonButton: () => JSX.Element;
2
+ export interface EditJsonButtonProps {
3
+ isReadonly: boolean;
4
+ }
5
+ export declare const EditJsonButton: (props: EditJsonButtonProps) => JSX.Element;
3
6
  //# sourceMappingURL=EditJsonButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EditJsonButton.d.ts","sourceRoot":"","sources":["../../../src/components/EditJsonButton/EditJsonButton.tsx"],"names":[],"mappings":";AAmBA,eAAO,MAAM,cAAc,mBAS1B,CAAC"}
1
+ {"version":3,"file":"EditJsonButton.d.ts","sourceRoot":"","sources":["../../../src/components/EditJsonButton/EditJsonButton.tsx"],"names":[],"mappings":";AAmBA,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,cAAc,UAAW,mBAAmB,gBAaxD,CAAC"}
@@ -16,12 +16,14 @@ import { InfoTooltip } from '@perses-dev/components';
16
16
  import { TOOLTIP_TEXT } from '../../constants';
17
17
  import { ToolbarIconButton } from '../ToolbarIconButton';
18
18
  import { useEditJsonDialog } from '../../context';
19
- export const EditJsonButton = ()=>{
19
+ export const EditJsonButton = (props)=>{
20
+ const { isReadonly } = props;
20
21
  const { openEditJsonDialog } = useEditJsonDialog();
22
+ const info = isReadonly ? TOOLTIP_TEXT.viewJson : TOOLTIP_TEXT.editJson;
21
23
  return /*#__PURE__*/ _jsx(InfoTooltip, {
22
- description: TOOLTIP_TEXT.editJson,
24
+ description: info,
23
25
  children: /*#__PURE__*/ _jsx(ToolbarIconButton, {
24
- "aria-label": TOOLTIP_TEXT.editJson,
26
+ "aria-label": info,
25
27
  variant: "outlined",
26
28
  onClick: ()=>openEditJsonDialog(),
27
29
  children: /*#__PURE__*/ _jsx(CodeIcon, {})
@@ -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 } from '@perses-dev/components';\nimport { TOOLTIP_TEXT } from '../../constants';\nimport { ToolbarIconButton } from '../ToolbarIconButton';\nimport { useEditJsonDialog } from '../../context';\n\nexport const EditJsonButton = () => {\n const { openEditJsonDialog } = useEditJsonDialog();\n return (\n <InfoTooltip description={TOOLTIP_TEXT.editJson}>\n <ToolbarIconButton aria-label={TOOLTIP_TEXT.editJson} variant=\"outlined\" onClick={() => openEditJsonDialog()}>\n <CodeIcon />\n </ToolbarIconButton>\n </InfoTooltip>\n );\n};\n"],"names":["CodeIcon","InfoTooltip","TOOLTIP_TEXT","ToolbarIconButton","useEditJsonDialog","EditJsonButton","openEditJsonDialog","description","editJson","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;AAAA,OAAOA,QAAQ,MAAM,4BAA4B,CAAC;AAClD,SAASC,WAAW,QAAQ,wBAAwB,CAAC;AACrD,SAASC,YAAY,QAAQ,iBAAiB,CAAC;AAC/C,SAASC,iBAAiB,QAAQ,sBAAsB,CAAC;AACzD,SAASC,iBAAiB,QAAQ,eAAe,CAAC;AAElD,OAAO,MAAMC,cAAc,GAAG,IAAM;IAClC,MAAM,EAAEC,kBAAkB,CAAA,EAAE,GAAGF,iBAAiB,EAAE,AAAC;IACnD,qBACE,KAACH,WAAW;QAACM,WAAW,EAAEL,YAAY,CAACM,QAAQ;kBAC7C,cAAA,KAACL,iBAAiB;YAACM,YAAU,EAAEP,YAAY,CAACM,QAAQ;YAAEE,OAAO,EAAC,UAAU;YAACC,OAAO,EAAE,IAAML,kBAAkB,EAAE;sBAC1G,cAAA,KAACN,QAAQ,KAAG;UACM;MACR,CACd;AACJ,CAAC,CAAC"}
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 } from '@perses-dev/components';\nimport { TOOLTIP_TEXT } from '../../constants';\nimport { ToolbarIconButton } from '../ToolbarIconButton';\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","TOOLTIP_TEXT","ToolbarIconButton","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,QAAQ,yBAAyB;AACrD,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SAASC,iBAAiB,QAAQ,uBAAuB;AACzD,SAASC,iBAAiB,QAAQ,gBAAgB;AAMlD,OAAO,MAAMC,iBAAiB,CAACC;IAC7B,MAAM,EAAEC,WAAU,EAAE,GAAGD;IACvB,MAAM,EAAEE,mBAAkB,EAAE,GAAGJ;IAE/B,MAAMK,OAAOF,aAAaL,aAAaQ,WAAWR,aAAaS;IAE/D,qBACE,KAACV;QAAYW,aAAaH;kBACxB,cAAA,KAACN;YAAkBU,cAAYJ;YAAMK,SAAQ;YAAWC,SAAS,IAAMP;sBACrE,cAAA,KAACR;;;AAIT,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/EditJsonButton/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './EditJsonButton';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"sources":["../../../src/components/EditJsonButton/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './EditJsonButton';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,mBAAmB"}
@@ -1,3 +1,7 @@
1
1
  /// <reference types="react" />
2
- export declare const EditJsonDialog: () => JSX.Element;
2
+ export interface EditJsonDialogProps {
3
+ isReadonly: boolean;
4
+ disableMetadataEdition?: boolean;
5
+ }
6
+ export declare const EditJsonDialog: (props: EditJsonDialogProps) => JSX.Element;
3
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,eAAO,MAAM,cAAc,mBAS1B,CAAC"}
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,gBAYxD,CAAC"}
@@ -14,10 +14,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
14
  import { useState } from 'react';
15
15
  import { Alert, FormControl } from '@mui/material';
16
16
  import { Dialog, JSONEditor } from '@perses-dev/components';
17
- import { useTimeRange } from '@perses-dev/plugin-system';
17
+ import { useDatasourceStore, useTimeRange } from '@perses-dev/plugin-system';
18
18
  import { useEditJsonDialog } from '../../context/DashboardProvider';
19
19
  import { useDashboard } from '../../context/useDashboard';
20
- export const EditJsonDialog = ()=>{
20
+ export const EditJsonDialog = (props)=>{
21
+ const { isReadonly , disableMetadataEdition } = props;
21
22
  const { editJsonDialog , closeEditJsonDialog } = useEditJsonDialog();
22
23
  return /*#__PURE__*/ _jsxs(Dialog, {
23
24
  open: !!(editJsonDialog === null || editJsonDialog === void 0 ? void 0 : editJsonDialog.isOpen),
@@ -25,18 +26,26 @@ export const EditJsonDialog = ()=>{
25
26
  fullWidth: true,
26
27
  maxWidth: "lg",
27
28
  children: [
28
- /*#__PURE__*/ _jsx(Dialog.Header, {
29
+ /*#__PURE__*/ _jsxs(Dialog.Header, {
29
30
  onClose: ()=>closeEditJsonDialog(),
30
- children: "Edit Dashboard"
31
+ children: [
32
+ !isReadonly && 'Edit ',
33
+ " Dashboard JSON"
34
+ ]
31
35
  }),
32
- (editJsonDialog === null || editJsonDialog === void 0 ? void 0 : editJsonDialog.isOpen) && /*#__PURE__*/ _jsx(EditJsonDialogForm, {})
36
+ (editJsonDialog === null || editJsonDialog === void 0 ? void 0 : editJsonDialog.isOpen) && /*#__PURE__*/ _jsx(EditJsonDialogForm, {
37
+ isReadonly: isReadonly,
38
+ disableMetadataEdition: disableMetadataEdition
39
+ })
33
40
  ]
34
41
  });
35
42
  };
36
- const EditJsonDialogForm = ()=>{
43
+ const EditJsonDialogForm = (props)=>{
44
+ const { isReadonly , disableMetadataEdition } = props;
37
45
  const { closeEditJsonDialog } = useEditJsonDialog();
38
46
  const { setTimeRange , setRefreshInterval } = useTimeRange();
39
47
  const { dashboard , setDashboard } = useDashboard();
48
+ const { setLocalDatasources } = useDatasourceStore();
40
49
  const [draftDashboard, setDraftDashboard] = useState(dashboard);
41
50
  const handleApply = (e)=>{
42
51
  e.preventDefault();
@@ -44,10 +53,20 @@ const EditJsonDialogForm = ()=>{
44
53
  setTimeRange({
45
54
  pastDuration: draftDashboard.spec.duration
46
55
  });
47
- var _refreshInterval;
48
- setRefreshInterval((_refreshInterval = draftDashboard.spec.refreshInterval) !== null && _refreshInterval !== void 0 ? _refreshInterval : '0s');
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 : {});
49
60
  closeEditJsonDialog();
50
61
  };
62
+ const completeDraftDashboard = (dashboard)=>{
63
+ try {
64
+ const json = JSON.parse(dashboard !== null && dashboard !== void 0 ? dashboard : '{}');
65
+ setDraftDashboard(json);
66
+ } catch (e) {
67
+ // do nothing
68
+ }
69
+ };
51
70
  return /*#__PURE__*/ _jsxs(Dialog.Form, {
52
71
  onSubmit: handleApply,
53
72
  children: [
@@ -56,7 +75,7 @@ const EditJsonDialogForm = ()=>{
56
75
  width: '100%'
57
76
  },
58
77
  children: [
59
- /*#__PURE__*/ _jsx(Alert, {
78
+ disableMetadataEdition && !isReadonly && /*#__PURE__*/ _jsx(Alert, {
60
79
  sx: {
61
80
  marginBottom: (theme)=>theme.spacing(1)
62
81
  },
@@ -67,14 +86,15 @@ const EditJsonDialogForm = ()=>{
67
86
  fullWidth: true,
68
87
  children: /*#__PURE__*/ _jsx(JSONEditor, {
69
88
  minHeight: "300px",
70
- maxHeight: "700px",
89
+ maxHeight: "70vh",
71
90
  value: draftDashboard,
72
- onChange: (value)=>setDraftDashboard(value)
91
+ onChange: (value)=>completeDraftDashboard(value),
92
+ readOnly: isReadonly
73
93
  })
74
94
  })
75
95
  ]
76
96
  }),
77
- /*#__PURE__*/ _jsx(Dialog.Actions, {
97
+ !isReadonly && /*#__PURE__*/ _jsx(Dialog.Actions, {
78
98
  children: /*#__PURE__*/ _jsx(Dialog.PrimaryButton, {
79
99
  onClick: handleApply,
80
100
  children: "Apply"
@@ -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 { useTimeRange } from '@perses-dev/plugin-system';\nimport { useEditJsonDialog } from '../../context/DashboardProvider';\nimport { useDashboard } from '../../context/useDashboard';\n\nexport const EditJsonDialog = () => {\n const { editJsonDialog, closeEditJsonDialog } = useEditJsonDialog();\n\n return (\n <Dialog open={!!editJsonDialog?.isOpen} scroll=\"paper\" fullWidth maxWidth=\"lg\">\n <Dialog.Header onClose={() => closeEditJsonDialog()}>Edit Dashboard</Dialog.Header>\n {editJsonDialog?.isOpen && <EditJsonDialogForm />}\n </Dialog>\n );\n};\n\nconst EditJsonDialogForm = () => {\n const { closeEditJsonDialog } = useEditJsonDialog();\n const { setTimeRange, setRefreshInterval } = useTimeRange();\n const { dashboard, setDashboard } = useDashboard();\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 closeEditJsonDialog();\n };\n\n return (\n <Dialog.Form onSubmit={handleApply}>\n <Dialog.Content sx={{ width: '100%' }}>\n <Alert sx={{ marginBottom: (theme) => theme.spacing(1) }} severity=\"warning\">\n Metadata cannot be modified or saved.\n </Alert>\n <FormControl fullWidth>\n <JSONEditor\n minHeight=\"300px\"\n maxHeight=\"700px\"\n value={draftDashboard}\n onChange={(value) => setDraftDashboard(value)}\n />\n </FormControl>\n </Dialog.Content>\n <Dialog.Actions>\n <Dialog.PrimaryButton onClick={handleApply}>Apply</Dialog.PrimaryButton>\n </Dialog.Actions>\n </Dialog.Form>\n );\n};\n"],"names":["useState","Alert","FormControl","Dialog","JSONEditor","useTimeRange","useEditJsonDialog","useDashboard","EditJsonDialog","editJsonDialog","closeEditJsonDialog","open","isOpen","scroll","fullWidth","maxWidth","Header","onClose","EditJsonDialogForm","setTimeRange","setRefreshInterval","dashboard","setDashboard","draftDashboard","setDraftDashboard","handleApply","e","preventDefault","pastDuration","spec","duration","refreshInterval","Form","onSubmit","Content","sx","width","marginBottom","theme","spacing","severity","minHeight","maxHeight","value","onChange","Actions","PrimaryButton","onClick"],"mappings":"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"}
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 <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","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,kCAAkC;AACpE,SAASC,YAAY,QAAQ,6BAA6B;AAO1D,OAAO,MAAMC,iBAAiB,CAACC;IAC7B,MAAM,EAAEC,WAAU,EAAEC,uBAAsB,EAAE,GAAGF;IAC/C,MAAM,EAAEG,eAAc,EAAEC,oBAAmB,EAAE,GAAGP;IAEhD,qBACE,MAACJ;QAAOY,MAAM,CAAC,CAACF,CAAAA,2BAAAA,4BAAAA,KAAAA,IAAAA,eAAgBG,MAAK;QAAGC,QAAO;QAAQC,SAAS;QAACC,UAAS;;0BACxE,MAAChB,OAAOiB;gBAAOC,SAAS,IAAMP;;oBAAwB,CAACH,cAAc;oBAAQ;;;YAC5EE,CAAAA,2BAAAA,4BAAAA,KAAAA,IAAAA,eAAgBG,MAAK,mBACpB,KAACM;gBAAmBX,YAAYA;gBAAYC,wBAAwBA;;;;AAI5E,EAAE;AAEF,MAAMU,qBAAqB,CAACZ;IAC1B,MAAM,EAAEC,WAAU,EAAEC,uBAAsB,EAAE,GAAGF;IAC/C,MAAM,EAAEI,oBAAmB,EAAE,GAAGP;IAChC,MAAM,EAAEgB,aAAY,EAAEC,mBAAkB,EAAE,GAAGlB;IAC7C,MAAM,EAAEmB,UAAS,EAAEC,aAAY,EAAE,GAAGlB;IACpC,MAAM,EAAEmB,oBAAmB,EAAE,GAAGtB;IAChC,MAAM,CAACuB,gBAAgBC,kBAAkB,GAAG7B,SAASyB;IAErD,MAAMK,cAAc,CAACC;QACnBA,EAAEC;QACFN,aAAaE;QACbL,aAAa;YAAEU,cAAcL,eAAeM,KAAKC;QAAS;YACvCP;QAAnBJ,mBAAmBI,CAAAA,uCAAAA,eAAeM,KAAKE,6BAApBR,kDAAAA,uCAAuC;YACtCA;QAApBD,oBAAoBC,CAAAA,mCAAAA,eAAeM,KAAKG,yBAApBT,8CAAAA,mCAAmC,CAAC;QACxDd;IACF;IAEA,MAAMwB,yBAAyB,CAACb;QAC9B,IAAI;YACF,MAAMc,OAAOC,KAAKC,MAAMhB,sBAAAA,uBAAAA,YAAa;YACrCI,kBAAkBU;QACpB,EAAE,OAAOR,GAAG;QACV,aAAa;QACf;IACF;IAEA,qBACE,MAAC5B,OAAOuC;QAAKC,UAAUb;;0BACrB,MAAC3B,OAAOyC;gBAAQC,IAAI;oBAAEC,OAAO;gBAAO;;oBACjClC,0BAA0B,CAACD,4BAC1B,KAACV;wBAAM4C,IAAI;4BAAEE,cAAc,CAACC,QAAUA,MAAMC,QAAQ;wBAAG;wBAAGC,UAAS;kCAAU;;kCAI/E,KAAChD;wBAAYgB,SAAS;kCACpB,cAAA,KAACd;4BACC+C,WAAU;4BACVC,WAAU;4BACVC,OAAOzB;4BACP0B,UAAU,CAACD,QAAkBf,uBAAuBe;4BACpDE,UAAU5C;;;;;YAIf,CAACA,4BACA,KAACR,OAAOqD;0BACN,cAAA,KAACrD,OAAOsD;oBAAcC,SAAS5B;8BAAa;;;;;AAKtD"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/EditJsonDialog/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './EditJsonDialog';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"sources":["../../../src/components/EditJsonDialog/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './EditJsonDialog';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,mBAAmB"}