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

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 (276) hide show
  1. package/dist/cjs/components/Annotations/AnnotationsEditor.js +302 -0
  2. package/dist/cjs/components/Annotations/EditAnnotationsButton.js +83 -0
  3. package/dist/cjs/components/DashboardToolbar/DashboardToolbar.js +4 -2
  4. package/dist/cjs/components/GridLayout/GridItemContent.js +4 -11
  5. package/dist/cjs/components/Panel/Panel.js +4 -1
  6. package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +2 -2
  7. package/dist/cjs/components/PanelDrawer/PanelQueriesSharedControls.js +3 -16
  8. package/dist/cjs/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +20 -3
  9. package/dist/cjs/components/Variables/VariableEditor.js +52 -18
  10. package/dist/cjs/constants/defaults.js +32 -0
  11. package/dist/cjs/constants/index.js +1 -0
  12. package/dist/cjs/constants/user-interface-text.js +1 -0
  13. package/dist/cjs/context/AnnotationProvider/AnnotationHydrationWrapper.js +50 -0
  14. package/dist/cjs/context/AnnotationProvider/AnnotationProvider.js +145 -0
  15. package/dist/cjs/context/AnnotationProvider/index.js +30 -0
  16. package/dist/cjs/context/DashboardProvider/DashboardProvider.js +11 -4
  17. package/dist/cjs/context/DashboardProvider/panel-group-slice.js +14 -11
  18. package/dist/cjs/context/DashboardProvider/use-save-dashboard.js +12 -4
  19. package/dist/cjs/context/DatasourceStoreProvider.js +38 -5
  20. package/dist/cjs/context/VariableProvider/VariableProvider.js +11 -6
  21. package/dist/cjs/context/index.js +1 -0
  22. package/dist/cjs/context/useDashboard.js +11 -1
  23. package/dist/cjs/index.js +1 -0
  24. package/dist/cjs/keyboard-shortcuts/index.js +3 -0
  25. package/dist/cjs/keyboard-shortcuts/utils.js +11 -0
  26. package/dist/cjs/model/PanelGroupDefinition.js +25 -0
  27. package/dist/cjs/model/index.js +2 -1
  28. package/dist/cjs/views/ViewDashboard/DashboardApp.js +9 -1
  29. package/dist/cjs/views/ViewDashboard/ViewDashboard.js +33 -28
  30. package/dist/components/AddGroupButton/AddGroupButton.js +1 -1
  31. package/dist/components/AddGroupButton/AddGroupButton.js.map +1 -1
  32. package/dist/components/AddPanelButton/AddPanelButton.js +1 -1
  33. package/dist/components/AddPanelButton/AddPanelButton.js.map +1 -1
  34. package/dist/components/Annotations/AnnotationsEditor.d.ts +8 -0
  35. package/dist/components/Annotations/AnnotationsEditor.d.ts.map +1 -0
  36. package/dist/components/Annotations/AnnotationsEditor.js +289 -0
  37. package/dist/components/Annotations/AnnotationsEditor.js.map +1 -0
  38. package/dist/components/Annotations/EditAnnotationsButton.d.ts +18 -0
  39. package/dist/components/Annotations/EditAnnotationsButton.d.ts.map +1 -0
  40. package/dist/components/Annotations/EditAnnotationsButton.js +70 -0
  41. package/dist/components/Annotations/EditAnnotationsButton.js.map +1 -0
  42. package/dist/components/Dashboard/Dashboard.js +1 -1
  43. package/dist/components/Dashboard/Dashboard.js.map +1 -1
  44. package/dist/components/DashboardLinks/DashboardLinksEditor.js +1 -1
  45. package/dist/components/DashboardLinks/DashboardLinksEditor.js.map +1 -1
  46. package/dist/components/DashboardLinks/EditDashboardLinksButton.js +1 -1
  47. package/dist/components/DashboardLinks/EditDashboardLinksButton.js.map +1 -1
  48. package/dist/components/DashboardShortcuts/useDashboardShortcuts.js.map +1 -1
  49. package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js +1 -1
  50. package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js.map +1 -1
  51. package/dist/components/DashboardToolbar/DashboardToolbar.d.ts +2 -0
  52. package/dist/components/DashboardToolbar/DashboardToolbar.d.ts.map +1 -1
  53. package/dist/components/DashboardToolbar/DashboardToolbar.js +5 -3
  54. package/dist/components/DashboardToolbar/DashboardToolbar.js.map +1 -1
  55. package/dist/components/Datasources/DatasourceEditor.d.ts.map +1 -1
  56. package/dist/components/Datasources/DatasourceEditor.js +1 -1
  57. package/dist/components/Datasources/DatasourceEditor.js.map +1 -1
  58. package/dist/components/Datasources/EditDatasourcesButton.js +1 -1
  59. package/dist/components/Datasources/EditDatasourcesButton.js.map +1 -1
  60. package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js +1 -1
  61. package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js.map +1 -1
  62. package/dist/components/DownloadButton/DownloadButton.js +1 -1
  63. package/dist/components/DownloadButton/DownloadButton.js.map +1 -1
  64. package/dist/components/DownloadButton/serializeDashboard.d.ts +1 -1
  65. package/dist/components/DownloadButton/serializeDashboard.d.ts.map +1 -1
  66. package/dist/components/DownloadButton/serializeDashboard.js.map +1 -1
  67. package/dist/components/EditButton/EditButton.js +1 -1
  68. package/dist/components/EditButton/EditButton.js.map +1 -1
  69. package/dist/components/EditJsonButton/EditJsonButton.js +1 -1
  70. package/dist/components/EditJsonButton/EditJsonButton.js.map +1 -1
  71. package/dist/components/EditJsonDialog/EditJsonDialog.js +1 -1
  72. package/dist/components/EditJsonDialog/EditJsonDialog.js.map +1 -1
  73. package/dist/components/EmptyDashboard/EmptyDashboard.js +1 -1
  74. package/dist/components/EmptyDashboard/EmptyDashboard.js.map +1 -1
  75. package/dist/components/GridLayout/GridContainer.js +1 -1
  76. package/dist/components/GridLayout/GridContainer.js.map +1 -1
  77. package/dist/components/GridLayout/GridItemContent.d.ts +1 -1
  78. package/dist/components/GridLayout/GridItemContent.d.ts.map +1 -1
  79. package/dist/components/GridLayout/GridItemContent.js +4 -11
  80. package/dist/components/GridLayout/GridItemContent.js.map +1 -1
  81. package/dist/components/GridLayout/GridLayout.d.ts.map +1 -1
  82. package/dist/components/GridLayout/GridLayout.js +1 -1
  83. package/dist/components/GridLayout/GridLayout.js.map +1 -1
  84. package/dist/components/GridLayout/GridTitle.js +1 -1
  85. package/dist/components/GridLayout/GridTitle.js.map +1 -1
  86. package/dist/components/GridLayout/Row.d.ts +1 -1
  87. package/dist/components/GridLayout/Row.d.ts.map +1 -1
  88. package/dist/components/GridLayout/Row.js +1 -1
  89. package/dist/components/GridLayout/Row.js.map +1 -1
  90. package/dist/components/LeaveDialog/LeaveDialog.d.ts +1 -1
  91. package/dist/components/LeaveDialog/LeaveDialog.d.ts.map +1 -1
  92. package/dist/components/LeaveDialog/LeaveDialog.js +1 -1
  93. package/dist/components/LeaveDialog/LeaveDialog.js.map +1 -1
  94. package/dist/components/LinksDisplay/LinksDisplay.js +1 -1
  95. package/dist/components/LinksDisplay/LinksDisplay.js.map +1 -1
  96. package/dist/components/Panel/Panel.d.ts +1 -1
  97. package/dist/components/Panel/Panel.d.ts.map +1 -1
  98. package/dist/components/Panel/Panel.js +5 -2
  99. package/dist/components/Panel/Panel.js.map +1 -1
  100. package/dist/components/Panel/PanelActions.js +1 -1
  101. package/dist/components/Panel/PanelActions.js.map +1 -1
  102. package/dist/components/Panel/PanelContent.js +1 -1
  103. package/dist/components/Panel/PanelContent.js.map +1 -1
  104. package/dist/components/Panel/PanelHeader.js +1 -1
  105. package/dist/components/Panel/PanelHeader.js.map +1 -1
  106. package/dist/components/Panel/PanelPluginLoader.js +1 -1
  107. package/dist/components/Panel/PanelPluginLoader.js.map +1 -1
  108. package/dist/components/Panel/useSelectionItemActions.js +1 -1
  109. package/dist/components/Panel/useSelectionItemActions.js.map +1 -1
  110. package/dist/components/PanelDrawer/PanelDrawer.js +1 -1
  111. package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -1
  112. package/dist/components/PanelDrawer/PanelEditorForm.d.ts +1 -1
  113. package/dist/components/PanelDrawer/PanelEditorForm.d.ts.map +1 -1
  114. package/dist/components/PanelDrawer/PanelEditorForm.js +3 -3
  115. package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -1
  116. package/dist/components/PanelDrawer/PanelPreview.js +1 -1
  117. package/dist/components/PanelDrawer/PanelPreview.js.map +1 -1
  118. package/dist/components/PanelDrawer/PanelQueriesSharedControls.d.ts.map +1 -1
  119. package/dist/components/PanelDrawer/PanelQueriesSharedControls.js +5 -18
  120. package/dist/components/PanelDrawer/PanelQueriesSharedControls.js.map +1 -1
  121. package/dist/components/PanelGroupDialog/PanelGroupDialog.js +1 -1
  122. package/dist/components/PanelGroupDialog/PanelGroupDialog.js.map +1 -1
  123. package/dist/components/PanelGroupDialog/PanelGroupEditorForm.js +1 -1
  124. package/dist/components/PanelGroupDialog/PanelGroupEditorForm.js.map +1 -1
  125. package/dist/components/QuerySummaryTable/QuerySummaryTable.js +1 -1
  126. package/dist/components/QuerySummaryTable/QuerySummaryTable.js.map +1 -1
  127. package/dist/components/QueryViewerDialog/QueryViewerDialog.js +1 -1
  128. package/dist/components/QueryViewerDialog/QueryViewerDialog.js.map +1 -1
  129. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.d.ts.map +1 -1
  130. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +22 -5
  131. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js.map +1 -1
  132. package/dist/components/Variables/EditVariablesButton.js +1 -1
  133. package/dist/components/Variables/EditVariablesButton.js.map +1 -1
  134. package/dist/components/Variables/ListVariableListBox.js +1 -1
  135. package/dist/components/Variables/ListVariableListBox.js.map +1 -1
  136. package/dist/components/Variables/Variable.js +2 -2
  137. package/dist/components/Variables/Variable.js.map +1 -1
  138. package/dist/components/Variables/VariableEditor.d.ts +1 -1
  139. package/dist/components/Variables/VariableEditor.d.ts.map +1 -1
  140. package/dist/components/Variables/VariableEditor.js +57 -23
  141. package/dist/components/Variables/VariableEditor.js.map +1 -1
  142. package/dist/components/Variables/VariableList.d.ts.map +1 -1
  143. package/dist/components/Variables/VariableList.js +1 -1
  144. package/dist/components/Variables/VariableList.js.map +1 -1
  145. package/dist/constants/defaults.d.ts +4 -0
  146. package/dist/constants/defaults.d.ts.map +1 -0
  147. package/dist/{model/DashboardResource.js → constants/defaults.js} +3 -5
  148. package/dist/constants/defaults.js.map +1 -0
  149. package/dist/constants/index.d.ts +1 -0
  150. package/dist/constants/index.d.ts.map +1 -1
  151. package/dist/constants/index.js +1 -0
  152. package/dist/constants/index.js.map +1 -1
  153. package/dist/constants/user-interface-text.d.ts +1 -0
  154. package/dist/constants/user-interface-text.d.ts.map +1 -1
  155. package/dist/constants/user-interface-text.js +1 -0
  156. package/dist/constants/user-interface-text.js.map +1 -1
  157. package/dist/context/AnnotationProvider/AnnotationHydrationWrapper.d.ts +7 -0
  158. package/dist/context/AnnotationProvider/AnnotationHydrationWrapper.d.ts.map +1 -0
  159. package/dist/context/AnnotationProvider/AnnotationHydrationWrapper.js +48 -0
  160. package/dist/context/AnnotationProvider/AnnotationHydrationWrapper.js.map +1 -0
  161. package/dist/context/AnnotationProvider/AnnotationProvider.d.ts +40 -0
  162. package/dist/context/AnnotationProvider/AnnotationProvider.d.ts.map +1 -0
  163. package/dist/context/AnnotationProvider/AnnotationProvider.js +114 -0
  164. package/dist/context/AnnotationProvider/AnnotationProvider.js.map +1 -0
  165. package/dist/context/AnnotationProvider/index.d.ts +2 -0
  166. package/dist/context/AnnotationProvider/index.d.ts.map +1 -0
  167. package/dist/context/AnnotationProvider/index.js +15 -0
  168. package/dist/context/AnnotationProvider/index.js.map +1 -0
  169. package/dist/context/DashboardProvider/DashboardProvider.d.ts +4 -2
  170. package/dist/context/DashboardProvider/DashboardProvider.d.ts.map +1 -1
  171. package/dist/context/DashboardProvider/DashboardProvider.js +11 -4
  172. package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -1
  173. package/dist/context/DashboardProvider/common.d.ts +1 -1
  174. package/dist/context/DashboardProvider/common.d.ts.map +1 -1
  175. package/dist/context/DashboardProvider/common.js.map +1 -1
  176. package/dist/context/DashboardProvider/dashboard-provider-api.d.ts +2 -2
  177. package/dist/context/DashboardProvider/dashboard-provider-api.d.ts.map +1 -1
  178. package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -1
  179. package/dist/context/DashboardProvider/delete-panel-slice.d.ts +1 -1
  180. package/dist/context/DashboardProvider/delete-panel-slice.d.ts.map +1 -1
  181. package/dist/context/DashboardProvider/delete-panel-slice.js.map +1 -1
  182. package/dist/context/DashboardProvider/duplicate-panel-slice.d.ts +1 -1
  183. package/dist/context/DashboardProvider/duplicate-panel-slice.d.ts.map +1 -1
  184. package/dist/context/DashboardProvider/duplicate-panel-slice.js.map +1 -1
  185. package/dist/context/DashboardProvider/panel-editor-slice.d.ts +2 -1
  186. package/dist/context/DashboardProvider/panel-editor-slice.d.ts.map +1 -1
  187. package/dist/context/DashboardProvider/panel-editor-slice.js.map +1 -1
  188. package/dist/context/DashboardProvider/panel-group-slice.d.ts +1 -1
  189. package/dist/context/DashboardProvider/panel-group-slice.d.ts.map +1 -1
  190. package/dist/context/DashboardProvider/panel-group-slice.js +14 -11
  191. package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -1
  192. package/dist/context/DashboardProvider/save-changes-dialog-slice.d.ts +8 -1
  193. package/dist/context/DashboardProvider/save-changes-dialog-slice.d.ts.map +1 -1
  194. package/dist/context/DashboardProvider/save-changes-dialog-slice.js.map +1 -1
  195. package/dist/context/DashboardProvider/use-save-dashboard.d.ts.map +1 -1
  196. package/dist/context/DashboardProvider/use-save-dashboard.js +13 -5
  197. package/dist/context/DashboardProvider/use-save-dashboard.js.map +1 -1
  198. package/dist/context/DashboardProvider/view-panel-slice.d.ts +1 -1
  199. package/dist/context/DashboardProvider/view-panel-slice.d.ts.map +1 -1
  200. package/dist/context/DashboardProvider/view-panel-slice.js.map +1 -1
  201. package/dist/context/DatasourceStoreProvider.d.ts +1 -2
  202. package/dist/context/DatasourceStoreProvider.d.ts.map +1 -1
  203. package/dist/context/DatasourceStoreProvider.js +40 -7
  204. package/dist/context/DatasourceStoreProvider.js.map +1 -1
  205. package/dist/context/PanelEditorProvider/PanelEditorProvider.js +1 -1
  206. package/dist/context/PanelEditorProvider/PanelEditorProvider.js.map +1 -1
  207. package/dist/context/VariableProvider/VariableProvider.d.ts +3 -2
  208. package/dist/context/VariableProvider/VariableProvider.d.ts.map +1 -1
  209. package/dist/context/VariableProvider/VariableProvider.js +13 -8
  210. package/dist/context/VariableProvider/VariableProvider.js.map +1 -1
  211. package/dist/context/VariableProvider/hydrationUtils.d.ts +1 -1
  212. package/dist/context/VariableProvider/hydrationUtils.d.ts.map +1 -1
  213. package/dist/context/VariableProvider/hydrationUtils.js.map +1 -1
  214. package/dist/context/VariableProvider/utils.d.ts +1 -1
  215. package/dist/context/VariableProvider/utils.d.ts.map +1 -1
  216. package/dist/context/VariableProvider/utils.js.map +1 -1
  217. package/dist/context/index.d.ts +1 -0
  218. package/dist/context/index.d.ts.map +1 -1
  219. package/dist/context/index.js +1 -0
  220. package/dist/context/index.js.map +1 -1
  221. package/dist/context/useDashboard.d.ts +2 -3
  222. package/dist/context/useDashboard.d.ts.map +1 -1
  223. package/dist/context/useDashboard.js +11 -1
  224. package/dist/context/useDashboard.js.map +1 -1
  225. package/dist/index.d.ts +1 -0
  226. package/dist/index.d.ts.map +1 -1
  227. package/dist/index.js +1 -0
  228. package/dist/index.js.map +1 -1
  229. package/dist/keyboard-shortcuts/PanelFocusProvider.js +1 -1
  230. package/dist/keyboard-shortcuts/PanelFocusProvider.js.map +1 -1
  231. package/dist/keyboard-shortcuts/index.d.ts +1 -1
  232. package/dist/keyboard-shortcuts/index.d.ts.map +1 -1
  233. package/dist/keyboard-shortcuts/index.js +1 -1
  234. package/dist/keyboard-shortcuts/index.js.map +1 -1
  235. package/dist/keyboard-shortcuts/utils.d.ts +8 -0
  236. package/dist/keyboard-shortcuts/utils.d.ts.map +1 -1
  237. package/dist/keyboard-shortcuts/utils.js +13 -0
  238. package/dist/keyboard-shortcuts/utils.js.map +1 -1
  239. package/dist/model/PanelGroupDefinition.d.ts +59 -0
  240. package/dist/model/PanelGroupDefinition.d.ts.map +1 -0
  241. package/dist/model/PanelGroupDefinition.js +19 -0
  242. package/dist/model/PanelGroupDefinition.js.map +1 -0
  243. package/dist/model/VariableDefinition.d.ts +50 -0
  244. package/dist/model/VariableDefinition.d.ts.map +1 -0
  245. package/dist/model/VariableDefinition.js +20 -0
  246. package/dist/model/VariableDefinition.js.map +1 -0
  247. package/dist/model/index.d.ts +2 -1
  248. package/dist/model/index.d.ts.map +1 -1
  249. package/dist/model/index.js +2 -1
  250. package/dist/model/index.js.map +1 -1
  251. package/dist/test/dashboard-provider.d.ts +1 -1
  252. package/dist/test/dashboard-provider.d.ts.map +1 -1
  253. package/dist/test/dashboard-provider.js.map +1 -1
  254. package/dist/test/datasource-provider.d.ts +1 -1
  255. package/dist/test/datasource-provider.d.ts.map +1 -1
  256. package/dist/test/datasource-provider.js.map +1 -1
  257. package/dist/test/render.js +1 -1
  258. package/dist/test/render.js.map +1 -1
  259. package/dist/test/testDashboard.d.ts +1 -1
  260. package/dist/test/testDashboard.d.ts.map +1 -1
  261. package/dist/test/testDashboard.js.map +1 -1
  262. package/dist/utils/panelUtils.d.ts +1 -1
  263. package/dist/utils/panelUtils.d.ts.map +1 -1
  264. package/dist/utils/panelUtils.js.map +1 -1
  265. package/dist/views/ViewDashboard/DashboardApp.d.ts +3 -1
  266. package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -1
  267. package/dist/views/ViewDashboard/DashboardApp.js +11 -3
  268. package/dist/views/ViewDashboard/DashboardApp.js.map +1 -1
  269. package/dist/views/ViewDashboard/ViewDashboard.d.ts.map +1 -1
  270. package/dist/views/ViewDashboard/ViewDashboard.js +33 -28
  271. package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -1
  272. package/package.json +9 -10
  273. package/dist/model/DashboardResource.d.ts +0 -15
  274. package/dist/model/DashboardResource.d.ts.map +0 -1
  275. package/dist/model/DashboardResource.js.map +0 -1
  276. /package/dist/cjs/model/{DashboardResource.js → VariableDefinition.js} +0 -0
@@ -0,0 +1,302 @@
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
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ Object.defineProperty(exports, "AnnotationEditor", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return AnnotationEditor;
21
+ }
22
+ });
23
+ const _jsxruntime = require("react/jsx-runtime");
24
+ const _react = require("react");
25
+ const _material = require("@mui/material");
26
+ const _Plus = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/Plus"));
27
+ const _useimmer = require("use-immer");
28
+ const _Pencil = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/Pencil"));
29
+ const _TrashCan = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/TrashCan"));
30
+ const _ArrowUp = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/ArrowUp"));
31
+ const _ArrowDown = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/ArrowDown"));
32
+ const _pluginsystem = require("@perses-dev/plugin-system");
33
+ const _context = require("../../context");
34
+ function _interop_require_default(obj) {
35
+ return obj && obj.__esModule ? obj : {
36
+ default: obj
37
+ };
38
+ }
39
+ function validateAnnotationSpecs(annotationSpecs) {
40
+ const errors = [];
41
+ const annotationNames = [];
42
+ for (const annotationSpec of annotationSpecs){
43
+ if (annotationNames.includes(annotationSpec.display.name)) {
44
+ errors.push(`Duplicate annotation name: ${annotationSpec.display.name}`);
45
+ } else {
46
+ annotationNames.push(annotationSpec.display.name);
47
+ }
48
+ }
49
+ return {
50
+ errors: errors,
51
+ isValid: errors.length === 0
52
+ };
53
+ }
54
+ function AnnotationEditor(props) {
55
+ const [annotationSpecs, setAnnotationSpecs] = (0, _useimmer.useImmer)(props.annotationSpecs);
56
+ const [annotationEditIdx, setAnnotationEditIdx] = (0, _react.useState)(null);
57
+ const [annotationFormAction, setAnnotationFormAction] = (0, _react.useState)('update');
58
+ const validation = (0, _react.useMemo)(()=>validateAnnotationSpecs(annotationSpecs), [
59
+ annotationSpecs
60
+ ]);
61
+ const currentEditingAnnotationSpec = annotationEditIdx !== null ? annotationSpecs[annotationEditIdx] : undefined;
62
+ const { openDiscardChangesConfirmationDialog, closeDiscardChangesConfirmationDialog } = (0, _context.useDiscardChangesConfirmationDialog)();
63
+ const handleCancel = ()=>{
64
+ if (JSON.stringify(props.annotationSpecs) !== JSON.stringify(annotationSpecs)) {
65
+ openDiscardChangesConfirmationDialog({
66
+ onDiscardChanges: ()=>{
67
+ closeDiscardChangesConfirmationDialog();
68
+ props.onCancel();
69
+ },
70
+ onCancel: ()=>{
71
+ closeDiscardChangesConfirmationDialog();
72
+ },
73
+ description: 'You have unapplied changes. Are you sure you want to discard these changes? Changes cannot be recovered.'
74
+ });
75
+ } else {
76
+ props.onCancel();
77
+ }
78
+ };
79
+ const removeAnnotation = (index)=>{
80
+ setAnnotationSpecs((draft)=>{
81
+ draft.splice(index, 1);
82
+ });
83
+ };
84
+ const addAnnotation = ()=>{
85
+ setAnnotationFormAction('create');
86
+ setAnnotationSpecs((draft)=>{
87
+ draft.push({
88
+ display: {
89
+ name: 'NewAnnotation'
90
+ },
91
+ plugin: {}
92
+ });
93
+ });
94
+ setAnnotationEditIdx(annotationSpecs.length);
95
+ };
96
+ const editAnnotation = (index)=>{
97
+ setAnnotationFormAction('update');
98
+ setAnnotationEditIdx(index);
99
+ };
100
+ const toggleAnnotationVisibility = (index, visible)=>{
101
+ setAnnotationSpecs((draft)=>{
102
+ const v = draft[index];
103
+ if (!v) {
104
+ return;
105
+ }
106
+ v.display.hidden = !visible;
107
+ });
108
+ };
109
+ const changeAnnotationOrder = (index, direction)=>{
110
+ const step = direction === 'up' ? -1 : 1;
111
+ setAnnotationSpecs((draft)=>{
112
+ const current = draft[index];
113
+ const adjacent = draft[index + step];
114
+ if (!current || !adjacent) {
115
+ return;
116
+ }
117
+ draft[index + step] = current;
118
+ draft[index] = adjacent;
119
+ });
120
+ };
121
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, {
122
+ children: annotationEditIdx !== null && currentEditingAnnotationSpec ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.ValidationProvider, {
123
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.AnnotationEditorForm, {
124
+ initialAnnotationSpec: currentEditingAnnotationSpec,
125
+ action: annotationFormAction,
126
+ isDraft: true,
127
+ onActionChange: setAnnotationFormAction,
128
+ onSave: (definition)=>{
129
+ setAnnotationSpecs((draft)=>{
130
+ draft[annotationEditIdx] = definition;
131
+ setAnnotationEditIdx(null);
132
+ });
133
+ },
134
+ onClose: ()=>{
135
+ if (annotationFormAction === 'create') {
136
+ removeAnnotation(annotationEditIdx);
137
+ }
138
+ setAnnotationEditIdx(null);
139
+ }
140
+ })
141
+ }) : /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
142
+ children: [
143
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
144
+ sx: {
145
+ display: 'flex',
146
+ alignItems: 'center',
147
+ padding: (theme)=>theme.spacing(1, 2),
148
+ borderBottom: (theme)=>`1px solid ${theme.palette.divider}`
149
+ },
150
+ children: [
151
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
152
+ variant: "h2",
153
+ children: "Edit Dashboard Annotations"
154
+ }),
155
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
156
+ direction: "row",
157
+ spacing: 1,
158
+ marginLeft: "auto",
159
+ children: [
160
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Button, {
161
+ disabled: props.annotationSpecs === annotationSpecs || !validation.isValid,
162
+ variant: "contained",
163
+ onClick: ()=>{
164
+ props.onChange(annotationSpecs);
165
+ },
166
+ children: "Apply"
167
+ }),
168
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Button, {
169
+ color: "secondary",
170
+ variant: "outlined",
171
+ onClick: handleCancel,
172
+ children: "Cancel"
173
+ })
174
+ ]
175
+ })
176
+ ]
177
+ }),
178
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
179
+ padding: 2,
180
+ sx: {
181
+ overflowY: 'scroll'
182
+ },
183
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
184
+ spacing: 2,
185
+ children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
186
+ spacing: 2,
187
+ children: [
188
+ !validation.isValid && validation.errors.map((error)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Alert, {
189
+ severity: "error",
190
+ children: error
191
+ }, error)),
192
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableContainer, {
193
+ children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Table, {
194
+ sx: {
195
+ minWidth: 650
196
+ },
197
+ "aria-label": "table of annotations",
198
+ children: [
199
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableHead, {
200
+ children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.TableRow, {
201
+ children: [
202
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(TableCell, {
203
+ children: "Visibility"
204
+ }),
205
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(TableCell, {
206
+ children: "Name"
207
+ }),
208
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(TableCell, {
209
+ children: "Type"
210
+ }),
211
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(TableCell, {
212
+ children: "Description"
213
+ }),
214
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(TableCell, {
215
+ align: "right",
216
+ children: "Actions"
217
+ })
218
+ ]
219
+ })
220
+ }),
221
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableBody, {
222
+ children: annotationSpecs.map((v, idx)=>/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.TableRow, {
223
+ children: [
224
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(TableCell, {
225
+ component: "th",
226
+ scope: "row",
227
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Switch, {
228
+ checked: v.display?.hidden !== true,
229
+ onChange: (e)=>{
230
+ toggleAnnotationVisibility(idx, e.target.checked);
231
+ }
232
+ })
233
+ }),
234
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(TableCell, {
235
+ component: "th",
236
+ scope: "row",
237
+ sx: {
238
+ fontWeight: 'bold'
239
+ },
240
+ children: v.display.name
241
+ }),
242
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(TableCell, {
243
+ children: v.plugin.kind
244
+ }),
245
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(TableCell, {
246
+ children: v.display?.description ?? ''
247
+ }),
248
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)(TableCell, {
249
+ align: "right",
250
+ sx: {
251
+ whiteSpace: 'nowrap'
252
+ },
253
+ children: [
254
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
255
+ onClick: ()=>changeAnnotationOrder(idx, 'up'),
256
+ disabled: idx === 0,
257
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_ArrowUp.default, {})
258
+ }),
259
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
260
+ onClick: ()=>changeAnnotationOrder(idx, 'down'),
261
+ disabled: idx === annotationSpecs.length - 1,
262
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_ArrowDown.default, {})
263
+ }),
264
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
265
+ onClick: ()=>editAnnotation(idx),
266
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Pencil.default, {})
267
+ }),
268
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
269
+ onClick: ()=>removeAnnotation(idx),
270
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_TrashCan.default, {})
271
+ })
272
+ ]
273
+ })
274
+ ]
275
+ }, v.display.name))
276
+ })
277
+ ]
278
+ })
279
+ }),
280
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
281
+ display: "flex",
282
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Button, {
283
+ variant: "contained",
284
+ startIcon: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Plus.default, {}),
285
+ sx: {
286
+ marginLeft: 'auto'
287
+ },
288
+ onClick: addAnnotation,
289
+ children: "Add Annotation"
290
+ })
291
+ })
292
+ ]
293
+ })
294
+ })
295
+ })
296
+ ]
297
+ })
298
+ });
299
+ }
300
+ const TableCell = (0, _material.styled)(_material.TableCell)(({ theme })=>({
301
+ borderBottom: `solid 1px ${theme.palette.divider}`
302
+ }));
@@ -0,0 +1,83 @@
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
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ Object.defineProperty(exports, "EditAnnotationsButton", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return EditAnnotationsButton;
21
+ }
22
+ });
23
+ const _jsxruntime = require("react/jsx-runtime");
24
+ const _react = require("react");
25
+ const _material = require("@mui/material");
26
+ const _PencilOutline = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/PencilOutline"));
27
+ const _components = require("@perses-dev/components");
28
+ const _constants = require("../../constants");
29
+ const _context = require("../../context");
30
+ const _AnnotationsEditor = require("./AnnotationsEditor");
31
+ function _interop_require_default(obj) {
32
+ return obj && obj.__esModule ? obj : {
33
+ default: obj
34
+ };
35
+ }
36
+ function EditAnnotationsButton({ variant = 'text', label = 'Annotations', color = 'primary', fullWidth }) {
37
+ const [isAnnotationEditorOpen, setIsAnnotationEditorOpen] = (0, _react.useState)(false);
38
+ const annotationSpecs = (0, _context.useAnnotationSpecs)();
39
+ const { setAnnotationSpecs } = (0, _context.useAnnotationActions)();
40
+ const openAnnotationEditor = ()=>{
41
+ setIsAnnotationEditorOpen(true);
42
+ };
43
+ const closeAnnotationEditor = ()=>{
44
+ setIsAnnotationEditorOpen(false);
45
+ };
46
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
47
+ children: [
48
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.InfoTooltip, {
49
+ description: _constants.TOOLTIP_TEXT.editAnnotations,
50
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Button, {
51
+ startIcon: /*#__PURE__*/ (0, _jsxruntime.jsx)(_PencilOutline.default, {}),
52
+ onClick: openAnnotationEditor,
53
+ "aria-label": _constants.TOOLTIP_TEXT.editAnnotations,
54
+ variant: variant,
55
+ color: color,
56
+ fullWidth: fullWidth,
57
+ sx: _constants.editButtonStyle,
58
+ children: label
59
+ })
60
+ }),
61
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.Drawer, {
62
+ isOpen: isAnnotationEditorOpen,
63
+ onClose: closeAnnotationEditor,
64
+ slotProps: {
65
+ paper: {
66
+ sx: {
67
+ width: '50%'
68
+ }
69
+ }
70
+ },
71
+ "data-testid": "annotation-editor",
72
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_AnnotationsEditor.AnnotationEditor, {
73
+ annotationSpecs: annotationSpecs,
74
+ onCancel: closeAnnotationEditor,
75
+ onChange: (annotations)=>{
76
+ setAnnotationSpecs(annotations);
77
+ setIsAnnotationEditorOpen(false);
78
+ }
79
+ })
80
+ })
81
+ ]
82
+ });
83
+ }
@@ -34,12 +34,13 @@ const _EditButton = require("../EditButton");
34
34
  const _EditJsonButton = require("../EditJsonButton");
35
35
  const _SaveDashboardButton = require("../SaveDashboardButton");
36
36
  const _DashboardStickyToolbar = require("../DashboardStickyToolbar");
37
+ const _EditAnnotationsButton = require("../Annotations/EditAnnotationsButton");
37
38
  const _DashboardLinks = require("../DashboardLinks");
38
39
  const _LinksDisplay = require("../LinksDisplay");
39
40
  const DashboardToolbar = (props)=>{
40
- const { dashboardName, dashboardTitleComponent, initialVariableIsSticky, isReadonly, isVariableEnabled, isDatasourceEnabled, isLinksEnabled = true, onEditButtonClick, onCancelButtonClick, onSave } = props;
41
+ const { dashboardName, dashboardTitleComponent, initialVariableIsSticky, isReadonly, isVariableEnabled, isAnnotationEnabled, isDatasourceEnabled, isLinksEnabled = true, timezone: toolbarTimezone, onEditButtonClick, onCancelButtonClick, onSave } = props;
41
42
  const { isEditMode } = (0, _context.useEditMode)();
42
- const { timeZone, setTimeZone } = (0, _pluginsystem.useTimeZoneParams)('local');
43
+ const { timeZone, setTimeZone } = (0, _pluginsystem.useTimeZoneParams)(toolbarTimezone);
43
44
  const dashboardLinks = (0, _context.useDashboardLinks)();
44
45
  const isBiggerThanSm = (0, _material.useMediaQuery)((0, _material.useTheme)().breakpoints.up('sm'));
45
46
  const isBiggerThanMd = (0, _material.useMediaQuery)((0, _material.useTheme)().breakpoints.up('md'));
@@ -91,6 +92,7 @@ const DashboardToolbar = (props)=>{
91
92
  ml: 1,
92
93
  whiteSpace: "nowrap",
93
94
  children: [
95
+ isAnnotationEnabled && /*#__PURE__*/ (0, _jsxruntime.jsx)(_EditAnnotationsButton.EditAnnotationsButton, {}),
94
96
  isVariableEnabled && /*#__PURE__*/ (0, _jsxruntime.jsx)(_Variables.EditVariablesButton, {}),
95
97
  isDatasourceEnabled && /*#__PURE__*/ (0, _jsxruntime.jsx)(_Datasources.EditDatasourcesButton, {}),
96
98
  isLinksEnabled && /*#__PURE__*/ (0, _jsxruntime.jsx)(_DashboardLinks.EditDashboardLinksButton, {}),
@@ -25,7 +25,7 @@ const _material = require("@mui/material");
25
25
  const _reactintersectionobserver = require("react-intersection-observer");
26
26
  const _pluginsystem = require("@perses-dev/plugin-system");
27
27
  const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
28
- const _core = require("@perses-dev/core");
28
+ const _model = require("../../model");
29
29
  const _context = require("../../context");
30
30
  const _keyboardshortcuts = require("../../keyboard-shortcuts");
31
31
  const _Panel = require("../Panel");
@@ -103,7 +103,7 @@ function GridItemContent(props) {
103
103
  queries
104
104
  ]);
105
105
  const readHandlers = {
106
- isPanelViewed: (0, _core.isPanelGroupItemIdEqual)(viewPanelGroupItemId, panelGroupItemId),
106
+ isPanelViewed: (0, _model.isPanelGroupItemIdEqual)(viewPanelGroupItemId, panelGroupItemId),
107
107
  onViewPanelClick: function() {
108
108
  if (viewPanelGroupItemId === undefined) {
109
109
  viewPanel(panelGroupItemId);
@@ -124,13 +124,6 @@ function GridItemContent(props) {
124
124
  // map TimeSeriesQueryDefinition to Definition<UnknownSpec>
125
125
  const suggestedStepMs = (0, _pluginsystem.useSuggestedStepMs)(width);
126
126
  const { data: plugin } = (0, _pluginsystem.usePlugin)('Panel', panelDefinition.spec.plugin.kind);
127
- const queryDefinitions = queries ?? [];
128
- const definitions = queryDefinitions.map((query)=>{
129
- return {
130
- kind: query.spec.plugin.kind,
131
- spec: query.spec.plugin.spec
132
- };
133
- });
134
127
  const pluginQueryOptions = typeof plugin?.queryOptions === 'function' ? plugin?.queryOptions(panelDefinition.spec.plugin.spec) : plugin?.queryOptions;
135
128
  return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
136
129
  ref: mergedRef,
@@ -144,7 +137,7 @@ function GridItemContent(props) {
144
137
  },
145
138
  children: [
146
139
  /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.DataQueriesProvider, {
147
- definitions: definitions,
140
+ definitions: queries ?? [],
148
141
  options: {
149
142
  suggestedStepMs,
150
143
  ...pluginQueryOptions
@@ -163,7 +156,7 @@ function GridItemContent(props) {
163
156
  }),
164
157
  /*#__PURE__*/ (0, _jsxruntime.jsx)(_QueryViewerDialog.QueryViewerDialog, {
165
158
  open: openQueryViewer,
166
- queryDefinitions: queryDefinitions,
159
+ queryDefinitions: queries ?? [],
167
160
  onClose: ()=>setOpenQueryViewer(false)
168
161
  })
169
162
  ]
@@ -79,7 +79,10 @@ const Panel = /*#__PURE__*/ (0, _react.memo)(function Panel(props) {
79
79
  return;
80
80
  }
81
81
  try {
82
- const plugin = await getPlugin('Panel', panelPluginKind);
82
+ const plugin = await getPlugin({
83
+ kind: 'Panel',
84
+ name: panelPluginKind
85
+ });
83
86
  // More defensive checking for plugin and actions
84
87
  if (!plugin || typeof plugin !== 'object' || !plugin.actions || !Array.isArray(plugin.actions) || plugin.actions.length === 0) {
85
88
  setPluginActions([]);
@@ -77,8 +77,8 @@ function PanelEditorForm(props) {
77
77
  setQueries(undefined, isHidden);
78
78
  }
79
79
  });
80
- const titleAction = (0, _pluginsystem.getTitleAction)(initialAction, true);
81
- const submitText = (0, _pluginsystem.getSubmitText)(initialAction, true);
80
+ const titleAction = (0, _components.getTitleAction)(initialAction, true);
81
+ const submitText = (0, _components.getSubmitText)(initialAction, true);
82
82
  const links = (0, _reacthookform.useWatch)({
83
83
  control: form.control,
84
84
  name: 'panelDefinition.spec.links'
@@ -34,22 +34,12 @@ function PanelQueriesSharedControls({ plugin, control, panelDefinition, onQuerie
34
34
  panelDefinition.spec.plugin.spec,
35
35
  pluginPreview
36
36
  ]);
37
- const [previewDefinition, setPreviewDefinition] = (0, _react.useState)(()=>panelDefinition.spec.queries?.map((query)=>{
38
- return {
39
- kind: query.spec.plugin.kind,
40
- spec: query.spec.plugin.spec
41
- };
42
- }) ?? []);
37
+ const [previewDefinition, setPreviewDefinition] = (0, _react.useState)(panelDefinition.spec.queries ?? []);
43
38
  const handleOnQueriesChange = (0, _react.useCallback)((queries)=>{
44
39
  onQueriesChange(queries);
45
40
  // If the number of queries has changed, force preview definition update to remove results of deleted queries.
46
41
  if (queries.length !== previewDefinition.length) {
47
- setPreviewDefinition(queries.map((query)=>{
48
- return {
49
- kind: query.spec.plugin.kind,
50
- spec: query.spec.plugin.spec
51
- };
52
- }));
42
+ setPreviewDefinition(queries);
53
43
  }
54
44
  }, [
55
45
  onQueriesChange,
@@ -60,10 +50,7 @@ function PanelQueriesSharedControls({ plugin, control, panelDefinition, onQuerie
60
50
  const newDefinitions = [
61
51
  ...prev
62
52
  ];
63
- newDefinitions[index] = {
64
- kind: newDef.spec.plugin.kind,
65
- spec: newDef.spec.plugin.spec
66
- };
53
+ newDefinitions[index] = newDef;
67
54
  return newDefinitions;
68
55
  });
69
56
  }, []);
@@ -33,16 +33,20 @@ const SaveChangesConfirmationDialog = ()=>{
33
33
  const isSavedDurationModified = dialog?.isSavedDurationModified ?? true;
34
34
  const isSavedVariableModified = dialog?.isSavedVariableModified ?? true;
35
35
  const isSavedRefreshIntervalModified = dialog?.isSavedRefreshIntervalModified ?? true;
36
+ const isSavedTimeZoneModified = dialog?.isTimeZoneModified ?? true;
36
37
  const [saveDefaultTimeRange, setSaveDefaultTimeRange] = (0, _react.useState)(isSavedDurationModified);
37
38
  const [saveDefaultVariables, setSaveDefaultVariables] = (0, _react.useState)(isSavedVariableModified);
38
39
  const [saveDefaultRefreshInterval, setDefaultRefreshInterval] = (0, _react.useState)(isSavedRefreshIntervalModified);
40
+ const [saveDefaultTimeZone, setSaveDefaultTimeZone] = (0, _react.useState)(isSavedTimeZoneModified);
39
41
  const { getSavedVariablesStatus } = (0, _context.useVariableDefinitionActions)();
40
42
  const { modifiedVariableNames } = getSavedVariablesStatus();
41
43
  const isOpen = dialog !== undefined;
42
44
  const { timeRange, refreshInterval } = (0, _pluginsystem.useTimeRange)();
45
+ const { timeZone } = (0, _pluginsystem.useTimeZoneParams)();
43
46
  const currentTimeRangeText = (0, _spec.isRelativeTimeRange)(timeRange) ? `(Last ${timeRange.pastDuration})` : '(Absolute time ranges can not be saved)';
44
- const saveTimeRangeMessage = `Save current time range as new default ${currentTimeRangeText}`;
45
- const saveVariableMessage = `Save current variable values as new default (${modifiedVariableNames.length > 0 ? modifiedVariableNames.join(', ') : 'No modified variables'})`;
47
+ const saveTimeRangeMessage = `Save current time range as the new default ${currentTimeRangeText}`;
48
+ const saveTimeZoneMessage = `Save the current timezone as the new default (${timeZone})`;
49
+ const saveVariableMessage = `Save current variable values as the new default (${modifiedVariableNames.length > 0 ? modifiedVariableNames.join(', ') : 'No modified variables'})`;
46
50
  const refreshIntervalDisplay = _pluginsystem.DEFAULT_REFRESH_INTERVAL_OPTIONS.some((i)=>i.display === refreshInterval) ? refreshInterval : _pluginsystem.DEFAULT_REFRESH_INTERVAL_OPTIONS.find((i)=>i.value.pastDuration === refreshInterval)?.display;
47
51
  const saveRefreshIntervalMessage = `Save current refresh interval as new default ${refreshIntervalDisplay ? `(${refreshIntervalDisplay})` : 'refresh interval not modified'}`;
48
52
  return /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.Dialog, {
@@ -84,6 +88,14 @@ const SaveChangesConfirmationDialog = ()=>{
84
88
  onChange: (e)=>setSaveDefaultVariables(e.target.checked)
85
89
  }),
86
90
  label: saveVariableMessage
91
+ }),
92
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.FormControlLabel, {
93
+ control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Checkbox, {
94
+ disabled: !isSavedTimeZoneModified,
95
+ checked: saveDefaultTimeZone && isSavedTimeZoneModified,
96
+ onChange: (e)=>setSaveDefaultTimeZone(e.target.checked)
97
+ }),
98
+ label: saveTimeZoneMessage
87
99
  })
88
100
  ]
89
101
  })
@@ -93,7 +105,12 @@ const SaveChangesConfirmationDialog = ()=>{
93
105
  children: [
94
106
  /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.Dialog.PrimaryButton, {
95
107
  onClick: ()=>{
96
- return dialog.onSaveChanges(saveDefaultTimeRange, saveDefaultRefreshInterval, saveDefaultVariables);
108
+ return dialog.onSaveChanges({
109
+ saveDefaultTimeRange,
110
+ saveDefaultRefreshInterval,
111
+ saveDefaultVariables,
112
+ saveDefaultTimeZone
113
+ });
97
114
  },
98
115
  children: "Save Changes"
99
116
  }),