@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.
- package/dist/cjs/components/DashboardToolbar/DashboardToolbar.js +9 -3
- package/dist/cjs/components/DownloadButton/DownloadButton.js +109 -0
- package/dist/cjs/{utils → components/DownloadButton}/index.js +1 -1
- package/dist/cjs/{css/styles.js → components/GridLayout/GridContainer.js} +66 -39
- package/dist/cjs/components/GridLayout/GridLayout.js +51 -64
- package/dist/cjs/components/GridLayout/GridTitle.js +11 -14
- package/dist/cjs/components/Panel/Panel.js +4 -2
- package/dist/cjs/components/Panel/PanelHeader.js +52 -48
- package/dist/cjs/components/PanelDrawer/PanelDrawer.test.js +23 -0
- package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +15 -54
- package/dist/cjs/components/TimeRangeControls/TimeRangeControls.test.js +27 -11
- package/dist/cjs/components/Variables/Variable.js +16 -4
- package/dist/cjs/components/Variables/VariableEditor.js +21 -1
- package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +63 -7
- package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +3 -3
- package/dist/cjs/components/Variables/VariableList.js +81 -17
- package/dist/cjs/components/index.js +1 -0
- package/dist/cjs/context/DashboardProvider/DashboardProvider.js +2 -1
- package/dist/cjs/context/DashboardProvider/dashboard-provider-api.js +68 -39
- package/dist/cjs/context/DashboardProvider/panel-editor-slice.js +40 -15
- package/dist/cjs/context/DashboardProvider/panel-group-editor-slice.js +5 -9
- package/dist/cjs/context/DashboardProvider/panel-group-slice.js +16 -1
- package/dist/cjs/context/{TimeRangeProvider.js → TimeRangeProvider/TimeRangeProvider.js} +4 -4
- package/dist/cjs/{utils/component-ids.js → context/TimeRangeProvider/index.js} +12 -14
- package/dist/cjs/{utils/time-range-params.js → context/TimeRangeProvider/query-params.js} +11 -5
- package/dist/cjs/index.js +0 -1
- package/dist/cjs/test/testDashboard.js +1 -1
- package/dist/cjs/views/ViewDashboard/DashboardApp.js +2 -1
- package/dist/cjs/views/ViewDashboard/ViewDashboard.js +6 -7
- package/dist/cjs/views/ViewDashboard/tests/panelGroups.test.js +16 -22
- package/dist/components/DashboardToolbar/DashboardToolbar.d.ts +1 -0
- package/dist/components/DashboardToolbar/DashboardToolbar.d.ts.map +1 -1
- package/dist/components/DashboardToolbar/DashboardToolbar.js +9 -3
- package/dist/components/DashboardToolbar/DashboardToolbar.js.map +1 -1
- package/dist/components/DownloadButton/DownloadButton.d.ts +3 -0
- package/dist/components/DownloadButton/DownloadButton.d.ts.map +1 -0
- package/dist/components/DownloadButton/DownloadButton.js +60 -0
- package/dist/components/DownloadButton/DownloadButton.js.map +1 -0
- package/dist/components/DownloadButton/index.d.ts +2 -0
- package/dist/components/DownloadButton/index.d.ts.map +1 -0
- package/dist/{utils → components/DownloadButton}/index.js +1 -1
- package/dist/components/DownloadButton/index.js.map +1 -0
- package/dist/components/GridLayout/GridContainer.d.ts +6 -0
- package/dist/components/GridLayout/GridContainer.d.ts.map +1 -0
- package/dist/{css/styles.js → components/GridLayout/GridContainer.js} +65 -38
- package/dist/components/GridLayout/GridContainer.js.map +1 -0
- package/dist/components/GridLayout/GridLayout.d.ts +1 -2
- package/dist/components/GridLayout/GridLayout.d.ts.map +1 -1
- package/dist/components/GridLayout/GridLayout.js +53 -66
- package/dist/components/GridLayout/GridLayout.js.map +1 -1
- package/dist/components/GridLayout/GridTitle.d.ts.map +1 -1
- package/dist/components/GridLayout/GridTitle.js +12 -15
- package/dist/components/GridLayout/GridTitle.js.map +1 -1
- package/dist/components/Panel/Panel.d.ts.map +1 -1
- package/dist/components/Panel/Panel.js +4 -2
- package/dist/components/Panel/Panel.js.map +1 -1
- package/dist/components/Panel/PanelHeader.d.ts.map +1 -1
- package/dist/components/Panel/PanelHeader.js +52 -48
- package/dist/components/Panel/PanelHeader.js.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.test.js +23 -0
- package/dist/components/PanelDrawer/PanelDrawer.test.js.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.js +19 -58
- package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.test.js +28 -12
- package/dist/components/TimeRangeControls/TimeRangeControls.test.js.map +1 -1
- package/dist/components/Variables/Variable.js +16 -4
- package/dist/components/Variables/Variable.js.map +1 -1
- package/dist/components/Variables/VariableEditor.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditor.js +23 -3
- package/dist/components/Variables/VariableEditor.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +25 -3
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts +1 -1
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +3 -3
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -1
- package/dist/components/Variables/VariableList.d.ts +5 -1
- package/dist/components/Variables/VariableList.d.ts.map +1 -1
- package/dist/components/Variables/VariableList.js +43 -18
- package/dist/components/Variables/VariableList.js.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -0
- package/dist/components/index.js.map +1 -1
- package/dist/context/DashboardProvider/DashboardProvider.js +2 -1
- package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -1
- package/dist/context/DashboardProvider/dashboard-provider-api.d.ts +1 -1
- package/dist/context/DashboardProvider/dashboard-provider-api.d.ts.map +1 -1
- package/dist/context/DashboardProvider/dashboard-provider-api.js +70 -41
- package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -1
- package/dist/context/DashboardProvider/panel-editor-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/panel-editor-slice.js +40 -15
- package/dist/context/DashboardProvider/panel-editor-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-group-editor-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/panel-group-editor-slice.js +5 -9
- package/dist/context/DashboardProvider/panel-group-editor-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-group-slice.d.ts +9 -0
- package/dist/context/DashboardProvider/panel-group-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/panel-group-slice.js +17 -0
- package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -1
- package/dist/context/{TimeRangeProvider.d.ts → TimeRangeProvider/TimeRangeProvider.d.ts} +2 -2
- package/dist/context/TimeRangeProvider/TimeRangeProvider.d.ts.map +1 -0
- package/dist/context/{TimeRangeProvider.js → TimeRangeProvider/TimeRangeProvider.js} +4 -4
- package/dist/context/TimeRangeProvider/TimeRangeProvider.js.map +1 -0
- package/dist/context/TimeRangeProvider/index.d.ts +3 -0
- package/dist/context/TimeRangeProvider/index.d.ts.map +1 -0
- package/dist/{utils/component-ids.js → context/TimeRangeProvider/index.js} +3 -14
- package/dist/context/TimeRangeProvider/index.js.map +1 -0
- package/dist/{utils/time-range-params.d.ts → context/TimeRangeProvider/query-params.d.ts} +3 -3
- package/dist/context/TimeRangeProvider/query-params.d.ts.map +1 -0
- package/dist/{utils/time-range-params.js → context/TimeRangeProvider/query-params.js} +13 -7
- package/dist/context/TimeRangeProvider/query-params.js.map +1 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/test/testDashboard.js +1 -1
- package/dist/test/testDashboard.js.map +1 -1
- package/dist/views/ViewDashboard/DashboardApp.d.ts +1 -0
- package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -1
- package/dist/views/ViewDashboard/DashboardApp.js +2 -1
- package/dist/views/ViewDashboard/DashboardApp.js.map +1 -1
- package/dist/views/ViewDashboard/ViewDashboard.d.ts +1 -0
- package/dist/views/ViewDashboard/ViewDashboard.d.ts.map +1 -1
- package/dist/views/ViewDashboard/ViewDashboard.js +6 -7
- package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -1
- package/dist/views/ViewDashboard/tests/panelGroups.test.js +16 -22
- package/dist/views/ViewDashboard/tests/panelGroups.test.js.map +1 -1
- package/package.json +4 -4
- package/dist/context/TimeRangeProvider.d.ts.map +0 -1
- package/dist/context/TimeRangeProvider.js.map +0 -1
- package/dist/css/styles.d.ts +0 -172
- package/dist/css/styles.d.ts.map +0 -1
- package/dist/css/styles.js.map +0 -1
- package/dist/utils/component-ids.d.ts +0 -8
- package/dist/utils/component-ids.d.ts.map +0 -1
- package/dist/utils/component-ids.js.map +0 -1
- package/dist/utils/index.d.ts +0 -2
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/time-range-params.d.ts.map +0 -1
- package/dist/utils/time-range-params.js.map +0 -1
|
@@ -27,13 +27,14 @@ const _components = require("@perses-dev/components");
|
|
|
27
27
|
const _context = require("../../context");
|
|
28
28
|
const _variables = require("../Variables");
|
|
29
29
|
const _timeRangeControls = require("../TimeRangeControls");
|
|
30
|
+
const _downloadButton = require("../DownloadButton");
|
|
30
31
|
function _interopRequireDefault(obj) {
|
|
31
32
|
return obj && obj.__esModule ? obj : {
|
|
32
33
|
default: obj
|
|
33
34
|
};
|
|
34
35
|
}
|
|
35
36
|
const DashboardToolbar = (props)=>{
|
|
36
|
-
const { dashboardName , dashboardTitleComponent , onEditButtonClick , onCancelButtonClick } = props;
|
|
37
|
+
const { dashboardName , dashboardTitleComponent , initialVariableIsSticky , onEditButtonClick , onCancelButtonClick } = props;
|
|
37
38
|
const { isEditMode , setEditMode } = (0, _context.useEditMode)();
|
|
38
39
|
const { openAddPanelGroup , openAddPanel } = (0, _context.useDashboardActions)();
|
|
39
40
|
const isLaptopSize = (0, _material.useMediaQuery)((0, _material.useTheme)().breakpoints.up('sm'));
|
|
@@ -89,7 +90,9 @@ const DashboardToolbar = (props)=>{
|
|
|
89
90
|
children: [
|
|
90
91
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_components.ErrorBoundary, {
|
|
91
92
|
FallbackComponent: _components.ErrorAlert,
|
|
92
|
-
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_variables.TemplateVariableList, {
|
|
93
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_variables.TemplateVariableList, {
|
|
94
|
+
initialVariableIsSticky: initialVariableIsSticky
|
|
95
|
+
})
|
|
93
96
|
}),
|
|
94
97
|
/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
95
98
|
direction: 'row',
|
|
@@ -133,6 +136,7 @@ const DashboardToolbar = (props)=>{
|
|
|
133
136
|
},
|
|
134
137
|
children: [
|
|
135
138
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_timeRangeControls.TimeRangeControls, {}),
|
|
139
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_downloadButton.DownloadButton, {}),
|
|
136
140
|
isLaptopSize && /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Button, {
|
|
137
141
|
variant: "outlined",
|
|
138
142
|
startIcon: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pencilOutline.default, {}),
|
|
@@ -150,7 +154,9 @@ const DashboardToolbar = (props)=>{
|
|
|
150
154
|
paddingY: 2,
|
|
151
155
|
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components.ErrorBoundary, {
|
|
152
156
|
FallbackComponent: _components.ErrorAlert,
|
|
153
|
-
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_variables.TemplateVariableList, {
|
|
157
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_variables.TemplateVariableList, {
|
|
158
|
+
initialVariableIsSticky: initialVariableIsSticky
|
|
159
|
+
})
|
|
154
160
|
})
|
|
155
161
|
})
|
|
156
162
|
]
|
|
@@ -0,0 +1,109 @@
|
|
|
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
|
+
Object.defineProperty(exports, "DownloadButton", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: ()=>DownloadButton
|
|
20
|
+
});
|
|
21
|
+
const _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
+
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
|
23
|
+
const _downloadOutline = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/DownloadOutline"));
|
|
24
|
+
const _material = require("@mui/material");
|
|
25
|
+
const _context = require("../../context");
|
|
26
|
+
function _interopRequireDefault(obj) {
|
|
27
|
+
return obj && obj.__esModule ? obj : {
|
|
28
|
+
default: obj
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
32
|
+
if (typeof WeakMap !== "function") return null;
|
|
33
|
+
var cacheBabelInterop = new WeakMap();
|
|
34
|
+
var cacheNodeInterop = new WeakMap();
|
|
35
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
36
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
37
|
+
})(nodeInterop);
|
|
38
|
+
}
|
|
39
|
+
function _interopRequireWildcard(obj, nodeInterop) {
|
|
40
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
41
|
+
return obj;
|
|
42
|
+
}
|
|
43
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
44
|
+
return {
|
|
45
|
+
default: obj
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
49
|
+
if (cache && cache.has(obj)) {
|
|
50
|
+
return cache.get(obj);
|
|
51
|
+
}
|
|
52
|
+
var newObj = {};
|
|
53
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
54
|
+
for(var key in obj){
|
|
55
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
56
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
57
|
+
if (desc && (desc.get || desc.set)) {
|
|
58
|
+
Object.defineProperty(newObj, key, desc);
|
|
59
|
+
} else {
|
|
60
|
+
newObj[key] = obj[key];
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
newObj.default = obj;
|
|
65
|
+
if (cache) {
|
|
66
|
+
cache.set(obj, newObj);
|
|
67
|
+
}
|
|
68
|
+
return newObj;
|
|
69
|
+
}
|
|
70
|
+
function DownloadButton() {
|
|
71
|
+
const { dashboard } = (0, _context.useDashboard)();
|
|
72
|
+
const hiddenLinkRef = (0, _react.useRef)(null);
|
|
73
|
+
const onDownloadButtonClick = ()=>{
|
|
74
|
+
if (!hiddenLinkRef || !hiddenLinkRef.current) return;
|
|
75
|
+
// Create blob URL
|
|
76
|
+
const hiddenLinkUrl = URL.createObjectURL(new Blob([
|
|
77
|
+
JSON.stringify(dashboard)
|
|
78
|
+
], {
|
|
79
|
+
type: 'application/json'
|
|
80
|
+
}));
|
|
81
|
+
// Simulate click
|
|
82
|
+
hiddenLinkRef.current.href = hiddenLinkUrl;
|
|
83
|
+
hiddenLinkRef.current.click();
|
|
84
|
+
// Remove blob URL (for memory management)
|
|
85
|
+
URL.revokeObjectURL(hiddenLinkUrl);
|
|
86
|
+
};
|
|
87
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
88
|
+
children: [
|
|
89
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(DownloadIconButton, {
|
|
90
|
+
title: "Download JSON",
|
|
91
|
+
onClick: onDownloadButtonClick,
|
|
92
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_downloadOutline.default, {})
|
|
93
|
+
}),
|
|
94
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)("a", {
|
|
95
|
+
ref: hiddenLinkRef,
|
|
96
|
+
style: {
|
|
97
|
+
display: 'none'
|
|
98
|
+
},
|
|
99
|
+
download: `${dashboard.metadata.name}.json`
|
|
100
|
+
})
|
|
101
|
+
]
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
const DownloadIconButton = (0, _material.styled)(_material.IconButton)(({ theme })=>({
|
|
105
|
+
border: `1px solid ${theme.palette.grey[300]}`,
|
|
106
|
+
borderRadius: theme.shape.borderRadius,
|
|
107
|
+
padding: '4px',
|
|
108
|
+
color: theme.palette.grey[900]
|
|
109
|
+
}));
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
-
_exportStar(require("./
|
|
17
|
+
_exportStar(require("./DownloadButton"), exports);
|
|
18
18
|
function _exportStar(from, to) {
|
|
19
19
|
Object.keys(from).forEach(function(k) {
|
|
20
20
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
|
|
@@ -14,40 +14,68 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
-
Object.defineProperty(exports, "
|
|
17
|
+
Object.defineProperty(exports, "GridContainer", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()=>
|
|
19
|
+
get: ()=>GridContainer
|
|
20
20
|
});
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
const _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
+
const _react = require("react");
|
|
23
|
+
const _material = require("@mui/material");
|
|
24
|
+
function GridContainer(props) {
|
|
25
|
+
const [isFirstRender, setIsFirstRender] = (0, _react.useState)(true);
|
|
26
|
+
(0, _react.useEffect)(()=>{
|
|
27
|
+
if (isFirstRender) {
|
|
28
|
+
setIsFirstRender(false);
|
|
29
|
+
}
|
|
30
|
+
}, [
|
|
31
|
+
isFirstRender
|
|
32
|
+
]);
|
|
33
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(ReactGridLayoutContainer, {
|
|
34
|
+
sx: {
|
|
35
|
+
// This adds spcing between grids (rows) in the overall dashboard
|
|
36
|
+
'& + &': {
|
|
37
|
+
marginTop: (theme)=>theme.spacing(1)
|
|
38
|
+
},
|
|
39
|
+
// This disables the animation of grid items when a grid is first rendered
|
|
40
|
+
// (see https://github.com/react-grid-layout/react-grid-layout/issues/103)
|
|
41
|
+
'& .react-grid-item.cssTransforms': {
|
|
42
|
+
transitionProperty: isFirstRender ? 'none' : 'transform'
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
children: props.children
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* These are the classes needed by react-grid-layout from their CSS stylesheet.
|
|
50
|
+
*/ const ReactGridLayoutContainer = (0, _material.styled)('section')(({ theme })=>({
|
|
51
|
+
'& .react-grid-layout': {
|
|
24
52
|
position: 'relative',
|
|
25
53
|
transition: 'height 200ms ease'
|
|
26
54
|
},
|
|
27
|
-
'
|
|
55
|
+
'& .react-grid-item': {
|
|
28
56
|
transition: 'all 200ms ease',
|
|
29
57
|
transitionProperty: 'left, top'
|
|
30
58
|
},
|
|
31
|
-
'
|
|
59
|
+
'& .react-grid-item img': {
|
|
32
60
|
pointerEvents: 'none',
|
|
33
61
|
userSelect: 'none'
|
|
34
62
|
},
|
|
35
|
-
'
|
|
63
|
+
'& .react-grid-item.cssTransforms': {
|
|
36
64
|
transitionProperty: 'transform'
|
|
37
65
|
},
|
|
38
|
-
'
|
|
66
|
+
'& .react-grid-item.resizing': {
|
|
39
67
|
zIndex: 1,
|
|
40
68
|
willChange: 'width, height'
|
|
41
69
|
},
|
|
42
|
-
'
|
|
70
|
+
'& .react-grid-item.react-draggable-dragging': {
|
|
43
71
|
transition: 'none',
|
|
44
72
|
zIndex: 3,
|
|
45
73
|
willChange: 'transform'
|
|
46
74
|
},
|
|
47
|
-
'
|
|
75
|
+
'& .react-grid-item.dropping': {
|
|
48
76
|
visibility: 'hidden'
|
|
49
77
|
},
|
|
50
|
-
'
|
|
78
|
+
'& .react-grid-item.react-grid-placeholder': {
|
|
51
79
|
background: theme.palette.primary.main,
|
|
52
80
|
opacity: 0.2,
|
|
53
81
|
transitionDuration: '100ms',
|
|
@@ -58,12 +86,12 @@ const styles = (theme)=>{
|
|
|
58
86
|
msUserSelect: 'none',
|
|
59
87
|
OUserSelect: 'none'
|
|
60
88
|
},
|
|
61
|
-
'
|
|
89
|
+
'& .react-grid-item > .react-resizable-handle': {
|
|
62
90
|
position: 'absolute',
|
|
63
91
|
width: '20px',
|
|
64
92
|
height: '20px'
|
|
65
93
|
},
|
|
66
|
-
'
|
|
94
|
+
'& .react-grid-item > .react-resizable-handle::after': {
|
|
67
95
|
content: '""',
|
|
68
96
|
position: 'absolute',
|
|
69
97
|
right: '3px',
|
|
@@ -73,62 +101,62 @@ const styles = (theme)=>{
|
|
|
73
101
|
borderRight: '2px solid rgba(0, 0, 0, 0.4)',
|
|
74
102
|
borderBottom: '2px solid rgba(0, 0, 0, 0.4)'
|
|
75
103
|
},
|
|
76
|
-
'
|
|
104
|
+
'& .react-resizable-hide > .react-resizable-handle': {
|
|
77
105
|
display: 'none'
|
|
78
106
|
},
|
|
79
|
-
'
|
|
107
|
+
'& .react-grid-item > .react-resizable-handle.react-resizable-handle-sw': {
|
|
80
108
|
bottom: '0',
|
|
81
109
|
left: '0',
|
|
82
110
|
cursor: 'sw-resize',
|
|
83
111
|
transform: 'rotate(90deg)'
|
|
84
112
|
},
|
|
85
|
-
'
|
|
113
|
+
'& .react-grid-item > .react-resizable-handle.react-resizable-handle-se': {
|
|
86
114
|
bottom: '0',
|
|
87
115
|
right: '0',
|
|
88
116
|
cursor: 'se-resize'
|
|
89
117
|
},
|
|
90
|
-
'
|
|
118
|
+
'& .react-grid-item > .react-resizable-handle.react-resizable-handle-nw': {
|
|
91
119
|
top: '0',
|
|
92
120
|
left: '0',
|
|
93
121
|
cursor: 'nw-resize',
|
|
94
122
|
transform: 'rotate(180deg)'
|
|
95
123
|
},
|
|
96
|
-
'
|
|
124
|
+
'& .react-grid-item > .react-resizable-handle.react-resizable-handle-ne': {
|
|
97
125
|
top: '0',
|
|
98
126
|
right: '0',
|
|
99
127
|
cursor: 'ne-resize',
|
|
100
128
|
transform: 'rotate(270deg)'
|
|
101
129
|
},
|
|
102
|
-
'
|
|
130
|
+
'& .react-grid-item > .react-resizable-handle.react-resizable-handle-w, &.react-grid-item > .react-resizable-handle.react-resizable-handle-e': {
|
|
103
131
|
top: '50%',
|
|
104
132
|
marginTop: '-10px',
|
|
105
133
|
cursor: 'ew-resize'
|
|
106
134
|
},
|
|
107
|
-
'
|
|
135
|
+
'& .react-grid-item > .react-resizable-handle.react-resizable-handle-w': {
|
|
108
136
|
left: '0',
|
|
109
137
|
transform: 'rotate(135deg)'
|
|
110
138
|
},
|
|
111
|
-
'
|
|
139
|
+
'& .react-grid-item > .react-resizable-handle.react-resizable-handle-e': {
|
|
112
140
|
right: '0',
|
|
113
141
|
transform: 'rotate(315deg)'
|
|
114
142
|
},
|
|
115
|
-
'
|
|
143
|
+
'& .react-grid-item > .react-resizable-handle.react-resizable-handle-n, &.react-grid-item > .react-resizable-handle.react-resizable-handle-s': {
|
|
116
144
|
left: '50%',
|
|
117
145
|
marginLeft: '-10px',
|
|
118
146
|
cursor: 'ns-resize'
|
|
119
147
|
},
|
|
120
|
-
'
|
|
148
|
+
'& .react-grid-item > .react-resizable-handle.react-resizable-handle-n': {
|
|
121
149
|
top: '0',
|
|
122
150
|
transform: 'rotate(225deg)'
|
|
123
151
|
},
|
|
124
|
-
'
|
|
152
|
+
'& .react-grid-item > .react-resizable-handle.react-resizable-handle-s': {
|
|
125
153
|
bottom: '0',
|
|
126
154
|
transform: 'rotate(45deg)'
|
|
127
155
|
},
|
|
128
|
-
'
|
|
156
|
+
'& .react-resizable': {
|
|
129
157
|
position: 'relative'
|
|
130
158
|
},
|
|
131
|
-
'
|
|
159
|
+
'& .react-resizable-handle': {
|
|
132
160
|
position: 'absolute',
|
|
133
161
|
width: '20px',
|
|
134
162
|
height: '20px',
|
|
@@ -139,54 +167,53 @@ const styles = (theme)=>{
|
|
|
139
167
|
backgroundPosition: 'bottom right',
|
|
140
168
|
padding: '0 3px 3px 0'
|
|
141
169
|
},
|
|
142
|
-
'
|
|
170
|
+
'& .react-resizable-handle-sw': {
|
|
143
171
|
bottom: '0',
|
|
144
172
|
left: '0',
|
|
145
173
|
cursor: 'sw-resize',
|
|
146
174
|
transform: 'rotate(90deg)'
|
|
147
175
|
},
|
|
148
|
-
'
|
|
176
|
+
'& .react-resizable-handle-se': {
|
|
149
177
|
bottom: '0',
|
|
150
178
|
right: '0',
|
|
151
179
|
cursor: 'se-resize'
|
|
152
180
|
},
|
|
153
|
-
'
|
|
181
|
+
'& .react-resizable-handle-nw': {
|
|
154
182
|
top: '0',
|
|
155
183
|
left: '0',
|
|
156
184
|
cursor: 'nw-resize',
|
|
157
185
|
transform: 'rotate(180deg)'
|
|
158
186
|
},
|
|
159
|
-
'
|
|
187
|
+
'& .react-resizable-handle-ne': {
|
|
160
188
|
top: '0',
|
|
161
189
|
right: '0',
|
|
162
190
|
cursor: 'ne-resize',
|
|
163
191
|
transform: 'rotate(270deg)'
|
|
164
192
|
},
|
|
165
|
-
'
|
|
193
|
+
'& .react-resizable-handle-w, .react-resizable-handle-e': {
|
|
166
194
|
top: '50%',
|
|
167
195
|
marginTop: '-10px',
|
|
168
196
|
cursor: 'ew-resize'
|
|
169
197
|
},
|
|
170
|
-
'
|
|
198
|
+
'& .react-resizable-handle-w': {
|
|
171
199
|
left: '0',
|
|
172
200
|
transform: 'rotate(135deg)'
|
|
173
201
|
},
|
|
174
|
-
'
|
|
202
|
+
'& .react-resizable-handle-e': {
|
|
175
203
|
right: '0',
|
|
176
204
|
transform: 'rotate(315deg)'
|
|
177
205
|
},
|
|
178
|
-
'
|
|
206
|
+
'& .react-resizable-handle-n, .react-resizable-handle-s': {
|
|
179
207
|
left: '50%',
|
|
180
208
|
marginLeft: '-10px',
|
|
181
209
|
cursor: 'ns-resize'
|
|
182
210
|
},
|
|
183
|
-
'
|
|
211
|
+
'& .react-resizable-handle-n': {
|
|
184
212
|
top: '0',
|
|
185
213
|
transform: 'rotate(225deg)'
|
|
186
214
|
},
|
|
187
|
-
'
|
|
215
|
+
'& .react-resizable-handle-s': {
|
|
188
216
|
bottom: '0',
|
|
189
217
|
transform: 'rotate(45deg)'
|
|
190
218
|
}
|
|
191
|
-
};
|
|
192
|
-
};
|
|
219
|
+
}));
|
|
@@ -23,83 +23,70 @@ const _react = require("react");
|
|
|
23
23
|
const _reactGridLayout = require("react-grid-layout");
|
|
24
24
|
const _material = require("@mui/material");
|
|
25
25
|
const _components = require("@perses-dev/components");
|
|
26
|
-
const _styles = require("../../css/styles");
|
|
27
26
|
const _context = require("../../context");
|
|
28
27
|
const _gridTitle = require("./GridTitle");
|
|
29
28
|
const _gridItemContent = require("./GridItemContent");
|
|
29
|
+
const _gridContainer = require("./GridContainer");
|
|
30
30
|
const ResponsiveGridLayout = (0, _reactGridLayout.WidthProvider)(_reactGridLayout.Responsive);
|
|
31
31
|
function GridLayout(props) {
|
|
32
|
-
const { panelGroupId
|
|
32
|
+
const { panelGroupId /*...others */ } = props;
|
|
33
33
|
const theme = (0, _material.useTheme)();
|
|
34
34
|
const groupDefinition = (0, _context.usePanelGroup)(panelGroupId);
|
|
35
35
|
const { updatePanelGroupLayouts } = (0, _context.usePanelGroupActions)(panelGroupId);
|
|
36
36
|
var ref;
|
|
37
37
|
const [isOpen, setIsOpen] = (0, _react.useState)((ref = !groupDefinition.isCollapsed) !== null && ref !== void 0 ? ref : true);
|
|
38
38
|
const { isEditMode } = (0, _context.useEditMode)();
|
|
39
|
-
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(
|
|
39
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_gridContainer.GridContainer, {
|
|
40
40
|
children: [
|
|
41
|
-
/*#__PURE__*/ (0, _jsxRuntime.jsx)(
|
|
42
|
-
|
|
41
|
+
groupDefinition.title !== undefined && /*#__PURE__*/ (0, _jsxRuntime.jsx)(_gridTitle.GridTitle, {
|
|
42
|
+
panelGroupId: panelGroupId,
|
|
43
|
+
title: groupDefinition.title,
|
|
44
|
+
collapse: groupDefinition.isCollapsed === undefined ? undefined : {
|
|
45
|
+
isOpen,
|
|
46
|
+
onToggleOpen: ()=>setIsOpen((current)=>!current)
|
|
47
|
+
}
|
|
43
48
|
}),
|
|
44
|
-
/*#__PURE__*/ (0, _jsxRuntime.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
layouts: {
|
|
86
|
-
sm: groupDefinition.itemLayouts
|
|
87
|
-
},
|
|
88
|
-
onLayoutChange: updatePanelGroupLayouts,
|
|
89
|
-
children: groupDefinition.itemLayouts.map(({ i })=>/*#__PURE__*/ (0, _jsxRuntime.jsx)("div", {
|
|
90
|
-
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components.ErrorBoundary, {
|
|
91
|
-
FallbackComponent: _components.ErrorAlert,
|
|
92
|
-
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_gridItemContent.GridItemContent, {
|
|
93
|
-
panelGroupItemId: {
|
|
94
|
-
panelGroupId,
|
|
95
|
-
panelGroupItemLayoutId: i
|
|
96
|
-
}
|
|
97
|
-
})
|
|
98
|
-
})
|
|
99
|
-
}, i))
|
|
100
|
-
})
|
|
101
|
-
})
|
|
102
|
-
]
|
|
49
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Collapse, {
|
|
50
|
+
in: isOpen,
|
|
51
|
+
unmountOnExit: true,
|
|
52
|
+
appear: false,
|
|
53
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(ResponsiveGridLayout, {
|
|
54
|
+
className: "layout",
|
|
55
|
+
breakpoints: {
|
|
56
|
+
sm: theme.breakpoints.values.sm,
|
|
57
|
+
xxs: 0
|
|
58
|
+
},
|
|
59
|
+
cols: {
|
|
60
|
+
sm: 24,
|
|
61
|
+
xxs: 2
|
|
62
|
+
},
|
|
63
|
+
rowHeight: 30,
|
|
64
|
+
draggableHandle: '.drag-handle',
|
|
65
|
+
resizeHandles: [
|
|
66
|
+
'se'
|
|
67
|
+
],
|
|
68
|
+
isDraggable: isEditMode,
|
|
69
|
+
isResizable: isEditMode,
|
|
70
|
+
containerPadding: [
|
|
71
|
+
0,
|
|
72
|
+
10
|
|
73
|
+
],
|
|
74
|
+
layouts: {
|
|
75
|
+
sm: groupDefinition.itemLayouts
|
|
76
|
+
},
|
|
77
|
+
onLayoutChange: updatePanelGroupLayouts,
|
|
78
|
+
children: groupDefinition.itemLayouts.map(({ i })=>/*#__PURE__*/ (0, _jsxRuntime.jsx)("div", {
|
|
79
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components.ErrorBoundary, {
|
|
80
|
+
FallbackComponent: _components.ErrorAlert,
|
|
81
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_gridItemContent.GridItemContent, {
|
|
82
|
+
panelGroupItemId: {
|
|
83
|
+
panelGroupId,
|
|
84
|
+
panelGroupItemLayoutId: i
|
|
85
|
+
}
|
|
86
|
+
})
|
|
87
|
+
})
|
|
88
|
+
}, i))
|
|
89
|
+
})
|
|
103
90
|
})
|
|
104
91
|
]
|
|
105
92
|
});
|
|
@@ -19,11 +19,10 @@ Object.defineProperty(exports, "GridTitle", {
|
|
|
19
19
|
get: ()=>GridTitle
|
|
20
20
|
});
|
|
21
21
|
const _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
-
const _react = require("react");
|
|
23
22
|
const _material = require("@mui/material");
|
|
24
23
|
const _chevronUp = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/ChevronUp"));
|
|
25
24
|
const _chevronDown = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/ChevronDown"));
|
|
26
|
-
const
|
|
25
|
+
const _chartBoxPlusOutline = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/ChartBoxPlusOutline"));
|
|
27
26
|
const _pencilOutline = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/PencilOutline"));
|
|
28
27
|
const _arrowUp = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/ArrowUp"));
|
|
29
28
|
const _arrowDown = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/ArrowDown"));
|
|
@@ -36,8 +35,8 @@ function _interopRequireDefault(obj) {
|
|
|
36
35
|
}
|
|
37
36
|
function GridTitle(props) {
|
|
38
37
|
const { panelGroupId , title , collapse } = props;
|
|
39
|
-
const
|
|
40
|
-
const {
|
|
38
|
+
const { openAddPanel , openEditPanelGroup , moveUp , moveDown } = (0, _context.usePanelGroupActions)(panelGroupId);
|
|
39
|
+
const { openDeletePanelGroupDialog } = (0, _context.useDeletePanelGroupDialog)();
|
|
41
40
|
const { isEditMode } = (0, _context.useEditMode)();
|
|
42
41
|
const text = /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Typography, {
|
|
43
42
|
variant: "h2",
|
|
@@ -54,8 +53,6 @@ function GridTitle(props) {
|
|
|
54
53
|
padding: (theme)=>theme.spacing(1),
|
|
55
54
|
backgroundColor: (theme)=>theme.palette.background.default
|
|
56
55
|
},
|
|
57
|
-
onMouseEnter: ()=>setIsHovered(true),
|
|
58
|
-
onMouseLeave: ()=>setIsHovered(false),
|
|
59
56
|
children: collapse ? /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
60
57
|
children: [
|
|
61
58
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
@@ -63,35 +60,35 @@ function GridTitle(props) {
|
|
|
63
60
|
children: collapse.isOpen ? /*#__PURE__*/ (0, _jsxRuntime.jsx)(_chevronUp.default, {}) : /*#__PURE__*/ (0, _jsxRuntime.jsx)(_chevronDown.default, {})
|
|
64
61
|
}),
|
|
65
62
|
text,
|
|
66
|
-
isEditMode &&
|
|
63
|
+
isEditMode && /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
67
64
|
direction: "row",
|
|
68
65
|
sx: {
|
|
69
66
|
marginLeft: 'auto'
|
|
70
67
|
},
|
|
71
68
|
children: [
|
|
72
69
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
73
|
-
"aria-label":
|
|
70
|
+
"aria-label": `add panel to group ${title}`,
|
|
74
71
|
onClick: openAddPanel,
|
|
75
|
-
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(
|
|
72
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_chartBoxPlusOutline.default, {})
|
|
76
73
|
}),
|
|
77
74
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
78
|
-
"aria-label":
|
|
75
|
+
"aria-label": `edit group ${title}`,
|
|
79
76
|
onClick: openEditPanelGroup,
|
|
80
77
|
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pencilOutline.default, {})
|
|
81
78
|
}),
|
|
82
79
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
83
|
-
"aria-label":
|
|
84
|
-
onClick:
|
|
80
|
+
"aria-label": `delete group ${title}`,
|
|
81
|
+
onClick: ()=>openDeletePanelGroupDialog(panelGroupId),
|
|
85
82
|
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_deleteOutline.default, {})
|
|
86
83
|
}),
|
|
87
84
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
88
|
-
"aria-label":
|
|
85
|
+
"aria-label": `move group ${title} down`,
|
|
89
86
|
disabled: moveDown === undefined,
|
|
90
87
|
onClick: moveDown,
|
|
91
88
|
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_arrowDown.default, {})
|
|
92
89
|
}),
|
|
93
90
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
94
|
-
"aria-label":
|
|
91
|
+
"aria-label": `move group ${title} up`,
|
|
95
92
|
disabled: moveUp === undefined,
|
|
96
93
|
onClick: moveUp,
|
|
97
94
|
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_arrowUp.default, {})
|
|
@@ -24,7 +24,6 @@ const _useResizeObserver = /*#__PURE__*/ _interopRequireDefault(require("use-res
|
|
|
24
24
|
const _reactIntersectionObserver = require("react-intersection-observer");
|
|
25
25
|
const _components = require("@perses-dev/components");
|
|
26
26
|
const _material = require("@mui/material");
|
|
27
|
-
const _componentIds = require("../../utils/component-ids");
|
|
28
27
|
const _panelHeader = require("./PanelHeader");
|
|
29
28
|
const _panelContent = require("./PanelContent");
|
|
30
29
|
function _interopRequireDefault(obj) {
|
|
@@ -35,7 +34,7 @@ function _interopRequireDefault(obj) {
|
|
|
35
34
|
function Panel(props) {
|
|
36
35
|
const { definition , editHandlers , onMouseEnter , onMouseLeave , sx , ...others } = props;
|
|
37
36
|
// Make sure we have an ID we can use for aria attributes
|
|
38
|
-
const generatedPanelId = (0,
|
|
37
|
+
const generatedPanelId = (0, _components.useId)('Panel');
|
|
39
38
|
const headerId = `${generatedPanelId}-header`;
|
|
40
39
|
const [contentElement, setContentElement] = (0, _react.useState)(null);
|
|
41
40
|
const [isHovered, setIsHovered] = (0, _react.useState)(false);
|
|
@@ -109,6 +108,9 @@ function Panel(props) {
|
|
|
109
108
|
ref: setContentElement,
|
|
110
109
|
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components.ErrorBoundary, {
|
|
111
110
|
FallbackComponent: _components.ErrorAlert,
|
|
111
|
+
resetKeys: [
|
|
112
|
+
definition.spec.plugin.spec
|
|
113
|
+
],
|
|
112
114
|
children: inView === true && /*#__PURE__*/ (0, _jsxRuntime.jsx)(_panelContent.PanelContent, {
|
|
113
115
|
panelPluginKind: definition.spec.plugin.kind,
|
|
114
116
|
spec: definition.spec.plugin.spec,
|