@perses-dev/dashboards 0.35.0 → 0.36.1

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 (45) hide show
  1. package/dist/cjs/components/DashboardToolbar/DashboardToolbar.js +16 -33
  2. package/dist/cjs/components/EditJsonDialog/EditJsonDialog.js +3 -1
  3. package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +54 -9
  4. package/dist/cjs/components/Variables/TemplateVariable.js +3 -3
  5. package/dist/cjs/context/DashboardProvider/DashboardProvider.js +5 -2
  6. package/dist/cjs/context/TemplateVariableProvider/TemplateVariableProvider.js +6 -5
  7. package/dist/cjs/context/TemplateVariableProvider/hydrationUtils.js +3 -3
  8. package/dist/cjs/context/useDashboard.js +5 -3
  9. package/dist/cjs/stories/decorators/constants.js +1 -0
  10. package/dist/cjs/test/testDashboard.js +1 -0
  11. package/dist/cjs/views/ViewDashboard/ViewDashboard.js +6 -1
  12. package/dist/components/DashboardToolbar/DashboardToolbar.d.ts.map +1 -1
  13. package/dist/components/DashboardToolbar/DashboardToolbar.js +16 -33
  14. package/dist/components/DashboardToolbar/DashboardToolbar.js.map +1 -1
  15. package/dist/components/EditJsonDialog/EditJsonDialog.js +3 -1
  16. package/dist/components/EditJsonDialog/EditJsonDialog.js.map +1 -1
  17. package/dist/components/TimeRangeControls/TimeRangeControls.d.ts +7 -3
  18. package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -1
  19. package/dist/components/TimeRangeControls/TimeRangeControls.js +53 -9
  20. package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
  21. package/dist/components/Variables/TemplateVariable.d.ts.map +1 -1
  22. package/dist/components/Variables/TemplateVariable.js +1 -1
  23. package/dist/components/Variables/TemplateVariable.js.map +1 -1
  24. package/dist/context/DashboardProvider/DashboardProvider.d.ts +1 -0
  25. package/dist/context/DashboardProvider/DashboardProvider.d.ts.map +1 -1
  26. package/dist/context/DashboardProvider/DashboardProvider.js +5 -2
  27. package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -1
  28. package/dist/context/TemplateVariableProvider/TemplateVariableProvider.d.ts.map +1 -1
  29. package/dist/context/TemplateVariableProvider/TemplateVariableProvider.js +2 -1
  30. package/dist/context/TemplateVariableProvider/TemplateVariableProvider.js.map +1 -1
  31. package/dist/context/TemplateVariableProvider/hydrationUtils.d.ts.map +1 -1
  32. package/dist/context/TemplateVariableProvider/hydrationUtils.js +1 -1
  33. package/dist/context/TemplateVariableProvider/hydrationUtils.js.map +1 -1
  34. package/dist/context/useDashboard.d.ts.map +1 -1
  35. package/dist/context/useDashboard.js +5 -3
  36. package/dist/context/useDashboard.js.map +1 -1
  37. package/dist/stories/decorators/constants.js +1 -0
  38. package/dist/stories/decorators/constants.js.map +1 -1
  39. package/dist/test/testDashboard.d.ts.map +1 -1
  40. package/dist/test/testDashboard.js +1 -0
  41. package/dist/test/testDashboard.js.map +1 -1
  42. package/dist/views/ViewDashboard/ViewDashboard.d.ts.map +1 -1
  43. package/dist/views/ViewDashboard/ViewDashboard.js +7 -2
  44. package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -1
  45. package/package.json +6 -6
@@ -34,8 +34,8 @@ const _dashboardStickyToolbar = require("../DashboardStickyToolbar");
34
34
  const DashboardToolbar = (props)=>{
35
35
  const { dashboardName , dashboardTitleComponent , initialVariableIsSticky , isReadonly , onEditButtonClick , onCancelButtonClick , onSave , } = props;
36
36
  const { isEditMode } = (0, _context.useEditMode)();
37
- const isBiggerThanMd = (0, _material.useMediaQuery)((0, _material.useTheme)().breakpoints.up('md'));
38
37
  const isBiggerThanSm = (0, _material.useMediaQuery)((0, _material.useTheme)().breakpoints.up('sm'));
38
+ const isBiggerThanLg = (0, _material.useMediaQuery)((0, _material.useTheme)().breakpoints.up('lg'));
39
39
  const dashboardTitle = dashboardTitleComponent ? dashboardTitleComponent : /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Typography, {
40
40
  variant: "h2",
41
41
  children: dashboardName
@@ -85,7 +85,7 @@ const DashboardToolbar = (props)=>{
85
85
  display: 'flex',
86
86
  width: '100%',
87
87
  alignItems: 'start',
88
- padding: (theme)=>theme.spacing(1, 2, 2, 2)
88
+ padding: (theme)=>theme.spacing(1, 2)
89
89
  },
90
90
  children: [
91
91
  /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components.ErrorBoundary, {
@@ -97,50 +97,33 @@ const DashboardToolbar = (props)=>{
97
97
  }
98
98
  })
99
99
  }),
100
- isBiggerThanMd ? // On bigger screens, make it one row
101
100
  /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Stack, {
101
+ ml: "auto",
102
102
  direction: "row",
103
- spacing: 1,
104
- marginLeft: "auto",
105
- sx: {
106
- whiteSpace: 'nowrap'
107
- },
108
- children: [
109
- /*#__PURE__*/ (0, _jsxRuntime.jsx)(_variables.EditVariablesButton, {}),
110
- /*#__PURE__*/ (0, _jsxRuntime.jsx)(_addPanelButton.AddPanelButton, {}),
111
- /*#__PURE__*/ (0, _jsxRuntime.jsx)(_addGroupButton.AddGroupButton, {}),
112
- /*#__PURE__*/ (0, _jsxRuntime.jsx)(_timeRangeControls.TimeRangeControls, {}),
113
- /*#__PURE__*/ (0, _jsxRuntime.jsx)(_downloadButton.DownloadButton, {}),
114
- /*#__PURE__*/ (0, _jsxRuntime.jsx)(_editJsonButton.EditJsonButton, {})
115
- ]
116
- }) : // On smaller screens, make it two rows
117
- /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Stack, {
118
- spacing: 1,
103
+ flexWrap: isBiggerThanLg ? 'nowrap' : 'wrap-reverse',
104
+ justifyContent: "end",
119
105
  children: [
120
106
  /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Stack, {
121
107
  direction: "row",
122
108
  spacing: 1,
123
- marginLeft: "auto",
124
- sx: {
125
- whiteSpace: 'nowrap'
126
- },
109
+ ml: 1,
110
+ mb: 1,
111
+ whiteSpace: "nowrap",
127
112
  children: [
128
- /*#__PURE__*/ (0, _jsxRuntime.jsx)(_timeRangeControls.TimeRangeControls, {}),
129
- /*#__PURE__*/ (0, _jsxRuntime.jsx)(_downloadButton.DownloadButton, {}),
130
- /*#__PURE__*/ (0, _jsxRuntime.jsx)(_editJsonButton.EditJsonButton, {})
113
+ /*#__PURE__*/ (0, _jsxRuntime.jsx)(_variables.EditVariablesButton, {}),
114
+ /*#__PURE__*/ (0, _jsxRuntime.jsx)(_addPanelButton.AddPanelButton, {}),
115
+ /*#__PURE__*/ (0, _jsxRuntime.jsx)(_addGroupButton.AddGroupButton, {})
131
116
  ]
132
117
  }),
133
118
  /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Stack, {
134
119
  direction: "row",
135
120
  spacing: 1,
136
- marginLeft: "auto",
137
- sx: {
138
- whiteSpace: 'nowrap'
139
- },
121
+ ml: 1,
122
+ mb: 1,
140
123
  children: [
141
- /*#__PURE__*/ (0, _jsxRuntime.jsx)(_variables.EditVariablesButton, {}),
142
- /*#__PURE__*/ (0, _jsxRuntime.jsx)(_addPanelButton.AddPanelButton, {}),
143
- /*#__PURE__*/ (0, _jsxRuntime.jsx)(_addGroupButton.AddGroupButton, {})
124
+ /*#__PURE__*/ (0, _jsxRuntime.jsx)(_timeRangeControls.TimeRangeControls, {}),
125
+ /*#__PURE__*/ (0, _jsxRuntime.jsx)(_downloadButton.DownloadButton, {}),
126
+ /*#__PURE__*/ (0, _jsxRuntime.jsx)(_editJsonButton.EditJsonButton, {})
144
127
  ]
145
128
  })
146
129
  ]
@@ -43,7 +43,7 @@ const EditJsonDialog = ()=>{
43
43
  };
44
44
  const EditJsonDialogForm = ()=>{
45
45
  const { closeEditJsonDialog } = (0, _dashboardProvider.useEditJsonDialog)();
46
- const { setTimeRange } = (0, _pluginSystem.useTimeRange)();
46
+ const { setTimeRange , setRefreshInterval } = (0, _pluginSystem.useTimeRange)();
47
47
  const { dashboard , setDashboard } = (0, _useDashboard.useDashboard)();
48
48
  const [draftDashboard, setDraftDashboard] = (0, _react.useState)(dashboard);
49
49
  const handleApply = (e)=>{
@@ -52,6 +52,8 @@ const EditJsonDialogForm = ()=>{
52
52
  setTimeRange({
53
53
  pastDuration: draftDashboard.spec.duration
54
54
  });
55
+ var _refreshInterval;
56
+ setRefreshInterval((_refreshInterval = draftDashboard.spec.refreshInterval) !== null && _refreshInterval !== void 0 ? _refreshInterval : '0s');
55
57
  closeEditJsonDialog();
56
58
  };
57
59
  return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_components.Dialog.Form, {
@@ -21,7 +21,8 @@ function _export(target, all) {
21
21
  });
22
22
  }
23
23
  _export(exports, {
24
- TIME_OPTIONS: ()=>TIME_OPTIONS,
24
+ DEFAULT_TIME_RANGE_OPTIONS: ()=>DEFAULT_TIME_RANGE_OPTIONS,
25
+ DEFAULT_REFRESH_INTERVAL_OPTIONS: ()=>DEFAULT_REFRESH_INTERVAL_OPTIONS,
25
26
  TimeRangeControls: ()=>TimeRangeControls
26
27
  });
27
28
  const _jsxRuntime = require("react/jsx-runtime");
@@ -38,7 +39,7 @@ function _interopRequireDefault(obj) {
38
39
  default: obj
39
40
  };
40
41
  }
41
- const TIME_OPTIONS = [
42
+ const DEFAULT_TIME_RANGE_OPTIONS = [
42
43
  {
43
44
  value: {
44
45
  pastDuration: '5m'
@@ -94,17 +95,55 @@ const TIME_OPTIONS = [
94
95
  display: 'Last 14 days'
95
96
  }
96
97
  ];
98
+ const DEFAULT_REFRESH_INTERVAL_OPTIONS = [
99
+ {
100
+ value: {
101
+ pastDuration: '0s'
102
+ },
103
+ display: 'Off'
104
+ },
105
+ {
106
+ value: {
107
+ pastDuration: '5s'
108
+ },
109
+ display: '5s'
110
+ },
111
+ {
112
+ value: {
113
+ pastDuration: '10s'
114
+ },
115
+ display: '10s'
116
+ },
117
+ {
118
+ value: {
119
+ pastDuration: '15s'
120
+ },
121
+ display: '15s'
122
+ },
123
+ {
124
+ value: {
125
+ pastDuration: '30s'
126
+ },
127
+ display: '30s'
128
+ },
129
+ {
130
+ value: {
131
+ pastDuration: '60s'
132
+ },
133
+ display: '1m'
134
+ }
135
+ ];
97
136
  const DEFAULT_HEIGHT = '34px';
98
- function TimeRangeControls({ heightPx , showRefresh =true }) {
99
- const { timeRange , setTimeRange , refresh } = (0, _pluginSystem.useTimeRange)();
137
+ function TimeRangeControls({ heightPx , showTimeRangeSelector =true , showRefreshButton =true , showRefreshInterval =true , timePresets =DEFAULT_TIME_RANGE_OPTIONS }) {
138
+ const { timeRange , setTimeRange , refresh , refreshInterval , setRefreshInterval } = (0, _pluginSystem.useTimeRange)();
100
139
  // TODO: Remove this since it couples to the dashboard context
101
140
  const dashboardDuration = (0, _context.useDashboardDuration)();
102
141
  // Convert height to a string, then use the string for styling
103
142
  const height = heightPx === undefined ? DEFAULT_HEIGHT : `${heightPx}px`;
104
143
  // add time shortcut if one does not match duration from dashboard JSON
105
- if (!TIME_OPTIONS.some((option)=>option.value.pastDuration === dashboardDuration)) {
144
+ if (!timePresets.some((option)=>option.value.pastDuration === dashboardDuration)) {
106
145
  if ((0, _core.isDurationString)(dashboardDuration)) {
107
- TIME_OPTIONS.push({
146
+ timePresets.push({
108
147
  value: {
109
148
  pastDuration: dashboardDuration
110
149
  },
@@ -116,13 +155,13 @@ function TimeRangeControls({ heightPx , showRefresh =true }) {
116
155
  direction: "row",
117
156
  spacing: 1,
118
157
  children: [
119
- /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components.DateTimeRangePicker, {
120
- timeOptions: TIME_OPTIONS,
158
+ showTimeRangeSelector && /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components.DateTimeRangePicker, {
159
+ timeOptions: timePresets,
121
160
  value: timeRange,
122
161
  onChange: setTimeRange,
123
162
  height: height
124
163
  }),
125
- showRefresh && /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components.InfoTooltip, {
164
+ showRefreshButton && /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components.InfoTooltip, {
126
165
  description: _constants.TOOLTIP_TEXT.refreshDashboard,
127
166
  children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_toolbarIconButton.ToolbarIconButton, {
128
167
  "aria-label": _constants.TOOLTIP_TEXT.refreshDashboard,
@@ -132,6 +171,12 @@ function TimeRangeControls({ heightPx , showRefresh =true }) {
132
171
  },
133
172
  children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_refresh.default, {})
134
173
  })
174
+ }),
175
+ showRefreshInterval && /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components.RefreshIntervalPicker, {
176
+ timeOptions: DEFAULT_REFRESH_INTERVAL_OPTIONS,
177
+ value: refreshInterval,
178
+ onChange: setRefreshInterval,
179
+ height: height
135
180
  })
136
181
  ]
137
182
  });
@@ -21,7 +21,7 @@ Object.defineProperty(exports, "TemplateVariable", {
21
21
  const _jsxRuntime = require("react/jsx-runtime");
22
22
  const _react = require("react");
23
23
  const _material = require("@mui/material");
24
- const _pluginSystem = require("@perses-dev/plugin-system");
24
+ const _core = require("@perses-dev/core");
25
25
  const _context = require("../../context");
26
26
  const _variableModel = require("./variable-model");
27
27
  function TemplateVariable({ name }) {
@@ -83,7 +83,7 @@ function ListVariable({ name }) {
83
83
  if (allowAllValue) {
84
84
  computedOptions = [
85
85
  {
86
- value: _pluginSystem.DEFAULT_ALL_VALUE,
86
+ value: _core.DEFAULT_ALL_VALUE,
87
87
  label: 'All'
88
88
  },
89
89
  ...computedOptions
@@ -142,7 +142,7 @@ function ListVariable({ name }) {
142
142
  // Must be selected
143
143
  if (e.target.value === null || e.target.value.length === 0) {
144
144
  if (allowAllValue) {
145
- setVariableValue(name, _pluginSystem.DEFAULT_ALL_VALUE);
145
+ setVariableValue(name, _core.DEFAULT_ALL_VALUE);
146
146
  }
147
147
  return;
148
148
  }
@@ -31,6 +31,7 @@ const _middleware = require("zustand/middleware");
31
31
  const _immer = require("zustand/middleware/immer");
32
32
  const _shallow = require("zustand/shallow");
33
33
  const _react = require("react");
34
+ const _core = require("@perses-dev/core");
34
35
  const _pluginSystem = require("@perses-dev/plugin-system");
35
36
  const _panelGroupEditorSlice = require("./panel-group-editor-slice");
36
37
  const _panelGroupSlice = require("./panel-group-slice");
@@ -82,7 +83,7 @@ function DashboardProvider(props) {
82
83
  }
83
84
  function initStore(props) {
84
85
  const { initialState: { dashboardResource , isEditMode } , } = props;
85
- const { spec: { display , duration } , metadata , } = dashboardResource;
86
+ const { spec: { display , duration , refreshInterval =_core.DEFAULT_REFRESH_INTERVAL } , metadata , } = dashboardResource;
86
87
  let { spec: { layouts , panels } , } = dashboardResource;
87
88
  // Set fallbacks in case the frontend is used with a non-Perses backend
88
89
  layouts = layouts !== null && layouts !== void 0 ? layouts : [];
@@ -103,11 +104,12 @@ function initStore(props) {
103
104
  metadata,
104
105
  display,
105
106
  duration,
107
+ refreshInterval,
106
108
  isEditMode: !!isEditMode,
107
109
  setEditMode: (isEditMode)=>set({
108
110
  isEditMode
109
111
  }),
110
- setDashboard: ({ metadata , spec: { display , panels ={} , layouts =[] , duration } })=>{
112
+ setDashboard: ({ metadata , spec: { display , panels ={} , layouts =[] , duration , refreshInterval } })=>{
111
113
  set((state)=>{
112
114
  state.metadata = metadata;
113
115
  state.display = display;
@@ -116,6 +118,7 @@ function initStore(props) {
116
118
  state.panelGroups = panelGroups;
117
119
  state.panelGroupOrder = panelGroupOrder;
118
120
  state.duration = duration;
121
+ state.refreshInterval = refreshInterval !== null && refreshInterval !== void 0 ? refreshInterval : _core.DEFAULT_REFRESH_INTERVAL;
119
122
  });
120
123
  }
121
124
  };
@@ -35,6 +35,7 @@ const _immer = require("zustand/middleware/immer");
35
35
  const _middleware = require("zustand/middleware");
36
36
  const _immer1 = /*#__PURE__*/ _interopRequireDefault(require("immer"));
37
37
  const _pluginSystem = require("@perses-dev/plugin-system");
38
+ const _core = require("@perses-dev/core");
38
39
  const _utils = require("./utils");
39
40
  const _hydrationUtils = require("./hydrationUtils");
40
41
  const _queryParams = require("./query-params");
@@ -113,7 +114,7 @@ function PluginProvider({ children }) {
113
114
  const v = {
114
115
  ...originalValues[name]
115
116
  };
116
- if (v.value === _pluginSystem.DEFAULT_ALL_VALUE) {
117
+ if (v.value === _core.DEFAULT_ALL_VALUE) {
117
118
  const definition = definitions.find((d)=>d.spec.name === name);
118
119
  // If the variable is a list variable and has a custom all value, then use that value instead
119
120
  if ((definition === null || definition === void 0 ? void 0 : definition.kind) === 'ListVariable' && definition.spec.custom_all_value) {
@@ -176,11 +177,11 @@ function createTemplateVariableSrvStore({ initialVariableDefinitions =[] , query
176
177
  return;
177
178
  }
178
179
  // Make sure there is only one all value
179
- if (Array.isArray(val) && val.includes(_pluginSystem.DEFAULT_ALL_VALUE)) {
180
- if (val.at(-1) === _pluginSystem.DEFAULT_ALL_VALUE) {
181
- val = _pluginSystem.DEFAULT_ALL_VALUE;
180
+ if (Array.isArray(val) && val.includes(_core.DEFAULT_ALL_VALUE)) {
181
+ if (val.at(-1) === _core.DEFAULT_ALL_VALUE) {
182
+ val = _core.DEFAULT_ALL_VALUE;
182
183
  } else {
183
- val = val.filter((v)=>v !== _pluginSystem.DEFAULT_ALL_VALUE);
184
+ val = val.filter((v)=>v !== _core.DEFAULT_ALL_VALUE);
184
185
  }
185
186
  }
186
187
  if (queryParams) {
@@ -18,7 +18,7 @@ Object.defineProperty(exports, "hydrateTemplateVariableStates", {
18
18
  enumerable: true,
19
19
  get: ()=>hydrateTemplateVariableStates
20
20
  });
21
- const _pluginSystem = require("@perses-dev/plugin-system");
21
+ const _core = require("@perses-dev/core");
22
22
  // TODO: move to TemplateVariableProvider/utils.ts
23
23
  function hydrateTemplateVariableState(variable, initialValue) {
24
24
  const varState = {
@@ -49,8 +49,8 @@ function hydrateTemplateVariableState(variable, initialValue) {
49
49
  // to end up in a buggy state if the variables are initialized with an "all"
50
50
  // value inside an array. When hydrating variables, normalize this to minimize
51
51
  // bugs.
52
- if (Array.isArray(varState.value) && varState.value.length === 1 && varState.value[0] === _pluginSystem.DEFAULT_ALL_VALUE) {
53
- varState.value = _pluginSystem.DEFAULT_ALL_VALUE;
52
+ if (Array.isArray(varState.value) && varState.value.length === 1 && varState.value[0] === _core.DEFAULT_ALL_VALUE) {
53
+ varState.value = _core.DEFAULT_ALL_VALUE;
54
54
  }
55
55
  break;
56
56
  default:
@@ -22,14 +22,15 @@ const _core = require("@perses-dev/core");
22
22
  const _dashboardProvider = require("./DashboardProvider");
23
23
  const _templateVariableProvider = require("./TemplateVariableProvider");
24
24
  function useDashboard() {
25
- const { panels , panelGroups , panelGroupOrder , setDashboard: setDashboardResource , metadata , display , duration , } = (0, _dashboardProvider.useDashboardStore)(({ panels , panelGroups , panelGroupOrder , setDashboard , metadata , display , duration })=>({
25
+ const { panels , panelGroups , panelGroupOrder , setDashboard: setDashboardResource , metadata , display , duration , refreshInterval , } = (0, _dashboardProvider.useDashboardStore)(({ panels , panelGroups , panelGroupOrder , setDashboard , metadata , display , duration , refreshInterval })=>({
26
26
  panels,
27
27
  panelGroups,
28
28
  panelGroupOrder,
29
29
  setDashboard,
30
30
  metadata,
31
31
  display,
32
- duration
32
+ duration,
33
+ refreshInterval
33
34
  }));
34
35
  const { setVariableDefinitions } = (0, _templateVariableProvider.useTemplateVariableActions)();
35
36
  const variables = (0, _templateVariableProvider.useTemplateVariableDefinitions)();
@@ -42,7 +43,8 @@ function useDashboard() {
42
43
  panels,
43
44
  layouts,
44
45
  variables,
45
- duration
46
+ duration,
47
+ refreshInterval
46
48
  }
47
49
  };
48
50
  const setDashboard = (dashboardResource)=>{
@@ -29,6 +29,7 @@ const EMPTY_DASHBOARD_RESOURCE = {
29
29
  },
30
30
  spec: {
31
31
  duration: '1h',
32
+ refreshInterval: '0s',
32
33
  variables: [],
33
34
  layouts: [],
34
35
  panels: {}
@@ -29,6 +29,7 @@ const testDashboard = {
29
29
  },
30
30
  spec: {
31
31
  duration: '30m',
32
+ refreshInterval: '0s',
32
33
  variables: [
33
34
  {
34
35
  kind: 'TextVariable',
@@ -20,6 +20,7 @@ Object.defineProperty(exports, "ViewDashboard", {
20
20
  });
21
21
  const _jsxRuntime = require("react/jsx-runtime");
22
22
  const _material = require("@mui/material");
23
+ const _core = require("@perses-dev/core");
23
24
  const _components = require("@perses-dev/components");
24
25
  const _pluginSystem = require("@perses-dev/plugin-system");
25
26
  const _context = require("../../context");
@@ -28,8 +29,11 @@ function ViewDashboard(props) {
28
29
  const { dashboardResource , datasourceApi , dashboardTitleComponent , emptyDashboardProps , onSave , onDiscard , initialVariableIsSticky , isReadonly , isEditing , sx , ...others } = props;
29
30
  const { spec } = dashboardResource;
30
31
  var _duration;
31
- const dashboardDuration = (_duration = spec.duration) !== null && _duration !== void 0 ? _duration : '1h';
32
+ const dashboardDuration = (_duration = spec.duration) !== null && _duration !== void 0 ? _duration : _core.DEFAULT_DASHBOARD_DURATION;
33
+ var _refreshInterval;
34
+ const dashhboardRefreshInterval = (_refreshInterval = spec.refreshInterval) !== null && _refreshInterval !== void 0 ? _refreshInterval : _core.DEFAULT_REFRESH_INTERVAL;
32
35
  const initialTimeRange = (0, _pluginSystem.useInitialTimeRange)(dashboardDuration);
36
+ const initialRefreshInterval = (0, _pluginSystem.useInitialRefreshInterval)(dashhboardRefreshInterval);
33
37
  return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_context.DatasourceStoreProvider, {
34
38
  dashboardResource: dashboardResource,
35
39
  datasourceApi: datasourceApi,
@@ -40,6 +44,7 @@ function ViewDashboard(props) {
40
44
  },
41
45
  children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pluginSystem.TimeRangeProvider, {
42
46
  initialTimeRange: initialTimeRange,
47
+ initialRefreshInterval: initialRefreshInterval,
43
48
  enabledURLParams: true,
44
49
  children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_context.TemplateVariableProvider, {
45
50
  initialVariableDefinitions: spec.variables,
@@ -1 +1 @@
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,gBA6G5D,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,gBAgG5D,CAAC"}
@@ -26,8 +26,8 @@ import { DashboardStickyToolbar } from '../DashboardStickyToolbar';
26
26
  export const DashboardToolbar = (props)=>{
27
27
  const { dashboardName , dashboardTitleComponent , initialVariableIsSticky , isReadonly , onEditButtonClick , onCancelButtonClick , onSave , } = props;
28
28
  const { isEditMode } = useEditMode();
29
- const isBiggerThanMd = useMediaQuery(useTheme().breakpoints.up('md'));
30
29
  const isBiggerThanSm = useMediaQuery(useTheme().breakpoints.up('sm'));
30
+ const isBiggerThanLg = useMediaQuery(useTheme().breakpoints.up('lg'));
31
31
  const dashboardTitle = dashboardTitleComponent ? dashboardTitleComponent : /*#__PURE__*/ _jsx(Typography, {
32
32
  variant: "h2",
33
33
  children: dashboardName
@@ -77,7 +77,7 @@ export const DashboardToolbar = (props)=>{
77
77
  display: 'flex',
78
78
  width: '100%',
79
79
  alignItems: 'start',
80
- padding: (theme)=>theme.spacing(1, 2, 2, 2)
80
+ padding: (theme)=>theme.spacing(1, 2)
81
81
  },
82
82
  children: [
83
83
  /*#__PURE__*/ _jsx(ErrorBoundary, {
@@ -89,50 +89,33 @@ export const DashboardToolbar = (props)=>{
89
89
  }
90
90
  })
91
91
  }),
92
- isBiggerThanMd ? // On bigger screens, make it one row
93
92
  /*#__PURE__*/ _jsxs(Stack, {
93
+ ml: "auto",
94
94
  direction: "row",
95
- spacing: 1,
96
- marginLeft: "auto",
97
- sx: {
98
- whiteSpace: 'nowrap'
99
- },
100
- children: [
101
- /*#__PURE__*/ _jsx(EditVariablesButton, {}),
102
- /*#__PURE__*/ _jsx(AddPanelButton, {}),
103
- /*#__PURE__*/ _jsx(AddGroupButton, {}),
104
- /*#__PURE__*/ _jsx(TimeRangeControls, {}),
105
- /*#__PURE__*/ _jsx(DownloadButton, {}),
106
- /*#__PURE__*/ _jsx(EditJsonButton, {})
107
- ]
108
- }) : // On smaller screens, make it two rows
109
- /*#__PURE__*/ _jsxs(Stack, {
110
- spacing: 1,
95
+ flexWrap: isBiggerThanLg ? 'nowrap' : 'wrap-reverse',
96
+ justifyContent: "end",
111
97
  children: [
112
98
  /*#__PURE__*/ _jsxs(Stack, {
113
99
  direction: "row",
114
100
  spacing: 1,
115
- marginLeft: "auto",
116
- sx: {
117
- whiteSpace: 'nowrap'
118
- },
101
+ ml: 1,
102
+ mb: 1,
103
+ whiteSpace: "nowrap",
119
104
  children: [
120
- /*#__PURE__*/ _jsx(TimeRangeControls, {}),
121
- /*#__PURE__*/ _jsx(DownloadButton, {}),
122
- /*#__PURE__*/ _jsx(EditJsonButton, {})
105
+ /*#__PURE__*/ _jsx(EditVariablesButton, {}),
106
+ /*#__PURE__*/ _jsx(AddPanelButton, {}),
107
+ /*#__PURE__*/ _jsx(AddGroupButton, {})
123
108
  ]
124
109
  }),
125
110
  /*#__PURE__*/ _jsxs(Stack, {
126
111
  direction: "row",
127
112
  spacing: 1,
128
- marginLeft: "auto",
129
- sx: {
130
- whiteSpace: 'nowrap'
131
- },
113
+ ml: 1,
114
+ mb: 1,
132
115
  children: [
133
- /*#__PURE__*/ _jsx(EditVariablesButton, {}),
134
- /*#__PURE__*/ _jsx(AddPanelButton, {}),
135
- /*#__PURE__*/ _jsx(AddGroupButton, {})
116
+ /*#__PURE__*/ _jsx(TimeRangeControls, {}),
117
+ /*#__PURE__*/ _jsx(DownloadButton, {}),
118
+ /*#__PURE__*/ _jsx(EditJsonButton, {})
136
119
  ]
137
120
  })
138
121
  ]
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/DashboardToolbar/DashboardToolbar.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 { Typography, Stack, Button, Box, useTheme, useMediaQuery, Alert } from '@mui/material';\nimport { ErrorBoundary, ErrorAlert } from '@perses-dev/components';\nimport { OnSaveDashboard, useEditMode } from '../../context';\nimport { AddPanelButton } from '../AddPanelButton';\nimport { AddGroupButton } from '../AddGroupButton';\nimport { DownloadButton } from '../DownloadButton';\nimport { TimeRangeControls } from '../TimeRangeControls';\nimport { EditVariablesButton } from '../Variables';\nimport { EditButton } from '../EditButton';\nimport { EditJsonButton } from '../EditJsonButton';\nimport { SaveDashboardButton } from '../SaveDashboardButton';\nimport { DashboardStickyToolbar } from '../DashboardStickyToolbar';\n\nexport interface DashboardToolbarProps {\n dashboardName: string;\n dashboardTitleComponent?: JSX.Element;\n initialVariableIsSticky?: boolean;\n isReadonly: boolean;\n onEditButtonClick: () => void;\n onCancelButtonClick: () => void;\n onSave?: OnSaveDashboard;\n}\n\nexport const DashboardToolbar = (props: DashboardToolbarProps) => {\n const {\n dashboardName,\n dashboardTitleComponent,\n initialVariableIsSticky,\n isReadonly,\n onEditButtonClick,\n onCancelButtonClick,\n onSave,\n } = props;\n\n const { isEditMode } = useEditMode();\n\n const isBiggerThanMd = useMediaQuery(useTheme().breakpoints.up('md'));\n const isBiggerThanSm = useMediaQuery(useTheme().breakpoints.up('sm'));\n\n const dashboardTitle = dashboardTitleComponent ? (\n dashboardTitleComponent\n ) : (\n <Typography variant=\"h2\">{dashboardName}</Typography>\n );\n\n const testId = 'dashboard-toolbar';\n\n return (\n <>\n {isEditMode ? (\n <Stack spacing={1} data-testid={testId}>\n <Box p={2} display=\"flex\" sx={{ backgroundColor: (theme) => theme.palette.primary.main + '30' }}>\n {dashboardTitle}\n <Stack direction=\"row\" spacing={1} marginLeft=\"auto\">\n {isReadonly && (\n <Alert severity={'warning'} sx={{ backgroundColor: 'transparent', padding: 0 }}>\n Dashboard managed via code only. Download JSON and commit changes to save.\n </Alert>\n )}\n <SaveDashboardButton onSave={onSave} isDisabled={isReadonly} />\n <Button variant=\"outlined\" onClick={onCancelButtonClick}>\n Cancel\n </Button>\n </Stack>\n </Box>\n <Box\n sx={{\n display: 'flex',\n width: '100%',\n alignItems: 'start',\n padding: (theme) => theme.spacing(1, 2, 2, 2),\n }}\n >\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <DashboardStickyToolbar\n initialVariableIsSticky={initialVariableIsSticky}\n sx={{\n backgroundColor: ({ palette }) => palette.background.default,\n }}\n />\n </ErrorBoundary>\n {isBiggerThanMd ? (\n // On bigger screens, make it one row\n <Stack direction=\"row\" spacing={1} marginLeft=\"auto\" sx={{ whiteSpace: 'nowrap' }}>\n <EditVariablesButton />\n <AddPanelButton />\n <AddGroupButton />\n <TimeRangeControls />\n <DownloadButton />\n <EditJsonButton />\n </Stack>\n ) : (\n // On smaller screens, make it two rows\n <Stack spacing={1}>\n <Stack direction=\"row\" spacing={1} marginLeft=\"auto\" sx={{ whiteSpace: 'nowrap' }}>\n <TimeRangeControls />\n <DownloadButton />\n <EditJsonButton />\n </Stack>\n <Stack direction=\"row\" spacing={1} marginLeft=\"auto\" sx={{ whiteSpace: 'nowrap' }}>\n <EditVariablesButton />\n <AddPanelButton />\n <AddGroupButton />\n </Stack>\n </Stack>\n )}\n </Box>\n </Stack>\n ) : (\n <Stack spacing={1} padding={2} data-testid={testId}>\n <Box sx={{ display: 'flex', width: '100%' }}>\n {dashboardTitle}\n <Stack direction=\"row\" spacing={1} marginLeft=\"auto\">\n <TimeRangeControls />\n <DownloadButton />\n {isBiggerThanSm && <EditButton onClick={onEditButtonClick} />}\n </Stack>\n </Box>\n <Box paddingY={2}>\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <DashboardStickyToolbar\n initialVariableIsSticky={initialVariableIsSticky}\n sx={{\n backgroundColor: ({ palette }) => palette.background.default,\n }}\n />\n </ErrorBoundary>\n </Box>\n </Stack>\n )}\n </>\n );\n};\n"],"names":["Typography","Stack","Button","Box","useTheme","useMediaQuery","Alert","ErrorBoundary","ErrorAlert","useEditMode","AddPanelButton","AddGroupButton","DownloadButton","TimeRangeControls","EditVariablesButton","EditButton","EditJsonButton","SaveDashboardButton","DashboardStickyToolbar","DashboardToolbar","props","dashboardName","dashboardTitleComponent","initialVariableIsSticky","isReadonly","onEditButtonClick","onCancelButtonClick","onSave","isEditMode","isBiggerThanMd","breakpoints","up","isBiggerThanSm","dashboardTitle","variant","testId","spacing","data-testid","p","display","sx","backgroundColor","theme","palette","primary","main","direction","marginLeft","severity","padding","isDisabled","onClick","width","alignItems","FallbackComponent","background","default","whiteSpace","paddingY"],"mappings":"AA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EAAE,CAAC;YAAEZ,aAAW,EAAEF,MAAM;;8BAChD,MAAChC,GAAG;oBAACqC,EAAE,EAAE;wBAAED,OAAO,EAAE,MAAM;wBAAEa,KAAK,EAAE,MAAM;qBAAE;;wBACxCnB,cAAc;sCACf,MAAChC,KAAK;4BAAC6C,SAAS,EAAC,KAAK;4BAACV,OAAO,EAAE,CAAC;4BAAEW,UAAU,EAAC,MAAM;;8CAClD,KAAClC,iBAAiB,KAAG;8CACrB,KAACD,cAAc,KAAG;gCACjBoB,cAAc,kBAAI,KAACjB,UAAU;oCAACoC,OAAO,EAAE1B,iBAAiB;kCAAI;;0BACvD;;kBACJ;8BACN,KAACtB,GAAG;oBAACuD,QAAQ,EAAE,CAAC;8BACd,cAAA,KAACnD,aAAa;wBAAC+C,iBAAiB,EAAE9C,UAAU;kCAC1C,cAAA,KAACU,sBAAsB;4BACrBK,uBAAuB,EAAEA,uBAAuB;4BAChDiB,EAAE,EAAE;gCACFC,eAAe,EAAE,CAAC,EAAEE,OAAO,CAAA,EAAE,GAAKA,OAAO,CAACY,UAAU,CAACC,OAAO;6BAC7D;0BACD;sBACY;kBACZ;;UACA,AACT;MACA,CACH;AACJ,CAAC,CAAC"}
1
+ {"version":3,"sources":["../../../src/components/DashboardToolbar/DashboardToolbar.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 { Typography, Stack, Button, Box, useTheme, useMediaQuery, Alert } from '@mui/material';\nimport { ErrorBoundary, ErrorAlert } from '@perses-dev/components';\nimport { OnSaveDashboard, useEditMode } from '../../context';\nimport { AddPanelButton } from '../AddPanelButton';\nimport { AddGroupButton } from '../AddGroupButton';\nimport { DownloadButton } from '../DownloadButton';\nimport { TimeRangeControls } from '../TimeRangeControls';\nimport { EditVariablesButton } from '../Variables';\nimport { EditButton } from '../EditButton';\nimport { EditJsonButton } from '../EditJsonButton';\nimport { SaveDashboardButton } from '../SaveDashboardButton';\nimport { DashboardStickyToolbar } from '../DashboardStickyToolbar';\n\nexport interface DashboardToolbarProps {\n dashboardName: string;\n dashboardTitleComponent?: JSX.Element;\n initialVariableIsSticky?: boolean;\n isReadonly: boolean;\n onEditButtonClick: () => void;\n onCancelButtonClick: () => void;\n onSave?: OnSaveDashboard;\n}\n\nexport const DashboardToolbar = (props: DashboardToolbarProps) => {\n const {\n dashboardName,\n dashboardTitleComponent,\n initialVariableIsSticky,\n isReadonly,\n onEditButtonClick,\n onCancelButtonClick,\n onSave,\n } = props;\n\n const { isEditMode } = useEditMode();\n\n const isBiggerThanSm = useMediaQuery(useTheme().breakpoints.up('sm'));\n const isBiggerThanLg = useMediaQuery(useTheme().breakpoints.up('lg'));\n\n const dashboardTitle = dashboardTitleComponent ? (\n dashboardTitleComponent\n ) : (\n <Typography variant=\"h2\">{dashboardName}</Typography>\n );\n\n const testId = 'dashboard-toolbar';\n\n return (\n <>\n {isEditMode ? (\n <Stack spacing={1} data-testid={testId}>\n <Box p={2} display=\"flex\" sx={{ backgroundColor: (theme) => theme.palette.primary.main + '30' }}>\n {dashboardTitle}\n <Stack direction=\"row\" spacing={1} marginLeft=\"auto\">\n {isReadonly && (\n <Alert severity={'warning'} sx={{ backgroundColor: 'transparent', padding: 0 }}>\n Dashboard managed via code only. Download JSON and commit changes to save.\n </Alert>\n )}\n <SaveDashboardButton onSave={onSave} isDisabled={isReadonly} />\n <Button variant=\"outlined\" onClick={onCancelButtonClick}>\n Cancel\n </Button>\n </Stack>\n </Box>\n <Box\n sx={{\n display: 'flex',\n width: '100%',\n alignItems: 'start',\n padding: (theme) => theme.spacing(1, 2),\n }}\n >\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <DashboardStickyToolbar\n initialVariableIsSticky={initialVariableIsSticky}\n sx={{\n backgroundColor: ({ palette }) => palette.background.default,\n }}\n />\n </ErrorBoundary>\n <Stack ml=\"auto\" direction=\"row\" flexWrap={isBiggerThanLg ? 'nowrap' : 'wrap-reverse'} justifyContent=\"end\">\n <Stack direction=\"row\" spacing={1} ml={1} mb={1} whiteSpace=\"nowrap\">\n <EditVariablesButton />\n <AddPanelButton />\n <AddGroupButton />\n </Stack>\n <Stack direction=\"row\" spacing={1} ml={1} mb={1}>\n <TimeRangeControls />\n <DownloadButton />\n <EditJsonButton />\n </Stack>\n </Stack>\n </Box>\n </Stack>\n ) : (\n <Stack spacing={1} padding={2} data-testid={testId}>\n <Box sx={{ display: 'flex', width: '100%' }}>\n {dashboardTitle}\n <Stack direction=\"row\" spacing={1} marginLeft=\"auto\">\n <TimeRangeControls />\n <DownloadButton />\n {isBiggerThanSm && <EditButton onClick={onEditButtonClick} />}\n </Stack>\n </Box>\n <Box paddingY={2}>\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <DashboardStickyToolbar\n initialVariableIsSticky={initialVariableIsSticky}\n sx={{\n backgroundColor: ({ palette }) => palette.background.default,\n }}\n />\n </ErrorBoundary>\n </Box>\n </Stack>\n )}\n </>\n );\n};\n"],"names":["Typography","Stack","Button","Box","useTheme","useMediaQuery","Alert","ErrorBoundary","ErrorAlert","useEditMode","AddPanelButton","AddGroupButton","DownloadButton","TimeRangeControls","EditVariablesButton","EditButton","EditJsonButton","SaveDashboardButton","DashboardStickyToolbar","DashboardToolbar","props","dashboardName","dashboardTitleComponent","initialVariableIsSticky","isReadonly","onEditButtonClick","onCancelButtonClick","onSave","isEditMode","isBiggerThanSm","breakpoints","up","isBiggerThanLg","dashboardTitle","variant","testId","spacing","data-testid","p","display","sx","backgroundColor","theme","palette","primary","main","direction","marginLeft","severity","padding","isDisabled","onClick","width","alignItems","FallbackComponent","background","default","ml","flexWrap","justifyContent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;8CACrB,KAACD,cAAc,KAAG;gCACjBiB,cAAc,kBAAI,KAACd,UAAU;oCAACoC,OAAO,EAAE1B,iBAAiB;kCAAI;;0BACvD;;kBACJ;8BACN,KAACtB,GAAG;oBAAC2D,QAAQ,EAAE,CAAC;8BACd,cAAA,KAACvD,aAAa;wBAAC+C,iBAAiB,EAAE9C,UAAU;kCAC1C,cAAA,KAACU,sBAAsB;4BACrBK,uBAAuB,EAAEA,uBAAuB;4BAChDiB,EAAE,EAAE;gCACFC,eAAe,EAAE,CAAC,EAAEE,OAAO,CAAA,EAAE,GAAKA,OAAO,CAACY,UAAU,CAACC,OAAO;6BAC7D;0BACD;sBACY;kBACZ;;UACA,AACT;MACA,CACH;AACJ,CAAC,CAAC"}
@@ -35,7 +35,7 @@ export const EditJsonDialog = ()=>{
35
35
  };
36
36
  const EditJsonDialogForm = ()=>{
37
37
  const { closeEditJsonDialog } = useEditJsonDialog();
38
- const { setTimeRange } = useTimeRange();
38
+ const { setTimeRange , setRefreshInterval } = useTimeRange();
39
39
  const { dashboard , setDashboard } = useDashboard();
40
40
  const [draftDashboard, setDraftDashboard] = useState(dashboard);
41
41
  const handleApply = (e)=>{
@@ -44,6 +44,8 @@ const EditJsonDialogForm = ()=>{
44
44
  setTimeRange({
45
45
  pastDuration: draftDashboard.spec.duration
46
46
  });
47
+ var _refreshInterval;
48
+ setRefreshInterval((_refreshInterval = draftDashboard.spec.refreshInterval) !== null && _refreshInterval !== void 0 ? _refreshInterval : '0s');
47
49
  closeEditJsonDialog();
48
50
  };
49
51
  return /*#__PURE__*/ _jsxs(Dialog.Form, {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/EditJsonDialog/EditJsonDialog.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { FormEvent, useState } from 'react';\nimport { Alert, FormControl } from '@mui/material';\nimport { Dialog, JSONEditor } from '@perses-dev/components';\nimport { useTimeRange } from '@perses-dev/plugin-system';\nimport { useEditJsonDialog } from '../../context/DashboardProvider';\nimport { useDashboard } from '../../context/useDashboard';\n\nexport const EditJsonDialog = () => {\n const { editJsonDialog, closeEditJsonDialog } = useEditJsonDialog();\n\n return (\n <Dialog open={!!editJsonDialog?.isOpen} scroll=\"paper\" fullWidth maxWidth=\"lg\">\n <Dialog.Header onClose={() => closeEditJsonDialog()}>Edit Dashboard</Dialog.Header>\n {editJsonDialog?.isOpen && <EditJsonDialogForm />}\n </Dialog>\n );\n};\n\nconst EditJsonDialogForm = () => {\n const { closeEditJsonDialog } = useEditJsonDialog();\n const { setTimeRange } = useTimeRange();\n const { dashboard, setDashboard } = useDashboard();\n const [draftDashboard, setDraftDashboard] = useState(dashboard);\n\n const handleApply = (e: FormEvent) => {\n e.preventDefault();\n setDashboard(draftDashboard);\n setTimeRange({ pastDuration: draftDashboard.spec.duration });\n closeEditJsonDialog();\n };\n\n return (\n <Dialog.Form onSubmit={handleApply}>\n <Dialog.Content sx={{ width: '100%' }}>\n <Alert sx={{ marginBottom: (theme) => theme.spacing(1) }} severity=\"warning\">\n Metadata cannot be modified or saved.\n </Alert>\n <FormControl fullWidth>\n <JSONEditor\n minHeight=\"300px\"\n maxHeight=\"700px\"\n value={draftDashboard}\n onChange={(value) => setDraftDashboard(value)}\n />\n </FormControl>\n </Dialog.Content>\n <Dialog.Actions>\n <Dialog.PrimaryButton onClick={handleApply}>Apply</Dialog.PrimaryButton>\n </Dialog.Actions>\n </Dialog.Form>\n );\n};\n"],"names":["useState","Alert","FormControl","Dialog","JSONEditor","useTimeRange","useEditJsonDialog","useDashboard","EditJsonDialog","editJsonDialog","closeEditJsonDialog","open","isOpen","scroll","fullWidth","maxWidth","Header","onClose","EditJsonDialogForm","setTimeRange","dashboard","setDashboard","draftDashboard","setDraftDashboard","handleApply","e","preventDefault","pastDuration","spec","duration","Form","onSubmit","Content","sx","width","marginBottom","theme","spacing","severity","minHeight","maxHeight","value","onChange","Actions","PrimaryButton","onClick"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC;AAAA,SAAoBA,QAAQ,QAAQ,OAAO,CAAC;AAC5C,SAASC,KAAK,EAAEC,WAAW,QAAQ,eAAe,CAAC;AACnD,SAASC,MAAM,EAAEC,UAAU,QAAQ,wBAAwB,CAAC;AAC5D,SAASC,YAAY,QAAQ,2BAA2B,CAAC;AACzD,SAASC,iBAAiB,QAAQ,iCAAiC,CAAC;AACpE,SAASC,YAAY,QAAQ,4BAA4B,CAAC;AAE1D,OAAO,MAAMC,cAAc,GAAG,IAAM;IAClC,MAAM,EAAEC,cAAc,CAAA,EAAEC,mBAAmB,CAAA,EAAE,GAAGJ,iBAAiB,EAAE,AAAC;IAEpE,qBACE,MAACH,MAAM;QAACQ,IAAI,EAAE,CAAC,CAACF,CAAAA,cAAc,aAAdA,cAAc,WAAQ,GAAtBA,KAAAA,CAAsB,GAAtBA,cAAc,CAAEG,MAAM,CAAA;QAAEC,MAAM,EAAC,OAAO;QAACC,SAAS;QAACC,QAAQ,EAAC,IAAI;;0BAC5E,KAACZ,MAAM,CAACa,MAAM;gBAACC,OAAO,EAAE,IAAMP,mBAAmB,EAAE;0BAAE,gBAAc;cAAgB;YAClFD,CAAAA,cAAc,aAAdA,cAAc,WAAQ,GAAtBA,KAAAA,CAAsB,GAAtBA,cAAc,CAAEG,MAAM,CAAA,kBAAI,KAACM,kBAAkB,KAAG;;MAC1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MAAM,CAACyC,aAAa;oBAACC,OAAO,EAAErB,WAAW;8BAAE,OAAK;kBAAuB;cACzD;;MACL,CACd;AACJ,CAAC,AAAC"}
1
+ {"version":3,"sources":["../../../src/components/EditJsonDialog/EditJsonDialog.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { FormEvent, useState } from 'react';\nimport { Alert, FormControl } from '@mui/material';\nimport { Dialog, JSONEditor } from '@perses-dev/components';\nimport { useTimeRange } from '@perses-dev/plugin-system';\nimport { useEditJsonDialog } from '../../context/DashboardProvider';\nimport { useDashboard } from '../../context/useDashboard';\n\nexport const EditJsonDialog = () => {\n const { editJsonDialog, closeEditJsonDialog } = useEditJsonDialog();\n\n return (\n <Dialog open={!!editJsonDialog?.isOpen} scroll=\"paper\" fullWidth maxWidth=\"lg\">\n <Dialog.Header onClose={() => closeEditJsonDialog()}>Edit Dashboard</Dialog.Header>\n {editJsonDialog?.isOpen && <EditJsonDialogForm />}\n </Dialog>\n );\n};\n\nconst EditJsonDialogForm = () => {\n const { closeEditJsonDialog } = useEditJsonDialog();\n const { setTimeRange, setRefreshInterval } = useTimeRange();\n const { dashboard, setDashboard } = useDashboard();\n const [draftDashboard, setDraftDashboard] = useState(dashboard);\n\n const handleApply = (e: FormEvent) => {\n e.preventDefault();\n setDashboard(draftDashboard);\n setTimeRange({ pastDuration: draftDashboard.spec.duration });\n setRefreshInterval(draftDashboard.spec.refreshInterval ?? '0s');\n closeEditJsonDialog();\n };\n\n return (\n <Dialog.Form onSubmit={handleApply}>\n <Dialog.Content sx={{ width: '100%' }}>\n <Alert sx={{ marginBottom: (theme) => theme.spacing(1) }} severity=\"warning\">\n Metadata cannot be modified or saved.\n </Alert>\n <FormControl fullWidth>\n <JSONEditor\n minHeight=\"300px\"\n maxHeight=\"700px\"\n value={draftDashboard}\n onChange={(value) => setDraftDashboard(value)}\n />\n </FormControl>\n </Dialog.Content>\n <Dialog.Actions>\n <Dialog.PrimaryButton onClick={handleApply}>Apply</Dialog.PrimaryButton>\n </Dialog.Actions>\n </Dialog.Form>\n );\n};\n"],"names":["useState","Alert","FormControl","Dialog","JSONEditor","useTimeRange","useEditJsonDialog","useDashboard","EditJsonDialog","editJsonDialog","closeEditJsonDialog","open","isOpen","scroll","fullWidth","maxWidth","Header","onClose","EditJsonDialogForm","setTimeRange","setRefreshInterval","dashboard","setDashboard","draftDashboard","setDraftDashboard","handleApply","e","preventDefault","pastDuration","spec","duration","refreshInterval","Form","onSubmit","Content","sx","width","marginBottom","theme","spacing","severity","minHeight","maxHeight","value","onChange","Actions","PrimaryButton","onClick"],"mappings":"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,SAAoBA,QAAQ,QAAQ,OAAO,CAAC;AAC5C,SAASC,KAAK,EAAEC,WAAW,QAAQ,eAAe,CAAC;AACnD,SAASC,MAAM,EAAEC,UAAU,QAAQ,wBAAwB,CAAC;AAC5D,SAASC,YAAY,QAAQ,2BAA2B,CAAC;AACzD,SAASC,iBAAiB,QAAQ,iCAAiC,CAAC;AACpE,SAASC,YAAY,QAAQ,4BAA4B,CAAC;AAE1D,OAAO,MAAMC,cAAc,GAAG,IAAM;IAClC,MAAM,EAAEC,cAAc,CAAA,EAAEC,mBAAmB,CAAA,EAAE,GAAGJ,iBAAiB,EAAE,AAAC;IAEpE,qBACE,MAACH,MAAM;QAACQ,IAA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AACC,QAAQ,EAAER,WAAW;;0BAChC,MAACtB,MAAM,CAAC+B,OAAO;gBAACC,EAAE,EAAE;oBAAEC,KAAK,EAAE,MAAM;iBAAE;;kCACnC,KAACnC,KAAK;wBAACkC,EAAE,EAAE;4BAAEE,YAAY,EAAE,CAACC,KAAK,GAAKA,KAAK,CAACC,OAAO,CAAC,CAAC,CAAC;yBAAE;wBAAEC,QAAQ,EAAC,SAAS;kCAAC,uCAE7E;sBAAQ;kCACR,KAACtC,WAAW;wBAACY,SAAS;kCACpB,cAAA,KAACV,UAAU;4BACTqC,SAAS,EAAC,OAAO;4BACjBC,SAAS,EAAC,OAAO;4BACjBC,KAAK,EAAEpB,cAAc;4BACrBqB,QAAQ,EAAE,CAACD,KAAK,GAAKnB,iBAAiB,CAACmB,KAAK,CAAC;0BAC7C;sBACU;;cACC;0BACjB,KAACxC,MAAM,CAAC0C,OAAO;0BACb,cAAA,KAAC1C,MAAM,CAAC2C,aAAa;oBAACC,OAAO,EAAEtB,WAAW;8BAAE,OAAK;kBAAuB;cACzD;;MACL,CACd;AACJ,CAAC,AAAC"}
@@ -1,10 +1,14 @@
1
1
  /// <reference types="react" />
2
2
  import { TimeOption } from '@perses-dev/components';
3
- export declare const TIME_OPTIONS: TimeOption[];
3
+ export declare const DEFAULT_TIME_RANGE_OPTIONS: TimeOption[];
4
+ export declare const DEFAULT_REFRESH_INTERVAL_OPTIONS: TimeOption[];
4
5
  interface TimeRangeControlsProps {
5
6
  heightPx?: number;
6
- showRefresh?: boolean;
7
+ showTimeRangeSelector?: boolean;
8
+ showRefreshButton?: boolean;
9
+ showRefreshInterval?: boolean;
10
+ timePresets?: TimeOption[];
7
11
  }
8
- export declare function TimeRangeControls({ heightPx, showRefresh }: TimeRangeControlsProps): JSX.Element;
12
+ export declare function TimeRangeControls({ heightPx, showTimeRangeSelector, showRefreshButton, showRefreshInterval, timePresets, }: TimeRangeControlsProps): JSX.Element;
9
13
  export {};
10
14
  //# sourceMappingURL=TimeRangeControls.d.ts.map