@perses-dev/dashboards 0.16.0 → 0.18.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 (98) hide show
  1. package/dist/cjs/components/DashboardToolbar/DashboardToolbar.js +52 -41
  2. package/dist/cjs/components/GridLayout/GridContainer.js +2 -2
  3. package/dist/cjs/components/GridLayout/GridLayout.js +13 -2
  4. package/dist/cjs/components/GridLayout/GridTitle.js +4 -6
  5. package/dist/cjs/components/Panel/PanelHeader.js +1 -1
  6. package/dist/cjs/components/PanelDrawer/PanelDrawer.js +3 -4
  7. package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +28 -5
  8. package/dist/cjs/components/TimeRangeControls/TimeRangeControls.test.js +11 -5
  9. package/dist/cjs/components/Variables/Variable.js +2 -46
  10. package/dist/cjs/components/Variables/VariableEditor.js +142 -130
  11. package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +318 -167
  12. package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +5 -4
  13. package/dist/cjs/components/Variables/VariableList.js +13 -8
  14. package/dist/cjs/components/Variables/variable-model.js +106 -0
  15. package/dist/cjs/components/Variables/variable-model.test.js +106 -0
  16. package/dist/cjs/context/TemplateVariableProvider/query-params.js +3 -1
  17. package/dist/cjs/context/index.js +0 -1
  18. package/dist/cjs/views/ViewDashboard/DashboardApp.js +2 -1
  19. package/dist/cjs/views/ViewDashboard/ViewDashboard.js +6 -4
  20. package/dist/cjs/views/ViewDashboard/tests/panelGroups.test.js +4 -2
  21. package/dist/components/DashboardToolbar/DashboardToolbar.d.ts +1 -0
  22. package/dist/components/DashboardToolbar/DashboardToolbar.d.ts.map +1 -1
  23. package/dist/components/DashboardToolbar/DashboardToolbar.js +53 -42
  24. package/dist/components/DashboardToolbar/DashboardToolbar.js.map +1 -1
  25. package/dist/components/GridLayout/GridContainer.js +2 -2
  26. package/dist/components/GridLayout/GridContainer.js.map +1 -1
  27. package/dist/components/GridLayout/GridLayout.d.ts.map +1 -1
  28. package/dist/components/GridLayout/GridLayout.js +13 -2
  29. package/dist/components/GridLayout/GridLayout.js.map +1 -1
  30. package/dist/components/GridLayout/GridTitle.d.ts.map +1 -1
  31. package/dist/components/GridLayout/GridTitle.js +4 -6
  32. package/dist/components/GridLayout/GridTitle.js.map +1 -1
  33. package/dist/components/Panel/PanelHeader.js +1 -1
  34. package/dist/components/Panel/PanelHeader.js.map +1 -1
  35. package/dist/components/PanelDrawer/PanelDrawer.js +3 -4
  36. package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -1
  37. package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -1
  38. package/dist/components/TimeRangeControls/TimeRangeControls.js +24 -7
  39. package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
  40. package/dist/components/TimeRangeControls/TimeRangeControls.test.js +11 -5
  41. package/dist/components/TimeRangeControls/TimeRangeControls.test.js.map +1 -1
  42. package/dist/components/Variables/Variable.d.ts.map +1 -1
  43. package/dist/components/Variables/Variable.js +3 -47
  44. package/dist/components/Variables/Variable.js.map +1 -1
  45. package/dist/components/Variables/VariableEditor.d.ts.map +1 -1
  46. package/dist/components/Variables/VariableEditor.js +142 -130
  47. package/dist/components/Variables/VariableEditor.js.map +1 -1
  48. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
  49. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +315 -169
  50. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
  51. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts +1 -0
  52. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts.map +1 -1
  53. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +5 -4
  54. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -1
  55. package/dist/components/Variables/VariableList.d.ts +2 -0
  56. package/dist/components/Variables/VariableList.d.ts.map +1 -1
  57. package/dist/components/Variables/VariableList.js +13 -8
  58. package/dist/components/Variables/VariableList.js.map +1 -1
  59. package/dist/components/Variables/variable-model.d.ts +9 -0
  60. package/dist/components/Variables/variable-model.d.ts.map +1 -0
  61. package/dist/components/Variables/variable-model.js +95 -0
  62. package/dist/components/Variables/variable-model.js.map +1 -0
  63. package/dist/components/Variables/variable-model.test.d.ts +2 -0
  64. package/dist/components/Variables/variable-model.test.d.ts.map +1 -0
  65. package/dist/components/Variables/variable-model.test.js +104 -0
  66. package/dist/components/Variables/variable-model.test.js.map +1 -0
  67. package/dist/context/TemplateVariableProvider/query-params.js +3 -1
  68. package/dist/context/TemplateVariableProvider/query-params.js.map +1 -1
  69. package/dist/context/index.d.ts +0 -1
  70. package/dist/context/index.d.ts.map +1 -1
  71. package/dist/context/index.js +0 -1
  72. package/dist/context/index.js.map +1 -1
  73. package/dist/views/ViewDashboard/DashboardApp.d.ts +1 -0
  74. package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -1
  75. package/dist/views/ViewDashboard/DashboardApp.js +2 -1
  76. package/dist/views/ViewDashboard/DashboardApp.js.map +1 -1
  77. package/dist/views/ViewDashboard/ViewDashboard.d.ts +1 -0
  78. package/dist/views/ViewDashboard/ViewDashboard.d.ts.map +1 -1
  79. package/dist/views/ViewDashboard/ViewDashboard.js +5 -3
  80. package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -1
  81. package/dist/views/ViewDashboard/tests/panelGroups.test.js +4 -2
  82. package/dist/views/ViewDashboard/tests/panelGroups.test.js.map +1 -1
  83. package/package.json +5 -5
  84. package/dist/cjs/context/TimeRangeProvider/TimeRangeProvider.js +0 -91
  85. package/dist/cjs/context/TimeRangeProvider/index.js +0 -29
  86. package/dist/cjs/context/TimeRangeProvider/query-params.js +0 -157
  87. package/dist/context/TimeRangeProvider/TimeRangeProvider.d.ts +0 -19
  88. package/dist/context/TimeRangeProvider/TimeRangeProvider.d.ts.map +0 -1
  89. package/dist/context/TimeRangeProvider/TimeRangeProvider.js +0 -44
  90. package/dist/context/TimeRangeProvider/TimeRangeProvider.js.map +0 -1
  91. package/dist/context/TimeRangeProvider/index.d.ts +0 -3
  92. package/dist/context/TimeRangeProvider/index.d.ts.map +0 -1
  93. package/dist/context/TimeRangeProvider/index.js +0 -16
  94. package/dist/context/TimeRangeProvider/index.js.map +0 -1
  95. package/dist/context/TimeRangeProvider/query-params.d.ts +0 -25
  96. package/dist/context/TimeRangeProvider/query-params.d.ts.map +0 -1
  97. package/dist/context/TimeRangeProvider/query-params.js +0 -149
  98. package/dist/context/TimeRangeProvider/query-params.js.map +0 -1
@@ -0,0 +1,106 @@
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
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ function _export(target, all) {
18
+ for(var name1 in all)Object.defineProperty(target, name1, {
19
+ enumerable: true,
20
+ get: all[name1]
21
+ });
22
+ }
23
+ _export(exports, {
24
+ filterVariableList: ()=>filterVariableList,
25
+ useListVariablePluginValues: ()=>useListVariablePluginValues,
26
+ getVariableValuesKey: ()=>getVariableValuesKey
27
+ });
28
+ const _pluginSystem = require("@perses-dev/plugin-system");
29
+ const _reactQuery = require("@tanstack/react-query");
30
+ function filterVariableList(data, capturedRegexp) {
31
+ const result = [];
32
+ const filteredSet = new Set();
33
+ for (const variableValue of data){
34
+ const matches = variableValue.value.matchAll(capturedRegexp);
35
+ let concat = '';
36
+ for (const match of matches){
37
+ for(let i = 1; i < match.length; i++){
38
+ const m = match[i];
39
+ if (m !== undefined) {
40
+ concat = `${concat}${m}`;
41
+ }
42
+ }
43
+ }
44
+ if (concat !== '' && !filteredSet.has(concat)) {
45
+ // like that we are avoiding to have duplicating variable value
46
+ filteredSet.add(concat);
47
+ result.push({
48
+ label: variableValue.label,
49
+ value: concat
50
+ });
51
+ }
52
+ }
53
+ return result;
54
+ }
55
+ function useListVariablePluginValues(definition) {
56
+ const { data: variablePlugin } = (0, _pluginSystem.usePlugin)('Variable', definition.spec.plugin.kind);
57
+ const datasourceStore = (0, _pluginSystem.useDatasourceStore)();
58
+ const allVariables = (0, _pluginSystem.useTemplateVariableValues)();
59
+ const { absoluteTimeRange: timeRange , refreshKey } = (0, _pluginSystem.useTimeRange)();
60
+ const variablePluginCtx = {
61
+ timeRange,
62
+ datasourceStore,
63
+ variables: allVariables
64
+ };
65
+ const spec = definition.spec.plugin.spec;
66
+ const capturingRegexp = definition.spec.capturing_regexp !== undefined ? new RegExp(definition.spec.capturing_regexp, 'g') : undefined;
67
+ let dependsOnVariables;
68
+ if (variablePlugin === null || variablePlugin === void 0 ? void 0 : variablePlugin.dependsOn) {
69
+ const dependencies = variablePlugin.dependsOn(spec, variablePluginCtx);
70
+ dependsOnVariables = dependencies.variables;
71
+ }
72
+ const variables = (0, _pluginSystem.useTemplateVariableValues)(dependsOnVariables);
73
+ let waitToLoad = false;
74
+ if (dependsOnVariables) {
75
+ waitToLoad = dependsOnVariables.some((v)=>{
76
+ var ref;
77
+ return (ref = variables[v]) === null || ref === void 0 ? void 0 : ref.loading;
78
+ });
79
+ }
80
+ const variablesValueKey = getVariableValuesKey(variables);
81
+ return (0, _reactQuery.useQuery)([
82
+ name,
83
+ definition,
84
+ variablesValueKey,
85
+ timeRange,
86
+ refreshKey
87
+ ], async ()=>{
88
+ const resp = await (variablePlugin === null || variablePlugin === void 0 ? void 0 : variablePlugin.getVariableOptions(spec, {
89
+ datasourceStore,
90
+ variables,
91
+ timeRange
92
+ }));
93
+ if (resp === undefined) {
94
+ return [];
95
+ }
96
+ if (capturingRegexp === undefined) {
97
+ return resp.data;
98
+ }
99
+ return filterVariableList(resp.data, capturingRegexp);
100
+ }, {
101
+ enabled: !!variablePlugin || waitToLoad
102
+ });
103
+ }
104
+ function getVariableValuesKey(v) {
105
+ return Object.values(v).map((v)=>JSON.stringify(v.value)).join(',');
106
+ }
@@ -0,0 +1,106 @@
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
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ const _variableModel = require("./variable-model");
18
+ describe('filterVariableList', ()=>{
19
+ const testSuite = [
20
+ {
21
+ title: 'basic case',
22
+ capturing_regexp: /([^-]*)-host-([^-]*)/g,
23
+ originalValues: [
24
+ {
25
+ label: 'l1',
26
+ value: 'us1-host-ahdix'
27
+ },
28
+ {
29
+ label: 'l2',
30
+ value: 'us1-host-diua'
31
+ },
32
+ {
33
+ label: 'l3',
34
+ value: 'eu1-host-adf'
35
+ },
36
+ {
37
+ label: 'l4',
38
+ value: 'bar'
39
+ }
40
+ ],
41
+ result: [
42
+ {
43
+ label: 'l1',
44
+ value: 'us1ahdix'
45
+ },
46
+ {
47
+ label: 'l2',
48
+ value: 'us1diua'
49
+ },
50
+ {
51
+ label: 'l3',
52
+ value: 'eu1adf'
53
+ }
54
+ ]
55
+ },
56
+ {
57
+ title: 'duplicate captured value',
58
+ capturing_regexp: /prometheus-(.+):\d+/g,
59
+ originalValues: [
60
+ {
61
+ label: 'l1',
62
+ value: 'prometheus-app:9090'
63
+ },
64
+ {
65
+ label: 'l2',
66
+ value: 'prometheus-app:9091'
67
+ },
68
+ {
69
+ label: 'l3',
70
+ value: 'prometheus-platform:9091'
71
+ },
72
+ {
73
+ label: 'l4',
74
+ value: 'prometheus-database:9091'
75
+ },
76
+ {
77
+ label: 'l5',
78
+ value: 'prometheus-perses:9091'
79
+ }
80
+ ],
81
+ result: [
82
+ {
83
+ label: 'l1',
84
+ value: 'app'
85
+ },
86
+ {
87
+ label: 'l3',
88
+ value: 'platform'
89
+ },
90
+ {
91
+ label: 'l4',
92
+ value: 'database'
93
+ },
94
+ {
95
+ label: 'l5',
96
+ value: 'perses'
97
+ }
98
+ ]
99
+ }
100
+ ];
101
+ testSuite.forEach(({ title , capturing_regexp , originalValues , result })=>{
102
+ it(title, ()=>{
103
+ expect((0, _variableModel.filterVariableList)(originalValues, capturing_regexp)).toEqual(result);
104
+ });
105
+ });
106
+ });
@@ -63,7 +63,9 @@ function useVariableQueryParams(defs) {
63
63
  const name = getURLQueryParamName(def.spec.name);
64
64
  config[name] = VariableValueParam;
65
65
  });
66
- return (0, _useQueryParams.useQueryParams)(config);
66
+ return (0, _useQueryParams.useQueryParams)(config, {
67
+ updateType: 'replaceIn'
68
+ });
67
69
  }
68
70
  function getInitalValuesFromQueryParameters(queryParamValues) {
69
71
  const values = {};
@@ -17,7 +17,6 @@ Object.defineProperty(exports, "__esModule", {
17
17
  _exportStar(require("./DashboardProvider"), exports);
18
18
  _exportStar(require("./DatasourceStoreProvider"), exports);
19
19
  _exportStar(require("./TemplateVariableProvider"), exports);
20
- _exportStar(require("./TimeRangeProvider"), exports);
21
20
  _exportStar(require("./useDashboard"), exports);
22
21
  function _exportStar(from, to) {
23
22
  Object.keys(from).forEach(function(k) {
@@ -25,7 +25,7 @@ const _components = require("@perses-dev/components");
25
25
  const _components1 = require("../../components");
26
26
  const _context = require("../../context");
27
27
  const DashboardApp = (props)=>{
28
- const { dashboardResource , dashboardTitleComponent , initialVariableIsSticky } = props;
28
+ const { dashboardResource , dashboardTitleComponent , initialVariableIsSticky , isReadonly } = props;
29
29
  const { setEditMode } = (0, _context.useEditMode)();
30
30
  const { dashboard , setDashboard } = (0, _context.useDashboard)();
31
31
  const [originalDashboard, setOriginalDashboard] = (0, _react.useState)(undefined);
@@ -67,6 +67,7 @@ const DashboardApp = (props)=>{
67
67
  dashboardName: dashboardResource.metadata.name,
68
68
  dashboardTitleComponent: dashboardTitleComponent,
69
69
  initialVariableIsSticky: initialVariableIsSticky,
70
+ isReadonly: isReadonly,
70
71
  onEditButtonClick: onEditButtonClick,
71
72
  onCancelButtonClick: onCancelButtonClick
72
73
  }),
@@ -21,14 +21,15 @@ Object.defineProperty(exports, "ViewDashboard", {
21
21
  const _jsxRuntime = require("react/jsx-runtime");
22
22
  const _material = require("@mui/material");
23
23
  const _components = require("@perses-dev/components");
24
+ const _pluginSystem = require("@perses-dev/plugin-system");
24
25
  const _context = require("../../context");
25
26
  const _dashboardApp = require("./DashboardApp");
26
27
  function ViewDashboard(props) {
27
- const { dashboardResource , datasourceApi , dashboardTitleComponent , initialVariableIsSticky , sx , ...others } = props;
28
+ const { dashboardResource , datasourceApi , dashboardTitleComponent , initialVariableIsSticky , isReadonly , sx , ...others } = props;
28
29
  const { spec } = dashboardResource;
29
30
  var _duration;
30
31
  const dashboardDuration = (_duration = spec.duration) !== null && _duration !== void 0 ? _duration : '1h';
31
- const initialTimeRange = (0, _context.useInitialTimeRange)(dashboardDuration);
32
+ const initialTimeRange = (0, _pluginSystem.useInitialTimeRange)(dashboardDuration);
32
33
  return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_context.DatasourceStoreProvider, {
33
34
  dashboardResource: dashboardResource,
34
35
  datasourceApi: datasourceApi,
@@ -36,7 +37,7 @@ function ViewDashboard(props) {
36
37
  initialState: {
37
38
  dashboardResource
38
39
  },
39
- children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_context.TimeRangeProvider, {
40
+ children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pluginSystem.TimeRangeProvider, {
40
41
  initialTimeRange: initialTimeRange,
41
42
  enabledURLParams: true,
42
43
  children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_context.TemplateVariableProvider, {
@@ -55,7 +56,8 @@ function ViewDashboard(props) {
55
56
  children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_dashboardApp.DashboardApp, {
56
57
  dashboardResource: dashboardResource,
57
58
  dashboardTitleComponent: dashboardTitleComponent,
58
- initialVariableIsSticky: initialVariableIsSticky
59
+ initialVariableIsSticky: initialVariableIsSticky,
60
+ isReadonly: isReadonly
59
61
  })
60
62
  })
61
63
  })
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", {
17
17
  const _jsxRuntime = require("react/jsx-runtime");
18
18
  const _react = require("@testing-library/react");
19
19
  const _userEvent = /*#__PURE__*/ _interopRequireDefault(require("@testing-library/user-event"));
20
+ const _pluginSystem = require("@perses-dev/plugin-system");
20
21
  const _context = require("../../../context");
21
22
  const _test = require("../../../test");
22
23
  const _dashboardApp = require("../DashboardApp");
@@ -27,7 +28,7 @@ function _interopRequireDefault(obj) {
27
28
  }
28
29
  describe('Panel Groups', ()=>{
29
30
  const renderDashboard = ()=>{
30
- (0, _test.renderWithContext)(/*#__PURE__*/ (0, _jsxRuntime.jsx)(_context.TimeRangeProvider, {
31
+ (0, _test.renderWithContext)(/*#__PURE__*/ (0, _jsxRuntime.jsx)(_pluginSystem.TimeRangeProvider, {
31
32
  initialTimeRange: {
32
33
  pastDuration: '30m'
33
34
  },
@@ -38,7 +39,8 @@ describe('Panel Groups', ()=>{
38
39
  isEditMode: true
39
40
  },
40
41
  children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_dashboardApp.DashboardApp, {
41
- dashboardResource: (0, _test.getTestDashboard)()
42
+ dashboardResource: (0, _test.getTestDashboard)(),
43
+ isReadonly: false
42
44
  })
43
45
  })
44
46
  })
@@ -3,6 +3,7 @@ export interface DashboardToolbarProps {
3
3
  dashboardName: string;
4
4
  dashboardTitleComponent?: JSX.Element;
5
5
  initialVariableIsSticky?: boolean;
6
+ isReadonly: boolean;
6
7
  onEditButtonClick: () => void;
7
8
  onCancelButtonClick: () => void;
8
9
  }
@@ -1 +1 @@
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"}
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,UAAU,EAAE,OAAO,CAAC;IACpB,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAC9B,mBAAmB,EAAE,MAAM,IAAI,CAAC;CACjC;AAED,eAAO,MAAM,gBAAgB,UAAW,qBAAqB,gBA0G5D,CAAC"}
@@ -11,7 +11,7 @@
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
13
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
14
- import { Typography, Stack, Button, Box, useTheme, useMediaQuery } from '@mui/material';
14
+ import { Typography, Stack, Button, Box, useTheme, useMediaQuery, Alert } from '@mui/material';
15
15
  import PencilIcon from 'mdi-material-ui/PencilOutline';
16
16
  import AddPanelGroupIcon from 'mdi-material-ui/PlusBoxOutline';
17
17
  import AddPanelIcon from 'mdi-material-ui/ChartBoxPlusOutline';
@@ -21,7 +21,7 @@ import { TemplateVariableList } from '../Variables';
21
21
  import { TimeRangeControls } from '../TimeRangeControls';
22
22
  import { DownloadButton } from '../DownloadButton';
23
23
  export const DashboardToolbar = (props)=>{
24
- const { dashboardName , dashboardTitleComponent , initialVariableIsSticky , onEditButtonClick , onCancelButtonClick } = props;
24
+ const { dashboardName , dashboardTitleComponent , initialVariableIsSticky , isReadonly , onEditButtonClick , onCancelButtonClick , } = props;
25
25
  const { isEditMode , setEditMode } = useEditMode();
26
26
  const { openAddPanelGroup , openAddPanel } = useDashboardActions();
27
27
  const isLaptopSize = useMediaQuery(useTheme().breakpoints.up('sm'));
@@ -34,58 +34,67 @@ export const DashboardToolbar = (props)=>{
34
34
  };
35
35
  return /*#__PURE__*/ _jsx(_Fragment, {
36
36
  children: isEditMode ? /*#__PURE__*/ _jsxs(Stack, {
37
- spacing: 2,
37
+ spacing: 1,
38
38
  children: [
39
- /*#__PURE__*/ _jsx(Box, {
39
+ /*#__PURE__*/ _jsxs(Box, {
40
+ p: 2,
41
+ display: "flex",
40
42
  sx: {
41
- backgroundColor: (theme)=>theme.palette.primary.light + '20'
43
+ backgroundColor: (theme)=>theme.palette.primary.main + '30'
42
44
  },
43
- children: /*#__PURE__*/ _jsxs(Box, {
44
- padding: 2,
45
- display: "flex",
46
- children: [
47
- dashboardTitle,
48
- /*#__PURE__*/ _jsxs(Stack, {
49
- direction: "row",
50
- spacing: 1,
51
- sx: {
52
- marginLeft: 'auto'
53
- },
54
- children: [
55
- /*#__PURE__*/ _jsx(Button, {
56
- variant: "contained",
57
- onClick: onSave,
58
- children: "Save"
59
- }),
60
- /*#__PURE__*/ _jsx(Button, {
61
- variant: "outlined",
62
- onClick: onCancelButtonClick,
63
- children: "Cancel"
64
- })
65
- ]
66
- })
67
- ]
68
- })
45
+ children: [
46
+ dashboardTitle,
47
+ /*#__PURE__*/ _jsxs(Stack, {
48
+ direction: "row",
49
+ spacing: 1,
50
+ marginLeft: "auto",
51
+ children: [
52
+ isReadonly && /*#__PURE__*/ _jsx(Alert, {
53
+ severity: 'warning',
54
+ sx: {
55
+ backgroundColor: 'transparent',
56
+ padding: 0
57
+ },
58
+ children: "Dashboard managed via code only. Download JSON and commit changes to save."
59
+ }),
60
+ /*#__PURE__*/ _jsx(Button, {
61
+ variant: "contained",
62
+ onClick: onSave,
63
+ disabled: isReadonly,
64
+ children: "Save"
65
+ }),
66
+ /*#__PURE__*/ _jsx(Button, {
67
+ variant: "outlined",
68
+ onClick: onCancelButtonClick,
69
+ children: "Cancel"
70
+ })
71
+ ]
72
+ })
73
+ ]
69
74
  }),
70
75
  /*#__PURE__*/ _jsxs(Box, {
71
76
  sx: {
72
77
  display: 'flex',
73
78
  width: '100%',
74
79
  alignItems: 'flex-start',
75
- padding: (theme)=>theme.spacing(2)
80
+ padding: (theme)=>theme.spacing(0, 2, 2, 2)
76
81
  },
77
82
  children: [
78
83
  /*#__PURE__*/ _jsx(ErrorBoundary, {
79
84
  FallbackComponent: ErrorAlert,
80
85
  children: /*#__PURE__*/ _jsx(TemplateVariableList, {
81
- initialVariableIsSticky: initialVariableIsSticky
86
+ initialVariableIsSticky: initialVariableIsSticky,
87
+ sx: {
88
+ backgroundColor: ({ palette })=>palette.mode === 'dark' ? palette.background.default : palette.background.paper
89
+ }
82
90
  })
83
91
  }),
84
92
  /*#__PURE__*/ _jsxs(Stack, {
85
- direction: 'row',
93
+ direction: "row",
86
94
  spacing: 1,
95
+ marginLeft: "auto",
87
96
  sx: {
88
- marginLeft: 'auto'
97
+ whiteSpace: 'nowrap'
89
98
  },
90
99
  children: [
91
100
  /*#__PURE__*/ _jsx(Button, {
@@ -98,14 +107,15 @@ export const DashboardToolbar = (props)=>{
98
107
  onClick: openAddPanel,
99
108
  children: "Add Panel"
100
109
  }),
101
- /*#__PURE__*/ _jsx(TimeRangeControls, {})
110
+ /*#__PURE__*/ _jsx(TimeRangeControls, {}),
111
+ /*#__PURE__*/ _jsx(DownloadButton, {})
102
112
  ]
103
113
  })
104
114
  ]
105
115
  })
106
116
  ]
107
117
  }) : /*#__PURE__*/ _jsxs(Stack, {
108
- spacing: 2,
118
+ spacing: 1,
109
119
  padding: 2,
110
120
  children: [
111
121
  /*#__PURE__*/ _jsxs(Box, {
@@ -117,10 +127,8 @@ export const DashboardToolbar = (props)=>{
117
127
  dashboardTitle,
118
128
  /*#__PURE__*/ _jsxs(Stack, {
119
129
  direction: "row",
120
- spacing: 2,
121
- sx: {
122
- marginLeft: 'auto'
123
- },
130
+ spacing: 1,
131
+ marginLeft: "auto",
124
132
  children: [
125
133
  /*#__PURE__*/ _jsx(TimeRangeControls, {}),
126
134
  /*#__PURE__*/ _jsx(DownloadButton, {}),
@@ -142,7 +150,10 @@ export const DashboardToolbar = (props)=>{
142
150
  children: /*#__PURE__*/ _jsx(ErrorBoundary, {
143
151
  FallbackComponent: ErrorAlert,
144
152
  children: /*#__PURE__*/ _jsx(TemplateVariableList, {
145
- initialVariableIsSticky: initialVariableIsSticky
153
+ initialVariableIsSticky: initialVariableIsSticky,
154
+ sx: {
155
+ backgroundColor: ({ palette })=>palette.mode === 'dark' ? palette.background.default : palette.background.paper
156
+ }
146
157
  })
147
158
  })
148
159
  })
@@ -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';\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,MAA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O,OAAO,EAAE,CAAC;;8BAC3B,MAACrC,GAAG;oBAAC+B,EAAE,EAAE;wBAAEO,OAAO,EAAE,MAAM;wBAAEI,KAAK,EAAE,MAAM;qBAAE;;wBACxCf,cAAc;sCACf,MAAC7B,KAAK;4BAACyC,SAAS,EAAC,KAAK;4BAACT,OAAO,EAAE,CAAC;4BAAEC,EAAE,EAAE;gCAAES,UAAU,EAAE,MAAM;6BAAE;;8CAC3D,KAAC7B,iBAAiB,KAAG;8CACrB,KAACC,cAAc,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"}
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, Alert } 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 isReadonly: boolean;\n onEditButtonClick: () => void;\n onCancelButtonClick: () => void;\n}\n\nexport const DashboardToolbar = (props: DashboardToolbarProps) => {\n const {\n dashboardName,\n dashboardTitleComponent,\n initialVariableIsSticky,\n isReadonly,\n onEditButtonClick,\n 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={1}>\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 <Button variant=\"contained\" onClick={onSave} disabled={isReadonly}>\n Save\n </Button>\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: 'flex-start',\n padding: (theme) => theme.spacing(0, 2, 2, 2),\n }}\n >\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <TemplateVariableList\n initialVariableIsSticky={initialVariableIsSticky}\n sx={{\n backgroundColor: ({ palette }) =>\n palette.mode === 'dark' ? palette.background.default : palette.background.paper,\n }}\n />\n </ErrorBoundary>\n <Stack direction=\"row\" spacing={1} marginLeft=\"auto\" sx={{ whiteSpace: 'nowrap' }}>\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 <DownloadButton />\n </Stack>\n </Box>\n </Stack>\n ) : (\n <Stack spacing={1} padding={2}>\n <Box sx={{ display: 'flex', width: '100%' }}>\n {dashboardTitle}\n <Stack direction=\"row\" spacing={1} 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\n initialVariableIsSticky={initialVariableIsSticky}\n sx={{\n backgroundColor: ({ palette }) =>\n palette.mode === 'dark' ? palette.background.default : palette.background.paper,\n }}\n />\n </ErrorBoundary>\n </Box>\n </Stack>\n )}\n </>\n );\n};\n"],"names":["Typography","Stack","Button","Box","useTheme","useMediaQuery","Alert","PencilIcon","AddPanelGroupIcon","AddPanelIcon","ErrorBoundary","ErrorAlert","useDashboardActions","useEditMode","TemplateVariableList","TimeRangeControls","DownloadButton","DashboardToolbar","props","dashboardName","dashboardTitleComponent","initialVariableIsSticky","isReadonly","onEditButtonClick","onCancelButtonClick","isEditMode","setEditMode","openAddPanelGroup","openAddPanel","isLaptopSize","breakpoints","up","dashboardTitle","variant","onSave","spacing","p","display","sx","backgroundColor","theme","palette","primary","main","direction","marginLeft","severity","padding","onClick","disabled","width","alignItems","FallbackComponent","mode","background","default","paper","whiteSpace","start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O,UAAU,EAAE,MAAM;qCAAE;8CAC3B,MAED;kCAAS,AACV;;0BACK;;kBACJ;8BACN,KAAC1C,GAAG;oBAACwD,QAAQ,EAAE,CAAC;8BACd,cAAA,KAACjD,aAAa;wBAAC0C,iBAAiB,EAAEzC,UAAU;kCAC1C,cAAA,KAACG,oBAAoB;4BACnBO,uBAAuB,EAAEA,uBAAuB;4BAChDiB,EAAE,EAAE;gCACFC,eAAe,EAAE,CAAC,EAAEE,OAAO,CAAA,EAAE,GAC3BA,OAAO,CAACY,IAAI,KAAK,MAAM,GAAGZ,OAAO,CAACa,UAAU,CAACC,OAAO,GAAGd,OAAO,CAACa,UAAU,CAACE,KAAK;6BAClF;0BACD;sBACY;kBACZ;;UACA,AACT;MACA,CACH;AACJ,CAAC,CAAC"}
@@ -90,8 +90,8 @@ export function GridContainer(props) {
90
90
  bottom: '3px',
91
91
  width: '5px',
92
92
  height: '5px',
93
- borderRight: '2px solid rgba(0, 0, 0, 0.4)',
94
- borderBottom: '2px solid rgba(0, 0, 0, 0.4)'
93
+ borderRight: `2px solid ${theme.palette.text.secondary}`,
94
+ borderBottom: `2px solid ${theme.palette.text.secondary}`
95
95
  },
96
96
  '& .react-resizable-hide > .react-resizable-handle': {
97
97
  display: 'none'
@@ -1 +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","marginL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e;SAC3B;QACD,8BAA8B,EAAE;YAC9BN,MAAM,EAAE,GAAG;YACXD,KAAK,EAAE,GAAG;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
+ {"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 ${theme.palette.text.secondary}`,\n borderBottom: `2px solid ${theme.palette.text.secondary}`,\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","text","secondary","borderBottom","display","left","cursor","transform","top","marginLeft","backgroundRepeat","backgroundOrigin","boxSizing","backgroundImage","backgroundPosition","padding"],"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,SAAS,EAAEC,QAAQ,QAAQ,OAAO,CAAC;AAC5C,SAASC,MAAM,QAAQ,eAAe,CAAC;AAMvC,OAAO,SAASC,aAAa,CAACC,KAAyB,EAAE;IACvD,MAAM,CAACC,aAAa,EAAEC,gBAAgB,CAAC,GAAGL,QAAQ,CAAC,IAAI,CAAC,AAAC;IACzDD,SAAS,CAAC,IAAM;QACd,IAAIK,aAAa,EAAE;YACjBC,gBAAgB,CAAC,KAAK,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC,EAAE;QAACD,aAAa;KAAC,CAAC,CAAC;IAEpB,qBACE,KAACE,wBAAwB;QACvBC,EAAE,EAAE;YACF,iEAAiE;YACjE,OAAO,EAAE;gBAAEC,SAAS,EAAE,CAACC,KAAK,GAAKA,KAAK,CAACC,OAAO,CAAC,CAAC,CAAC;aAAE;YACnD,0EAA0E;YAC1E,0EAA0E;YAC1E,kCAAkC,EAAE;gBAAEC,kBAAkB,EAAEP,aAAa,GAAG,MAAM,GAAG,WAAW;aAAE;SACjG;kBAEAD,KAAK,CAACS,QAAQ;MACU,CAC3B;AACJ,CAAC;AAED;;CAEC,GACD,MAAMN,wBAAwB,GAAGL,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAEQ,KAAK,CAAA,EAAE,GAAM,CAAA;QACjE,sBAAsB,EAAE;YACtBI,QAAQ,EAAE,UAAU;YACpBC,U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":["../../../src/components/GridLayout/GridLayout.tsx"],"names":[],"mappings":";AAgBA,OAAO,EAAoD,YAAY,EAAE,MAAM,eAAe,CAAC;AAO/F,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,YAAY,CAAC;CAC5B;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,eA+ChD"}
1
+ {"version":3,"file":"GridLayout.d.ts","sourceRoot":"","sources":["../../../src/components/GridLayout/GridLayout.tsx"],"names":[],"mappings":";AAgBA,OAAO,EAAoD,YAAY,EAAE,MAAM,eAAe,CAAC;AAO/F,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,YAAY,CAAC;CAC5B;AAID;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,eA0DhD"}