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

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 (290) hide show
  1. package/dist/cjs/components/DashboardLinks/DashboardLinksEditor.js +366 -0
  2. package/dist/cjs/components/DashboardLinks/EditDashboardLinksButton.js +81 -0
  3. package/dist/cjs/components/DashboardLinks/index.js +31 -0
  4. package/dist/cjs/components/DashboardShortcuts/index.js +23 -0
  5. package/dist/cjs/components/DashboardShortcuts/useDashboardShortcuts.js +373 -0
  6. package/dist/cjs/components/DashboardToolbar/DashboardToolbar.js +16 -1
  7. package/dist/cjs/components/Datasources/EditDatasourcesButton.js +1 -7
  8. package/dist/cjs/components/GridLayout/GridItemContent.js +19 -6
  9. package/dist/cjs/components/{Panel/PanelLinks.js → LinksDisplay/LinksDisplay.js} +59 -10
  10. package/dist/cjs/components/LinksDisplay/index.js +30 -0
  11. package/dist/cjs/components/Panel/PanelActions.js +38 -23
  12. package/dist/cjs/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +4 -4
  13. package/dist/cjs/components/SaveDashboardButton/SaveDashboardButton.js +3 -61
  14. package/dist/cjs/components/Variables/ListVariableListBox.js +6 -6
  15. package/dist/cjs/components/Variables/Variable.js +3 -3
  16. package/dist/cjs/components/index.js +2 -0
  17. package/dist/cjs/constants/user-interface-text.js +1 -0
  18. package/dist/cjs/context/DashboardProvider/DashboardProvider.js +5 -1
  19. package/dist/cjs/context/DashboardProvider/dashboard-provider-api.js +16 -0
  20. package/dist/cjs/context/DashboardProvider/index.js +7 -0
  21. package/dist/cjs/context/DashboardProvider/links-slice.js +32 -0
  22. package/dist/cjs/context/DashboardProvider/panel-group-slice.js +2 -2
  23. package/dist/cjs/context/DashboardProvider/use-save-dashboard.js +104 -0
  24. package/dist/cjs/context/DatasourceStoreProvider.js +3 -9
  25. package/dist/cjs/context/VariableProvider/VariableProvider.js +7 -6
  26. package/dist/cjs/context/VariableProvider/hydrationUtils.js +3 -3
  27. package/dist/cjs/context/useDashboard.js +7 -4
  28. package/dist/cjs/index.js +2 -0
  29. package/dist/cjs/keyboard-shortcuts/PanelFocusProvider.js +157 -0
  30. package/dist/cjs/keyboard-shortcuts/default-shortcuts/dashboard.js +75 -0
  31. package/dist/cjs/keyboard-shortcuts/default-shortcuts/global.js +121 -0
  32. package/dist/cjs/keyboard-shortcuts/default-shortcuts/index.js +33 -0
  33. package/dist/cjs/keyboard-shortcuts/default-shortcuts/panel.js +90 -0
  34. package/dist/cjs/keyboard-shortcuts/default-shortcuts/time-range.js +142 -0
  35. package/dist/cjs/keyboard-shortcuts/events.js +93 -0
  36. package/dist/cjs/keyboard-shortcuts/index.js +89 -0
  37. package/dist/cjs/keyboard-shortcuts/types.js +42 -0
  38. package/dist/cjs/keyboard-shortcuts/utils.js +76 -0
  39. package/dist/cjs/model/DashboardResource.js +16 -0
  40. package/dist/cjs/model/index.js +30 -0
  41. package/dist/cjs/test/render.js +18 -3
  42. package/dist/cjs/views/ViewDashboard/DashboardApp.js +17 -2
  43. package/dist/cjs/views/ViewDashboard/ViewDashboard.js +2 -1
  44. package/dist/components/Dashboard/Dashboard.d.ts.map +1 -1
  45. package/dist/components/Dashboard/Dashboard.js.map +1 -1
  46. package/dist/components/DashboardLinks/DashboardLinksEditor.d.ts +9 -0
  47. package/dist/components/DashboardLinks/DashboardLinksEditor.d.ts.map +1 -0
  48. package/dist/components/DashboardLinks/DashboardLinksEditor.js +353 -0
  49. package/dist/components/DashboardLinks/DashboardLinksEditor.js.map +1 -0
  50. package/dist/components/DashboardLinks/EditDashboardLinksButton.d.ts +18 -0
  51. package/dist/components/DashboardLinks/EditDashboardLinksButton.d.ts.map +1 -0
  52. package/dist/components/DashboardLinks/EditDashboardLinksButton.js +68 -0
  53. package/dist/components/DashboardLinks/EditDashboardLinksButton.js.map +1 -0
  54. package/dist/components/DashboardLinks/index.d.ts +3 -0
  55. package/dist/components/DashboardLinks/index.d.ts.map +1 -0
  56. package/dist/components/DashboardLinks/index.js +16 -0
  57. package/dist/components/DashboardLinks/index.js.map +1 -0
  58. package/dist/components/DashboardShortcuts/index.d.ts +3 -0
  59. package/dist/components/DashboardShortcuts/index.d.ts.map +1 -0
  60. package/dist/components/DashboardShortcuts/index.js +15 -0
  61. package/dist/components/DashboardShortcuts/index.js.map +1 -0
  62. package/dist/components/DashboardShortcuts/useDashboardShortcuts.d.ts +12 -0
  63. package/dist/components/DashboardShortcuts/useDashboardShortcuts.d.ts.map +1 -0
  64. package/dist/components/DashboardShortcuts/useDashboardShortcuts.js +365 -0
  65. package/dist/components/DashboardShortcuts/useDashboardShortcuts.js.map +1 -0
  66. package/dist/components/DashboardToolbar/DashboardToolbar.d.ts +1 -0
  67. package/dist/components/DashboardToolbar/DashboardToolbar.d.ts.map +1 -1
  68. package/dist/components/DashboardToolbar/DashboardToolbar.js +17 -2
  69. package/dist/components/DashboardToolbar/DashboardToolbar.js.map +1 -1
  70. package/dist/components/Datasources/DatasourceEditor.d.ts +1 -1
  71. package/dist/components/Datasources/DatasourceEditor.d.ts.map +1 -1
  72. package/dist/components/Datasources/DatasourceEditor.js.map +1 -1
  73. package/dist/components/Datasources/EditDatasourcesButton.d.ts.map +1 -1
  74. package/dist/components/Datasources/EditDatasourcesButton.js +1 -7
  75. package/dist/components/Datasources/EditDatasourcesButton.js.map +1 -1
  76. package/dist/components/DownloadButton/serializeDashboard.d.ts +2 -2
  77. package/dist/components/DownloadButton/serializeDashboard.d.ts.map +1 -1
  78. package/dist/components/DownloadButton/serializeDashboard.js.map +1 -1
  79. package/dist/components/GridLayout/GridItemContent.d.ts.map +1 -1
  80. package/dist/components/GridLayout/GridItemContent.js +21 -8
  81. package/dist/components/GridLayout/GridItemContent.js.map +1 -1
  82. package/dist/components/GridLayout/GridLayout.d.ts +1 -1
  83. package/dist/components/GridLayout/GridLayout.d.ts.map +1 -1
  84. package/dist/components/GridLayout/GridLayout.js.map +1 -1
  85. package/dist/components/GridLayout/GridTitle.d.ts +1 -1
  86. package/dist/components/GridLayout/GridTitle.js.map +1 -1
  87. package/dist/components/GridLayout/Row.d.ts +2 -1
  88. package/dist/components/GridLayout/Row.d.ts.map +1 -1
  89. package/dist/components/GridLayout/Row.js.map +1 -1
  90. package/dist/components/LeaveDialog/LeaveDialog.d.ts +3 -3
  91. package/dist/components/LeaveDialog/LeaveDialog.d.ts.map +1 -1
  92. package/dist/components/LeaveDialog/LeaveDialog.js.map +1 -1
  93. package/dist/components/LinksDisplay/LinksDisplay.d.ts +10 -0
  94. package/dist/components/LinksDisplay/LinksDisplay.d.ts.map +1 -0
  95. package/dist/components/{Panel/PanelLinks.js → LinksDisplay/LinksDisplay.js} +59 -10
  96. package/dist/components/LinksDisplay/LinksDisplay.js.map +1 -0
  97. package/dist/components/LinksDisplay/index.d.ts +2 -0
  98. package/dist/components/LinksDisplay/index.d.ts.map +1 -0
  99. package/dist/components/LinksDisplay/index.js +15 -0
  100. package/dist/components/LinksDisplay/index.js.map +1 -0
  101. package/dist/components/Panel/Panel.d.ts +2 -1
  102. package/dist/components/Panel/Panel.d.ts.map +1 -1
  103. package/dist/components/Panel/Panel.js.map +1 -1
  104. package/dist/components/Panel/PanelActions.d.ts +1 -1
  105. package/dist/components/Panel/PanelActions.d.ts.map +1 -1
  106. package/dist/components/Panel/PanelActions.js +39 -24
  107. package/dist/components/Panel/PanelActions.js.map +1 -1
  108. package/dist/components/Panel/PanelContent.d.ts +1 -1
  109. package/dist/components/Panel/PanelContent.js.map +1 -1
  110. package/dist/components/Panel/PanelHeader.d.ts +1 -1
  111. package/dist/components/Panel/PanelHeader.js.map +1 -1
  112. package/dist/components/Panel/PanelPluginLoader.d.ts +1 -1
  113. package/dist/components/Panel/PanelPluginLoader.js.map +1 -1
  114. package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -1
  115. package/dist/components/PanelDrawer/PanelEditorForm.d.ts +2 -1
  116. package/dist/components/PanelDrawer/PanelEditorForm.d.ts.map +1 -1
  117. package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -1
  118. package/dist/components/PanelDrawer/PanelPreview.d.ts +1 -1
  119. package/dist/components/PanelDrawer/PanelPreview.js.map +1 -1
  120. package/dist/components/PanelDrawer/PanelQueriesSharedControls.d.ts +1 -1
  121. package/dist/components/PanelDrawer/PanelQueriesSharedControls.js.map +1 -1
  122. package/dist/components/PanelDrawer/usePanelEditor.d.ts +1 -1
  123. package/dist/components/PanelDrawer/usePanelEditor.js.map +1 -1
  124. package/dist/components/QuerySummaryTable/QuerySummaryTable.js.map +1 -1
  125. package/dist/components/QueryViewerDialog/QueryViewerDialog.d.ts +1 -1
  126. package/dist/components/QueryViewerDialog/QueryViewerDialog.js.map +1 -1
  127. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +1 -1
  128. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js.map +1 -1
  129. package/dist/components/SaveDashboardButton/SaveDashboardButton.d.ts.map +1 -1
  130. package/dist/components/SaveDashboardButton/SaveDashboardButton.js +4 -62
  131. package/dist/components/SaveDashboardButton/SaveDashboardButton.js.map +1 -1
  132. package/dist/components/Variables/BuiltinVariableAccordions.d.ts +1 -1
  133. package/dist/components/Variables/BuiltinVariableAccordions.js.map +1 -1
  134. package/dist/components/Variables/EditVariablesButton.d.ts.map +1 -1
  135. package/dist/components/Variables/EditVariablesButton.js.map +1 -1
  136. package/dist/components/Variables/ListVariableListBox.js +1 -1
  137. package/dist/components/Variables/ListVariableListBox.js.map +1 -1
  138. package/dist/components/Variables/Variable.d.ts +1 -1
  139. package/dist/components/Variables/Variable.js +1 -1
  140. package/dist/components/Variables/Variable.js.map +1 -1
  141. package/dist/components/Variables/VariableEditor.d.ts +2 -1
  142. package/dist/components/Variables/VariableEditor.d.ts.map +1 -1
  143. package/dist/components/Variables/VariableEditor.js.map +1 -1
  144. package/dist/components/Variables/VariableList.d.ts +1 -1
  145. package/dist/components/Variables/VariableList.d.ts.map +1 -1
  146. package/dist/components/Variables/VariableList.js.map +1 -1
  147. package/dist/components/index.d.ts +2 -0
  148. package/dist/components/index.d.ts.map +1 -1
  149. package/dist/components/index.js +2 -0
  150. package/dist/components/index.js.map +1 -1
  151. package/dist/constants/user-interface-text.d.ts +1 -0
  152. package/dist/constants/user-interface-text.d.ts.map +1 -1
  153. package/dist/constants/user-interface-text.js +1 -0
  154. package/dist/constants/user-interface-text.js.map +1 -1
  155. package/dist/context/DashboardProvider/DashboardProvider.d.ts +8 -6
  156. package/dist/context/DashboardProvider/DashboardProvider.d.ts.map +1 -1
  157. package/dist/context/DashboardProvider/DashboardProvider.js +5 -1
  158. package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -1
  159. package/dist/context/DashboardProvider/common.d.ts +3 -2
  160. package/dist/context/DashboardProvider/common.d.ts.map +1 -1
  161. package/dist/context/DashboardProvider/common.js.map +1 -1
  162. package/dist/context/DashboardProvider/dashboard-provider-api.d.ts +15 -2
  163. package/dist/context/DashboardProvider/dashboard-provider-api.d.ts.map +1 -1
  164. package/dist/context/DashboardProvider/dashboard-provider-api.js +14 -0
  165. package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -1
  166. package/dist/context/DashboardProvider/delete-panel-group-slice.d.ts +1 -1
  167. package/dist/context/DashboardProvider/delete-panel-group-slice.js.map +1 -1
  168. package/dist/context/DashboardProvider/delete-panel-slice.js.map +1 -1
  169. package/dist/context/DashboardProvider/duplicate-panel-slice.js.map +1 -1
  170. package/dist/context/DashboardProvider/index.d.ts +2 -0
  171. package/dist/context/DashboardProvider/index.d.ts.map +1 -1
  172. package/dist/context/DashboardProvider/index.js +1 -0
  173. package/dist/context/DashboardProvider/index.js.map +1 -1
  174. package/dist/context/DashboardProvider/links-slice.d.ts +19 -0
  175. package/dist/context/DashboardProvider/links-slice.d.ts.map +1 -0
  176. package/dist/context/DashboardProvider/links-slice.js +27 -0
  177. package/dist/context/DashboardProvider/links-slice.js.map +1 -0
  178. package/dist/context/DashboardProvider/panel-editor-slice.d.ts +2 -1
  179. package/dist/context/DashboardProvider/panel-editor-slice.d.ts.map +1 -1
  180. package/dist/context/DashboardProvider/panel-editor-slice.js.map +1 -1
  181. package/dist/context/DashboardProvider/panel-group-editor-slice.d.ts +1 -1
  182. package/dist/context/DashboardProvider/panel-group-editor-slice.js.map +1 -1
  183. package/dist/context/DashboardProvider/panel-group-slice.d.ts +2 -1
  184. package/dist/context/DashboardProvider/panel-group-slice.d.ts.map +1 -1
  185. package/dist/context/DashboardProvider/panel-group-slice.js +1 -1
  186. package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -1
  187. package/dist/context/DashboardProvider/panel-slice.d.ts +1 -1
  188. package/dist/context/DashboardProvider/panel-slice.js.map +1 -1
  189. package/dist/context/DashboardProvider/use-save-dashboard.d.ts +25 -0
  190. package/dist/context/DashboardProvider/use-save-dashboard.d.ts.map +1 -0
  191. package/dist/context/DashboardProvider/use-save-dashboard.js +105 -0
  192. package/dist/context/DashboardProvider/use-save-dashboard.js.map +1 -0
  193. package/dist/context/DashboardProvider/view-panel-slice.d.ts.map +1 -1
  194. package/dist/context/DashboardProvider/view-panel-slice.js.map +1 -1
  195. package/dist/context/DatasourceStoreProvider.d.ts +4 -2
  196. package/dist/context/DatasourceStoreProvider.d.ts.map +1 -1
  197. package/dist/context/DatasourceStoreProvider.js +3 -9
  198. package/dist/context/DatasourceStoreProvider.js.map +1 -1
  199. package/dist/context/VariableProvider/VariableProvider.d.ts +2 -1
  200. package/dist/context/VariableProvider/VariableProvider.d.ts.map +1 -1
  201. package/dist/context/VariableProvider/VariableProvider.js +2 -1
  202. package/dist/context/VariableProvider/VariableProvider.js.map +1 -1
  203. package/dist/context/VariableProvider/hydrationUtils.d.ts +2 -1
  204. package/dist/context/VariableProvider/hydrationUtils.d.ts.map +1 -1
  205. package/dist/context/VariableProvider/hydrationUtils.js +1 -1
  206. package/dist/context/VariableProvider/hydrationUtils.js.map +1 -1
  207. package/dist/context/VariableProvider/query-params.d.ts +1 -1
  208. package/dist/context/VariableProvider/query-params.js.map +1 -1
  209. package/dist/context/VariableProvider/utils.d.ts +2 -1
  210. package/dist/context/VariableProvider/utils.d.ts.map +1 -1
  211. package/dist/context/VariableProvider/utils.js.map +1 -1
  212. package/dist/context/useDashboard.d.ts +11 -3
  213. package/dist/context/useDashboard.d.ts.map +1 -1
  214. package/dist/context/useDashboard.js +6 -3
  215. package/dist/context/useDashboard.js.map +1 -1
  216. package/dist/index.d.ts +2 -0
  217. package/dist/index.d.ts.map +1 -1
  218. package/dist/index.js +2 -0
  219. package/dist/index.js.map +1 -1
  220. package/dist/keyboard-shortcuts/PanelFocusProvider.d.ts +12 -0
  221. package/dist/keyboard-shortcuts/PanelFocusProvider.d.ts.map +1 -0
  222. package/dist/keyboard-shortcuts/PanelFocusProvider.js +97 -0
  223. package/dist/keyboard-shortcuts/PanelFocusProvider.js.map +1 -0
  224. package/dist/keyboard-shortcuts/default-shortcuts/dashboard.d.ts +6 -0
  225. package/dist/keyboard-shortcuts/default-shortcuts/dashboard.d.ts.map +1 -0
  226. package/dist/keyboard-shortcuts/default-shortcuts/dashboard.js +53 -0
  227. package/dist/keyboard-shortcuts/default-shortcuts/dashboard.js.map +1 -0
  228. package/dist/keyboard-shortcuts/default-shortcuts/global.d.ts +9 -0
  229. package/dist/keyboard-shortcuts/default-shortcuts/global.d.ts.map +1 -0
  230. package/dist/keyboard-shortcuts/default-shortcuts/global.js +90 -0
  231. package/dist/keyboard-shortcuts/default-shortcuts/global.js.map +1 -0
  232. package/dist/keyboard-shortcuts/default-shortcuts/index.d.ts +5 -0
  233. package/dist/keyboard-shortcuts/default-shortcuts/index.d.ts.map +1 -0
  234. package/dist/keyboard-shortcuts/default-shortcuts/index.js +18 -0
  235. package/dist/keyboard-shortcuts/default-shortcuts/index.js.map +1 -0
  236. package/dist/keyboard-shortcuts/default-shortcuts/panel.d.ts +7 -0
  237. package/dist/keyboard-shortcuts/default-shortcuts/panel.d.ts.map +1 -0
  238. package/dist/keyboard-shortcuts/default-shortcuts/panel.js +65 -0
  239. package/dist/keyboard-shortcuts/default-shortcuts/panel.js.map +1 -0
  240. package/dist/keyboard-shortcuts/default-shortcuts/time-range.d.ts +10 -0
  241. package/dist/keyboard-shortcuts/default-shortcuts/time-range.d.ts.map +1 -0
  242. package/dist/keyboard-shortcuts/default-shortcuts/time-range.js +108 -0
  243. package/dist/keyboard-shortcuts/default-shortcuts/time-range.js.map +1 -0
  244. package/dist/keyboard-shortcuts/events.d.ts +18 -0
  245. package/dist/keyboard-shortcuts/events.d.ts.map +1 -0
  246. package/dist/keyboard-shortcuts/events.js +35 -0
  247. package/dist/keyboard-shortcuts/events.js.map +1 -0
  248. package/dist/keyboard-shortcuts/index.d.ts +9 -0
  249. package/dist/keyboard-shortcuts/index.d.ts.map +1 -0
  250. package/dist/keyboard-shortcuts/index.js +21 -0
  251. package/dist/keyboard-shortcuts/index.js.map +1 -0
  252. package/dist/keyboard-shortcuts/types.d.ts +37 -0
  253. package/dist/keyboard-shortcuts/types.d.ts.map +1 -0
  254. package/dist/keyboard-shortcuts/types.js +26 -0
  255. package/dist/keyboard-shortcuts/types.js.map +1 -0
  256. package/dist/keyboard-shortcuts/utils.d.ts +12 -0
  257. package/dist/keyboard-shortcuts/utils.d.ts.map +1 -0
  258. package/dist/keyboard-shortcuts/utils.js +51 -0
  259. package/dist/keyboard-shortcuts/utils.js.map +1 -0
  260. package/dist/model/DashboardResource.d.ts +15 -0
  261. package/dist/model/DashboardResource.d.ts.map +1 -0
  262. package/dist/model/DashboardResource.js +18 -0
  263. package/dist/model/DashboardResource.js.map +1 -0
  264. package/dist/model/index.d.ts +2 -0
  265. package/dist/model/index.d.ts.map +1 -0
  266. package/dist/model/index.js +15 -0
  267. package/dist/model/index.js.map +1 -0
  268. package/dist/test/dashboard-provider.d.ts +1 -1
  269. package/dist/test/dashboard-provider.d.ts.map +1 -1
  270. package/dist/test/dashboard-provider.js.map +1 -1
  271. package/dist/test/datasource-provider.js.map +1 -1
  272. package/dist/test/plugin-registry.js.map +1 -1
  273. package/dist/test/render.d.ts.map +1 -1
  274. package/dist/test/render.js +18 -3
  275. package/dist/test/render.js.map +1 -1
  276. package/dist/test/testDashboard.d.ts +11 -2
  277. package/dist/test/testDashboard.d.ts.map +1 -1
  278. package/dist/test/testDashboard.js.map +1 -1
  279. package/dist/utils/panelUtils.js.map +1 -1
  280. package/dist/views/ViewDashboard/DashboardApp.d.ts +5 -3
  281. package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -1
  282. package/dist/views/ViewDashboard/DashboardApp.js +18 -3
  283. package/dist/views/ViewDashboard/DashboardApp.js.map +1 -1
  284. package/dist/views/ViewDashboard/ViewDashboard.d.ts.map +1 -1
  285. package/dist/views/ViewDashboard/ViewDashboard.js +3 -2
  286. package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -1
  287. package/package.json +5 -3
  288. package/dist/components/Panel/PanelLinks.d.ts +0 -6
  289. package/dist/components/Panel/PanelLinks.d.ts.map +0 -1
  290. package/dist/components/Panel/PanelLinks.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/keyboard-shortcuts/types.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { HotkeySequence, RegisterableHotkey } from '@tanstack/hotkeys';\n\n/** Extend TanStack's HotkeyMeta with Perses-specific fields. */\ndeclare module '@tanstack/hotkeys' {\n interface HotkeyMeta {\n /** Unique kebab-case identifier, e.g., \"go-home\", \"save-dashboard\" */\n id: string;\n /** Category for grouping in the help modal */\n category: ShortcutCategory;\n /** Scope in which this shortcut is active */\n scope: ShortcutScope;\n /** Override for display formatting (e.g. '?' for the show-shortcuts shortcut) */\n displayOverride?: string;\n }\n}\n\nexport type ShortcutScope = 'global' | 'dashboard' | 'panel';\n\nexport type ShortcutCategory = 'global' | 'time-range' | 'dashboard' | 'focused-panel';\n\nexport const SHORTCUT_CATEGORY_LABELS: Record<ShortcutCategory, string> = {\n global: 'Global',\n 'time-range': 'Time Range',\n dashboard: 'Dashboard',\n 'focused-panel': 'Focused Panel',\n};\n\nexport const SHORTCUT_CATEGORY_ORDER: ShortcutCategory[] = ['global', 'time-range', 'dashboard', 'focused-panel'];\n\n/** Shortcut definition (data only, no callback). */\nexport interface PersesShortcutDef {\n id: string;\n /** TanStack hotkey for single-key shortcuts (e.g., \"Mod+S\", \"E\", or RawHotkey object) */\n hotkey?: RegisterableHotkey;\n /** TanStack sequence array for multi-key sequences (e.g., ['G', 'H']) */\n sequence?: HotkeySequence;\n name: string;\n description: string;\n category: ShortcutCategory;\n scope: ShortcutScope;\n /** Override TanStack's smart ignoreInputs default if needed */\n ignoreInputs?: boolean;\n /** Custom DOM event name dispatched when this shortcut fires */\n event?: string;\n /** Override for display formatting (e.g. '?' for the show-shortcuts shortcut) */\n displayOverride?: string;\n}\n"],"names":["SHORTCUT_CATEGORY_LABELS","global","dashboard","SHORTCUT_CATEGORY_ORDER"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAsBjC,OAAO,MAAMA,2BAA6D;IACxEC,QAAQ;IACR,cAAc;IACdC,WAAW;IACX,iBAAiB;AACnB,EAAE;AAEF,OAAO,MAAMC,0BAA8C;IAAC;IAAU;IAAc;IAAa;CAAgB,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { HotkeyMeta, HotkeySequence, RegisterableHotkey } from '@tanstack/hotkeys';
2
+ import { PersesShortcutDef } from './types';
3
+ export declare function buildShortcutOptions(def: PersesShortcutDef, enabled: boolean): {
4
+ enabled: boolean;
5
+ meta: HotkeyMeta;
6
+ ignoreInputs?: boolean;
7
+ };
8
+ export declare function requireShortcutHotkey(def: PersesShortcutDef): RegisterableHotkey;
9
+ export declare function requireShortcutSequence(def: PersesShortcutDef): HotkeySequence;
10
+ export declare function requireShortcutEvent(def: PersesShortcutDef): string;
11
+ export declare function dispatchShortcutEvent(eventName: string): void;
12
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/keyboard-shortcuts/utils.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACnF,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,iBAAiB,EACtB,OAAO,EAAE,OAAO,GACf;IACD,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,UAAU,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAaA;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,iBAAiB,GAAG,kBAAkB,CAKhF;AAED,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,iBAAiB,GAAG,cAAc,CAK9E;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,iBAAiB,GAAG,MAAM,CAKnE;AAED,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAE7D"}
@@ -0,0 +1,51 @@
1
+ // Copyright The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ export function buildShortcutOptions(def, enabled) {
14
+ return {
15
+ enabled,
16
+ meta: {
17
+ id: def.id,
18
+ name: def.name,
19
+ description: def.description,
20
+ category: def.category,
21
+ scope: def.scope,
22
+ displayOverride: def.displayOverride
23
+ },
24
+ ...def.ignoreInputs !== undefined ? {
25
+ ignoreInputs: def.ignoreInputs
26
+ } : {}
27
+ };
28
+ }
29
+ export function requireShortcutHotkey(def) {
30
+ if (def.hotkey === undefined) {
31
+ throw new Error(`Shortcut ${def.id} is missing a hotkey definition`);
32
+ }
33
+ return def.hotkey;
34
+ }
35
+ export function requireShortcutSequence(def) {
36
+ if (def.sequence === undefined) {
37
+ throw new Error(`Shortcut ${def.id} is missing a sequence definition`);
38
+ }
39
+ return def.sequence;
40
+ }
41
+ export function requireShortcutEvent(def) {
42
+ if (def.event === undefined) {
43
+ throw new Error(`Shortcut ${def.id} is missing an event definition`);
44
+ }
45
+ return def.event;
46
+ }
47
+ export function dispatchShortcutEvent(eventName) {
48
+ window.dispatchEvent(new CustomEvent(eventName));
49
+ }
50
+
51
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/keyboard-shortcuts/utils.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { HotkeyMeta, HotkeySequence, RegisterableHotkey } from '@tanstack/hotkeys';\nimport { PersesShortcutDef } from './types';\n\nexport function buildShortcutOptions(\n def: PersesShortcutDef,\n enabled: boolean\n): {\n enabled: boolean;\n meta: HotkeyMeta;\n ignoreInputs?: boolean;\n} {\n return {\n enabled,\n meta: {\n id: def.id,\n name: def.name,\n description: def.description,\n category: def.category,\n scope: def.scope,\n displayOverride: def.displayOverride,\n },\n ...(def.ignoreInputs !== undefined ? { ignoreInputs: def.ignoreInputs } : {}),\n };\n}\n\nexport function requireShortcutHotkey(def: PersesShortcutDef): RegisterableHotkey {\n if (def.hotkey === undefined) {\n throw new Error(`Shortcut ${def.id} is missing a hotkey definition`);\n }\n return def.hotkey;\n}\n\nexport function requireShortcutSequence(def: PersesShortcutDef): HotkeySequence {\n if (def.sequence === undefined) {\n throw new Error(`Shortcut ${def.id} is missing a sequence definition`);\n }\n return def.sequence;\n}\n\nexport function requireShortcutEvent(def: PersesShortcutDef): string {\n if (def.event === undefined) {\n throw new Error(`Shortcut ${def.id} is missing an event definition`);\n }\n return def.event;\n}\n\nexport function dispatchShortcutEvent(eventName: string): void {\n window.dispatchEvent(new CustomEvent(eventName));\n}\n"],"names":["buildShortcutOptions","def","enabled","meta","id","name","description","category","scope","displayOverride","ignoreInputs","undefined","requireShortcutHotkey","hotkey","Error","requireShortcutSequence","sequence","requireShortcutEvent","event","dispatchShortcutEvent","eventName","window","dispatchEvent","CustomEvent"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAKjC,OAAO,SAASA,qBACdC,GAAsB,EACtBC,OAAgB;IAMhB,OAAO;QACLA;QACAC,MAAM;YACJC,IAAIH,IAAIG,EAAE;YACVC,MAAMJ,IAAII,IAAI;YACdC,aAAaL,IAAIK,WAAW;YAC5BC,UAAUN,IAAIM,QAAQ;YACtBC,OAAOP,IAAIO,KAAK;YAChBC,iBAAiBR,IAAIQ,eAAe;QACtC;QACA,GAAIR,IAAIS,YAAY,KAAKC,YAAY;YAAED,cAAcT,IAAIS,YAAY;QAAC,IAAI,CAAC,CAAC;IAC9E;AACF;AAEA,OAAO,SAASE,sBAAsBX,GAAsB;IAC1D,IAAIA,IAAIY,MAAM,KAAKF,WAAW;QAC5B,MAAM,IAAIG,MAAM,CAAC,SAAS,EAAEb,IAAIG,EAAE,CAAC,+BAA+B,CAAC;IACrE;IACA,OAAOH,IAAIY,MAAM;AACnB;AAEA,OAAO,SAASE,wBAAwBd,GAAsB;IAC5D,IAAIA,IAAIe,QAAQ,KAAKL,WAAW;QAC9B,MAAM,IAAIG,MAAM,CAAC,SAAS,EAAEb,IAAIG,EAAE,CAAC,iCAAiC,CAAC;IACvE;IACA,OAAOH,IAAIe,QAAQ;AACrB;AAEA,OAAO,SAASC,qBAAqBhB,GAAsB;IACzD,IAAIA,IAAIiB,KAAK,KAAKP,WAAW;QAC3B,MAAM,IAAIG,MAAM,CAAC,SAAS,EAAEb,IAAIG,EAAE,CAAC,+BAA+B,CAAC;IACrE;IACA,OAAOH,IAAIiB,KAAK;AAClB;AAEA,OAAO,SAASC,sBAAsBC,SAAiB;IACrDC,OAAOC,aAAa,CAAC,IAAIC,YAAYH;AACvC"}
@@ -0,0 +1,15 @@
1
+ import { DashboardSpec } from '@perses-dev/spec';
2
+ export type DashboardKind = 'Dashboard' | 'EphemeralDashboard';
3
+ export type DashboardMetaData = {
4
+ name: string;
5
+ project: string;
6
+ createdAt?: string;
7
+ updatedAt?: string;
8
+ version?: number;
9
+ };
10
+ export interface DashboardResource {
11
+ kind: DashboardKind;
12
+ spec: DashboardSpec;
13
+ metadata: DashboardMetaData;
14
+ }
15
+ //# sourceMappingURL=DashboardResource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DashboardResource.d.ts","sourceRoot":"","sources":["../../src/model/DashboardResource.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG,oBAAoB,CAAC;AAG/D,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAMF,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,aAAa,CAAC;IACpB,QAAQ,EAAE,iBAAiB,CAAC;CAC7B"}
@@ -0,0 +1,18 @@
1
+ // Copyright The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ /* TODO: There is an open and ongoing issue whether the meta-data should be removed or not.
14
+ Such a decision would affect DashbaordProvider and buildDatasourceProxyUrl
15
+ https://github.com/perses/perses/issues/4016
16
+ */ export { };
17
+
18
+ //# sourceMappingURL=DashboardResource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/model/DashboardResource.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { DashboardSpec } from '@perses-dev/spec';\n\nexport type DashboardKind = 'Dashboard' | 'EphemeralDashboard';\n\n/* TODO: As discussed we can keep this intermediary type until we decide on a new location for it. */\nexport type DashboardMetaData = {\n name: string;\n project: string;\n createdAt?: string;\n updatedAt?: string;\n version?: number;\n};\n\n/* TODO: There is an open and ongoing issue whether the meta-data should be removed or not.\n Such a decision would affect DashbaordProvider and buildDatasourceProxyUrl\n https://github.com/perses/perses/issues/4016\n*/\nexport interface DashboardResource {\n kind: DashboardKind;\n spec: DashboardSpec;\n metadata: DashboardMetaData;\n}\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAejC;;;AAGA,GACA,WAIC"}
@@ -0,0 +1,2 @@
1
+ export * from './DashboardResource';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":"AAaA,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,15 @@
1
+ // Copyright The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ export * from './DashboardResource';
14
+
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/model/index.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './DashboardResource';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,sBAAsB"}
@@ -1,6 +1,6 @@
1
- import { DashboardResource } from '@perses-dev/core';
2
1
  import { StoreApi } from 'zustand';
3
2
  import { DashboardStoreState } from '../context';
3
+ import { DashboardResource } from '../model';
4
4
  /**
5
5
  * Helper to get a test dashboard resource.
6
6
  */
@@ -1 +1 @@
1
- {"version":3,"file":"dashboard-provider.d.ts","sourceRoot":"","sources":["../../src/test/dashboard-provider.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAoB,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAGnE;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,iBAAiB,CAGpD;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,IAAI;IAC5C,oBAAoB,EAAE,MAAM,IAAI,CAAC;IACjC,KAAK,EAAE;QAAE,KAAK,CAAC,EAAE,QAAQ,CAAC,mBAAmB,CAAC,CAAA;KAAE,CAAC;CAClD,CAcA"}
1
+ {"version":3,"file":"dashboard-provider.d.ts","sourceRoot":"","sources":["../../src/test/dashboard-provider.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAoB,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAG7C;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,iBAAiB,CAGpD;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,IAAI;IAC5C,oBAAoB,EAAE,MAAM,IAAI,CAAC;IACjC,KAAK,EAAE;QAAE,KAAK,CAAC,EAAE,QAAQ,CAAC,mBAAmB,CAAC,CAAA;KAAE,CAAC;CAClD,CAcA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/test/dashboard-provider.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { DashboardResource } from '@perses-dev/core';\nimport { useContext } from 'react';\nimport { StoreApi } from 'zustand';\nimport { DashboardContext, DashboardStoreState } from '../context';\nimport testDashboard from './testDashboard';\n\n/**\n * Helper to get a test dashboard resource.\n */\nexport function getTestDashboard(): DashboardResource {\n // TODO: Should we be cloning this to create a new object each time?\n return testDashboard;\n}\n\n/**\n * Test helper to create a \"spy\" component that will capture the DashboardProvider's store, allowing you to inspect\n * its state in tests. Be sure to render the DashboardProviderSpy component that's returned in the component test\n * underneath the DashboardProvider.\n */\nexport function createDashboardProviderSpy(): {\n DashboardProviderSpy: () => null;\n store: { value?: StoreApi<DashboardStoreState> };\n} {\n const store: { value?: StoreApi<DashboardStoreState> } = {};\n\n // Spy component just captures the store value so it can be inspected in tests\n function DashboardProviderSpy(): null {\n const ctx = useContext(DashboardContext);\n store.value = ctx;\n return null;\n }\n\n return {\n DashboardProviderSpy,\n store,\n };\n}\n"],"names":["useContext","DashboardContext","testDashboard","getTestDashboard","createDashboardProviderSpy","store","DashboardProviderSpy","ctx","value"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAASA,UAAU,QAAQ,QAAQ;AAEnC,SAASC,gBAAgB,QAA6B,aAAa;AACnE,OAAOC,mBAAmB,kBAAkB;AAE5C;;CAEC,GACD,OAAO,SAASC;IACd,oEAAoE;IACpE,OAAOD;AACT;AAEA;;;;CAIC,GACD,OAAO,SAASE;IAId,MAAMC,QAAmD,CAAC;IAE1D,8EAA8E;IAC9E,SAASC;QACP,MAAMC,MAAMP,WAAWC;QACvBI,MAAMG,KAAK,GAAGD;QACd,OAAO;IACT;IAEA,OAAO;QACLD;QACAD;IACF;AACF"}
1
+ {"version":3,"sources":["../../src/test/dashboard-provider.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { useContext } from 'react';\nimport { StoreApi } from 'zustand';\nimport { DashboardContext, DashboardStoreState } from '../context';\nimport { DashboardResource } from '../model';\nimport testDashboard from './testDashboard';\n\n/**\n * Helper to get a test dashboard resource.\n */\nexport function getTestDashboard(): DashboardResource {\n // TODO: Should we be cloning this to create a new object each time?\n return testDashboard;\n}\n\n/**\n * Test helper to create a \"spy\" component that will capture the DashboardProvider's store, allowing you to inspect\n * its state in tests. Be sure to render the DashboardProviderSpy component that's returned in the component test\n * underneath the DashboardProvider.\n */\nexport function createDashboardProviderSpy(): {\n DashboardProviderSpy: () => null;\n store: { value?: StoreApi<DashboardStoreState> };\n} {\n const store: { value?: StoreApi<DashboardStoreState> } = {};\n\n // Spy component just captures the store value so it can be inspected in tests\n function DashboardProviderSpy(): null {\n const ctx = useContext(DashboardContext);\n store.value = ctx;\n return null;\n }\n\n return {\n DashboardProviderSpy,\n store,\n };\n}\n"],"names":["useContext","DashboardContext","testDashboard","getTestDashboard","createDashboardProviderSpy","store","DashboardProviderSpy","ctx","value"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,UAAU,QAAQ,QAAQ;AAEnC,SAASC,gBAAgB,QAA6B,aAAa;AAEnE,OAAOC,mBAAmB,kBAAkB;AAE5C;;CAEC,GACD,OAAO,SAASC;IACd,oEAAoE;IACpE,OAAOD;AACT;AAEA;;;;CAIC,GACD,OAAO,SAASE;IAId,MAAMC,QAAmD,CAAC;IAE1D,8EAA8E;IAC9E,SAASC;QACP,MAAMC,MAAMP,WAAWC;QACvBI,MAAMG,KAAK,GAAGD;QACd,OAAO;IACT;IAEA,OAAO;QACLD;QACAD;IACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/test/datasource-provider.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { GlobalDatasourceResource } from '@perses-dev/core';\nimport { DatasourceStoreProviderProps } from '../context';\nimport { getTestDashboard } from './dashboard-provider';\n\nexport const prometheusDemoUrl = 'https://prometheus.demo.prometheus.io';\nexport const prometheusDemo: GlobalDatasourceResource = {\n kind: 'GlobalDatasource',\n metadata: {\n name: 'PrometheusDemo',\n createdAt: '0001-01-01T00:00:00Z',\n updatedAt: '0001-01-01T00:00:00Z',\n version: 0,\n },\n spec: {\n default: true,\n plugin: {\n kind: 'PrometheusDatasource',\n spec: { directUrl: prometheusDemoUrl },\n },\n },\n} as const;\n\n// This default currently defines the bare minimum to get a story working in\n// the `Dashboard` storybook with the Prometheus demo api. We'll likely want\n// to expand it to do more in the future.\nexport const defaultDatasourceProps: Pick<DatasourceStoreProviderProps, 'datasourceApi' | 'dashboardResource'> = {\n dashboardResource: getTestDashboard(),\n datasourceApi: {\n buildProxyUrl: () => '',\n getDatasource: () => {\n return Promise.resolve(undefined);\n },\n getGlobalDatasource: (selector) => {\n if (selector.kind === 'PrometheusDatasource') {\n return Promise.resolve(prometheusDemo);\n }\n\n return Promise.resolve(undefined);\n },\n listDatasources: () => {\n return Promise.resolve([]);\n },\n listGlobalDatasources: () => {\n return Promise.resolve([]);\n },\n },\n};\n"],"names":["getTestDashboard","prometheusDemoUrl","prometheusDemo","kind","metadata","name","createdAt","updatedAt","version","spec","default","plugin","directUrl","defaultDatasourceProps","dashboardResource","datasourceApi","buildProxyUrl","getDatasource","Promise","resolve","undefined","getGlobalDatasource","selector","listDatasources","listGlobalDatasources"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,SAASA,gBAAgB,QAAQ,uBAAuB;AAExD,OAAO,MAAMC,oBAAoB,wCAAwC;AACzE,OAAO,MAAMC,iBAA2C;IACtDC,MAAM;IACNC,UAAU;QACRC,MAAM;QACNC,WAAW;QACXC,WAAW;QACXC,SAAS;IACX;IACAC,MAAM;QACJC,SAAS;QACTC,QAAQ;YACNR,MAAM;YACNM,MAAM;gBAAEG,WAAWX;YAAkB;QACvC;IACF;AACF,EAAW;AAEX,4EAA4E;AAC5E,4EAA4E;AAC5E,yCAAyC;AACzC,OAAO,MAAMY,yBAAoG;IAC/GC,mBAAmBd;IACnBe,eAAe;QACbC,eAAe,IAAM;QACrBC,eAAe;YACb,OAAOC,QAAQC,OAAO,CAACC;QACzB;QACAC,qBAAqB,CAACC;YACpB,IAAIA,SAASnB,IAAI,KAAK,wBAAwB;gBAC5C,OAAOe,QAAQC,OAAO,CAACjB;YACzB;YAEA,OAAOgB,QAAQC,OAAO,CAACC;QACzB;QACAG,iBAAiB;YACf,OAAOL,QAAQC,OAAO,CAAC,EAAE;QAC3B;QACAK,uBAAuB;YACrB,OAAON,QAAQC,OAAO,CAAC,EAAE;QAC3B;IACF;AACF,EAAE"}
1
+ {"version":3,"sources":["../../src/test/datasource-provider.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { GlobalDatasourceResource } from '@perses-dev/core'; // TODO\nimport { DatasourceStoreProviderProps } from '../context';\nimport { getTestDashboard } from './dashboard-provider';\n\nexport const prometheusDemoUrl = 'https://prometheus.demo.prometheus.io';\nexport const prometheusDemo: GlobalDatasourceResource = {\n kind: 'GlobalDatasource',\n metadata: {\n name: 'PrometheusDemo',\n createdAt: '0001-01-01T00:00:00Z',\n updatedAt: '0001-01-01T00:00:00Z',\n version: 0,\n },\n spec: {\n default: true,\n plugin: {\n kind: 'PrometheusDatasource',\n spec: { directUrl: prometheusDemoUrl },\n },\n },\n} as const;\n\n// This default currently defines the bare minimum to get a story working in\n// the `Dashboard` storybook with the Prometheus demo api. We'll likely want\n// to expand it to do more in the future.\nexport const defaultDatasourceProps: Pick<DatasourceStoreProviderProps, 'datasourceApi' | 'dashboardResource'> = {\n dashboardResource: getTestDashboard(),\n datasourceApi: {\n buildProxyUrl: () => '',\n getDatasource: () => {\n return Promise.resolve(undefined);\n },\n getGlobalDatasource: (selector) => {\n if (selector.kind === 'PrometheusDatasource') {\n return Promise.resolve(prometheusDemo);\n }\n\n return Promise.resolve(undefined);\n },\n listDatasources: () => {\n return Promise.resolve([]);\n },\n listGlobalDatasources: () => {\n return Promise.resolve([]);\n },\n },\n};\n"],"names":["getTestDashboard","prometheusDemoUrl","prometheusDemo","kind","metadata","name","createdAt","updatedAt","version","spec","default","plugin","directUrl","defaultDatasourceProps","dashboardResource","datasourceApi","buildProxyUrl","getDatasource","Promise","resolve","undefined","getGlobalDatasource","selector","listDatasources","listGlobalDatasources"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,SAASA,gBAAgB,QAAQ,uBAAuB;AAExD,OAAO,MAAMC,oBAAoB,wCAAwC;AACzE,OAAO,MAAMC,iBAA2C;IACtDC,MAAM;IACNC,UAAU;QACRC,MAAM;QACNC,WAAW;QACXC,WAAW;QACXC,SAAS;IACX;IACAC,MAAM;QACJC,SAAS;QACTC,QAAQ;YACNR,MAAM;YACNM,MAAM;gBAAEG,WAAWX;YAAkB;QACvC;IACF;AACF,EAAW;AAEX,4EAA4E;AAC5E,4EAA4E;AAC5E,yCAAyC;AACzC,OAAO,MAAMY,yBAAoG;IAC/GC,mBAAmBd;IACnBe,eAAe;QACbC,eAAe,IAAM;QACrBC,eAAe;YACb,OAAOC,QAAQC,OAAO,CAACC;QACzB;QACAC,qBAAqB,CAACC;YACpB,IAAIA,SAASnB,IAAI,KAAK,wBAAwB;gBAC5C,OAAOe,QAAQC,OAAO,CAACjB;YACzB;YAEA,OAAOgB,QAAQC,OAAO,CAACC;QACzB;QACAG,iBAAiB;YACf,OAAOL,QAAQC,OAAO,CAAC,EAAE;QAC3B;QACAK,uBAAuB;YACrB,OAAON,QAAQC,OAAO,CAAC,EAAE;QAC3B;IACF;AACF,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/test/plugin-registry.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { UnknownSpec } from '@perses-dev/core';\nimport { PanelPlugin, MockPlugin } from '@perses-dev/plugin-system';\nimport { ReactElement } from 'react';\n\nconst FakeTimeSeriesChartOptionEditor = (): ReactElement => {\n return <div>TimeSeriesChart options</div>;\n};\n\nconst FakeTimeSeriesPlugin: PanelPlugin<UnknownSpec> = {\n PanelComponent: () => {\n return <div>TimeSeriesChart panel</div>;\n },\n panelOptionsEditorComponents: [\n {\n label: 'Settings',\n content: FakeTimeSeriesChartOptionEditor,\n },\n ],\n createInitialOptions: () => ({}),\n supportedQueryTypes: ['TimeSeriesQuery'],\n};\n\nconst MOCK_TIME_SERIES_PANEL: MockPlugin = {\n kind: 'Panel',\n spec: { name: 'TimeSeriesChart' },\n plugin: FakeTimeSeriesPlugin,\n};\n\n// Array of default mock plugins added to the PluginRegistry during test renders\nexport const MOCK_PLUGINS: MockPlugin[] = [MOCK_TIME_SERIES_PANEL];\n"],"names":["FakeTimeSeriesChartOptionEditor","div","FakeTimeSeriesPlugin","PanelComponent","panelOptionsEditorComponents","label","content","createInitialOptions","supportedQueryTypes","MOCK_TIME_SERIES_PANEL","kind","spec","name","plugin","MOCK_PLUGINS"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAMjC,MAAMA,kCAAkC;IACtC,qBAAO,KAACC;kBAAI;;AACd;AAEA,MAAMC,uBAAiD;IACrDC,gBAAgB;QACd,qBAAO,KAACF;sBAAI;;IACd;IACAG,8BAA8B;QAC5B;YACEC,OAAO;YACPC,SAASN;QACX;KACD;IACDO,sBAAsB,IAAO,CAAA,CAAC,CAAA;IAC9BC,qBAAqB;QAAC;KAAkB;AAC1C;AAEA,MAAMC,yBAAqC;IACzCC,MAAM;IACNC,MAAM;QAAEC,MAAM;IAAkB;IAChCC,QAAQX;AACV;AAEA,gFAAgF;AAChF,OAAO,MAAMY,eAA6B;IAACL;CAAuB,CAAC"}
1
+ {"version":3,"sources":["../../src/test/plugin-registry.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { UnknownSpec } from '@perses-dev/spec';\nimport { PanelPlugin, MockPlugin } from '@perses-dev/plugin-system';\nimport { ReactElement } from 'react';\n\nconst FakeTimeSeriesChartOptionEditor = (): ReactElement => {\n return <div>TimeSeriesChart options</div>;\n};\n\nconst FakeTimeSeriesPlugin: PanelPlugin<UnknownSpec> = {\n PanelComponent: () => {\n return <div>TimeSeriesChart panel</div>;\n },\n panelOptionsEditorComponents: [\n {\n label: 'Settings',\n content: FakeTimeSeriesChartOptionEditor,\n },\n ],\n createInitialOptions: () => ({}),\n supportedQueryTypes: ['TimeSeriesQuery'],\n};\n\nconst MOCK_TIME_SERIES_PANEL: MockPlugin = {\n kind: 'Panel',\n spec: { name: 'TimeSeriesChart' },\n plugin: FakeTimeSeriesPlugin,\n};\n\n// Array of default mock plugins added to the PluginRegistry during test renders\nexport const MOCK_PLUGINS: MockPlugin[] = [MOCK_TIME_SERIES_PANEL];\n"],"names":["FakeTimeSeriesChartOptionEditor","div","FakeTimeSeriesPlugin","PanelComponent","panelOptionsEditorComponents","label","content","createInitialOptions","supportedQueryTypes","MOCK_TIME_SERIES_PANEL","kind","spec","name","plugin","MOCK_PLUGINS"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAMjC,MAAMA,kCAAkC;IACtC,qBAAO,KAACC;kBAAI;;AACd;AAEA,MAAMC,uBAAiD;IACrDC,gBAAgB;QACd,qBAAO,KAACF;sBAAI;;IACd;IACAG,8BAA8B;QAC5B;YACEC,OAAO;YACPC,SAASN;QACX;KACD;IACDO,sBAAsB,IAAO,CAAA,CAAC,CAAA;IAC9BC,qBAAqB;QAAC;KAAkB;AAC1C;AAEA,MAAMC,yBAAqC;IACzCC,MAAM;IACNC,MAAM;QAAEC,MAAM;IAAkB;IAChCC,QAAQX;AACV;AAEA,gFAAgF;AAChF,OAAO,MAAMY,eAA6B;IAACL;CAAuB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/test/render.tsx"],"names":[],"mappings":";AAgBA,OAAO,EAAU,aAAa,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAuB,aAAa,EAAE,MAAM,SAAS,CAAC;AAiC7D;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,KAAK,CAAC,YAAY,EACtB,OAAO,CAAC,EAAE,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC,EACxC,OAAO,CAAC,EAAE,aAAa,GACtB,YAAY,CA4Bd"}
1
+ {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/test/render.tsx"],"names":[],"mappings":";AAiBA,OAAO,EAAU,aAAa,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAuB,aAAa,EAAE,MAAM,SAAS,CAAC;AAkC7D;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,KAAK,CAAC,YAAY,EACtB,OAAO,CAAC,EAAE,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC,EACxC,OAAO,CAAC,EAAE,aAAa,GACtB,YAAY,CAqCd"}
@@ -13,6 +13,7 @@
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
14
  import { ChartsProvider, SnackbarProvider, testChartsTheme } from '@perses-dev/components';
15
15
  import { mockPluginRegistry, PluginRegistry } from '@perses-dev/plugin-system';
16
+ import { HotkeysProvider } from '@tanstack/react-hotkeys';
16
17
  import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
17
18
  import { render } from '@testing-library/react';
18
19
  import { createMemoryHistory } from 'history';
@@ -21,6 +22,7 @@ import { Router } from 'react-router-dom';
21
22
  import { QueryParamProvider } from 'use-query-params';
22
23
  import { ReactRouter6Adapter } from 'use-query-params/adapters/react-router-6';
23
24
  import { DatasourceStoreProvider } from '../context';
25
+ import { PanelFocusProvider } from '../keyboard-shortcuts';
24
26
  import { defaultDatasourceProps } from '../test';
25
27
  import { MOCK_PLUGINS } from './plugin-registry';
26
28
  /*
@@ -71,9 +73,22 @@ import { MOCK_PLUGINS } from './plugin-registry';
71
73
  children: /*#__PURE__*/ _jsx(PluginRegistry, {
72
74
  pluginLoader: mockRegistry.pluginLoader,
73
75
  defaultPluginKinds: mockRegistry.defaultPluginKinds,
74
- children: /*#__PURE__*/ _jsx(DatasourceStoreProvider, {
75
- ...defaultDatasourceProps,
76
- children: ui
76
+ children: /*#__PURE__*/ _jsx(HotkeysProvider, {
77
+ defaultOptions: {
78
+ hotkey: {
79
+ preventDefault: true,
80
+ stopPropagation: true
81
+ },
82
+ hotkeySequence: {
83
+ timeout: 1000
84
+ }
85
+ },
86
+ children: /*#__PURE__*/ _jsx(PanelFocusProvider, {
87
+ children: /*#__PURE__*/ _jsx(DatasourceStoreProvider, {
88
+ ...defaultDatasourceProps,
89
+ children: ui
90
+ })
91
+ })
77
92
  })
78
93
  })
79
94
  })
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/test/render.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ChartsProvider, SnackbarProvider, testChartsTheme } from '@perses-dev/components';\nimport { mockPluginRegistry, PluginRegistry } from '@perses-dev/plugin-system';\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport { render, RenderOptions, RenderResult } from '@testing-library/react';\nimport { createMemoryHistory, MemoryHistory } from 'history';\nimport { ReactElement, useLayoutEffect, useState } from 'react';\nimport { Router } from 'react-router-dom';\nimport { QueryParamProvider } from 'use-query-params';\nimport { ReactRouter6Adapter } from 'use-query-params/adapters/react-router-6';\nimport { DatasourceStoreProvider } from '../context';\nimport { defaultDatasourceProps } from '../test';\nimport { MOCK_PLUGINS } from './plugin-registry';\n\ninterface CustomRouterProps {\n history: MemoryHistory;\n children: React.ReactNode;\n}\n\n/*\n * Workaround for React router upgrade type errors.\n * More details: https://stackoverflow.com/a/69948457/17575201\n */\nconst CustomRouter: React.FC<CustomRouterProps> = ({ history, children }) => {\n const [state, setState] = useState({\n action: history.action,\n location: history.location,\n });\n\n useLayoutEffect(() => history.listen(setState), [history]);\n\n return (\n <Router location={state.location} navigationType={state.action} navigator={history}>\n {children}\n </Router>\n );\n};\n\n/**\n * Test helper to render a React component with some common app-level providers wrapped around it.\n */\nexport function renderWithContext(\n ui: React.ReactElement,\n options?: Omit<RenderOptions, 'queries'>,\n history?: MemoryHistory\n): RenderResult {\n // Create a new QueryClient for each test to avoid caching issues\n const queryClient = new QueryClient({ defaultOptions: { queries: { refetchOnWindowFocus: false, retry: false } } });\n\n const customHistory = history ?? createMemoryHistory();\n\n const mockRegistry = mockPluginRegistry(...MOCK_PLUGINS);\n\n const BaseRender = (): ReactElement => (\n <CustomRouter history={customHistory}>\n <QueryClientProvider client={queryClient}>\n <QueryParamProvider adapter={ReactRouter6Adapter}>\n <SnackbarProvider anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}>\n <ChartsProvider chartsTheme={testChartsTheme}>\n <PluginRegistry\n pluginLoader={mockRegistry.pluginLoader}\n defaultPluginKinds={mockRegistry.defaultPluginKinds}\n >\n <DatasourceStoreProvider {...defaultDatasourceProps}>{ui}</DatasourceStoreProvider>\n </PluginRegistry>\n </ChartsProvider>\n </SnackbarProvider>\n </QueryParamProvider>\n </QueryClientProvider>\n </CustomRouter>\n );\n\n return render(<BaseRender />, options);\n}\n"],"names":["ChartsProvider","SnackbarProvider","testChartsTheme","mockPluginRegistry","PluginRegistry","QueryClient","QueryClientProvider","render","createMemoryHistory","useLayoutEffect","useState","Router","QueryParamProvider","ReactRouter6Adapter","DatasourceStoreProvider","defaultDatasourceProps","MOCK_PLUGINS","CustomRouter","history","children","state","setState","action","location","listen","navigationType","navigator","renderWithContext","ui","options","queryClient","defaultOptions","queries","refetchOnWindowFocus","retry","customHistory","mockRegistry","BaseRender","client","adapter","anchorOrigin","vertical","horizontal","chartsTheme","pluginLoader","defaultPluginKinds"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,cAAc,EAAEC,gBAAgB,EAAEC,eAAe,QAAQ,yBAAyB;AAC3F,SAASC,kBAAkB,EAAEC,cAAc,QAAQ,4BAA4B;AAC/E,SAASC,WAAW,EAAEC,mBAAmB,QAAQ,wBAAwB;AACzE,SAASC,MAAM,QAAqC,yBAAyB;AAC7E,SAASC,mBAAmB,QAAuB,UAAU;AAC7D,SAAuBC,eAAe,EAAEC,QAAQ,QAAQ,QAAQ;AAChE,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,kBAAkB,QAAQ,mBAAmB;AACtD,SAASC,mBAAmB,QAAQ,2CAA2C;AAC/E,SAASC,uBAAuB,QAAQ,aAAa;AACrD,SAASC,sBAAsB,QAAQ,UAAU;AACjD,SAASC,YAAY,QAAQ,oBAAoB;AAOjD;;;CAGC,GACD,MAAMC,eAA4C,CAAC,EAAEC,OAAO,EAAEC,QAAQ,EAAE;IACtE,MAAM,CAACC,OAAOC,SAAS,GAAGX,SAAS;QACjCY,QAAQJ,QAAQI,MAAM;QACtBC,UAAUL,QAAQK,QAAQ;IAC5B;IAEAd,gBAAgB,IAAMS,QAAQM,MAAM,CAACH,WAAW;QAACH;KAAQ;IAEzD,qBACE,KAACP;QAAOY,UAAUH,MAAMG,QAAQ;QAAEE,gBAAgBL,MAAME,MAAM;QAAEI,WAAWR;kBACxEC;;AAGP;AAEA;;CAEC,GACD,OAAO,SAASQ,kBACdC,EAAsB,EACtBC,OAAwC,EACxCX,OAAuB;IAEvB,iEAAiE;IACjE,MAAMY,cAAc,IAAIzB,YAAY;QAAE0B,gBAAgB;YAAEC,SAAS;gBAAEC,sBAAsB;gBAAOC,OAAO;YAAM;QAAE;IAAE;IAEjH,MAAMC,gBAAgBjB,WAAWV;IAEjC,MAAM4B,eAAejC,sBAAsBa;IAE3C,MAAMqB,aAAa,kBACjB,KAACpB;YAAaC,SAASiB;sBACrB,cAAA,KAAC7B;gBAAoBgC,QAAQR;0BAC3B,cAAA,KAAClB;oBAAmB2B,SAAS1B;8BAC3B,cAAA,KAACZ;wBAAiBuC,cAAc;4BAAEC,UAAU;4BAAUC,YAAY;wBAAQ;kCACxE,cAAA,KAAC1C;4BAAe2C,aAAazC;sCAC3B,cAAA,KAACE;gCACCwC,cAAcR,aAAaQ,YAAY;gCACvCC,oBAAoBT,aAAaS,kBAAkB;0CAEnD,cAAA,KAAC/B;oCAAyB,GAAGC,sBAAsB;8CAAGa;;;;;;;;IASpE,OAAOrB,qBAAO,KAAC8B,iBAAeR;AAChC"}
1
+ {"version":3,"sources":["../../src/test/render.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ChartsProvider, SnackbarProvider, testChartsTheme } from '@perses-dev/components';\nimport { mockPluginRegistry, PluginRegistry } from '@perses-dev/plugin-system';\nimport { HotkeysProvider } from '@tanstack/react-hotkeys';\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport { render, RenderOptions, RenderResult } from '@testing-library/react';\nimport { createMemoryHistory, MemoryHistory } from 'history';\nimport { ReactElement, useLayoutEffect, useState } from 'react';\nimport { Router } from 'react-router-dom';\nimport { QueryParamProvider } from 'use-query-params';\nimport { ReactRouter6Adapter } from 'use-query-params/adapters/react-router-6';\nimport { DatasourceStoreProvider } from '../context';\nimport { PanelFocusProvider } from '../keyboard-shortcuts';\nimport { defaultDatasourceProps } from '../test';\nimport { MOCK_PLUGINS } from './plugin-registry';\n\ninterface CustomRouterProps {\n history: MemoryHistory;\n children: React.ReactNode;\n}\n\n/*\n * Workaround for React router upgrade type errors.\n * More details: https://stackoverflow.com/a/69948457/17575201\n */\nconst CustomRouter: React.FC<CustomRouterProps> = ({ history, children }) => {\n const [state, setState] = useState({\n action: history.action,\n location: history.location,\n });\n\n useLayoutEffect(() => history.listen(setState), [history]);\n\n return (\n <Router location={state.location} navigationType={state.action} navigator={history}>\n {children}\n </Router>\n );\n};\n\n/**\n * Test helper to render a React component with some common app-level providers wrapped around it.\n */\nexport function renderWithContext(\n ui: React.ReactElement,\n options?: Omit<RenderOptions, 'queries'>,\n history?: MemoryHistory\n): RenderResult {\n // Create a new QueryClient for each test to avoid caching issues\n const queryClient = new QueryClient({ defaultOptions: { queries: { refetchOnWindowFocus: false, retry: false } } });\n\n const customHistory = history ?? createMemoryHistory();\n\n const mockRegistry = mockPluginRegistry(...MOCK_PLUGINS);\n\n const BaseRender = (): ReactElement => (\n <CustomRouter history={customHistory}>\n <QueryClientProvider client={queryClient}>\n <QueryParamProvider adapter={ReactRouter6Adapter}>\n <SnackbarProvider anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}>\n <ChartsProvider chartsTheme={testChartsTheme}>\n <PluginRegistry\n pluginLoader={mockRegistry.pluginLoader}\n defaultPluginKinds={mockRegistry.defaultPluginKinds}\n >\n <HotkeysProvider\n defaultOptions={{\n hotkey: { preventDefault: true, stopPropagation: true },\n hotkeySequence: { timeout: 1000 },\n }}\n >\n <PanelFocusProvider>\n <DatasourceStoreProvider {...defaultDatasourceProps}>{ui}</DatasourceStoreProvider>\n </PanelFocusProvider>\n </HotkeysProvider>\n </PluginRegistry>\n </ChartsProvider>\n </SnackbarProvider>\n </QueryParamProvider>\n </QueryClientProvider>\n </CustomRouter>\n );\n\n return render(<BaseRender />, options);\n}\n"],"names":["ChartsProvider","SnackbarProvider","testChartsTheme","mockPluginRegistry","PluginRegistry","HotkeysProvider","QueryClient","QueryClientProvider","render","createMemoryHistory","useLayoutEffect","useState","Router","QueryParamProvider","ReactRouter6Adapter","DatasourceStoreProvider","PanelFocusProvider","defaultDatasourceProps","MOCK_PLUGINS","CustomRouter","history","children","state","setState","action","location","listen","navigationType","navigator","renderWithContext","ui","options","queryClient","defaultOptions","queries","refetchOnWindowFocus","retry","customHistory","mockRegistry","BaseRender","client","adapter","anchorOrigin","vertical","horizontal","chartsTheme","pluginLoader","defaultPluginKinds","hotkey","preventDefault","stopPropagation","hotkeySequence","timeout"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,cAAc,EAAEC,gBAAgB,EAAEC,eAAe,QAAQ,yBAAyB;AAC3F,SAASC,kBAAkB,EAAEC,cAAc,QAAQ,4BAA4B;AAC/E,SAASC,eAAe,QAAQ,0BAA0B;AAC1D,SAASC,WAAW,EAAEC,mBAAmB,QAAQ,wBAAwB;AACzE,SAASC,MAAM,QAAqC,yBAAyB;AAC7E,SAASC,mBAAmB,QAAuB,UAAU;AAC7D,SAAuBC,eAAe,EAAEC,QAAQ,QAAQ,QAAQ;AAChE,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,kBAAkB,QAAQ,mBAAmB;AACtD,SAASC,mBAAmB,QAAQ,2CAA2C;AAC/E,SAASC,uBAAuB,QAAQ,aAAa;AACrD,S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B,GAAGE,sBAAsB;sDAAGa;;;;;;;;;;IAWxE,OAAOtB,qBAAO,KAAC+B,iBAAeR;AAChC"}
@@ -1,4 +1,13 @@
1
- import { DashboardResource } from '@perses-dev/core';
2
- declare const testDashboard: DashboardResource;
1
+ import { DashboardResource } from '../model';
2
+ type DashboardResourceTest = Omit<DashboardResource, 'metadata'> & {
3
+ metadata: {
4
+ name: string;
5
+ project: string;
6
+ createdAt: string;
7
+ updatedAt: string;
8
+ version: number;
9
+ };
10
+ };
11
+ declare const testDashboard: DashboardResourceTest;
3
12
  export default testDashboard;
4
13
  //# sourceMappingURL=testDashboard.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"testDashboard.d.ts","sourceRoot":"","sources":["../../src/test/testDashboard.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,QAAA,MAAM,aAAa,EAAE,iBA0PpB,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"testDashboard.d.ts","sourceRoot":"","sources":["../../src/test/testDashboard.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,KAAK,qBAAqB,GAAG,IAAI,CAAC,iBAAiB,EAAE,UAAU,CAAC,GAAG;IACjE,QAAQ,EAAE;QACR,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH,CAAC;AAEF,QAAA,MAAM,aAAa,EAAE,qBA0PpB,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/test/testDashboard.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { DashboardResource } from '@perses-dev/core';\n\nconst testDashboard: DashboardResource = {\n kind: 'Dashboard',\n metadata: {\n name: 'Node Stats',\n project: 'perses',\n createdAt: '2021-11-09',\n updatedAt: '2021-11-09',\n version: 0,\n },\n spec: {\n duration: '30m',\n refreshInterval: '0s',\n variables: [\n {\n kind: 'TextVariable',\n spec: {\n name: 'job',\n value: 'node',\n },\n },\n {\n kind: 'TextVariable',\n spec: {\n name: 'instance',\n value: 'demo.do.prometheus.io:9100',\n },\n },\n {\n kind: 'TextVariable',\n spec: {\n name: 'interval',\n value: '1m',\n },\n },\n ],\n panels: {\n cpu: {\n kind: 'Panel',\n spec: {\n display: { name: 'CPU' },\n plugin: {\n kind: 'TimeSeriesChart',\n spec: {\n format: { unit: '%' },\n },\n },\n queries: [\n {\n kind: 'TimeSeriesQuery',\n spec: {\n plugin: {\n kind: 'PrometheusTimeSeriesQuery',\n spec: {\n query:\n 'avg without (cpu)(rate(node_cpu_seconds_total{job=\"node\",instance=\"$instance\",mode!=\"idle\"}[$interval]))',\n },\n },\n },\n },\n ],\n },\n },\n memory: {\n kind: 'Panel',\n spec: {\n display: { name: 'Memory' },\n plugin: {\n kind: 'TimeSeriesChart',\n spec: {\n format: { unit: 'bytes' },\n },\n },\n queries: [\n {\n kind: 'TimeSeriesQuery',\n spec: {\n plugin: {\n kind: 'PrometheusTimeSeriesQuery',\n spec: {\n query:\n 'node_memory_MemTotal_bytes{job=\"node\",instance=\"$instance\"} - node_memory_MemFree_bytes{job=\"node\",instance=\"$instance\"} - node_memory_Buffers_bytes{job=\"node\",instance=\"$instance\"} - node_memory_Cached_bytes{job=\"node\",instance=\"$instance\"}',\n },\n },\n },\n },\n {\n kind: 'TimeSeriesQuery',\n spec: {\n plugin: {\n kind: 'PrometheusTimeSeriesQuery',\n spec: {\n query: 'node_memory_Buffers_bytes{job=\"node\",instance=\"$instance\"}',\n },\n },\n },\n },\n {\n kind: 'TimeSeriesQuery',\n spec: {\n plugin: {\n kind: 'PrometheusTimeSeriesQuery',\n spec: {\n query: 'node_memory_Cached_bytes{job=\"node\",instance=\"$instance\"}',\n },\n },\n },\n },\n {\n kind: 'TimeSeriesQuery',\n spec: {\n plugin: {\n kind: 'PrometheusTimeSeriesQuery',\n spec: {\n query: 'node_memory_MemFree_bytes{job=\"node\",instance=\"$instance\"}',\n },\n },\n },\n },\n ],\n },\n },\n // This panel is referenced in more than one layout below\n diskIO: {\n kind: 'Panel',\n spec: {\n display: { name: 'Disk I/O Utilization' },\n plugin: {\n kind: 'TimeSeriesChart',\n spec: {\n format: { unit: 'percent' },\n },\n },\n queries: [\n {\n kind: 'TimeSeriesQuery',\n spec: {\n plugin: {\n kind: 'PrometheusTimeSeriesQuery',\n spec: {\n query:\n 'rate(node_disk_io_time_seconds_total{job=\"node\",instance=\"$instance\",device!~\"^(md\\\\\\\\d+$|dm-)\"}[$interval])',\n },\n },\n },\n },\n ],\n },\n },\n filesystemFullness: {\n kind: 'Panel',\n spec: {\n display: { name: 'Filesystem Fullness' },\n plugin: {\n kind: 'TimeSeriesChart',\n spec: {\n format: { unit: 'percent' },\n },\n },\n queries: [\n {\n kind: 'TimeSeriesQuery',\n spec: {\n plugin: {\n kind: 'PrometheusTimeSeriesQuery',\n spec: {\n query:\n '1 - node_filesystem_free_bytes{job=\"node\",instance=\"$instance\",fstype!=\"rootfs\",mountpoint!~\"/(run|var).*\",mountpoint!=\"\"} / node_filesystem_size_bytes{job=\"node\",instance=\"$instance\"}',\n },\n },\n },\n },\n ],\n },\n },\n },\n layouts: [\n // Regular Title, no collapse enabled\n {\n kind: 'Grid',\n spec: {\n display: {\n title: 'CPU Stats',\n collapse: {\n open: true,\n },\n },\n items: [\n // First Row\n {\n x: 0,\n y: 0,\n width: 12,\n height: 4,\n content: { $ref: '#/spec/panels/cpu' },\n },\n {\n x: 0,\n y: 5,\n width: 6,\n height: 2,\n content: { $ref: '#/spec/panels/diskIO' },\n },\n ],\n },\n },\n // No title,\n {\n kind: 'Grid',\n spec: {\n items: [\n {\n x: 0,\n y: 0,\n width: 6,\n height: 2,\n content: { $ref: '#/spec/panels/diskIO' },\n },\n {\n x: 8,\n y: 0,\n width: 8,\n height: 3,\n content: { $ref: '#/spec/panels/memory' },\n },\n ],\n },\n },\n // Collapsed\n {\n kind: 'Grid',\n spec: {\n display: {\n title: 'Disk Stats',\n collapse: {\n open: false,\n },\n },\n items: [\n {\n x: 18,\n y: 0,\n width: 6,\n height: 2,\n content: { $ref: '#/spec/panels/filesystemFullness' },\n },\n ],\n },\n },\n ],\n },\n};\n\nexport default testDashboard;\n"],"names":["testDashboard","kind","metadata","name","project","createdAt","updatedAt","version","spec","duration","refreshInterval","variables","value","panels","cpu","display","plugin","format","unit","queries","query","memory","diskIO","filesystemFullness","layouts","title","collapse","open","items","x","y","width","height","content","$ref"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,MAAMA,gBAAmC;IACvCC,MAAM;IACNC,UAAU;QACRC,MAAM;QACNC,SAAS;QACTC,WAAW;QACXC,WAAW;QACXC,SAAS;IACX;IACAC,MAAM;QACJC,UAAU;QACVC,iBAAiB;QACjBC,WAAW;YACT;gBACEV,MAAM;gBACNO,MAAM;oBACJL,MAAM;oBACNS,OAAO;gBACT;YACF;YACA;gBACEX,MAAM;gBACNO,MAAM;oBACJL,MAAM;oBACNS,OAAO;gBACT;YACF;YACA;gBACEX,MAAM;gBACNO,MAAM;oBACJL,MAAM;oBACNS,OAAO;gBACT;YACF;SACD;QACD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BACRC,SAAS;gCAAEC,MAAM;4BAAmC;wBACtD;qBACD;gBACH;YACF;SACD;IACH;AACF;AAEA,eAAelC,cAAc"}
1
+ {"version":3,"sources":["../../src/test/testDashboard.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { DashboardResource } from '../model';\n\ntype DashboardResourceTest = Omit<DashboardResource, 'metadata'> & {\n metadata: {\n name: string;\n project: string;\n createdAt: string;\n updatedAt: string;\n version: number;\n };\n};\n\nconst testDashboard: DashboardResourceTest = {\n kind: 'Dashboard',\n metadata: {\n name: 'Node Stats',\n project: 'perses',\n createdAt: '2021-11-09',\n updatedAt: '2021-11-09',\n version: 0,\n },\n spec: {\n duration: '30m',\n refreshInterval: '0s',\n variables: [\n {\n kind: 'TextVariable',\n spec: {\n name: 'job',\n value: 'node',\n },\n },\n {\n kind: 'TextVariable',\n spec: {\n name: 'instance',\n value: 'demo.do.prometheus.io:9100',\n },\n },\n {\n kind: 'TextVariable',\n spec: {\n name: 'interval',\n value: '1m',\n },\n },\n ],\n panels: {\n cpu: {\n kind: 'Panel',\n spec: {\n display: { name: 'CPU' },\n plugin: {\n kind: 'TimeSeriesChart',\n spec: {\n format: { unit: '%' },\n },\n },\n queries: [\n {\n kind: 'TimeSeriesQuery',\n spec: {\n plugin: {\n kind: 'PrometheusTimeSeriesQuery',\n spec: {\n query:\n 'avg without (cpu)(rate(node_cpu_seconds_total{job=\"node\",instance=\"$instance\",mode!=\"idle\"}[$interval]))',\n },\n },\n },\n },\n ],\n },\n },\n memory: {\n kind: 'Panel',\n spec: {\n display: { name: 'Memory' },\n plugin: {\n kind: 'TimeSeriesChart',\n spec: {\n format: { unit: 'bytes' },\n },\n },\n queries: [\n {\n kind: 'TimeSeriesQuery',\n spec: {\n plugin: {\n kind: 'PrometheusTimeSeriesQuery',\n spec: {\n query:\n 'node_memory_MemTotal_bytes{job=\"node\",instance=\"$instance\"} - node_memory_MemFree_bytes{job=\"node\",instance=\"$instance\"} - node_memory_Buffers_bytes{job=\"node\",instance=\"$instance\"} - node_memory_Cached_bytes{job=\"node\",instance=\"$instance\"}',\n },\n },\n },\n },\n {\n kind: 'TimeSeriesQuery',\n spec: {\n plugin: {\n kind: 'PrometheusTimeSeriesQuery',\n spec: {\n query: 'node_memory_Buffers_bytes{job=\"node\",instance=\"$instance\"}',\n },\n },\n },\n },\n {\n kind: 'TimeSeriesQuery',\n spec: {\n plugin: {\n kind: 'PrometheusTimeSeriesQuery',\n spec: {\n query: 'node_memory_Cached_bytes{job=\"node\",instance=\"$instance\"}',\n },\n },\n },\n },\n {\n kind: 'TimeSeriesQuery',\n spec: {\n plugin: {\n kind: 'PrometheusTimeSeriesQuery',\n spec: {\n query: 'node_memory_MemFree_bytes{job=\"node\",instance=\"$instance\"}',\n },\n },\n },\n },\n ],\n },\n },\n // This panel is referenced in more than one layout below\n diskIO: {\n kind: 'Panel',\n spec: {\n display: { name: 'Disk I/O Utilization' },\n plugin: {\n kind: 'TimeSeriesChart',\n spec: {\n format: { unit: 'percent' },\n },\n },\n queries: [\n {\n kind: 'TimeSeriesQuery',\n spec: {\n plugin: {\n kind: 'PrometheusTimeSeriesQuery',\n spec: {\n query:\n 'rate(node_disk_io_time_seconds_total{job=\"node\",instance=\"$instance\",device!~\"^(md\\\\\\\\d+$|dm-)\"}[$interval])',\n },\n },\n },\n },\n ],\n },\n },\n filesystemFullness: {\n kind: 'Panel',\n spec: {\n display: { name: 'Filesystem Fullness' },\n plugin: {\n kind: 'TimeSeriesChart',\n spec: {\n format: { unit: 'percent' },\n },\n },\n queries: [\n {\n kind: 'TimeSeriesQuery',\n spec: {\n plugin: {\n kind: 'PrometheusTimeSeriesQuery',\n spec: {\n query:\n '1 - node_filesystem_free_bytes{job=\"node\",instance=\"$instance\",fstype!=\"rootfs\",mountpoint!~\"/(run|var).*\",mountpoint!=\"\"} / node_filesystem_size_bytes{job=\"node\",instance=\"$instance\"}',\n },\n },\n },\n },\n ],\n },\n },\n },\n layouts: [\n // Regular Title, no collapse enabled\n {\n kind: 'Grid',\n spec: {\n display: {\n title: 'CPU Stats',\n collapse: {\n open: true,\n },\n },\n items: [\n // First Row\n {\n x: 0,\n y: 0,\n width: 12,\n height: 4,\n content: { $ref: '#/spec/panels/cpu' },\n },\n {\n x: 0,\n y: 5,\n width: 6,\n height: 2,\n content: { $ref: '#/spec/panels/diskIO' },\n },\n ],\n },\n },\n // No title,\n {\n kind: 'Grid',\n spec: {\n items: [\n {\n x: 0,\n y: 0,\n width: 6,\n height: 2,\n content: { $ref: '#/spec/panels/diskIO' },\n },\n {\n x: 8,\n y: 0,\n width: 8,\n height: 3,\n content: { $ref: '#/spec/panels/memory' },\n },\n ],\n },\n },\n // Collapsed\n {\n kind: 'Grid',\n spec: {\n display: {\n title: 'Disk Stats',\n collapse: {\n open: false,\n },\n },\n items: [\n {\n x: 18,\n y: 0,\n width: 6,\n height: 2,\n content: { $ref: '#/spec/panels/filesystemFullness' },\n },\n ],\n },\n },\n ],\n },\n};\n\nexport default testDashboard;\n"],"names":["testDashboard","kind","metadata","name","project","createdAt","updatedAt","version","spec","duration","refreshInterval","variables","value","panels","cpu","display","plugin","format","unit","queries","query","memory","diskIO","filesystemFullness","layouts","title","collapse","open","items","x","y","width","height","content","$ref"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAcjC,MAAMA,gBAAuC;IAC3CC,MAAM;I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AAS;gCAAEC,MAAM;4BAAuB;wBAC1C;wBACA;4BACEL,GAAG;4BACHC,GAAG;4BACHC,OAAO;4BACPC,QAAQ;4BACRC,SAAS;gCAAEC,MAAM;4BAAuB;wBAC1C;qBACD;gBACH;YACF;YACA,YAAY;YACZ;gBACEjC,MAAM;gBACNO,MAAM;oBACJO,SAAS;wBACPU,OAAO;wBACPC,UAAU;4BACRC,MAAM;wBACR;oBACF;oBACAC,OAAO;wBACL;4BACEC,GAAG;4BACHC,GAAG;4BACHC,OAAO;4BACPC,QAAQ;4BACRC,SAAS;gCAAEC,MAAM;4BAAmC;wBACtD;qBACD;gBACH;YACF;SACD;IACH;AACF;AAEA,eAAelC,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/panelUtils.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { PanelGroupDefinition, PanelGroupItemLayout } from '@perses-dev/core';\nimport { GRID_LAYOUT_SMALL_BREAKPOINT, GRID_LAYOUT_COLS } from '../constants';\n\n// Given a PanelGroup, will find the Y coordinate for adding a new row to the grid, taking into account the items present\nexport function getYForNewRow(group: PanelGroupDefinition): number {\n let newRowY = 0;\n for (const layout of group.itemLayouts) {\n const itemMaxY = layout.y + layout.h;\n if (itemMaxY > newRowY) {\n newRowY = itemMaxY;\n }\n }\n return newRowY;\n}\n\ntype PanelGroupItemBounds = {\n /**\n * Left horizontal position.\n */\n x1: number;\n /**\n * Right horizontal position.\n */\n x2: number;\n /**\n * Top vertical position.\n */\n y1: number;\n /**\n * Bottom vertical position\n */\n y2: number;\n};\n\nfunction getPanelBounds({ x, y, w, h }: PanelGroupItemLayout): PanelGroupItemBounds {\n return {\n x1: x,\n x2: x + w,\n y1: y,\n y2: y + h,\n };\n}\n\nexport type UnpositionedPanelGroupItemLayout = Omit<PanelGroupItemLayout, 'x' | 'y'>;\n\n/**\n * Inserts a new panel into the layout with placement determined by a specified\n * reference panel. The new panel is placed:\n * - To the right of the reference panel if there is space available without\n * moving other panels.\n * - Otherwise, directly below the reference panel. If other panels are below\n * this location, they will also shift downward because the grid uses\n * vertical-based compacting.\n *\n * @param newLayout - Layout for new panel to insert into the grid.\n * @param referenceLayout - Layout for reference panel used to determine the\n * placement of the new panel.\n * @param itemLayouts - Full grid layout.\n * @returns - Item layouts modified to insert the new panel.\n */\nexport function insertPanelInLayout(\n newLayout: UnpositionedPanelGroupItemLayout,\n referenceLayout: PanelGroupItemLayout,\n itemLayouts: PanelGroupItemLayout[]\n): PanelGroupItemLayout[] {\n const MAX_LAYOUT_WIDTH = GRID_LAYOUT_COLS[GRID_LAYOUT_SMALL_BREAKPOINT];\n\n const referenceBounds = getPanelBounds(referenceLayout);\n\n // Organize layouts based on vertical relation to the item being inserted\n // after.\n const aboveInsertRow: PanelGroupItemLayout[] = [];\n const insertRow: PanelGroupItemLayout[] = [];\n const belowInsertRow: PanelGroupItemLayout[] = [];\n itemLayouts.forEach((itemLayout) => {\n const itemBounds = getPanelBounds(itemLayout);\n\n if (itemBounds.y2 <= referenceBounds.y1) {\n aboveInsertRow.push(itemLayout);\n } else if (itemBounds.y1 >= referenceBounds.y2) {\n belowInsertRow.push(itemLayout);\n } else {\n insertRow.push(itemLayout);\n }\n });\n\n // Cannot safely assume that the order of item layouts array is strictly\n // left to right. Sorting the row by horizontal position to more easily find\n // gaps.\n insertRow.sort((a, b) => a.x - b.x);\n const insertAfterIndex = insertRow.findIndex((item) => item.i === referenceLayout.i);\n\n if (insertAfterIndex === insertRow.length - 1) {\n // Insert to the right when space is available and the reference is the last\n // item in the row.\n if (referenceBounds.x2 + newLayout.w <= MAX_LAYOUT_WIDTH) {\n return [\n ...aboveInsertRow,\n ...insertRow,\n {\n ...newLayout,\n x: referenceBounds.x2,\n y: referenceBounds.y1,\n },\n ...belowInsertRow,\n ];\n }\n } else if (insertAfterIndex >= 0) {\n const nextItem = insertRow[insertAfterIndex + 1];\n\n if (nextItem && getPanelBounds(nextItem).x1 - referenceBounds.x2 >= newLayout.w) {\n // Insert to the right when space is available between the reference and\n // the next item in the row.\n insertRow.splice(insertAfterIndex + 1, 0, {\n ...newLayout,\n x: referenceBounds.x2,\n y: referenceBounds.y1,\n });\n\n return [...aboveInsertRow, ...insertRow, ...belowInsertRow];\n }\n }\n\n // Insert the new item below the original and shift the items below the\n // row where the reference is located.\n return [\n ...aboveInsertRow,\n ...insertRow,\n { x: referenceBounds.x1, y: referenceBounds.y2, ...newLayout },\n ...belowInsertRow.map((itemLayout) => {\n // Note: the grid will not necessarily display all of these items shifted\n // all the way down because of vertical compacting, but shifing their\n // y position ensures the new item gets vertical precedence over items\n // below it in that compacting.\n return { ...itemLayout, y: itemLayout.y + newLayout.h };\n }),\n ];\n}\n\n/**\n * This function generates a unique panel key based on UUID or timestamp and random suffix.\n */\nexport const generatePanelKey = (): string => {\n /* crypto.randomUUID() is only available in secure contexts (HTTPS), */\n if (window.isSecureContext) {\n return crypto.randomUUID().replaceAll('-', '');\n }\n const timestamp = String(Date.now());\n const randomSuffix = Math.random().toString(36).substring(2);\n return `${timestamp}${randomSuffix}`;\n};\n"],"names":["GRID_LAYOUT_SMALL_BREAKPOINT","GRID_LAYOUT_COLS","getYForNewRow","group","newRowY","layout","itemLayouts","itemMaxY","y","h","getPanelBounds","x","w","x1","x2","y1","y2","insertPanelInLayout","newLayout","referenceLayout","MAX_LAYOUT_WIDTH","referenceBounds","aboveInsertRow","insertRow","belowInsertRow","forEach","itemLayout","itemBounds","push","sort","a","b","insertAfterIndex","findIndex","item","i","length","nextItem","splice","map","generatePanelKey","window","isSecureContext","crypto","randomUUID","replaceAll","timestamp","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;KACD;AACH;AAEA;;CAEC,GACD,OAAO,MAAM+B,mBAAmB;IAC9B,qEAAqE,GACrE,IAAIC,OAAOC,eAAe,EAAE;QAC1B,OAAOC,OAAOC,UAAU,GAAGC,UAAU,CAAC,KAAK;IAC7C;IACA,MAAMC,YAAYC,OAAOC,KAAKC,GAAG;IACjC,MAAMC,eAAeC,KAAKC,MAAM,GAAGC,QAAQ,CAAC,IAAIC,SAAS,CAAC;IAC1D,OAAO,GAAGR,YAAYI,cAAc;AACtC,EAAE"}
1
+ {"version":3,"sources":["../../src/utils/panelUtils.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { PanelGroupDefinition, PanelGroupItemLayout } from '@perses-dev/core'; // TODO\nimport { GRID_LAYOUT_SMALL_BREAKPOINT, GRID_LAYOUT_COLS } from '../constants';\n\n// Given a PanelGroup, will find the Y coordinate for adding a new row to the grid, taking into account the items present\nexport function getYForNewRow(group: PanelGroupDefinition): number {\n let newRowY = 0;\n for (const layout of group.itemLayouts) {\n const itemMaxY = layout.y + layout.h;\n if (itemMaxY > newRowY) {\n newRowY = itemMaxY;\n }\n }\n return newRowY;\n}\n\ntype PanelGroupItemBounds = {\n /**\n * Left horizontal position.\n */\n x1: number;\n /**\n * Right horizontal position.\n */\n x2: number;\n /**\n * Top vertical position.\n */\n y1: number;\n /**\n * Bottom vertical position\n */\n y2: number;\n};\n\nfunction getPanelBounds({ x, y, w, h }: PanelGroupItemLayout): PanelGroupItemBounds {\n return {\n x1: x,\n x2: x + w,\n y1: y,\n y2: y + h,\n };\n}\n\nexport type UnpositionedPanelGroupItemLayout = Omit<PanelGroupItemLayout, 'x' | 'y'>;\n\n/**\n * Inserts a new panel into the layout with placement determined by a specified\n * reference panel. The new panel is placed:\n * - To the right of the reference panel if there is space available without\n * moving other panels.\n * - Otherwise, directly below the reference panel. If other panels are below\n * this location, they will also shift downward because the grid uses\n * vertical-based compacting.\n *\n * @param newLayout - Layout for new panel to insert into the grid.\n * @param referenceLayout - Layout for reference panel used to determine the\n * placement of the new panel.\n * @param itemLayouts - Full grid layout.\n * @returns - Item layouts modified to insert the new panel.\n */\nexport function insertPanelInLayout(\n newLayout: UnpositionedPanelGroupItemLayout,\n referenceLayout: PanelGroupItemLayout,\n itemLayouts: PanelGroupItemLayout[]\n): PanelGroupItemLayout[] {\n const MAX_LAYOUT_WIDTH = GRID_LAYOUT_COLS[GRID_LAYOUT_SMALL_BREAKPOINT];\n\n const referenceBounds = getPanelBounds(referenceLayout);\n\n // Organize layouts based on vertical relation to the item being inserted\n // after.\n const aboveInsertRow: PanelGroupItemLayout[] = [];\n const insertRow: PanelGroupItemLayout[] = [];\n const belowInsertRow: PanelGroupItemLayout[] = [];\n itemLayouts.forEach((itemLayout) => {\n const itemBounds = getPanelBounds(itemLayout);\n\n if (itemBounds.y2 <= referenceBounds.y1) {\n aboveInsertRow.push(itemLayout);\n } else if (itemBounds.y1 >= referenceBounds.y2) {\n belowInsertRow.push(itemLayout);\n } else {\n insertRow.push(itemLayout);\n }\n });\n\n // Cannot safely assume that the order of item layouts array is strictly\n // left to right. Sorting the row by horizontal position to more easily find\n // gaps.\n insertRow.sort((a, b) => a.x - b.x);\n const insertAfterIndex = insertRow.findIndex((item) => item.i === referenceLayout.i);\n\n if (insertAfterIndex === insertRow.length - 1) {\n // Insert to the right when space is available and the reference is the last\n // item in the row.\n if (referenceBounds.x2 + newLayout.w <= MAX_LAYOUT_WIDTH) {\n return [\n ...aboveInsertRow,\n ...insertRow,\n {\n ...newLayout,\n x: referenceBounds.x2,\n y: referenceBounds.y1,\n },\n ...belowInsertRow,\n ];\n }\n } else if (insertAfterIndex >= 0) {\n const nextItem = insertRow[insertAfterIndex + 1];\n\n if (nextItem && getPanelBounds(nextItem).x1 - referenceBounds.x2 >= newLayout.w) {\n // Insert to the right when space is available between the reference and\n // the next item in the row.\n insertRow.splice(insertAfterIndex + 1, 0, {\n ...newLayout,\n x: referenceBounds.x2,\n y: referenceBounds.y1,\n });\n\n return [...aboveInsertRow, ...insertRow, ...belowInsertRow];\n }\n }\n\n // Insert the new item below the original and shift the items below the\n // row where the reference is located.\n return [\n ...aboveInsertRow,\n ...insertRow,\n { x: referenceBounds.x1, y: referenceBounds.y2, ...newLayout },\n ...belowInsertRow.map((itemLayout) => {\n // Note: the grid will not necessarily display all of these items shifted\n // all the way down because of vertical compacting, but shifing their\n // y position ensures the new item gets vertical precedence over items\n // below it in that compacting.\n return { ...itemLayout, y: itemLayout.y + newLayout.h };\n }),\n ];\n}\n\n/**\n * This function generates a unique panel key based on UUID or timestamp and random suffix.\n */\nexport const generatePanelKey = (): string => {\n /* crypto.randomUUID() is only available in secure contexts (HTTPS), */\n if (window.isSecureContext) {\n return crypto.randomUUID().replaceAll('-', '');\n }\n const timestamp = String(Date.now());\n const randomSuffix = Math.random().toString(36).substring(2);\n return `${timestamp}${randomSuffix}`;\n};\n"],"names":["GRID_LAYOUT_SMALL_BREAKPOINT","GRID_LAYOUT_COLS","getYForNewRow","group","newRowY","layout","itemLayouts","itemMaxY","y","h","getPanelBounds","x","w","x1","x2","y1","y2","insertPanelInLayout","newLayout","referenceLayout","MAX_LAYOUT_WIDTH","referenceBounds","aboveInsertRow","insertRow","belowInsertRow","forEach","itemLayout","itemBounds","push","sort","a","b","insertAfterIndex","findIndex","item","i","length","nextItem","splice","map","generatePanelKey","window","isSecureContext","crypto","randomUUID","replaceAll","timestamp","String","Date","now","randomSuffix","Math","random","toString","substring"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C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AAU,GAAGC,UAAU,CAAC,KAAK;IAC7C;IACA,MAAMC,YAAYC,OAAOC,KAAKC,GAAG;IACjC,MAAMC,eAAeC,KAAKC,MAAM,GAAGC,QAAQ,CAAC,IAAIC,SAAS,CAAC;IAC1D,OAAO,GAAGR,YAAYI,cAAc;AACtC,EAAE"}
@@ -1,19 +1,21 @@
1
1
  import { ReactElement, ReactNode } from 'react';
2
- import { DashboardResource, EphemeralDashboardResource } from '@perses-dev/core';
2
+ import { DashboardSpec } from '@perses-dev/spec';
3
3
  import { EmptyDashboardProps } from '../../components';
4
4
  import { OnSaveDashboard } from '../../context';
5
+ import { DashboardResource } from '../../model';
5
6
  export interface DashboardAppProps {
6
- dashboardResource: DashboardResource | EphemeralDashboardResource;
7
+ dashboardResource: DashboardResource;
7
8
  emptyDashboardProps?: Partial<EmptyDashboardProps>;
8
9
  isReadonly: boolean;
9
10
  isVariableEnabled: boolean;
10
11
  isDatasourceEnabled: boolean;
12
+ disableShortcuts?: boolean;
11
13
  isCreating?: boolean;
12
14
  isInitialVariableSticky?: boolean;
13
15
  isLeavingConfirmDialogEnabled?: boolean;
14
16
  dashboardTitleComponent?: ReactNode;
15
17
  onSave?: OnSaveDashboard;
16
- onDiscard?: (entity: DashboardResource) => void;
18
+ onDiscard?: (name: string, spec: DashboardSpec) => void;
17
19
  }
18
20
  export declare const DashboardApp: (props: DashboardAppProps) => ReactElement;
19
21
  //# sourceMappingURL=DashboardApp.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DashboardApp.d.ts","sourceRoot":"","sources":["../../../src/views/ViewDashboard/DashboardApp.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAG1D,OAAO,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAEjF,OAAO,EAQL,mBAAmB,EAIpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAkE,MAAM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AAuB,CAAC,EAAE,OAAO,CAAC;IAElC,6BAA6B,CAAC,EAAE,OAAO,CAAC;IACxC,uBAAuB,CAAC,EAAE,SAAS,CAAC;IACpC,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;CACzD;AAED,eAAO,MAAM,YAAY,UAAW,iBAAiB,KAAG,YAMvD,CAAC"}
@@ -15,10 +15,18 @@ import { useState } from 'react';
15
15
  import { Box } from '@mui/material';
16
16
  import { ChartsProvider, ErrorAlert, ErrorBoundary, useChartsTheme } from '@perses-dev/components';
17
17
  import { useDatasourceStore } from '@perses-dev/plugin-system';
18
- import { PanelDrawer, Dashboard, PanelGroupDialog, DeletePanelGroupDialog, DashboardDiscardChangesConfirmationDialog, DashboardToolbar, DeletePanelDialog, EditJsonDialog, SaveChangesConfirmationDialog, LeaveDialog } from '../../components';
18
+ import { PanelDrawer, Dashboard, useDashboardShortcuts, PanelGroupDialog, DeletePanelGroupDialog, DashboardDiscardChangesConfirmationDialog, DashboardToolbar, DeletePanelDialog, EditJsonDialog, SaveChangesConfirmationDialog, LeaveDialog } from '../../components';
19
19
  import { useDashboard, useDiscardChangesConfirmationDialog, useEditMode } from '../../context';
20
+ import { PanelFocusProvider } from '../../keyboard-shortcuts';
20
21
  export const DashboardApp = (props)=>{
21
- const { dashboardResource, emptyDashboardProps, isReadonly, isVariableEnabled, isDatasourceEnabled, isCreating, isInitialVariableSticky, isLeavingConfirmDialogEnabled, dashboardTitleComponent, onSave, onDiscard } = props;
22
+ return /*#__PURE__*/ _jsx(PanelFocusProvider, {
23
+ children: /*#__PURE__*/ _jsx(DashboardAppContent, {
24
+ ...props
25
+ })
26
+ });
27
+ };
28
+ const DashboardAppContent = (props)=>{
29
+ const { dashboardResource, emptyDashboardProps, isReadonly, isVariableEnabled, isDatasourceEnabled, disableShortcuts, isCreating, isInitialVariableSticky, isLeavingConfirmDialogEnabled, dashboardTitleComponent, onSave, onDiscard } = props;
22
30
  const chartsTheme = useChartsTheme();
23
31
  const { isEditMode, setEditMode } = useEditMode();
24
32
  const { dashboard, setDashboard } = useDashboard();
@@ -33,7 +41,7 @@ export const DashboardApp = (props)=>{
33
41
  setEditMode(false);
34
42
  closeDiscardChangesConfirmationDialog();
35
43
  if (onDiscard) {
36
- onDiscard(dashboard);
44
+ onDiscard(dashboard.metadata.name, dashboard.spec);
37
45
  }
38
46
  };
39
47
  const onEditButtonClick = ()=>{
@@ -56,6 +64,13 @@ export const DashboardApp = (props)=>{
56
64
  });
57
65
  }
58
66
  };
67
+ useDashboardShortcuts({
68
+ onSave,
69
+ isReadonly,
70
+ onEditButtonClick,
71
+ onCancelButtonClick,
72
+ disabled: disableShortcuts
73
+ });
59
74
  return /*#__PURE__*/ _jsxs(Box, {
60
75
  sx: {
61
76
  flexGrow: 1,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/views/ViewDashboard/DashboardApp.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ReactElement, ReactNode, useState } from 'react';\nimport { Box } from '@mui/material';\nimport { ChartsProvider, ErrorAlert, ErrorBoundary, useChartsTheme } from '@perses-dev/components';\nimport { DashboardResource, EphemeralDashboardResource } from '@perses-dev/core';\nimport { useDatasourceStore } from '@perses-dev/plugin-system';\nimport {\n PanelDrawer,\n Dashboard,\n PanelGroupDialog,\n DeletePanelGroupDialog,\n DashboardDiscardChangesConfirmationDialog,\n DashboardToolbar,\n DeletePanelDialog,\n EmptyDashboardProps,\n EditJsonDialog,\n SaveChangesConfirmationDialog,\n LeaveDialog,\n} from '../../components';\nimport { OnSaveDashboard, useDashboard, useDiscardChangesConfirmationDialog, useEditMode } from '../../context';\n\nexport interface DashboardAppProps {\n dashboardResource: DashboardResource | EphemeralDashboardResource;\n emptyDashboardProps?: Partial<EmptyDashboardProps>;\n isReadonly: boolean;\n isVariableEnabled: boolean;\n isDatasourceEnabled: boolean;\n isCreating?: boolean;\n isInitialVariableSticky?: boolean;\n // If true, browser confirmation dialog will be shown when navigating away with unsaved changes (closing tab, ...).\n isLeavingConfirmDialogEnabled?: boolean;\n dashboardTitleComponent?: ReactNode;\n onSave?: OnSaveDashboard;\n onDiscard?: (entity: DashboardResource) => void;\n}\n\nexport const DashboardApp = (props: DashboardAppProps): ReactElement => {\n const {\n dashboardResource,\n emptyDashboardProps,\n isReadonly,\n isVariableEnabled,\n isDatasourceEnabled,\n isCreating,\n isInitialVariableSticky,\n isLeavingConfirmDialogEnabled,\n dashboardTitleComponent,\n onSave,\n onDiscard,\n } = props;\n\n const chartsTheme = useChartsTheme();\n\n const { isEditMode, setEditMode } = useEditMode();\n const { dashboard, setDashboard } = useDashboard();\n const [originalDashboard, setOriginalDashboard] = useState<\n DashboardResource | EphemeralDashboardResource | undefined\n >(undefined);\n const { setSavedDatasources } = useDatasourceStore();\n\n const { openDiscardChangesConfirmationDialog, closeDiscardChangesConfirmationDialog } =\n useDiscardChangesConfirmationDialog();\n\n const handleDiscardChanges = (): void => {\n // Reset to the original spec and exit edit mode\n if (originalDashboard) {\n setDashboard(originalDashboard);\n }\n setEditMode(false);\n closeDiscardChangesConfirmationDialog();\n if (onDiscard) {\n onDiscard(dashboard as unknown as DashboardResource);\n }\n };\n\n const onEditButtonClick = (): void => {\n setEditMode(true);\n setOriginalDashboard(dashboard);\n setSavedDatasources(dashboard.spec.datasources ?? {});\n };\n\n const onCancelButtonClick = (): void => {\n // check if dashboard has been modified\n if (JSON.stringify(dashboard) === JSON.stringify(originalDashboard)) {\n setEditMode(false);\n } else {\n openDiscardChangesConfirmationDialog({\n onDiscardChanges: () => {\n handleDiscardChanges();\n },\n onCancel: () => {\n closeDiscardChangesConfirmationDialog();\n },\n });\n }\n };\n\n return (\n <Box\n sx={{\n flexGrow: 1,\n overflowX: 'hidden',\n overflowY: 'auto',\n display: 'flex',\n flexDirection: 'column',\n }}\n >\n <DashboardToolbar\n dashboardName={dashboardResource.metadata.name}\n dashboardTitleComponent={dashboardTitleComponent}\n initialVariableIsSticky={isInitialVariableSticky}\n onSave={onSave}\n isReadonly={isReadonly}\n isVariableEnabled={isVariableEnabled}\n isDatasourceEnabled={isDatasourceEnabled}\n onEditButtonClick={onEditButtonClick}\n onCancelButtonClick={onCancelButtonClick}\n />\n <Box sx={{ paddingTop: 2, paddingX: 2, height: '100%' }}>\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <Dashboard\n emptyDashboardProps={{\n onEditButtonClick,\n ...emptyDashboardProps,\n }}\n />\n </ErrorBoundary>\n <ChartsProvider chartsTheme={chartsTheme} enablePinning={false} enableSyncGrouping={false}>\n <PanelDrawer />\n </ChartsProvider>\n <PanelGroupDialog />\n <DeletePanelGroupDialog />\n <DeletePanelDialog />\n <DashboardDiscardChangesConfirmationDialog />\n <EditJsonDialog isReadonly={!isEditMode} disableMetadataEdition={!isCreating} />\n <SaveChangesConfirmationDialog />\n {isLeavingConfirmDialogEnabled && isEditMode && (\n <LeaveDialog original={originalDashboard} current={dashboard} />\n )}\n </Box>\n </Box>\n );\n};\n"],"names":["useState","Box","ChartsProvider","ErrorAlert","ErrorBoundary","useChartsTheme","useDatasourceStore","PanelDrawer","Dashboard","PanelGroupDialog","DeletePanelGroupDialog","DashboardDiscardChangesConfirmationDialog","DashboardToolbar","DeletePanelDialog","EditJsonDialog","SaveChangesConfirmationDialog","LeaveDialog","useDashboard","useDiscardChangesConfirmationDialog","useEditMode","DashboardApp","props","dashboardResource","emptyDashboardProps","isReadonly","isVariableEnabled","isDatasourceEnabled","isCreating","isInitialVariableSticky","isLeavingConfirmDialogEnabled","dashboardTitleComponent","onSave","onDiscard","chartsTheme","isEditMode","setEditMode","dashboard","setDashboard","originalDashboard","setOriginalDashboard","undefined","setSavedDatasources","openDiscardChangesConfirmationDialog","closeDiscardChangesConfirmationDialog","handleDiscardChanges","onEditButtonClick","spec","datasources","onCancelButtonClick","JSON","stringify","onDiscardChanges","onCancel","sx","flexGrow","overflowX","overflowY","display","flexDirection","dashboardName","metadata","name","initialVariableIsSticky","paddingTop","paddingX","height","FallbackComponent","enablePinning","enableSyncGrouping","disableMetadataEdition","original","current"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAAkCA,QAAQ,QAAQ,QAAQ;AAC1D,SAASC,GAAG,QAAQ,gBAAgB;AACpC,SAASC,cAAc,EAAEC,UAAU,EAAEC,aAAa,EAAEC,cAAc,QAAQ,yBAAyB;AAEnG,SAASC,kBAAkB,QAAQ,4BAA4B;AAC/D,SACEC,WAAW,EACXC,SAAS,EACTC,gBAAgB,EAChBC,sBAAsB,EACtBC,yCAAyC,EACzCC,gBAAgB,EAChBC,iBAAiB,EAEjBC,cAAc,EACdC,6BAA6B,EAC7BC,WAAW,QACN,mBAAmB;AAC1B,SAA0BC,YAAY,EAAEC,mCAAmC,EAAEC,WAAW,QAAQ,gBAAgB;AAiBhH,OAAO,MAAMC,eAAe,CAACC;IAC3B,MAAM,EACJC,iBAAiB,EACjBC,mBAAmB,EACnBC,UAAU,EACVC,iBAAiB,EACjBC,mBAAmB,EACnBC,UAAU,EACVC,uBAAuB,EACvBC,6BAA6B,EAC7BC,uBAAuB,EACvBC,MAAM,EACNC,SAAS,EACV,GAAGX;IAEJ,MAAMY,cAAc5B;IAEpB,MAAM,EAAE6B,UAAU,EAAEC,WAAW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wBAAakC,eAAe;wBAAOC,oBAAoB;kCAClF,cAAA,KAAC7D;;kCAEH,KAACE;kCACD,KAACC;kCACD,KAACG;kCACD,KAACF;kCACD,KAACG;wBAAeU,YAAY,CAACU;wBAAYmC,wBAAwB,CAAC1C;;kCAClE,KAACZ;oBACAc,iCAAiCK,4BAChC,KAAClB;wBAAYsD,UAAUhC;wBAAmBiC,SAASnC;;;;;;AAK7D,EAAE"}
1
+ {"version":3,"sources":["../../../src/views/ViewDashboard/DashboardApp.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ReactElement, ReactNode, useState } from 'react';\nimport { Box } from '@mui/material';\nimport { ChartsProvider, ErrorAlert, ErrorBoundary, useChartsTheme } from '@perses-dev/components';\nimport { useDatasourceStore } from '@perses-dev/plugin-system';\nimport { DashboardSpec } from '@perses-dev/spec';\nimport {\n PanelDrawer,\n Dashboard,\n useDashboardShortcuts,\n PanelGroupDialog,\n DeletePanelGroupDialog,\n DashboardDiscardChangesConfirmationDialog,\n DashboardToolbar,\n DeletePanelDialog,\n EmptyDashboardProps,\n EditJsonDialog,\n SaveChangesConfirmationDialog,\n LeaveDialog,\n} from '../../components';\nimport { OnSaveDashboard, useDashboard, useDiscardChangesConfirmationDialog, useEditMode } from '../../context';\nimport { PanelFocusProvider } from '../../keyboard-shortcuts';\nimport { DashboardResource } from '../../model';\n\nexport interface DashboardAppProps {\n dashboardResource: DashboardResource;\n emptyDashboardProps?: Partial<EmptyDashboardProps>;\n isReadonly: boolean;\n isVariableEnabled: boolean;\n isDatasourceEnabled: boolean;\n disableShortcuts?: boolean;\n isCreating?: boolean;\n isInitialVariableSticky?: boolean;\n // If true, browser confirmation dialog will be shown when navigating away with unsaved changes (closing tab, ...).\n isLeavingConfirmDialogEnabled?: boolean;\n dashboardTitleComponent?: ReactNode;\n onSave?: OnSaveDashboard;\n onDiscard?: (name: string, spec: DashboardSpec) => void;\n}\n\nexport const DashboardApp = (props: DashboardAppProps): ReactElement => {\n return (\n <PanelFocusProvider>\n <DashboardAppContent {...props} />\n </PanelFocusProvider>\n );\n};\n\nconst DashboardAppContent = (props: DashboardAppProps): ReactElement => {\n const {\n dashboardResource,\n emptyDashboardProps,\n isReadonly,\n isVariableEnabled,\n isDatasourceEnabled,\n disableShortcuts,\n isCreating,\n isInitialVariableSticky,\n isLeavingConfirmDialogEnabled,\n dashboardTitleComponent,\n onSave,\n onDiscard,\n } = props;\n\n const chartsTheme = useChartsTheme();\n\n const { isEditMode, setEditMode } = useEditMode();\n\n const { dashboard, setDashboard } = useDashboard();\n const [originalDashboard, setOriginalDashboard] = useState<DashboardResource | undefined>(undefined);\n\n const { setSavedDatasources } = useDatasourceStore();\n\n const { openDiscardChangesConfirmationDialog, closeDiscardChangesConfirmationDialog } =\n useDiscardChangesConfirmationDialog();\n\n const handleDiscardChanges = (): void => {\n // Reset to the original spec and exit edit mode\n if (originalDashboard) {\n setDashboard(originalDashboard);\n }\n setEditMode(false);\n closeDiscardChangesConfirmationDialog();\n if (onDiscard) {\n onDiscard(dashboard.metadata.name, dashboard.spec);\n }\n };\n\n const onEditButtonClick = (): void => {\n setEditMode(true);\n setOriginalDashboard(dashboard);\n setSavedDatasources(dashboard.spec.datasources ?? {});\n };\n\n const onCancelButtonClick = (): void => {\n // check if dashboard has been modified\n if (JSON.stringify(dashboard) === JSON.stringify(originalDashboard)) {\n setEditMode(false);\n } else {\n openDiscardChangesConfirmationDialog({\n onDiscardChanges: () => {\n handleDiscardChanges();\n },\n onCancel: () => {\n closeDiscardChangesConfirmationDialog();\n },\n });\n }\n };\n\n useDashboardShortcuts({\n onSave,\n isReadonly,\n onEditButtonClick,\n onCancelButtonClick,\n disabled: disableShortcuts,\n });\n\n return (\n <Box\n sx={{\n flexGrow: 1,\n overflowX: 'hidden',\n overflowY: 'auto',\n display: 'flex',\n flexDirection: 'column',\n }}\n >\n <DashboardToolbar\n dashboardName={dashboardResource.metadata.name}\n dashboardTitleComponent={dashboardTitleComponent}\n initialVariableIsSticky={isInitialVariableSticky}\n onSave={onSave}\n isReadonly={isReadonly}\n isVariableEnabled={isVariableEnabled}\n isDatasourceEnabled={isDatasourceEnabled}\n onEditButtonClick={onEditButtonClick}\n onCancelButtonClick={onCancelButtonClick}\n />\n <Box sx={{ paddingTop: 2, paddingX: 2, height: '100%' }}>\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <Dashboard\n emptyDashboardProps={{\n onEditButtonClick,\n ...emptyDashboardProps,\n }}\n />\n </ErrorBoundary>\n <ChartsProvider chartsTheme={chartsTheme} enablePinning={false} enableSyncGrouping={false}>\n <PanelDrawer />\n </ChartsProvider>\n <PanelGroupDialog />\n <DeletePanelGroupDialog />\n <DeletePanelDialog />\n <DashboardDiscardChangesConfirmationDialog />\n <EditJsonDialog isReadonly={!isEditMode} disableMetadataEdition={!isCreating} />\n <SaveChangesConfirmationDialog />\n {isLeavingConfirmDialogEnabled && isEditMode && (\n <LeaveDialog original={originalDashboard} current={dashboard} />\n )}\n </Box>\n </Box>\n );\n};\n"],"names":["useState","Box","ChartsProvider","ErrorAlert","ErrorBoundary","useChartsTheme","useDatasourceStore","PanelDrawer","Dashboard","useDashboardShortcuts","PanelGroupDialog","DeletePanelGroupDialog","DashboardDiscardChangesConfirmationDialog","DashboardToolbar","DeletePanelDialog","EditJsonDialog","SaveChangesConfirmationDialog","LeaveDialog","useDashboard","useDiscardChangesConfirmationDialog","useEditMode","PanelFocusProvider","DashboardApp","props","DashboardAppContent","dashboardResource","emptyDashboardProps","isReadonly","isVariableEnabled","isDatasourceEnabled","disableShortcuts","isCreating","isInitialVariableSticky","isLeavingConfirmDialogEnabled","dashboardTitleComponent","onSave","onDiscard","chartsTheme","isEditMode","setEditMode","dashboard","setDashboard","originalDashboard","setOriginalDashboard","undefined","setSavedDatasources","openDiscardChangesConfirmationDialog","closeDiscardChangesConfirmationDialog","handleDiscardChanges","metadata","name","spec","onEditButtonClick","datasources","onCancelButtonClick","JSON","stringify","onDiscardChanges","onCancel","disabled","sx","flexGrow","overflowX","overflowY","display","flexDirection","dashboardName","initialVariableIsSticky","paddingTop","paddingX","height","FallbackComponent","enablePinning","enableSyncGrouping","disableMetadataEdition","original","current"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAAkCA,QAAQ,QAAQ,QAAQ;AAC1D,SAASC,GAAG,QAAQ,gBAAgB;AACpC,SAASC,cAAc,EAAEC,UAAU,EAAEC,aAAa,EAAEC,cAAc,QAAQ,yBAAyB;AACnG,SAASC,kBAAkB,QAAQ,4BAA4B;AAE/D,SACEC,WAAW,EACXC,SAAS,EACTC,qBAAqB,EACrBC,gBAAgB,EAChBC,sBAAsB,EACtBC,yCAAyC,EACzCC,gBAAgB,EAChBC,iBAAiB,EAEjBC,cAAc,EACdC,6BAA6B,EAC7BC,WAAW,QACN,mBAAmB;AAC1B,SAA0BC,YAAY,EAAEC,mCAAmC,EAAEC,WAAW,QAAQ,gBAAgB;AAChH,SAASC,kBAAkB,QAAQ,2BAA2B;AAmB9D,OAAO,MAAMC,eAAe,CAACC;IAC3B,qBACE,KAACF;kBACC,cAAA,KAACG;YAAqB,GAAGD,KAAK;;;AAGpC,EAAE;AAEF,MAAMC,sBAAsB,CAACD;IAC3B,MAAM,EACJE,iBAAiB,EACjBC,mBAAmB,EACnBC,UAAU,EACVC,iBAAiB,EACjBC,mBAAmB,EACnBC,gB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BAAqBA;gBACrBuB,mBAAmBA;gBACnBE,qBAAqBA;;0BAEvB,MAACrD;gBAAI2D,IAAI;oBAAEQ,YAAY;oBAAGC,UAAU;oBAAGC,QAAQ;gBAAO;;kCACpD,KAAClE;wBAAcmE,mBAAmBpE;kCAChC,cAAA,KAACK;4BACCkB,qBAAqB;gCACnB0B;gCACA,GAAG1B,mBAAmB;4BACxB;;;kCAGJ,KAACxB;wBAAemC,aAAaA;wBAAamC,eAAe;wBAAOC,oBAAoB;kCAClF,cAAA,KAAClE;;kCAEH,KAACG;kCACD,KAACC;kCACD,KAACG;kCACD,KAACF;kCACD,KAACG;wBAAeY,YAAY,CAACW;wBAAYoC,wBAAwB,CAAC3C;;kCAClE,KAACf;oBACAiB,iCAAiCK,4BAChC,KAACrB;wBAAY0D,UAAUjC;wBAAmBkC,SAASpC;;;;;;AAK7D"}
@@ -1 +1 @@
1
- {"version":3,"file":"ViewDashboard.d.ts","sourceRoot":"","sources":["../../../src/views/ViewDashboard/ViewDashboard.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAO,QAAQ,EAAE,MAAM,eAAe,CAAC;AAS9C,OAAO,EAAE,YAAY,EAAW,MAAM,OAAO,CAAC;AAC9C,OAAO,EACL,4BAA4B,EAE5B,qBAAqB,EAEtB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAgB,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEjE,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,EAAE,iBAAiB;IACvF,aAAa,EAAE,4BAA4B,CAAC,eAAe,CAAC,CAAC;IAC7D,2BAA2B,CAAC,EAAE,qBAAqB,CAAC,6BAA6B,CAAC,CAAC;IACnF,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,YAAY,CAgHrE"}
1
+ {"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