@perses-dev/dashboards 0.0.0-snapshot-tooltip-highlight-c995fc8 → 0.0.0-snapshot-saving-defaults-refinements-1b25cec

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 (122) hide show
  1. package/dist/cjs/components/DashboardStickyToolbar/DashboardStickyToolbar.js +79 -0
  2. package/dist/cjs/components/DashboardStickyToolbar/index.js +28 -0
  3. package/dist/cjs/components/DashboardToolbar/DashboardToolbar.js +8 -24
  4. package/dist/cjs/components/EditJsonButton/EditJsonButton.js +1 -0
  5. package/dist/cjs/components/GridLayout/GridTitle.js +30 -9
  6. package/dist/cjs/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +92 -0
  7. package/dist/cjs/components/SaveChangesConfirmationDialog/index.js +28 -0
  8. package/dist/cjs/components/SaveDashboardButton/SaveDashboardButton.js +81 -0
  9. package/dist/cjs/components/SaveDashboardButton/index.js +28 -0
  10. package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +123 -197
  11. package/dist/cjs/components/Variables/VariableEditorForm/VariablePreview.js +178 -0
  12. package/dist/cjs/components/Variables/VariableEditorForm/index.js +1 -0
  13. package/dist/cjs/components/Variables/VariableList.js +16 -55
  14. package/dist/cjs/components/Variables/index.js +1 -0
  15. package/dist/cjs/components/index.js +3 -0
  16. package/dist/cjs/context/DashboardProvider/DashboardProvider.js +2 -0
  17. package/dist/cjs/context/DashboardProvider/dashboard-provider-api.js +9 -0
  18. package/dist/cjs/context/DashboardProvider/index.js +1 -0
  19. package/dist/cjs/context/DashboardProvider/save-changes-dialog-slice.js +33 -0
  20. package/dist/cjs/context/TemplateVariableProvider/TemplateVariableProvider.js +56 -7
  21. package/dist/cjs/context/TemplateVariableProvider/hydrationUtils.js +2 -0
  22. package/dist/cjs/context/TemplateVariableProvider/utils.js +44 -0
  23. package/dist/cjs/test/render.js +35 -13
  24. package/dist/cjs/views/ViewDashboard/DashboardApp.js +2 -1
  25. package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.d.ts +9 -0
  26. package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.d.ts.map +1 -0
  27. package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js +68 -0
  28. package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js.map +1 -0
  29. package/dist/components/DashboardStickyToolbar/index.d.ts +2 -0
  30. package/dist/components/DashboardStickyToolbar/index.d.ts.map +1 -0
  31. package/dist/components/DashboardStickyToolbar/index.js +15 -0
  32. package/dist/components/DashboardStickyToolbar/index.js.map +1 -0
  33. package/dist/components/DashboardToolbar/DashboardToolbar.d.ts +2 -2
  34. package/dist/components/DashboardToolbar/DashboardToolbar.d.ts.map +1 -1
  35. package/dist/components/DashboardToolbar/DashboardToolbar.js +10 -26
  36. package/dist/components/DashboardToolbar/DashboardToolbar.js.map +1 -1
  37. package/dist/components/EditJsonButton/EditJsonButton.js +1 -0
  38. package/dist/components/EditJsonButton/EditJsonButton.js.map +1 -1
  39. package/dist/components/GridLayout/GridTitle.d.ts.map +1 -1
  40. package/dist/components/GridLayout/GridTitle.js +30 -9
  41. package/dist/components/GridLayout/GridTitle.js.map +1 -1
  42. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.d.ts +3 -0
  43. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.d.ts.map +1 -0
  44. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +86 -0
  45. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js.map +1 -0
  46. package/dist/components/SaveChangesConfirmationDialog/index.d.ts +2 -0
  47. package/dist/components/SaveChangesConfirmationDialog/index.d.ts.map +1 -0
  48. package/dist/components/SaveChangesConfirmationDialog/index.js +15 -0
  49. package/dist/components/SaveChangesConfirmationDialog/index.js.map +1 -0
  50. package/dist/components/SaveDashboardButton/SaveDashboardButton.d.ts +10 -0
  51. package/dist/components/SaveDashboardButton/SaveDashboardButton.d.ts.map +1 -0
  52. package/dist/components/SaveDashboardButton/SaveDashboardButton.js +75 -0
  53. package/dist/components/SaveDashboardButton/SaveDashboardButton.js.map +1 -0
  54. package/dist/components/SaveDashboardButton/index.d.ts +2 -0
  55. package/dist/components/SaveDashboardButton/index.d.ts.map +1 -0
  56. package/dist/components/SaveDashboardButton/index.js +15 -0
  57. package/dist/components/SaveDashboardButton/index.js.map +1 -0
  58. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts +4 -2
  59. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
  60. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +126 -195
  61. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
  62. package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts +16 -0
  63. package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts.map +1 -0
  64. package/dist/components/Variables/VariableEditorForm/VariablePreview.js +122 -0
  65. package/dist/components/Variables/VariableEditorForm/VariablePreview.js.map +1 -0
  66. package/dist/components/Variables/VariableEditorForm/index.d.ts +1 -0
  67. package/dist/components/Variables/VariableEditorForm/index.d.ts.map +1 -1
  68. package/dist/components/Variables/VariableEditorForm/index.js +1 -0
  69. package/dist/components/Variables/VariableEditorForm/index.js.map +1 -1
  70. package/dist/components/Variables/VariableList.d.ts +1 -7
  71. package/dist/components/Variables/VariableList.d.ts.map +1 -1
  72. package/dist/components/Variables/VariableList.js +18 -52
  73. package/dist/components/Variables/VariableList.js.map +1 -1
  74. package/dist/components/Variables/index.d.ts +1 -0
  75. package/dist/components/Variables/index.d.ts.map +1 -1
  76. package/dist/components/Variables/index.js +1 -0
  77. package/dist/components/Variables/index.js.map +1 -1
  78. package/dist/components/index.d.ts +3 -0
  79. package/dist/components/index.d.ts.map +1 -1
  80. package/dist/components/index.js +3 -0
  81. package/dist/components/index.js.map +1 -1
  82. package/dist/context/DashboardProvider/DashboardProvider.d.ts +2 -1
  83. package/dist/context/DashboardProvider/DashboardProvider.d.ts.map +1 -1
  84. package/dist/context/DashboardProvider/DashboardProvider.js +2 -0
  85. package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -1
  86. package/dist/context/DashboardProvider/common.d.ts +2 -1
  87. package/dist/context/DashboardProvider/common.d.ts.map +1 -1
  88. package/dist/context/DashboardProvider/common.js.map +1 -1
  89. package/dist/context/DashboardProvider/dashboard-provider-api.d.ts +5 -0
  90. package/dist/context/DashboardProvider/dashboard-provider-api.d.ts.map +1 -1
  91. package/dist/context/DashboardProvider/dashboard-provider-api.js +8 -0
  92. package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -1
  93. package/dist/context/DashboardProvider/index.d.ts +1 -0
  94. package/dist/context/DashboardProvider/index.d.ts.map +1 -1
  95. package/dist/context/DashboardProvider/index.js +1 -0
  96. package/dist/context/DashboardProvider/index.js.map +1 -1
  97. package/dist/context/DashboardProvider/save-changes-dialog-slice.d.ts +15 -0
  98. package/dist/context/DashboardProvider/save-changes-dialog-slice.d.ts.map +1 -0
  99. package/dist/context/DashboardProvider/save-changes-dialog-slice.js +27 -0
  100. package/dist/context/DashboardProvider/save-changes-dialog-slice.js.map +1 -0
  101. package/dist/context/TemplateVariableProvider/TemplateVariableProvider.d.ts +10 -0
  102. package/dist/context/TemplateVariableProvider/TemplateVariableProvider.d.ts.map +1 -1
  103. package/dist/context/TemplateVariableProvider/TemplateVariableProvider.js +51 -7
  104. package/dist/context/TemplateVariableProvider/TemplateVariableProvider.js.map +1 -1
  105. package/dist/context/TemplateVariableProvider/hydrationUtils.d.ts.map +1 -1
  106. package/dist/context/TemplateVariableProvider/hydrationUtils.js +2 -0
  107. package/dist/context/TemplateVariableProvider/hydrationUtils.js.map +1 -1
  108. package/dist/context/TemplateVariableProvider/utils.d.ts +7 -0
  109. package/dist/context/TemplateVariableProvider/utils.d.ts.map +1 -0
  110. package/dist/context/TemplateVariableProvider/utils.js +40 -0
  111. package/dist/context/TemplateVariableProvider/utils.js.map +1 -0
  112. package/dist/stories/decorators/WithDashboard.js.map +1 -1
  113. package/dist/stories/decorators/WithDatasourceStore.js.map +1 -1
  114. package/dist/stories/decorators/WithTemplateVariables.js.map +1 -1
  115. package/dist/test/render.d.ts.map +1 -1
  116. package/dist/test/render.js +35 -13
  117. package/dist/test/render.js.map +1 -1
  118. package/dist/views/ViewDashboard/DashboardApp.d.ts +2 -1
  119. package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -1
  120. package/dist/views/ViewDashboard/DashboardApp.js +3 -2
  121. package/dist/views/ViewDashboard/DashboardApp.js.map +1 -1
  122. package/package.json +7 -6
@@ -19,66 +19,27 @@ Object.defineProperty(exports, "TemplateVariableList", {
19
19
  get: ()=>TemplateVariableList
20
20
  });
21
21
  const _jsxRuntime = require("react/jsx-runtime");
22
- const _react = require("react");
23
22
  const _material = require("@mui/material");
24
- const _pinOutline = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/PinOutline"));
25
- const _pinOffOutline = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/PinOffOutline"));
26
23
  const _context = require("../../context");
27
24
  const _templateVariable = require("./TemplateVariable");
28
- function _interopRequireDefault(obj) {
29
- return obj && obj.__esModule ? obj : {
30
- default: obj
31
- };
32
- }
33
25
  const VARIABLE_INPUT_MIN_WIDTH = '120px';
34
26
  const VARIABLE_INPUT_MAX_WIDTH = '240px';
35
- function TemplateVariableList(props) {
36
- const [isPin, setIsPin] = (0, _react.useState)(props.initialVariableIsSticky);
27
+ function TemplateVariableList() {
37
28
  const variableDefinitions = (0, _context.useTemplateVariableDefinitions)();
38
- const scrollTrigger = (0, _material.useScrollTrigger)({
39
- disableHysteresis: true
40
- });
41
- const isSticky = scrollTrigger && props.initialVariableIsSticky && isPin;
42
- return(// marginBottom={-1} counteracts the marginBottom={1} on every variable input.
43
- // The margin on the inputs is for spacing between inputs, but is not meant to add space to bottom of the container.
44
- /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Box, {
45
- marginBottom: -1,
46
- "data-testid": "variable-list",
47
- children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.AppBar, {
48
- color: "inherit",
49
- position: isSticky ? 'fixed' : 'static',
50
- elevation: isSticky ? 4 : 0,
51
- sx: {
52
- backgroundColor: 'inherit',
53
- ...props.sx
54
- },
55
- children: /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Box, {
56
- display: "flex",
57
- flexWrap: "wrap",
58
- alignItems: "start",
59
- my: isSticky ? 2 : 0,
60
- ml: isSticky ? 2 : 0,
61
- children: [
62
- variableDefinitions.map((v)=>{
63
- var ref;
64
- /*#__PURE__*/ return (0, _jsxRuntime.jsx)(_material.Box, {
65
- display: ((ref = v.spec.display) === null || ref === void 0 ? void 0 : ref.hidden) ? 'none' : undefined,
66
- minWidth: VARIABLE_INPUT_MIN_WIDTH,
67
- maxWidth: VARIABLE_INPUT_MAX_WIDTH,
68
- marginBottom: 1,
69
- marginRight: 1,
70
- "data-testid": "template-variable",
71
- children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_templateVariable.TemplateVariable, {
72
- name: v.spec.name
73
- }, v.spec.name)
74
- }, v.spec.name);
75
- }),
76
- props.initialVariableIsSticky && /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.IconButton, {
77
- onClick: ()=>setIsPin(!isPin),
78
- children: isPin ? /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pinOutline.default, {}) : /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pinOffOutline.default, {})
79
- })
80
- ]
81
- })
29
+ return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
30
+ children: variableDefinitions.map((v)=>{
31
+ var ref;
32
+ /*#__PURE__*/ return (0, _jsxRuntime.jsx)(_material.Box, {
33
+ display: ((ref = v.spec.display) === null || ref === void 0 ? void 0 : ref.hidden) ? 'none' : undefined,
34
+ minWidth: VARIABLE_INPUT_MIN_WIDTH,
35
+ maxWidth: VARIABLE_INPUT_MAX_WIDTH,
36
+ marginBottom: 1,
37
+ marginRight: 1,
38
+ "data-testid": "template-variable",
39
+ children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_templateVariable.TemplateVariable, {
40
+ name: v.spec.name
41
+ }, v.spec.name)
42
+ }, v.spec.name);
82
43
  })
83
- }));
44
+ });
84
45
  }
@@ -19,6 +19,7 @@ _exportStar(require("./TemplateVariable"), exports);
19
19
  _exportStar(require("./VariableEditor"), exports);
20
20
  _exportStar(require("./VariableEditorForm"), exports);
21
21
  _exportStar(require("./VariableList"), exports);
22
+ _exportStar(require("./variable-model"), exports);
22
23
  function _exportStar(from, to) {
23
24
  Object.keys(from).forEach(function(k) {
24
25
  if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
@@ -18,6 +18,7 @@ _exportStar(require("./AddGroupButton"), exports);
18
18
  _exportStar(require("./AddPanelButton"), exports);
19
19
  _exportStar(require("./Dashboard"), exports);
20
20
  _exportStar(require("./DashboardToolbar"), exports);
21
+ _exportStar(require("./DashboardStickyToolbar"), exports);
21
22
  _exportStar(require("./DeletePanelDialog"), exports);
22
23
  _exportStar(require("./DeletePanelGroupDialog"), exports);
23
24
  _exportStar(require("./DiscardChangesConfirmationDialog"), exports);
@@ -30,6 +31,8 @@ _exportStar(require("./Panel"), exports);
30
31
  _exportStar(require("./PanelDrawer"), exports);
31
32
  _exportStar(require("./PanelGroupDialog"), exports);
32
33
  _exportStar(require("./QuerySummaryTable"), exports);
34
+ _exportStar(require("./SaveChangesConfirmationDialog"), exports);
35
+ _exportStar(require("./SaveDashboardButton"), exports);
33
36
  _exportStar(require("./TimeRangeControls"), exports);
34
37
  _exportStar(require("./ToolbarIconButton"), exports);
35
38
  _exportStar(require("./Variables"), exports);
@@ -39,6 +39,7 @@ const _panelSlice = require("./panel-slice");
39
39
  const _deletePanelGroupSlice = require("./delete-panel-group-slice");
40
40
  const _deletePanelSlice = require("./delete-panel-slice");
41
41
  const _discardChangesDialogSlice = require("./discard-changes-dialog-slice");
42
+ const _saveChangesDialogSlice = require("./save-changes-dialog-slice");
42
43
  const _duplicatePanelSlice = require("./duplicate-panel-slice");
43
44
  const _editJsonDialogSlice = require("./edit-json-dialog-slice");
44
45
  const _common = require("./common");
@@ -98,6 +99,7 @@ function initStore(props) {
98
99
  ...(0, _duplicatePanelSlice.createDuplicatePanelSlice)()(...args),
99
100
  /* General */ ...(0, _discardChangesDialogSlice.createDiscardChangesDialogSlice)(...args),
100
101
  ...(0, _editJsonDialogSlice.createEditJsonDialogSlice)(...args),
102
+ ...(0, _saveChangesDialogSlice.createSaveChangesDialogSlice)(...args),
101
103
  metadata,
102
104
  display,
103
105
  duration,
@@ -34,6 +34,7 @@ _export(exports, {
34
34
  usePanelEditor: ()=>usePanelEditor,
35
35
  useDeletePanelDialog: ()=>useDeletePanelDialog,
36
36
  useDashboardDuration: ()=>useDashboardDuration,
37
+ useSaveChangesConfirmationDialog: ()=>useSaveChangesConfirmationDialog,
37
38
  useDiscardChangesConfirmationDialog: ()=>useDiscardChangesConfirmationDialog,
38
39
  useEditJsonDialog: ()=>useEditJsonDialog
39
40
  });
@@ -193,6 +194,14 @@ const selectDashboardDuration = (state)=>state.duration;
193
194
  function useDashboardDuration() {
194
195
  return (0, _dashboardProvider.useDashboardStore)(selectDashboardDuration);
195
196
  }
197
+ const selectSaveChangesConfirmationDialog = ({ saveChangesConfirmationDialog , openSaveChangesConfirmationDialog , closeSaveChangesConfirmationDialog })=>({
198
+ saveChangesConfirmationDialog,
199
+ openSaveChangesConfirmationDialog,
200
+ closeSaveChangesConfirmationDialog
201
+ });
202
+ function useSaveChangesConfirmationDialog() {
203
+ return (0, _dashboardProvider.useDashboardStore)(selectSaveChangesConfirmationDialog);
204
+ }
196
205
  const selectDiscardChangesConfirmationDialog = ({ discardChangesConfirmationDialog , openDiscardChangesConfirmationDialog , closeDiscardChangesConfirmationDialog })=>({
197
206
  discardChangesConfirmationDialog,
198
207
  openDiscardChangesConfirmationDialog,
@@ -14,6 +14,7 @@
14
14
  Object.defineProperty(exports, "__esModule", {
15
15
  value: true
16
16
  });
17
+ _exportStar(require("./common"), exports);
17
18
  _exportStar(require("./dashboard-provider-api"), exports);
18
19
  _exportStar(require("./DashboardProvider"), exports);
19
20
  function _exportStar(from, to) {
@@ -0,0 +1,33 @@
1
+ // Copyright 2023 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ Object.defineProperty(exports, "createSaveChangesDialogSlice", {
18
+ enumerable: true,
19
+ get: ()=>createSaveChangesDialogSlice
20
+ });
21
+ const createSaveChangesDialogSlice = (set)=>({
22
+ isOpen: false,
23
+ openSaveChangesConfirmationDialog (dialog) {
24
+ set((state)=>{
25
+ state.saveChangesConfirmationDialog = dialog;
26
+ }, false, 'openSaveChangesConfirmationDialog');
27
+ },
28
+ closeSaveChangesConfirmationDialog () {
29
+ set((state)=>{
30
+ state.saveChangesConfirmationDialog = undefined;
31
+ }, false, 'closeSaveChangesConfirmationDialog');
32
+ }
33
+ });
@@ -33,9 +33,16 @@ const _react = require("react");
33
33
  const _zustand = require("zustand");
34
34
  const _immer = require("zustand/middleware/immer");
35
35
  const _middleware = require("zustand/middleware");
36
+ const _immer1 = /*#__PURE__*/ _interopRequireDefault(require("immer"));
36
37
  const _pluginSystem = require("@perses-dev/plugin-system");
38
+ const _utils = require("./utils");
37
39
  const _hydrationUtils = require("./hydrationUtils");
38
40
  const _queryParams = require("./query-params");
41
+ function _interopRequireDefault(obj) {
42
+ return obj && obj.__esModule ? obj : {
43
+ default: obj
44
+ };
45
+ }
39
46
  const TemplateVariableStoreContext = /*#__PURE__*/ (0, _react.createContext)(undefined);
40
47
  function useTemplateVariableStoreCtx() {
41
48
  const context = (0, _react.useContext)(TemplateVariableStoreContext);
@@ -80,7 +87,9 @@ function useTemplateVariableActions() {
80
87
  setVariableValue: s.setVariableValue,
81
88
  setVariableLoading: s.setVariableLoading,
82
89
  setVariableOptions: s.setVariableOptions,
83
- setVariableDefinitions: s.setVariableDefinitions
90
+ setVariableDefinitions: s.setVariableDefinitions,
91
+ setVariableDefaultValues: s.setVariableDefaultValues,
92
+ getSavedVariablesStatus: s.getSavedVariablesStatus
84
93
  };
85
94
  });
86
95
  }
@@ -123,14 +132,16 @@ function PluginProvider({ children }) {
123
132
  }
124
133
  function createTemplateVariableSrvStore({ initialVariableDefinitions =[] , queryParams }) {
125
134
  const initialParams = (0, _queryParams.getInitalValuesFromQueryParameters)(queryParams ? queryParams[0] : {});
126
- const store = (0, _zustand.createStore)()((0, _middleware.devtools)((0, _immer.immer)((set)=>({
135
+ const store = (0, _zustand.createStore)()((0, _middleware.devtools)((0, _immer.immer)((set, get)=>{
136
+ return {
127
137
  variableState: (0, _hydrationUtils.hydrateTemplateVariableStates)(initialVariableDefinitions, initialParams),
128
138
  variableDefinitions: initialVariableDefinitions,
129
139
  setVariableDefinitions (definitions) {
130
140
  set((state)=>{
131
141
  state.variableDefinitions = definitions;
132
142
  state.variableState = (0, _hydrationUtils.hydrateTemplateVariableStates)(definitions, initialParams);
133
- });
143
+ }, false, '[Variables] setVariableDefinitions' // Used for action name in Redux devtools
144
+ );
134
145
  },
135
146
  setVariableOptions (name, options) {
136
147
  set((state)=>{
@@ -139,7 +150,7 @@ function createTemplateVariableSrvStore({ initialVariableDefinitions =[] , query
139
150
  return;
140
151
  }
141
152
  varState.options = options;
142
- });
153
+ }, false, '[Variables] setVariableOptions');
143
154
  },
144
155
  setVariableLoading (name, loading) {
145
156
  set((state)=>{
@@ -148,7 +159,7 @@ function createTemplateVariableSrvStore({ initialVariableDefinitions =[] , query
148
159
  return;
149
160
  }
150
161
  varState.loading = loading;
151
- });
162
+ }, false, '[Variables] setVariableLoading');
152
163
  },
153
164
  setVariableValue: (name, value)=>set((state)=>{
154
165
  let val = value;
@@ -171,8 +182,46 @@ function createTemplateVariableSrvStore({ initialVariableDefinitions =[] , query
171
182
  });
172
183
  }
173
184
  varState.value = val;
174
- })
175
- }))));
185
+ }, false, '[Variables] setVariableValue'),
186
+ setVariableDefaultValues: ()=>{
187
+ const variableDefinitions = get().variableDefinitions;
188
+ const variableState = get().variableState;
189
+ const updatedVariables = (0, _immer1.default)(variableDefinitions, (draft)=>{
190
+ draft.forEach((variable, index)=>{
191
+ if (variable.kind === 'ListVariable') {
192
+ const currentVariable = variableState[variable.spec.name];
193
+ if ((currentVariable === null || currentVariable === void 0 ? void 0 : currentVariable.value) !== undefined) {
194
+ draft[index] = {
195
+ kind: 'ListVariable',
196
+ spec: (0, _immer1.default)(variable.spec, (specDraft)=>{
197
+ specDraft.default_value = currentVariable.value;
198
+ })
199
+ };
200
+ }
201
+ } else if (variable.kind === 'TextVariable') {
202
+ const currentVariable1 = variableState[variable.spec.name];
203
+ const currentVariableValue = typeof (currentVariable1 === null || currentVariable1 === void 0 ? void 0 : currentVariable1.value) === 'string' ? currentVariable1.value : '';
204
+ if ((currentVariable1 === null || currentVariable1 === void 0 ? void 0 : currentVariable1.value) !== undefined) {
205
+ draft[index] = {
206
+ kind: 'TextVariable',
207
+ spec: (0, _immer1.default)(variable.spec, (specDraft)=>{
208
+ specDraft.value = currentVariableValue;
209
+ })
210
+ };
211
+ }
212
+ }
213
+ });
214
+ });
215
+ set((state)=>{
216
+ state.variableDefinitions = updatedVariables;
217
+ }, false, '[Variables] setVariableDefaultValues');
218
+ return updatedVariables;
219
+ },
220
+ getSavedVariablesStatus: ()=>{
221
+ return (0, _utils.checkSavedDefaultVariableStatus)(get().variableDefinitions, get().variableState);
222
+ }
223
+ };
224
+ })));
176
225
  return store;
177
226
  }
178
227
  function TemplateVariableProvider({ children , initialVariableDefinitions =[] }) {
@@ -19,6 +19,7 @@ Object.defineProperty(exports, "hydrateTemplateVariableStates", {
19
19
  get: ()=>hydrateTemplateVariableStates
20
20
  });
21
21
  const _pluginSystem = require("@perses-dev/plugin-system");
22
+ // TODO: move to TemplateVariableProvider/utils.ts
22
23
  function hydrateTemplateVariableState(variable, initialValue) {
23
24
  const varState = {
24
25
  value: null,
@@ -32,6 +33,7 @@ function hydrateTemplateVariableState(variable, initialValue) {
32
33
  varState.options = [];
33
34
  var ref;
34
35
  varState.value = (ref = initialValue !== null && initialValue !== void 0 ? initialValue : variable.spec.default_value) !== null && ref !== void 0 ? ref : null;
36
+ // TODO: smarter fallbacks for default_value when allow_all_value is true
35
37
  if (varState.options.length > 0 && !varState.value) {
36
38
  var ref1;
37
39
  var ref2;
@@ -0,0 +1,44 @@
1
+ // Copyright 2023 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ Object.defineProperty(exports, "checkSavedDefaultVariableStatus", {
18
+ enumerable: true,
19
+ get: ()=>checkSavedDefaultVariableStatus
20
+ });
21
+ function checkSavedDefaultVariableStatus(definitions, varState) {
22
+ let isSavedVariableModified = false;
23
+ const modifiedVariableNames = [];
24
+ for (const savedVariable of definitions){
25
+ if (savedVariable.kind === 'ListVariable') {
26
+ const currentVariable = varState[savedVariable.spec.name];
27
+ if ((currentVariable === null || currentVariable === void 0 ? void 0 : currentVariable.value) !== null && (currentVariable === null || currentVariable === void 0 ? void 0 : currentVariable.value) !== savedVariable.spec.default_value) {
28
+ modifiedVariableNames.push(savedVariable.spec.name);
29
+ isSavedVariableModified = true;
30
+ }
31
+ } else if (savedVariable.kind === 'TextVariable') {
32
+ const currentVariable1 = varState[savedVariable.spec.name];
33
+ const currentVariableValue = typeof (currentVariable1 === null || currentVariable1 === void 0 ? void 0 : currentVariable1.value) === 'string' ? currentVariable1.value : '';
34
+ if (savedVariable.spec.value !== currentVariableValue) {
35
+ modifiedVariableNames.push(savedVariable.spec.name);
36
+ isSavedVariableModified = true;
37
+ }
38
+ }
39
+ }
40
+ return {
41
+ isSavedVariableModified,
42
+ modifiedVariableNames
43
+ };
44
+ }
@@ -19,7 +19,8 @@ Object.defineProperty(exports, "renderWithContext", {
19
19
  get: ()=>renderWithContext
20
20
  });
21
21
  const _jsxRuntime = require("react/jsx-runtime");
22
- const _react = require("@testing-library/react");
22
+ const _react = require("react");
23
+ const _react1 = require("@testing-library/react");
23
24
  const _reactRouterDom = require("react-router-dom");
24
25
  const _history = require("history");
25
26
  const _useQueryParams = require("use-query-params");
@@ -28,6 +29,24 @@ const _reactQuery = require("@tanstack/react-query");
28
29
  const _components = require("@perses-dev/components");
29
30
  const _pluginSystem = require("@perses-dev/plugin-system");
30
31
  const _pluginRegistry = require("./plugin-registry");
32
+ /*
33
+ * Workaround for React router upgrade type errors.
34
+ * More details: https://stackoverflow.com/a/69948457/17575201
35
+ */ const CustomRouter = ({ history , children })=>{
36
+ const [state, setState] = (0, _react.useState)({
37
+ action: history.action,
38
+ location: history.location
39
+ });
40
+ (0, _react.useLayoutEffect)(()=>history.listen(setState), [
41
+ history
42
+ ]);
43
+ return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_reactRouterDom.Router, {
44
+ location: state.location,
45
+ navigationType: state.action,
46
+ navigator: history,
47
+ children: children
48
+ });
49
+ };
31
50
  function renderWithContext(ui, options, history) {
32
51
  // Create a new QueryClient for each test to avoid caching issues
33
52
  const queryClient = new _reactQuery.QueryClient({
@@ -38,25 +57,28 @@ function renderWithContext(ui, options, history) {
38
57
  }
39
58
  }
40
59
  });
41
- const BaseRender = ()=>{
42
- const HistoryRouter = _reactRouterDom.unstable_HistoryRouter;
43
- history = history !== null && history !== void 0 ? history : (0, _history.createMemoryHistory)();
44
- return /*#__PURE__*/ (0, _jsxRuntime.jsx)(HistoryRouter, {
45
- history: history,
60
+ const customHistory = history !== null && history !== void 0 ? history : (0, _history.createMemoryHistory)();
61
+ const BaseRender = ()=>/*#__PURE__*/ (0, _jsxRuntime.jsx)(CustomRouter, {
62
+ history: customHistory,
46
63
  children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_reactQuery.QueryClientProvider, {
47
64
  client: queryClient,
48
65
  children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_useQueryParams.QueryParamProvider, {
49
66
  adapter: _reactRouter6.ReactRouter6Adapter,
50
- children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components.ChartsThemeProvider, {
51
- chartsTheme: _components.testChartsTheme,
52
- children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pluginSystem.PluginRegistry, {
53
- ...(0, _pluginSystem.mockPluginRegistry)(..._pluginRegistry.MOCK_PLUGINS),
54
- children: ui
67
+ children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components.SnackbarProvider, {
68
+ anchorOrigin: {
69
+ vertical: 'bottom',
70
+ horizontal: 'right'
71
+ },
72
+ children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components.ChartsThemeProvider, {
73
+ chartsTheme: _components.testChartsTheme,
74
+ children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pluginSystem.PluginRegistry, {
75
+ ...(0, _pluginSystem.mockPluginRegistry)(..._pluginRegistry.MOCK_PLUGINS),
76
+ children: ui
77
+ })
55
78
  })
56
79
  })
57
80
  })
58
81
  })
59
82
  });
60
- };
61
- return (0, _react.render)(/*#__PURE__*/ (0, _jsxRuntime.jsx)(BaseRender, {}), options);
83
+ return (0, _react1.render)(/*#__PURE__*/ (0, _jsxRuntime.jsx)(BaseRender, {}), options);
62
84
  }
@@ -98,7 +98,8 @@ const DashboardApp = (props)=>{
98
98
  /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components1.DeletePanelGroupDialog, {}),
99
99
  /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components1.DeletePanelDialog, {}),
100
100
  /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components1.DiscardChangesConfirmationDialog, {}),
101
- /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components1.EditJsonDialog, {})
101
+ /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components1.EditJsonDialog, {}),
102
+ /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components1.SaveChangesConfirmationDialog, {})
102
103
  ]
103
104
  })
104
105
  ]
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { SxProps, Theme } from '@mui/material';
3
+ interface DashboardStickyToolbarProps {
4
+ initialVariableIsSticky?: boolean;
5
+ sx?: SxProps<Theme>;
6
+ }
7
+ export declare function DashboardStickyToolbar(props: DashboardStickyToolbarProps): JSX.Element;
8
+ export {};
9
+ //# sourceMappingURL=DashboardStickyToolbar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DashboardStickyToolbar.d.ts","sourceRoot":"","sources":["../../../src/components/DashboardStickyToolbar/DashboardStickyToolbar.tsx"],"names":[],"mappings":";AAcA,OAAO,EAA2B,OAAO,EAAE,KAAK,EAAoB,MAAM,eAAe,CAAC;AAM1F,UAAU,2BAA2B;IACnC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,EAAE,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;CACrB;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,2BAA2B,eAgCxE"}
@@ -0,0 +1,68 @@
1
+ // Copyright 2023 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
+ import { useState } from 'react';
15
+ import { AppBar, Box, IconButton, useScrollTrigger } from '@mui/material';
16
+ import PinOutline from 'mdi-material-ui/PinOutline';
17
+ import PinOffOutline from 'mdi-material-ui/PinOffOutline';
18
+ import { TemplateVariableList } from '../Variables';
19
+ import { TimeRangeControls } from '../TimeRangeControls';
20
+ export function DashboardStickyToolbar(props) {
21
+ const [isPin, setIsPin] = useState(props.initialVariableIsSticky);
22
+ const scrollTrigger = useScrollTrigger({
23
+ disableHysteresis: true
24
+ });
25
+ const isSticky = scrollTrigger && props.initialVariableIsSticky && isPin;
26
+ return(// marginBottom={-1} counteracts the marginBottom={1} on every variable input.
27
+ // The margin on the inputs is for spacing between inputs, but is not meant to add space to bottom of the container.
28
+ /*#__PURE__*/ _jsx(Box, {
29
+ marginBottom: -1,
30
+ "data-testid": "variable-list",
31
+ children: /*#__PURE__*/ _jsx(AppBar, {
32
+ color: "inherit",
33
+ position: isSticky ? 'fixed' : 'static',
34
+ elevation: isSticky ? 4 : 0,
35
+ sx: {
36
+ backgroundColor: 'inherit',
37
+ ...props.sx
38
+ },
39
+ children: /*#__PURE__*/ _jsxs(Box, {
40
+ display: "flex",
41
+ justifyContent: "space-between",
42
+ children: [
43
+ /*#__PURE__*/ _jsxs(Box, {
44
+ display: "flex",
45
+ flexWrap: "wrap",
46
+ alignItems: "start",
47
+ my: isSticky ? 2 : 0,
48
+ ml: isSticky ? 2 : 0,
49
+ children: [
50
+ /*#__PURE__*/ _jsx(TemplateVariableList, {}),
51
+ props.initialVariableIsSticky && /*#__PURE__*/ _jsx(IconButton, {
52
+ onClick: ()=>setIsPin(!isPin),
53
+ children: isPin ? /*#__PURE__*/ _jsx(PinOutline, {}) : /*#__PURE__*/ _jsx(PinOffOutline, {})
54
+ })
55
+ ]
56
+ }),
57
+ isSticky && /*#__PURE__*/ _jsx(Box, {
58
+ my: 2,
59
+ mr: 2,
60
+ children: /*#__PURE__*/ _jsx(TimeRangeControls, {})
61
+ })
62
+ ]
63
+ })
64
+ })
65
+ }));
66
+ }
67
+
68
+ //# sourceMappingURL=DashboardStickyToolbar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/DashboardStickyToolbar/DashboardStickyToolbar.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { useState } from 'react';\nimport { AppBar, Box, IconButton, SxProps, Theme, useScrollTrigger } from '@mui/material';\nimport PinOutline from 'mdi-material-ui/PinOutline';\nimport PinOffOutline from 'mdi-material-ui/PinOffOutline';\nimport { TemplateVariableList } from '../Variables';\nimport { TimeRangeControls } from '../TimeRangeControls';\n\ninterface DashboardStickyToolbarProps {\n initialVariableIsSticky?: boolean;\n sx?: SxProps<Theme>;\n}\n\nexport function DashboardStickyToolbar(props: DashboardStickyToolbarProps) {\n const [isPin, setIsPin] = useState(props.initialVariableIsSticky);\n\n const scrollTrigger = useScrollTrigger({ disableHysteresis: true });\n const isSticky = scrollTrigger && props.initialVariableIsSticky && isPin;\n\n return (\n // marginBottom={-1} counteracts the marginBottom={1} on every variable input.\n // The margin on the inputs is for spacing between inputs, but is not meant to add space to bottom of the container.\n <Box marginBottom={-1} data-testid=\"variable-list\">\n <AppBar\n color=\"inherit\"\n position={isSticky ? 'fixed' : 'static'}\n elevation={isSticky ? 4 : 0}\n sx={{ backgroundColor: 'inherit', ...props.sx }}\n >\n <Box display=\"flex\" justifyContent=\"space-between\">\n <Box display=\"flex\" flexWrap=\"wrap\" alignItems=\"start\" my={isSticky ? 2 : 0} ml={isSticky ? 2 : 0}>\n <TemplateVariableList></TemplateVariableList>\n {props.initialVariableIsSticky && (\n <IconButton onClick={() => setIsPin(!isPin)}>{isPin ? <PinOutline /> : <PinOffOutline />}</IconButton>\n )}\n </Box>\n {isSticky && (\n <Box my={2} mr={2}>\n <TimeRangeControls></TimeRangeControls>\n </Box>\n )}\n </Box>\n </AppBar>\n </Box>\n );\n}\n"],"names":["useState","AppBar","Box","IconButton","useScrollTrigger","PinOutline","PinOffOutline","TemplateVariableList","TimeRangeControls","DashboardStickyToolbar","props","isPin","setIsPin","initialVariableIsSticky","scrollTrigger","disableHysteresis","isSticky","marginBottom","data-testid","color","position","elevation","sx","backgroundColor","display","justifyContent","flexWrap","alignItems","my","ml","onClick","mr"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC;AAAA,SAASA,QAAQ,QAAQ,OAAO,CAAC;AACjC,SAASC,MAAM,EAAEC,GAAG,EAAEC,UAAU,EAAkBC,gBAAgB,QAAQ,eAAe,CAAC;AAC1F,OAAOC,UAAU,MAAM,4BAA4B,CAAC;AACpD,OAAOC,aAAa,MAAM,+BAA+B,CAAC;AAC1D,SAASC,oBAAoB,QAAQ,cAAc,CAAC;AACpD,SAASC,iBAAiB,QAAQ,sBAAsB,CAAC;AAOzD,OAAO,SAASC,sBAAsB,CAACC,KAAkC,EAAE;IACzE,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGZ,QAAQ,CAACU,KAAK,CAACG,uBAAuB,CAAC,AAAC;IAElE,MAAMC,aAAa,GAAGV,gBAAgB,CAAC;QAAEW,iBAAiB,EAAE,IAAI;KAAE,CAAC,AAAC;IACpE,MAAMC,QAAQ,GAAGF,aAAa,IAAIJ,KAAK,CAACG,uBAAuB,IAAIF,KAAK,AAAC;IAEzE,OACE,8EAA8E;IAC9E,oHAAoH;kBACpH,KAACT,GAAG;QAACe,YAAY,EAAE,CAAC,CAAC;QAAEC,aAAW,EAAC,eAAe;kBAChD,cAAA,KAACjB,MAAM;YACLkB,KAAK,EAAC,SAAS;YACfC,QAAQ,EAAEJ,QAAQ,GAAG,OAAO,GAAG,QAAQ;YACvCK,SAAS,EAAEL,QAAQ,GAAG,CAAC,GAAG,CAAC;YAC3BM,EAAE,EAAE;gBAAEC,eAAe,EAAE,SAAS;gBAAE,GAAGb,KAAK,CAACY,EAAE;aAAE;sBAE/C,cAAA,MAACpB,GAAG;gBAACsB,OAAO,EAAC,MAAM;gBAACC,cAAc,EAAC,eAAe;;kCAChD,MAACvB,GAAG;wBAACsB,OAAO,EAAC,MAAM;wBAACE,QAAQ,EAAC,MAAM;wBAACC,UAAU,EAAC,OAAO;wBAACC,EAAE,EAAEZ,QAAQ,GAAG,CAAC,GAAG,CAAC;wBAAEa,EAAE,EAAEb,QAAQ,GAAG,CAAC,GAAG,CAAC;;0CAC/F,KAACT,oBAAoB,KAAwB;4BAC5CG,KAAK,CAACG,uBAAuB,kBAC5B,KAACV,UAAU;gCAAC2B,OAAO,EAAE,IAAMlB,QAAQ,CAAC,CAACD,KAAK,CAAC;0CAAGA,KAAK,iBAAG,KAACN,UAAU,KAAG,iBAAG,KAACC,aAAa,KAAG;8BAAc,AACvG;;sBACG;oBACLU,QAAQ,kBACP,KAACd,GAAG;wBAAC0B,EAAE,EAAE,CAAC;wBAAEG,EAAE,EAAE,CAAC;kCACf,cAAA,KAACvB,iBAAiB,KAAqB;sBACnC,AACP;;cACG;UACC;MACL,EACN;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './DashboardStickyToolbar';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/DashboardStickyToolbar/index.ts"],"names":[],"mappings":"AAaA,cAAc,0BAA0B,CAAC"}
@@ -0,0 +1,15 @@
1
+ // Copyright 2023 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ export * from './DashboardStickyToolbar';
14
+
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/DashboardStickyToolbar/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './DashboardStickyToolbar';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,0BAA0B,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { DashboardResource } from '@perses-dev/core';
2
+ import { OnSaveDashboard } from '../../context';
3
3
  export interface DashboardToolbarProps {
4
4
  dashboardName: string;
5
5
  dashboardTitleComponent?: JSX.Element;
@@ -7,7 +7,7 @@ export interface DashboardToolbarProps {
7
7
  isReadonly: boolean;
8
8
  onEditButtonClick: () => void;
9
9
  onCancelButtonClick: () => void;
10
- onSave?: (entity: DashboardResource) => Promise<DashboardResource>;
10
+ onSave?: OnSaveDashboard;
11
11
  }
12
12
  export declare const DashboardToolbar: (props: DashboardToolbarProps) => JSX.Element;
13
13
  //# sourceMappingURL=DashboardToolbar.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DashboardToolbar.d.ts","sourceRoot":"","sources":["../../../src/components/DashboardToolbar/DashboardToolbar.tsx"],"names":[],"mappings":";AAgBA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAUrD,MAAM,WAAW,qBAAqB;IACpC,aAAa,EAAE,MAAM,CAAC;IACtB,uBAAuB,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IACtC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,UAAU,EAAE,OAAO,CAAC;IACpB,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAC9B,mBAAmB,EAAE,MAAM,IAAI,CAAC;IAChC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAC;CACpE;AAED,eAAO,MAAM,gBAAgB,UAAW,qBAAqB,gBAoI5D,CAAC"}
1
+ {"version":3,"file":"DashboardToolbar.d.ts","sourceRoot":"","sources":["../../../src/components/DashboardToolbar/DashboardToolbar.tsx"],"names":[],"mappings":";AAeA,OAAO,EAAE,eAAe,EAAe,MAAM,eAAe,CAAC;AAW7D,MAAM,WAAW,qBAAqB;IACpC,aAAa,EAAE,MAAM,CAAC;IACtB,uBAAuB,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IACtC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,UAAU,EAAE,OAAO,CAAC;IACpB,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAC9B,mBAAmB,EAAE,MAAM,IAAI,CAAC;IAChC,MAAM,CAAC,EAAE,eAAe,CAAC;CAC1B;AAED,eAAO,MAAM,gBAAgB,UAAW,qBAAqB,gBA+G5D,CAAC"}