@perses-dev/dashboards 0.14.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/dist/cjs/components/DashboardToolbar/DashboardToolbar.js +9 -3
  2. package/dist/cjs/components/DownloadButton/DownloadButton.js +109 -0
  3. package/dist/cjs/{utils → components/DownloadButton}/index.js +1 -1
  4. package/dist/cjs/{css/styles.js → components/GridLayout/GridContainer.js} +66 -39
  5. package/dist/cjs/components/GridLayout/GridLayout.js +51 -64
  6. package/dist/cjs/components/GridLayout/GridTitle.js +11 -14
  7. package/dist/cjs/components/Panel/Panel.js +4 -2
  8. package/dist/cjs/components/Panel/PanelHeader.js +52 -48
  9. package/dist/cjs/components/PanelDrawer/PanelDrawer.test.js +23 -0
  10. package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +15 -54
  11. package/dist/cjs/components/TimeRangeControls/TimeRangeControls.test.js +27 -11
  12. package/dist/cjs/components/Variables/Variable.js +16 -4
  13. package/dist/cjs/components/Variables/VariableEditor.js +21 -1
  14. package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +63 -7
  15. package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +3 -3
  16. package/dist/cjs/components/Variables/VariableList.js +81 -17
  17. package/dist/cjs/components/index.js +1 -0
  18. package/dist/cjs/context/DashboardProvider/DashboardProvider.js +2 -1
  19. package/dist/cjs/context/DashboardProvider/dashboard-provider-api.js +68 -39
  20. package/dist/cjs/context/DashboardProvider/panel-editor-slice.js +40 -15
  21. package/dist/cjs/context/DashboardProvider/panel-group-editor-slice.js +5 -9
  22. package/dist/cjs/context/DashboardProvider/panel-group-slice.js +16 -1
  23. package/dist/cjs/context/{TimeRangeProvider.js → TimeRangeProvider/TimeRangeProvider.js} +4 -4
  24. package/dist/cjs/{utils/component-ids.js → context/TimeRangeProvider/index.js} +12 -14
  25. package/dist/cjs/{utils/time-range-params.js → context/TimeRangeProvider/query-params.js} +11 -5
  26. package/dist/cjs/index.js +0 -1
  27. package/dist/cjs/test/testDashboard.js +1 -1
  28. package/dist/cjs/views/ViewDashboard/DashboardApp.js +2 -1
  29. package/dist/cjs/views/ViewDashboard/ViewDashboard.js +6 -7
  30. package/dist/cjs/views/ViewDashboard/tests/panelGroups.test.js +16 -22
  31. package/dist/components/DashboardToolbar/DashboardToolbar.d.ts +1 -0
  32. package/dist/components/DashboardToolbar/DashboardToolbar.d.ts.map +1 -1
  33. package/dist/components/DashboardToolbar/DashboardToolbar.js +9 -3
  34. package/dist/components/DashboardToolbar/DashboardToolbar.js.map +1 -1
  35. package/dist/components/DownloadButton/DownloadButton.d.ts +3 -0
  36. package/dist/components/DownloadButton/DownloadButton.d.ts.map +1 -0
  37. package/dist/components/DownloadButton/DownloadButton.js +60 -0
  38. package/dist/components/DownloadButton/DownloadButton.js.map +1 -0
  39. package/dist/components/DownloadButton/index.d.ts +2 -0
  40. package/dist/components/DownloadButton/index.d.ts.map +1 -0
  41. package/dist/{utils → components/DownloadButton}/index.js +1 -1
  42. package/dist/components/DownloadButton/index.js.map +1 -0
  43. package/dist/components/GridLayout/GridContainer.d.ts +6 -0
  44. package/dist/components/GridLayout/GridContainer.d.ts.map +1 -0
  45. package/dist/{css/styles.js → components/GridLayout/GridContainer.js} +65 -38
  46. package/dist/components/GridLayout/GridContainer.js.map +1 -0
  47. package/dist/components/GridLayout/GridLayout.d.ts +1 -2
  48. package/dist/components/GridLayout/GridLayout.d.ts.map +1 -1
  49. package/dist/components/GridLayout/GridLayout.js +53 -66
  50. package/dist/components/GridLayout/GridLayout.js.map +1 -1
  51. package/dist/components/GridLayout/GridTitle.d.ts.map +1 -1
  52. package/dist/components/GridLayout/GridTitle.js +12 -15
  53. package/dist/components/GridLayout/GridTitle.js.map +1 -1
  54. package/dist/components/Panel/Panel.d.ts.map +1 -1
  55. package/dist/components/Panel/Panel.js +4 -2
  56. package/dist/components/Panel/Panel.js.map +1 -1
  57. package/dist/components/Panel/PanelHeader.d.ts.map +1 -1
  58. package/dist/components/Panel/PanelHeader.js +52 -48
  59. package/dist/components/Panel/PanelHeader.js.map +1 -1
  60. package/dist/components/PanelDrawer/PanelDrawer.test.js +23 -0
  61. package/dist/components/PanelDrawer/PanelDrawer.test.js.map +1 -1
  62. package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -1
  63. package/dist/components/TimeRangeControls/TimeRangeControls.js +19 -58
  64. package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
  65. package/dist/components/TimeRangeControls/TimeRangeControls.test.js +28 -12
  66. package/dist/components/TimeRangeControls/TimeRangeControls.test.js.map +1 -1
  67. package/dist/components/Variables/Variable.js +16 -4
  68. package/dist/components/Variables/Variable.js.map +1 -1
  69. package/dist/components/Variables/VariableEditor.d.ts.map +1 -1
  70. package/dist/components/Variables/VariableEditor.js +23 -3
  71. package/dist/components/Variables/VariableEditor.js.map +1 -1
  72. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
  73. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +25 -3
  74. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
  75. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts +1 -1
  76. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts.map +1 -1
  77. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +3 -3
  78. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -1
  79. package/dist/components/Variables/VariableList.d.ts +5 -1
  80. package/dist/components/Variables/VariableList.d.ts.map +1 -1
  81. package/dist/components/Variables/VariableList.js +43 -18
  82. package/dist/components/Variables/VariableList.js.map +1 -1
  83. package/dist/components/index.d.ts +1 -0
  84. package/dist/components/index.d.ts.map +1 -1
  85. package/dist/components/index.js +1 -0
  86. package/dist/components/index.js.map +1 -1
  87. package/dist/context/DashboardProvider/DashboardProvider.js +2 -1
  88. package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -1
  89. package/dist/context/DashboardProvider/dashboard-provider-api.d.ts +1 -1
  90. package/dist/context/DashboardProvider/dashboard-provider-api.d.ts.map +1 -1
  91. package/dist/context/DashboardProvider/dashboard-provider-api.js +70 -41
  92. package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -1
  93. package/dist/context/DashboardProvider/panel-editor-slice.d.ts.map +1 -1
  94. package/dist/context/DashboardProvider/panel-editor-slice.js +40 -15
  95. package/dist/context/DashboardProvider/panel-editor-slice.js.map +1 -1
  96. package/dist/context/DashboardProvider/panel-group-editor-slice.d.ts.map +1 -1
  97. package/dist/context/DashboardProvider/panel-group-editor-slice.js +5 -9
  98. package/dist/context/DashboardProvider/panel-group-editor-slice.js.map +1 -1
  99. package/dist/context/DashboardProvider/panel-group-slice.d.ts +9 -0
  100. package/dist/context/DashboardProvider/panel-group-slice.d.ts.map +1 -1
  101. package/dist/context/DashboardProvider/panel-group-slice.js +17 -0
  102. package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -1
  103. package/dist/context/{TimeRangeProvider.d.ts → TimeRangeProvider/TimeRangeProvider.d.ts} +2 -2
  104. package/dist/context/TimeRangeProvider/TimeRangeProvider.d.ts.map +1 -0
  105. package/dist/context/{TimeRangeProvider.js → TimeRangeProvider/TimeRangeProvider.js} +4 -4
  106. package/dist/context/TimeRangeProvider/TimeRangeProvider.js.map +1 -0
  107. package/dist/context/TimeRangeProvider/index.d.ts +3 -0
  108. package/dist/context/TimeRangeProvider/index.d.ts.map +1 -0
  109. package/dist/{utils/component-ids.js → context/TimeRangeProvider/index.js} +3 -14
  110. package/dist/context/TimeRangeProvider/index.js.map +1 -0
  111. package/dist/{utils/time-range-params.d.ts → context/TimeRangeProvider/query-params.d.ts} +3 -3
  112. package/dist/context/TimeRangeProvider/query-params.d.ts.map +1 -0
  113. package/dist/{utils/time-range-params.js → context/TimeRangeProvider/query-params.js} +13 -7
  114. package/dist/context/TimeRangeProvider/query-params.js.map +1 -0
  115. package/dist/index.d.ts +0 -1
  116. package/dist/index.d.ts.map +1 -1
  117. package/dist/index.js +0 -1
  118. package/dist/index.js.map +1 -1
  119. package/dist/test/testDashboard.js +1 -1
  120. package/dist/test/testDashboard.js.map +1 -1
  121. package/dist/views/ViewDashboard/DashboardApp.d.ts +1 -0
  122. package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -1
  123. package/dist/views/ViewDashboard/DashboardApp.js +2 -1
  124. package/dist/views/ViewDashboard/DashboardApp.js.map +1 -1
  125. package/dist/views/ViewDashboard/ViewDashboard.d.ts +1 -0
  126. package/dist/views/ViewDashboard/ViewDashboard.d.ts.map +1 -1
  127. package/dist/views/ViewDashboard/ViewDashboard.js +6 -7
  128. package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -1
  129. package/dist/views/ViewDashboard/tests/panelGroups.test.js +16 -22
  130. package/dist/views/ViewDashboard/tests/panelGroups.test.js.map +1 -1
  131. package/package.json +4 -4
  132. package/dist/context/TimeRangeProvider.d.ts.map +0 -1
  133. package/dist/context/TimeRangeProvider.js.map +0 -1
  134. package/dist/css/styles.d.ts +0 -172
  135. package/dist/css/styles.d.ts.map +0 -1
  136. package/dist/css/styles.js.map +0 -1
  137. package/dist/utils/component-ids.d.ts +0 -8
  138. package/dist/utils/component-ids.d.ts.map +0 -1
  139. package/dist/utils/component-ids.js.map +0 -1
  140. package/dist/utils/index.d.ts +0 -2
  141. package/dist/utils/index.d.ts.map +0 -1
  142. package/dist/utils/index.js.map +0 -1
  143. package/dist/utils/time-range-params.d.ts.map +0 -1
  144. package/dist/utils/time-range-params.js.map +0 -1
@@ -22,15 +22,13 @@ const _jsxRuntime = require("react/jsx-runtime");
22
22
  const _material = require("@mui/material");
23
23
  const _components = require("@perses-dev/components");
24
24
  const _context = require("../../context");
25
- const _utils = require("../../utils");
26
25
  const _dashboardApp = require("./DashboardApp");
27
26
  function ViewDashboard(props) {
28
- const { dashboardResource , datasourceApi , dashboardTitleComponent , sx , ...others } = props;
27
+ const { dashboardResource , datasourceApi , dashboardTitleComponent , initialVariableIsSticky , sx , ...others } = props;
29
28
  const { spec } = dashboardResource;
30
29
  var _duration;
31
30
  const dashboardDuration = (_duration = spec.duration) !== null && _duration !== void 0 ? _duration : '1h';
32
- const initialTimeRange = (0, _utils.useInitialTimeRange)(dashboardDuration);
33
- const { timeRange , setTimeRange } = (0, _utils.useSetTimeRangeParams)(initialTimeRange, true);
31
+ const initialTimeRange = (0, _context.useInitialTimeRange)(dashboardDuration);
34
32
  return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_context.DatasourceStoreProvider, {
35
33
  dashboardResource: dashboardResource,
36
34
  datasourceApi: datasourceApi,
@@ -39,8 +37,8 @@ function ViewDashboard(props) {
39
37
  dashboardResource
40
38
  },
41
39
  children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_context.TimeRangeProvider, {
42
- timeRange: timeRange,
43
- setTimeRange: setTimeRange,
40
+ initialTimeRange: initialTimeRange,
41
+ enabledURLParams: true,
44
42
  children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_context.TemplateVariableProvider, {
45
43
  initialVariableDefinitions: spec.variables,
46
44
  children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Box, {
@@ -56,7 +54,8 @@ function ViewDashboard(props) {
56
54
  FallbackComponent: _components.ErrorAlert,
57
55
  children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_dashboardApp.DashboardApp, {
58
56
  dashboardResource: dashboardResource,
59
- dashboardTitleComponent: dashboardTitleComponent
57
+ dashboardTitleComponent: dashboardTitleComponent,
58
+ initialVariableIsSticky: initialVariableIsSticky
60
59
  })
61
60
  })
62
61
  })
@@ -28,7 +28,7 @@ function _interopRequireDefault(obj) {
28
28
  describe('Panel Groups', ()=>{
29
29
  const renderDashboard = ()=>{
30
30
  (0, _test.renderWithContext)(/*#__PURE__*/ (0, _jsxRuntime.jsx)(_context.TimeRangeProvider, {
31
- timeRange: {
31
+ initialTimeRange: {
32
32
  pastDuration: '30m'
33
33
  },
34
34
  children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_context.TemplateVariableProvider, {
@@ -46,45 +46,40 @@ describe('Panel Groups', ()=>{
46
46
  };
47
47
  it('should delete panel', ()=>{
48
48
  renderDashboard();
49
- const panel = _react.screen.getByText('CPU');
50
- _userEvent.default.hover(panel);
51
- const deletePanelButton = _react.screen.getByLabelText('delete panel');
49
+ const panelTitle = 'CPU';
50
+ const deletePanelButton = _react.screen.getByLabelText(`delete panel ${panelTitle}`);
52
51
  _userEvent.default.click(deletePanelButton);
53
52
  _react.screen.getByText('Delete Panel');
54
53
  const deleteButton = _react.screen.getByText('Delete');
55
54
  _userEvent.default.click(deleteButton);
56
55
  // The panel should disappear
57
- const deletedPanel = _react.screen.queryByText('CPU');
56
+ const deletedPanel = _react.screen.queryByText(panelTitle);
58
57
  expect(deletedPanel).not.toBeInTheDocument();
59
58
  });
60
59
  it('should only delete panel from panel group if panel is not referenced more than once', ()=>{
61
60
  renderDashboard();
62
- const panels = _react.screen.getAllByText('Disk I/O Utilization');
61
+ const panelTitle = 'Disk I/O Utilization';
62
+ const panels = _react.screen.getAllByText(panelTitle);
63
63
  expect(panels).toHaveLength(2);
64
- const panel = panels[0];
65
- if (panel === undefined) throw new Error('Missing panel');
66
- _userEvent.default.hover(panel);
67
- const deletePanelButton = _react.screen.getByLabelText('delete panel');
64
+ const deletePanelButton = _react.screen.getAllByLabelText(`delete panel ${panelTitle}`)[0];
65
+ if (deletePanelButton === undefined) throw new Error('Missing delete button');
68
66
  _userEvent.default.click(deletePanelButton);
69
67
  _react.screen.getByText('Delete Panel');
70
68
  const deleteButton = _react.screen.getByText('Delete');
71
69
  _userEvent.default.click(deleteButton);
72
70
  // The deleted panel should still be on screen in the other group
73
- const deletedPanel = _react.screen.queryByText('Disk I/O Utilization');
71
+ const deletedPanel = _react.screen.queryByText(panelTitle);
74
72
  expect(deletedPanel).toBeInTheDocument();
75
73
  });
76
74
  it('should swap panels', ()=>{
77
75
  renderDashboard();
78
76
  // should move panel down
79
- const group1 = _react.screen.getByText('CPU Stats');
80
- _userEvent.default.hover(group1);
81
- const moveGroupDownBtn = _react.screen.getByLabelText('move group down');
77
+ const groupTitle1 = 'CPU Stats';
78
+ const moveGroupDownBtn = _react.screen.getByLabelText(`move group ${groupTitle1} down`);
82
79
  _userEvent.default.click(moveGroupDownBtn);
83
- _userEvent.default.unhover(moveGroupDownBtn);
84
80
  // should move panel up
85
- const group2 = _react.screen.getByText('Disk Stats');
86
- _userEvent.default.hover(group2);
87
- const moveGroupUpBtn = _react.screen.getByLabelText('move group up');
81
+ const groupTitle2 = 'Disk Stats';
82
+ const moveGroupUpBtn = _react.screen.getByLabelText(`move group ${groupTitle2} up`);
88
83
  _userEvent.default.click(moveGroupUpBtn);
89
84
  /* TODO: Figure out how to test this visually without coupling to the store
90
85
  const layouts = storeApi.getState().layouts;
@@ -94,15 +89,14 @@ describe('Panel Groups', ()=>{
94
89
  */ });
95
90
  it('should delete a panel group', ()=>{
96
91
  renderDashboard();
97
- const group = _react.screen.getByText('CPU Stats');
98
- _userEvent.default.hover(group);
99
- const deleteGroupIcon = _react.screen.getByLabelText('delete group');
92
+ const groupTitle = 'CPU Stats';
93
+ const deleteGroupIcon = _react.screen.getByLabelText(`delete group ${groupTitle}`);
100
94
  _userEvent.default.click(deleteGroupIcon);
101
95
  _react.screen.getByText('Delete Panel Group');
102
96
  const deleteButton = _react.screen.getByText('Delete');
103
97
  _userEvent.default.click(deleteButton);
104
98
  // should remove group
105
- const deletedGroup = _react.screen.queryByText('CPU Stats');
99
+ const deletedGroup = _react.screen.queryByText(groupTitle);
106
100
  expect(deletedGroup).not.toBeInTheDocument();
107
101
  // CPU panel should be completely gone since it wasn't in any other group
108
102
  let panel = _react.screen.queryByText('CPU');
@@ -2,6 +2,7 @@
2
2
  export interface DashboardToolbarProps {
3
3
  dashboardName: string;
4
4
  dashboardTitleComponent?: JSX.Element;
5
+ initialVariableIsSticky?: boolean;
5
6
  onEditButtonClick: () => void;
6
7
  onCancelButtonClick: () => void;
7
8
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DashboardToolbar.d.ts","sourceRoot":"","sources":["../../../src/components/DashboardToolbar/DashboardToolbar.tsx"],"names":[],"mappings":";AAsBA,MAAM,WAAW,qBAAqB;IACpC,aAAa,EAAE,MAAM,CAAC;IACtB,uBAAuB,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IACtC,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAC9B,mBAAmB,EAAE,MAAM,IAAI,CAAC;CACjC;AAED,eAAO,MAAM,gBAAgB,UAAW,qBAAqB,gBAkF5D,CAAC"}
1
+ {"version":3,"file":"DashboardToolbar.d.ts","sourceRoot":"","sources":["../../../src/components/DashboardToolbar/DashboardToolbar.tsx"],"names":[],"mappings":";AAuBA,MAAM,WAAW,qBAAqB;IACpC,aAAa,EAAE,MAAM,CAAC;IACtB,uBAAuB,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IACtC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAC9B,mBAAmB,EAAE,MAAM,IAAI,CAAC;CACjC;AAED,eAAO,MAAM,gBAAgB,UAAW,qBAAqB,gBAoF5D,CAAC"}
@@ -19,8 +19,9 @@ import { ErrorBoundary, ErrorAlert } from '@perses-dev/components';
19
19
  import { useDashboardActions, useEditMode } from '../../context';
20
20
  import { TemplateVariableList } from '../Variables';
21
21
  import { TimeRangeControls } from '../TimeRangeControls';
22
+ import { DownloadButton } from '../DownloadButton';
22
23
  export const DashboardToolbar = (props)=>{
23
- const { dashboardName , dashboardTitleComponent , onEditButtonClick , onCancelButtonClick } = props;
24
+ const { dashboardName , dashboardTitleComponent , initialVariableIsSticky , onEditButtonClick , onCancelButtonClick } = props;
24
25
  const { isEditMode , setEditMode } = useEditMode();
25
26
  const { openAddPanelGroup , openAddPanel } = useDashboardActions();
26
27
  const isLaptopSize = useMediaQuery(useTheme().breakpoints.up('sm'));
@@ -76,7 +77,9 @@ export const DashboardToolbar = (props)=>{
76
77
  children: [
77
78
  /*#__PURE__*/ _jsx(ErrorBoundary, {
78
79
  FallbackComponent: ErrorAlert,
79
- children: /*#__PURE__*/ _jsx(TemplateVariableList, {})
80
+ children: /*#__PURE__*/ _jsx(TemplateVariableList, {
81
+ initialVariableIsSticky: initialVariableIsSticky
82
+ })
80
83
  }),
81
84
  /*#__PURE__*/ _jsxs(Stack, {
82
85
  direction: 'row',
@@ -120,6 +123,7 @@ export const DashboardToolbar = (props)=>{
120
123
  },
121
124
  children: [
122
125
  /*#__PURE__*/ _jsx(TimeRangeControls, {}),
126
+ /*#__PURE__*/ _jsx(DownloadButton, {}),
123
127
  isLaptopSize && /*#__PURE__*/ _jsx(Button, {
124
128
  variant: "outlined",
125
129
  startIcon: /*#__PURE__*/ _jsx(PencilIcon, {}),
@@ -137,7 +141,9 @@ export const DashboardToolbar = (props)=>{
137
141
  paddingY: 2,
138
142
  children: /*#__PURE__*/ _jsx(ErrorBoundary, {
139
143
  FallbackComponent: ErrorAlert,
140
- children: /*#__PURE__*/ _jsx(TemplateVariableList, {})
144
+ children: /*#__PURE__*/ _jsx(TemplateVariableList, {
145
+ initialVariableIsSticky: initialVariableIsSticky
146
+ })
141
147
  })
142
148
  })
143
149
  ]
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/DashboardToolbar/DashboardToolbar.tsx"],"sourcesContent":["// Copyright 2022 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 } from '@mui/material';\nimport PencilIcon from 'mdi-material-ui/PencilOutline';\nimport AddPanelGroupIcon from 'mdi-material-ui/PlusBoxOutline';\nimport AddPanelIcon from 'mdi-material-ui/ChartBoxPlusOutline';\nimport { ErrorBoundary, ErrorAlert } from '@perses-dev/components';\nimport { useDashboardActions, useEditMode } from '../../context';\nimport { TemplateVariableList } from '../Variables';\nimport { TimeRangeControls } from '../TimeRangeControls';\n\nexport interface DashboardToolbarProps {\n dashboardName: string;\n dashboardTitleComponent?: JSX.Element;\n onEditButtonClick: () => void;\n onCancelButtonClick: () => void;\n}\n\nexport const DashboardToolbar = (props: DashboardToolbarProps) => {\n const { dashboardName, dashboardTitleComponent, onEditButtonClick, onCancelButtonClick } = props;\n\n const { isEditMode, setEditMode } = useEditMode();\n const { openAddPanelGroup, openAddPanel } = useDashboardActions();\n const isLaptopSize = useMediaQuery(useTheme().breakpoints.up('sm'));\n const dashboardTitle = dashboardTitleComponent ? (\n dashboardTitleComponent\n ) : (\n <Typography variant=\"h2\">{dashboardName}</Typography>\n );\n\n const onSave = () => {\n setEditMode(false);\n };\n\n return (\n <>\n {isEditMode ? (\n <Stack spacing={2}>\n <Box sx={{ backgroundColor: (theme) => theme.palette.primary.light + '20' }}>\n <Box padding={2} display=\"flex\">\n {dashboardTitle}\n <Stack direction=\"row\" spacing={1} sx={{ marginLeft: 'auto' }}>\n <Button variant=\"contained\" onClick={onSave}>\n Save\n </Button>\n <Button variant=\"outlined\" onClick={onCancelButtonClick}>\n Cancel\n </Button>\n </Stack>\n </Box>\n </Box>\n <Box\n sx={{\n display: 'flex',\n width: '100%',\n alignItems: 'flex-start',\n padding: (theme) => theme.spacing(2),\n }}\n >\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <TemplateVariableList />\n </ErrorBoundary>\n <Stack direction={'row'} spacing={1} sx={{ marginLeft: 'auto' }}>\n <Button startIcon={<AddPanelGroupIcon />} onClick={openAddPanelGroup}>\n Add Panel Group\n </Button>\n <Button startIcon={<AddPanelIcon />} onClick={openAddPanel}>\n Add Panel\n </Button>\n <TimeRangeControls />\n </Stack>\n </Box>\n </Stack>\n ) : (\n <Stack spacing={2} padding={2}>\n <Box sx={{ display: 'flex', width: '100%' }}>\n {dashboardTitle}\n <Stack direction=\"row\" spacing={2} sx={{ marginLeft: 'auto' }}>\n <TimeRangeControls />\n {isLaptopSize && (\n <Button\n variant=\"outlined\"\n startIcon={<PencilIcon />}\n onClick={onEditButtonClick}\n sx={{ marginLeft: 'auto' }}\n >\n Edit\n </Button>\n )}\n </Stack>\n </Box>\n <Box paddingY={2}>\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <TemplateVariableList />\n </ErrorBoundary>\n </Box>\n </Stack>\n )}\n </>\n );\n};\n"],"names":["Typography","Stack","Button","Box","useTheme","useMediaQuery","PencilIcon","AddPanelGroupIcon","AddPanelIcon","ErrorBoundary","ErrorAlert","useDashboardActions","useEditMode","TemplateVariableList","TimeRangeControls","DashboardToolbar","props","dashboardName","dashboardTitleComponent","onEditButtonClick","onCancelButtonClick","isEditMode","setEditMode","openAddPanelGroup","openAddPanel","isLaptopSize","breakpoints","up","dashboardTitle","variant","onSave","spacing","sx","backgroundColor","theme","palette","primary","light","padding","display","direction","marginLeft","onClick","width","alignItems","FallbackComponent","startIcon","paddingY"],"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,UAAU,EAAEC,KAAK,EAAEC,MAAM,EAAEC,GAAG,EAAEC,QAAQ,EAAEC,aAAa,QAAQ,eAAe,CAAC;AACxF,OAAOC,UAAU,MAAM,+BAA+B,CAAC;AACvD,OAAOC,iBAAiB,MAAM,gCAAgC,CAAC;AAC/D,OAAOC,YAAY,MAAM,qCAAqC,CAAC;AAC/D,SAASC,aAAa,EAAE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EC,EAAE,EAAE;gCAAES,UAAU,EAAE,MAAM;6BAAE;;8CAC3D,KAAC3B,iBAAiB,KAAG;gCACpBW,YAAY,kBACX,KAACvB,MAAM;oCACL2B,OAAO,EAAC,UAAU;oCAClBiB,SAAS,gBAAE,KAACxC,UAAU,KAAG;oCACzBoC,OAAO,EAAEvB,iBAAiB;oCAC1Ba,EAAE,EAAE;wCAAES,UAAU,EAAE,MAAM;qCAAE;8CAC3B,MAED;kCAAS,AACV;;0BACK;;kBACJ;8BACN,KAACtC,GAAG;oBAAC4C,QAAQ,EAAE,CAAC;8BACd,cAAA,KAACtC,aAAa;wBAACoC,iBAAiB,EAAEnC,UAAU;kCAC1C,cAAA,KAACG,oBAAoB,KAAG;sBACV;kBACZ;;UACA,AACT;MACA,CACH;AACJ,CAAC,CAAC"}
1
+ {"version":3,"sources":["../../../src/components/DashboardToolbar/DashboardToolbar.tsx"],"sourcesContent":["// Copyright 2022 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 } from '@mui/material';\nimport PencilIcon from 'mdi-material-ui/PencilOutline';\nimport AddPanelGroupIcon from 'mdi-material-ui/PlusBoxOutline';\nimport AddPanelIcon from 'mdi-material-ui/ChartBoxPlusOutline';\nimport { ErrorBoundary, ErrorAlert } from '@perses-dev/components';\nimport { useDashboardActions, useEditMode } from '../../context';\nimport { TemplateVariableList } from '../Variables';\nimport { TimeRangeControls } from '../TimeRangeControls';\nimport { DownloadButton } from '../DownloadButton';\n\nexport interface DashboardToolbarProps {\n dashboardName: string;\n dashboardTitleComponent?: JSX.Element;\n initialVariableIsSticky?: boolean;\n onEditButtonClick: () => void;\n onCancelButtonClick: () => void;\n}\n\nexport const DashboardToolbar = (props: DashboardToolbarProps) => {\n const { dashboardName, dashboardTitleComponent, initialVariableIsSticky, onEditButtonClick, onCancelButtonClick } =\n props;\n\n const { isEditMode, setEditMode } = useEditMode();\n const { openAddPanelGroup, openAddPanel } = useDashboardActions();\n const isLaptopSize = useMediaQuery(useTheme().breakpoints.up('sm'));\n const dashboardTitle = dashboardTitleComponent ? (\n dashboardTitleComponent\n ) : (\n <Typography variant=\"h2\">{dashboardName}</Typography>\n );\n\n const onSave = () => {\n setEditMode(false);\n };\n\n return (\n <>\n {isEditMode ? (\n <Stack spacing={2}>\n <Box sx={{ backgroundColor: (theme) => theme.palette.primary.light + '20' }}>\n <Box padding={2} display=\"flex\">\n {dashboardTitle}\n <Stack direction=\"row\" spacing={1} sx={{ marginLeft: 'auto' }}>\n <Button variant=\"contained\" onClick={onSave}>\n Save\n </Button>\n <Button variant=\"outlined\" onClick={onCancelButtonClick}>\n Cancel\n </Button>\n </Stack>\n </Box>\n </Box>\n <Box\n sx={{\n display: 'flex',\n width: '100%',\n alignItems: 'flex-start',\n padding: (theme) => theme.spacing(2),\n }}\n >\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <TemplateVariableList initialVariableIsSticky={initialVariableIsSticky} />\n </ErrorBoundary>\n <Stack direction={'row'} spacing={1} sx={{ marginLeft: 'auto' }}>\n <Button startIcon={<AddPanelGroupIcon />} onClick={openAddPanelGroup}>\n Add Panel Group\n </Button>\n <Button startIcon={<AddPanelIcon />} onClick={openAddPanel}>\n Add Panel\n </Button>\n <TimeRangeControls />\n </Stack>\n </Box>\n </Stack>\n ) : (\n <Stack spacing={2} padding={2}>\n <Box sx={{ display: 'flex', width: '100%' }}>\n {dashboardTitle}\n <Stack direction=\"row\" spacing={2} sx={{ marginLeft: 'auto' }}>\n <TimeRangeControls />\n <DownloadButton />\n {isLaptopSize && (\n <Button\n variant=\"outlined\"\n startIcon={<PencilIcon />}\n onClick={onEditButtonClick}\n sx={{ marginLeft: 'auto' }}\n >\n Edit\n </Button>\n )}\n </Stack>\n </Box>\n <Box paddingY={2}>\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <TemplateVariableList initialVariableIsSticky={initialVariableIsSticky} />\n </ErrorBoundary>\n </Box>\n </Stack>\n )}\n </>\n );\n};\n"],"names":["Typography","Stack","Button","Box","useTheme","useMediaQuery","PencilIcon","AddPanelGroupIcon","AddPanelIcon","ErrorBoundary","ErrorAlert","useDashboardActions","useEditMode","TemplateVariableList","TimeRangeControls","DownloadButton","DashboardToolbar","props","dashboardName","dashboardTitleComponent","initialVariableIsSticky","onEditButtonClick","onCancelButtonClick","isEditMode","setEditMode","openAddPanelGroup","openAddPanel","isLaptopSize","breakpoints","up","dashboardTitle","variant","onSave","spacing","sx","backgroundColor","theme","palette","primary","light","padding","display","direction","marginLeft","onClick","width","alignItems","FallbackComponent","startIcon","paddingY"],"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,UAAU,EAAEC,KAAK,EAAEC,MAAM,EAAEC,GAAG,EAAEC,QAAQ,EAAEC,aAAa,QAAQ,eAAe,CAAC;AACxF,OAAOC,UAAU,MAAM,+BAA+B,CAAC;AACvD,OAAOC,iBAAiB,MAAM,gCAAgC,CAAC;AAC/D,OAAOC,YAAY,MAAM,qCAAqC,CAAC;AAC/D,SAASC,aAAa,EAAEC,UAAU,QAAQ,wBAAwB,CAAC;AACnE,SAASC,mBAAmB,EAAEC,WAAW,QAAQ,eAAe,CAAC;AACjE,SAASC,oBAAoB,QAAQ,cAAc,CAAC;AACpD,SAASC,iBAAiB,QAAQ,sBAAsB,CAAC;AACzD,SAASC,cAAc,QAAQ,mBA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KAAG;gCACjBY,YAAY,kBACX,KAACzB,MAAM;oCACL6B,OAAO,EAAC,UAAU;oCAClBiB,SAAS,gBAAE,KAAC1C,UAAU,KAAG;oCACzBsC,OAAO,EAAEvB,iBAAiB;oCAC1Ba,EAAE,EAAE;wCAAES,UAAU,EAAE,MAAM;qCAAE;8CAC3B,MAED;kCAAS,AACV;;0BACK;;kBACJ;8BACN,KAACxC,GAAG;oBAAC8C,QAAQ,EAAE,CAAC;8BACd,cAAA,KAACxC,aAAa;wBAACsC,iBAAiB,EAAErC,UAAU;kCAC1C,cAAA,KAACG,oBAAoB;4BAACO,uBAAuB,EAAEA,uBAAuB;0BAAI;sBAC5D;kBACZ;;UACA,AACT;MACA,CACH;AACJ,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ export declare function DownloadButton(): JSX.Element;
3
+ //# sourceMappingURL=DownloadButton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DownloadButton.d.ts","sourceRoot":"","sources":["../../../src/components/DownloadButton/DownloadButton.tsx"],"names":[],"mappings":";AAmBA,wBAAgB,cAAc,gBA8B7B"}
@@ -0,0 +1,60 @@
1
+ // Copyright 2022 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
14
+ import React, { useRef } from 'react';
15
+ import DownloadIcon from 'mdi-material-ui/DownloadOutline';
16
+ import { IconButton, styled } from '@mui/material';
17
+ import { useDashboard } from '../../context';
18
+ // Button to download the dashboard as a JSON file.
19
+ export function DownloadButton() {
20
+ const { dashboard } = useDashboard();
21
+ const hiddenLinkRef = useRef(null);
22
+ const onDownloadButtonClick = ()=>{
23
+ if (!hiddenLinkRef || !hiddenLinkRef.current) return;
24
+ // Create blob URL
25
+ const hiddenLinkUrl = URL.createObjectURL(new Blob([
26
+ JSON.stringify(dashboard)
27
+ ], {
28
+ type: 'application/json'
29
+ }));
30
+ // Simulate click
31
+ hiddenLinkRef.current.href = hiddenLinkUrl;
32
+ hiddenLinkRef.current.click();
33
+ // Remove blob URL (for memory management)
34
+ URL.revokeObjectURL(hiddenLinkUrl);
35
+ };
36
+ return /*#__PURE__*/ _jsxs(_Fragment, {
37
+ children: [
38
+ /*#__PURE__*/ _jsx(DownloadIconButton, {
39
+ title: "Download JSON",
40
+ onClick: onDownloadButtonClick,
41
+ children: /*#__PURE__*/ _jsx(DownloadIcon, {})
42
+ }),
43
+ /*#__PURE__*/ _jsx("a", {
44
+ ref: hiddenLinkRef,
45
+ style: {
46
+ display: 'none'
47
+ },
48
+ download: `${dashboard.metadata.name}.json`
49
+ })
50
+ ]
51
+ });
52
+ }
53
+ const DownloadIconButton = styled(IconButton)(({ theme })=>({
54
+ border: `1px solid ${theme.palette.grey[300]}`,
55
+ borderRadius: theme.shape.borderRadius,
56
+ padding: '4px',
57
+ color: theme.palette.grey[900]
58
+ }));
59
+
60
+ //# sourceMappingURL=DownloadButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/DownloadButton/DownloadButton.tsx"],"sourcesContent":["// Copyright 2022 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 React, { useRef } from 'react';\nimport DownloadIcon from 'mdi-material-ui/DownloadOutline';\nimport { IconButton, styled } from '@mui/material';\nimport { useDashboard } from '../../context';\n\n// Button to download the dashboard as a JSON file.\nexport function DownloadButton() {\n const { dashboard } = useDashboard();\n const hiddenLinkRef = useRef<HTMLAnchorElement>(null);\n\n const onDownloadButtonClick = () => {\n if (!hiddenLinkRef || !hiddenLinkRef.current) return;\n // Create blob URL\n const hiddenLinkUrl = URL.createObjectURL(\n new Blob([JSON.stringify(dashboard)], {\n type: 'application/json',\n })\n );\n // Simulate click\n hiddenLinkRef.current.href = hiddenLinkUrl;\n hiddenLinkRef.current.click();\n // Remove blob URL (for memory management)\n URL.revokeObjectURL(hiddenLinkUrl);\n };\n\n return (\n <>\n <DownloadIconButton title=\"Download JSON\" onClick={onDownloadButtonClick}>\n <DownloadIcon />\n </DownloadIconButton>\n {/* Hidden link to download the dashboard as a JSON file */}\n {/* eslint-disable jsx-a11y/anchor-has-content */}\n {/* eslint-disable jsx-a11y/anchor-is-valid */}\n <a ref={hiddenLinkRef} style={{ display: 'none' }} download={`${dashboard.metadata.name}.json`} />\n </>\n );\n}\n\nconst DownloadIconButton = styled(IconButton)(({ theme }) => ({\n border: `1px solid ${theme.palette.grey[300]}`,\n borderRadius: theme.shape.borderRadius,\n padding: '4px',\n color: theme.palette.grey[900],\n}));\n"],"names":["React","useRef","DownloadIcon","IconButton","styled","useDashboard","DownloadButton","dashboard","hiddenLinkRef","onDownloadButtonClick","current","hiddenLinkUrl","URL","createObjectURL","Blob","JSON","stringify","type","href","click","revokeObjectURL","DownloadIconButton","title","onClick","a","ref","style","display","download","metadata","name","theme","border","palette","grey","borderRadius","shape","padding","color"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC;A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AU,CAAC,CAAC,CAAC,EAAE4B,KAAK,CAAA,EAAE,GAAM,CAAA;QAC5DC,MAAM,EAAE,CAAC,UAAU,EAAED,KAAK,CAACE,OAAO,CAACC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QAC9CC,YAAY,EAAEJ,KAAK,CAACK,KAAK,CAACD,YAAY;QACtCE,OAAO,EAAE,KAAK;QACdC,KAAK,EAAEP,KAAK,CAACE,OAAO,CAACC,IAAI,CAAC,GAAG,CAAC;KAC/B,CAAA,AAAC,CAAC,AAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './DownloadButton';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/DownloadButton/index.ts"],"names":[],"mappings":"AAaA,cAAc,kBAAkB,CAAC"}
@@ -10,6 +10,6 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- export * from './time-range-params';
13
+ export * from './DownloadButton';
14
14
 
15
15
  //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/DownloadButton/index.ts"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './DownloadButton';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ export interface GridContainerProps {
3
+ children: React.ReactNode;
4
+ }
5
+ export declare function GridContainer(props: GridContainerProps): JSX.Element;
6
+ //# sourceMappingURL=GridContainer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GridContainer.d.ts","sourceRoot":"","sources":["../../../src/components/GridLayout/GridContainer.tsx"],"names":[],"mappings":";AAgBA,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,eAqBtD"}
@@ -10,36 +10,64 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- export const styles = (theme)=>{
14
- return {
15
- '&.react-grid-layout': {
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ import { useEffect, useState } from 'react';
15
+ import { styled } from '@mui/material';
16
+ export function GridContainer(props) {
17
+ const [isFirstRender, setIsFirstRender] = useState(true);
18
+ useEffect(()=>{
19
+ if (isFirstRender) {
20
+ setIsFirstRender(false);
21
+ }
22
+ }, [
23
+ isFirstRender
24
+ ]);
25
+ return /*#__PURE__*/ _jsx(ReactGridLayoutContainer, {
26
+ sx: {
27
+ // This adds spcing between grids (rows) in the overall dashboard
28
+ '& + &': {
29
+ marginTop: (theme)=>theme.spacing(1)
30
+ },
31
+ // This disables the animation of grid items when a grid is first rendered
32
+ // (see https://github.com/react-grid-layout/react-grid-layout/issues/103)
33
+ '& .react-grid-item.cssTransforms': {
34
+ transitionProperty: isFirstRender ? 'none' : 'transform'
35
+ }
36
+ },
37
+ children: props.children
38
+ });
39
+ }
40
+ /**
41
+ * These are the classes needed by react-grid-layout from their CSS stylesheet.
42
+ */ const ReactGridLayoutContainer = styled('section')(({ theme })=>({
43
+ '& .react-grid-layout': {
16
44
  position: 'relative',
17
45
  transition: 'height 200ms ease'
18
46
  },
19
- '&.react-grid-item': {
47
+ '& .react-grid-item': {
20
48
  transition: 'all 200ms ease',
21
49
  transitionProperty: 'left, top'
22
50
  },
23
- '&.react-grid-item img': {
51
+ '& .react-grid-item img': {
24
52
  pointerEvents: 'none',
25
53
  userSelect: 'none'
26
54
  },
27
- '&.react-grid-item.cssTransforms': {
55
+ '& .react-grid-item.cssTransforms': {
28
56
  transitionProperty: 'transform'
29
57
  },
30
- '&.react-grid-item.resizing': {
58
+ '& .react-grid-item.resizing': {
31
59
  zIndex: 1,
32
60
  willChange: 'width, height'
33
61
  },
34
- '&.react-grid-item.react-draggable-dragging': {
62
+ '& .react-grid-item.react-draggable-dragging': {
35
63
  transition: 'none',
36
64
  zIndex: 3,
37
65
  willChange: 'transform'
38
66
  },
39
- '&.react-grid-item.dropping': {
67
+ '& .react-grid-item.dropping': {
40
68
  visibility: 'hidden'
41
69
  },
42
- '&.react-grid-item.react-grid-placeholder': {
70
+ '& .react-grid-item.react-grid-placeholder': {
43
71
  background: theme.palette.primary.main,
44
72
  opacity: 0.2,
45
73
  transitionDuration: '100ms',
@@ -50,12 +78,12 @@ export const styles = (theme)=>{
50
78
  msUserSelect: 'none',
51
79
  OUserSelect: 'none'
52
80
  },
53
- '&.react-grid-item > .react-resizable-handle': {
81
+ '& .react-grid-item > .react-resizable-handle': {
54
82
  position: 'absolute',
55
83
  width: '20px',
56
84
  height: '20px'
57
85
  },
58
- '&.react-grid-item > .react-resizable-handle::after': {
86
+ '& .react-grid-item > .react-resizable-handle::after': {
59
87
  content: '""',
60
88
  position: 'absolute',
61
89
  right: '3px',
@@ -65,62 +93,62 @@ export const styles = (theme)=>{
65
93
  borderRight: '2px solid rgba(0, 0, 0, 0.4)',
66
94
  borderBottom: '2px solid rgba(0, 0, 0, 0.4)'
67
95
  },
68
- '&.react-resizable-hide > .react-resizable-handle': {
96
+ '& .react-resizable-hide > .react-resizable-handle': {
69
97
  display: 'none'
70
98
  },
71
- '&.react-grid-item > .react-resizable-handle.react-resizable-handle-sw': {
99
+ '& .react-grid-item > .react-resizable-handle.react-resizable-handle-sw': {
72
100
  bottom: '0',
73
101
  left: '0',
74
102
  cursor: 'sw-resize',
75
103
  transform: 'rotate(90deg)'
76
104
  },
77
- '&.react-grid-item > .react-resizable-handle.react-resizable-handle-se': {
105
+ '& .react-grid-item > .react-resizable-handle.react-resizable-handle-se': {
78
106
  bottom: '0',
79
107
  right: '0',
80
108
  cursor: 'se-resize'
81
109
  },
82
- '&.react-grid-item > .react-resizable-handle.react-resizable-handle-nw': {
110
+ '& .react-grid-item > .react-resizable-handle.react-resizable-handle-nw': {
83
111
  top: '0',
84
112
  left: '0',
85
113
  cursor: 'nw-resize',
86
114
  transform: 'rotate(180deg)'
87
115
  },
88
- '&.react-grid-item > .react-resizable-handle.react-resizable-handle-ne': {
116
+ '& .react-grid-item > .react-resizable-handle.react-resizable-handle-ne': {
89
117
  top: '0',
90
118
  right: '0',
91
119
  cursor: 'ne-resize',
92
120
  transform: 'rotate(270deg)'
93
121
  },
94
- '&.react-grid-item > .react-resizable-handle.react-resizable-handle-w, &.react-grid-item > .react-resizable-handle.react-resizable-handle-e': {
122
+ '& .react-grid-item > .react-resizable-handle.react-resizable-handle-w, &.react-grid-item > .react-resizable-handle.react-resizable-handle-e': {
95
123
  top: '50%',
96
124
  marginTop: '-10px',
97
125
  cursor: 'ew-resize'
98
126
  },
99
- '&.react-grid-item > .react-resizable-handle.react-resizable-handle-w': {
127
+ '& .react-grid-item > .react-resizable-handle.react-resizable-handle-w': {
100
128
  left: '0',
101
129
  transform: 'rotate(135deg)'
102
130
  },
103
- '&.react-grid-item > .react-resizable-handle.react-resizable-handle-e': {
131
+ '& .react-grid-item > .react-resizable-handle.react-resizable-handle-e': {
104
132
  right: '0',
105
133
  transform: 'rotate(315deg)'
106
134
  },
107
- '&.react-grid-item > .react-resizable-handle.react-resizable-handle-n, &.react-grid-item > .react-resizable-handle.react-resizable-handle-s': {
135
+ '& .react-grid-item > .react-resizable-handle.react-resizable-handle-n, &.react-grid-item > .react-resizable-handle.react-resizable-handle-s': {
108
136
  left: '50%',
109
137
  marginLeft: '-10px',
110
138
  cursor: 'ns-resize'
111
139
  },
112
- '&.react-grid-item > .react-resizable-handle.react-resizable-handle-n': {
140
+ '& .react-grid-item > .react-resizable-handle.react-resizable-handle-n': {
113
141
  top: '0',
114
142
  transform: 'rotate(225deg)'
115
143
  },
116
- '&.react-grid-item > .react-resizable-handle.react-resizable-handle-s': {
144
+ '& .react-grid-item > .react-resizable-handle.react-resizable-handle-s': {
117
145
  bottom: '0',
118
146
  transform: 'rotate(45deg)'
119
147
  },
120
- '&.react-resizable': {
148
+ '& .react-resizable': {
121
149
  position: 'relative'
122
150
  },
123
- '&.react-resizable-handle': {
151
+ '& .react-resizable-handle': {
124
152
  position: 'absolute',
125
153
  width: '20px',
126
154
  height: '20px',
@@ -131,56 +159,55 @@ export const styles = (theme)=>{
131
159
  backgroundPosition: 'bottom right',
132
160
  padding: '0 3px 3px 0'
133
161
  },
134
- '&.react-resizable-handle-sw': {
162
+ '& .react-resizable-handle-sw': {
135
163
  bottom: '0',
136
164
  left: '0',
137
165
  cursor: 'sw-resize',
138
166
  transform: 'rotate(90deg)'
139
167
  },
140
- '&.react-resizable-handle-se': {
168
+ '& .react-resizable-handle-se': {
141
169
  bottom: '0',
142
170
  right: '0',
143
171
  cursor: 'se-resize'
144
172
  },
145
- '&.react-resizable-handle-nw': {
173
+ '& .react-resizable-handle-nw': {
146
174
  top: '0',
147
175
  left: '0',
148
176
  cursor: 'nw-resize',
149
177
  transform: 'rotate(180deg)'
150
178
  },
151
- '&.react-resizable-handle-ne': {
179
+ '& .react-resizable-handle-ne': {
152
180
  top: '0',
153
181
  right: '0',
154
182
  cursor: 'ne-resize',
155
183
  transform: 'rotate(270deg)'
156
184
  },
157
- '&.react-resizable-handle-w, .react-resizable-handle-e': {
185
+ '& .react-resizable-handle-w, .react-resizable-handle-e': {
158
186
  top: '50%',
159
187
  marginTop: '-10px',
160
188
  cursor: 'ew-resize'
161
189
  },
162
- '&.react-resizable-handle-w': {
190
+ '& .react-resizable-handle-w': {
163
191
  left: '0',
164
192
  transform: 'rotate(135deg)'
165
193
  },
166
- '&.react-resizable-handle-e': {
194
+ '& .react-resizable-handle-e': {
167
195
  right: '0',
168
196
  transform: 'rotate(315deg)'
169
197
  },
170
- '&.react-resizable-handle-n, .react-resizable-handle-s': {
198
+ '& .react-resizable-handle-n, .react-resizable-handle-s': {
171
199
  left: '50%',
172
200
  marginLeft: '-10px',
173
201
  cursor: 'ns-resize'
174
202
  },
175
- '&.react-resizable-handle-n': {
203
+ '& .react-resizable-handle-n': {
176
204
  top: '0',
177
205
  transform: 'rotate(225deg)'
178
206
  },
179
- '&.react-resizable-handle-s': {
207
+ '& .react-resizable-handle-s': {
180
208
  bottom: '0',
181
209
  transform: 'rotate(45deg)'
182
210
  }
183
- };
184
- };
211
+ }));
185
212
 
186
- //# sourceMappingURL=styles.js.map
213
+ //# sourceMappingURL=GridContainer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/GridLayout/GridContainer.tsx"],"sourcesContent":["// Copyright 2022 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 { useEffect, useState } from 'react';\nimport { styled } from '@mui/material';\n\nexport interface GridContainerProps {\n children: React.ReactNode;\n}\n\nexport function GridContainer(props: GridContainerProps) {\n const [isFirstRender, setIsFirstRender] = useState(true);\n useEffect(() => {\n if (isFirstRender) {\n setIsFirstRender(false);\n }\n }, [isFirstRender]);\n\n return (\n <ReactGridLayoutContainer\n sx={{\n // This adds spcing between grids (rows) in the overall dashboard\n '& + &': { marginTop: (theme) => theme.spacing(1) },\n // This disables the animation of grid items when a grid is first rendered\n // (see https://github.com/react-grid-layout/react-grid-layout/issues/103)\n '& .react-grid-item.cssTransforms': { transitionProperty: isFirstRender ? 'none' : 'transform' },\n }}\n >\n {props.children}\n </ReactGridLayoutContainer>\n );\n}\n\n/**\n * These are the classes needed by react-grid-layout from their CSS stylesheet.\n */\nconst ReactGridLayoutContainer = styled('section')(({ theme }) => ({\n '& .react-grid-layout': {\n position: 'relative',\n transition: 'height 200ms ease',\n },\n '& .react-grid-item': {\n transition: 'all 200ms ease',\n transitionProperty: 'left, top',\n },\n '& .react-grid-item img': {\n pointerEvents: 'none',\n userSelect: 'none',\n },\n '& .react-grid-item.cssTransforms': {\n transitionProperty: 'transform',\n },\n '& .react-grid-item.resizing': {\n zIndex: 1,\n willChange: 'width, height',\n },\n '& .react-grid-item.react-draggable-dragging': {\n transition: 'none',\n zIndex: 3,\n willChange: 'transform',\n },\n '& .react-grid-item.dropping': {\n visibility: 'hidden',\n },\n '& .react-grid-item.react-grid-placeholder': {\n background: theme.palette.primary.main,\n opacity: 0.2,\n transitionDuration: '100ms',\n zIndex: 2,\n userSelect: 'none',\n WebkitUserSelect: 'none',\n MozUserSelect: 'none',\n msUserSelect: 'none',\n OUserSelect: 'none',\n },\n\n '& .react-grid-item > .react-resizable-handle': {\n position: 'absolute',\n width: '20px',\n height: '20px',\n },\n '& .react-grid-item > .react-resizable-handle::after': {\n content: '\"\"',\n position: 'absolute',\n right: '3px',\n bottom: '3px',\n width: '5px',\n height: '5px',\n borderRight: '2px solid rgba(0, 0, 0, 0.4)',\n borderBottom: '2px solid rgba(0, 0, 0, 0.4)',\n },\n\n '& .react-resizable-hide > .react-resizable-handle': {\n display: 'none',\n },\n\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-sw': {\n bottom: '0',\n left: '0',\n cursor: 'sw-resize',\n transform: 'rotate(90deg)',\n },\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-se': {\n bottom: '0',\n right: '0',\n cursor: 'se-resize',\n },\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-nw': {\n top: '0',\n left: '0',\n cursor: 'nw-resize',\n transform: 'rotate(180deg)',\n },\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-ne': {\n top: '0',\n right: '0',\n cursor: 'ne-resize',\n transform: 'rotate(270deg)',\n },\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-w, &.react-grid-item > .react-resizable-handle.react-resizable-handle-e':\n {\n top: '50%',\n marginTop: '-10px',\n cursor: 'ew-resize',\n },\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-w': {\n left: '0',\n transform: 'rotate(135deg)',\n },\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-e': {\n right: '0',\n transform: 'rotate(315deg)',\n },\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-n, &.react-grid-item > .react-resizable-handle.react-resizable-handle-s':\n {\n left: '50%',\n marginLeft: '-10px',\n cursor: 'ns-resize',\n },\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-n': {\n top: '0',\n transform: 'rotate(225deg)',\n },\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-s': {\n bottom: '0',\n transform: 'rotate(45deg)',\n },\n '& .react-resizable': {\n position: 'relative',\n },\n '& .react-resizable-handle': {\n position: 'absolute',\n width: '20px',\n height: '20px',\n backgroundRepeat: 'no-repeat',\n backgroundOrigin: 'content-box',\n boxSizing: 'border-box',\n backgroundImage: `url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2IDYiIHN0eWxlPSJiYWNrZ3JvdW5kLWNvbG9yOiNmZmZmZmYwMCIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSI2cHgiIGhlaWdodD0iNnB4Ij48ZyBvcGFjaXR5PSIwLjMwMiI+PHBhdGggZD0iTSA2IDYgTCAwIDYgTCAwIDQuMiBMIDQgNC4yIEwgNC4yIDQuMiBMIDQuMiAwIEwgNiAwIEwgNiA2IEwgNiA2IFoiIGZpbGw9IiMwMDAwMDAiLz48L2c+PC9zdmc+')`,\n backgroundPosition: 'bottom right',\n padding: '0 3px 3px 0',\n },\n '& .react-resizable-handle-sw': {\n bottom: '0',\n left: '0',\n cursor: 'sw-resize',\n transform: 'rotate(90deg)',\n },\n '& .react-resizable-handle-se': {\n bottom: '0',\n right: '0',\n cursor: 'se-resize',\n },\n '& .react-resizable-handle-nw': {\n top: '0',\n left: '0',\n cursor: 'nw-resize',\n transform: 'rotate(180deg)',\n },\n '& .react-resizable-handle-ne': {\n top: '0',\n right: '0',\n cursor: 'ne-resize',\n transform: 'rotate(270deg)',\n },\n '& .react-resizable-handle-w, .react-resizable-handle-e': {\n top: '50%',\n marginTop: '-10px',\n cursor: 'ew-resize',\n },\n '& .react-resizable-handle-w': {\n left: '0',\n transform: 'rotate(135deg)',\n },\n '& .react-resizable-handle-e': {\n right: '0',\n transform: 'rotate(315deg)',\n },\n '& .react-resizable-handle-n, .react-resizable-handle-s': {\n left: '50%',\n marginLeft: '-10px',\n cursor: 'ns-resize',\n },\n '& .react-resizable-handle-n': {\n top: '0',\n transform: 'rotate(225deg)',\n },\n '& .react-resizable-handle-s': {\n bottom: '0',\n transform: 'rotate(45deg)',\n },\n}));\n"],"names":["useEffect","useState","styled","GridContainer","props","isFirstRender","setIsFirstRender","ReactGridLayoutContainer","sx","marginTop","theme","spacing","transitionProperty","children","position","transition","pointerEvents","userSelect","zIndex","willChange","visibility","background","palette","primary","main","opacity","transitionDuration","WebkitUserSelect","MozUserSelect","msUserSelect","OUserSelect","width","height","content","right","bottom","borderRight","borderBottom","display","left","cursor","transform","top","marginLeft","backgroundRepeat","backgroundOrigin","boxSizing","backgroundImage","backgroundPosition","padding"],"mappings":"AAAA,oCAAoC;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G;YACVM,MAAM,EAAE,WAAW;SACpB;QACD,8BAA8B,EAAE;YAC9BE,GAAG,EAAE,GAAG;YACRH,IAAI,EAAE,GAAG;YACTC,MAAM,EAAE,WAAW;YACnBC,SAAS,EAAE,gBAAgB;SAC5B;QACD,8BAA8B,EAAE;YAC9BC,GAAG,EAAE,GAAG;YACRR,KAAK,EAAE,GAAG;YACVM,MAAM,EAAE,WAAW;YACnBC,SAAS,EAAE,gBAAgB;SAC5B;QACD,wDAAwD,EAAE;YACxDC,GAAG,EAAE,KAAK;YACVjC,SAAS,EAAE,OAAO;YAClB+B,MAAM,EAAE,WAAW;SACpB;QACD,6BAA6B,EAAE;YAC7BD,IAAI,EAAE,GAAG;YACTE,SAAS,EAAE,gBAAgB;SAC5B;QACD,6BAA6B,EAAE;YAC7BP,KAAK,EAAE,GAAG;YACVO,SAAS,EAAE,gBAAgB;SAC5B;QACD,wDAAwD,EAAE;YACxDF,IAAI,EAAE,KAAK;YACXI,UAAU,EAAE,OAAO;YACnBH,MAAM,EAAE,WAAW;SACpB;QACD,6BAA6B,EAAE;YAC7BE,GAAG,EAAE,GAAG;YACRD,SAAS,EAAE,gBAAgB;SAC5B;QACD,6BAA6B,EAAE;YAC7BN,MAAM,EAAE,GAAG;YACXM,SAAS,EAAE,eAAe;SAC3B;KACF,CAAA,AAAC,CAAC,AAAC"}
@@ -1,7 +1,6 @@
1
1
  /// <reference types="react" />
2
- import { BoxProps } from '@mui/material';
3
2
  import { PanelGroupId } from '../../context';
4
- export interface GridLayoutProps extends BoxProps {
3
+ export interface GridLayoutProps {
5
4
  panelGroupId: PanelGroupId;
6
5
  }
7
6
  /**