@perses-dev/dashboards 0.10.0 → 0.12.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/Dashboard.js +4 -5
- package/dist/cjs/components/DashboardToolbar.js +18 -5
- package/dist/cjs/components/GridLayout/GridItemContent.js +3 -11
- package/dist/cjs/components/GridLayout/GridLayout.js +20 -20
- package/dist/cjs/components/GridLayout/GridTitle.js +9 -11
- package/dist/cjs/components/Panel/DeletePanelDialog.js +12 -10
- package/dist/cjs/components/Panel/Panel.js +12 -22
- package/dist/cjs/components/Panel/Panel.test.js +5 -3
- package/dist/cjs/components/Panel/index.js +1 -0
- package/dist/cjs/components/PanelDrawer/PanelDrawer.js +1 -1
- package/dist/cjs/components/PanelDrawer/PanelDrawer.test.js +13 -5
- package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +21 -15
- package/dist/cjs/components/PanelDrawer/PanelPreview.js +9 -3
- package/dist/cjs/components/PanelGroupDialog/DeletePanelGroupDialog.js +13 -11
- package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.js +70 -111
- package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.test.js +22 -16
- package/dist/cjs/components/PanelGroupDialog/PanelGroupEditorForm.js +92 -0
- package/dist/cjs/components/PanelGroupDialog/index.js +29 -0
- package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +8 -11
- package/dist/cjs/components/TimeRangeControls/TimeRangeControls.test.js +20 -13
- package/dist/cjs/components/Variables/Variable.js +1 -0
- package/dist/cjs/components/Variables/VariableEditor.js +40 -6
- package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +9 -5
- package/dist/cjs/components/Variables/VariableList.js +0 -1
- package/dist/cjs/components/index.js +1 -0
- package/dist/cjs/context/DashboardProvider/DashboardProvider.js +26 -8
- package/dist/cjs/context/DashboardProvider/common.js +10 -0
- package/dist/cjs/context/DashboardProvider/dashboard-provider-api.js +122 -29
- package/dist/cjs/context/DashboardProvider/delete-panel-group-slice.js +70 -0
- package/dist/cjs/context/DashboardProvider/delete-panel-slice.js +85 -0
- package/dist/cjs/context/DashboardProvider/panel-editor-slice.js +182 -0
- package/dist/cjs/context/DashboardProvider/panel-group-editor-slice.js +89 -0
- package/dist/cjs/context/DashboardProvider/panel-group-slice.js +83 -18
- package/dist/cjs/context/DashboardProvider/panel-slice.js +36 -0
- package/dist/cjs/context/TimeRangeProvider.js +20 -44
- package/dist/cjs/context/index.js +1 -1
- package/dist/cjs/context/useDashboardSpec.js +90 -0
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/test/render.js +25 -5
- package/dist/cjs/test/setup-tests.js +4 -1
- package/dist/cjs/test/testDashboard.js +11 -10
- package/dist/cjs/utils/index.js +28 -0
- package/dist/cjs/utils/time-range-params.js +151 -0
- package/dist/cjs/views/ViewDashboard/DashboardApp.js +2 -5
- package/dist/cjs/views/ViewDashboard/ViewDashboard.js +5 -22
- package/dist/cjs/views/ViewDashboard/tests/panelGroups.test.js +42 -93
- package/dist/components/Dashboard.js +5 -6
- package/dist/components/Dashboard.js.map +1 -1
- package/dist/components/DashboardToolbar.d.ts.map +1 -1
- package/dist/components/DashboardToolbar.js +20 -7
- package/dist/components/DashboardToolbar.js.map +1 -1
- package/dist/components/GridLayout/GridItemContent.d.ts +2 -4
- package/dist/components/GridLayout/GridItemContent.d.ts.map +1 -1
- package/dist/components/GridLayout/GridItemContent.js +4 -12
- package/dist/components/GridLayout/GridItemContent.js.map +1 -1
- package/dist/components/GridLayout/GridLayout.d.ts +2 -3
- package/dist/components/GridLayout/GridLayout.d.ts.map +1 -1
- package/dist/components/GridLayout/GridLayout.js +22 -22
- package/dist/components/GridLayout/GridLayout.js.map +1 -1
- package/dist/components/GridLayout/GridTitle.d.ts +2 -1
- package/dist/components/GridLayout/GridTitle.d.ts.map +1 -1
- package/dist/components/GridLayout/GridTitle.js +10 -12
- package/dist/components/GridLayout/GridTitle.js.map +1 -1
- package/dist/components/Panel/DeletePanelDialog.d.ts +0 -1
- package/dist/components/Panel/DeletePanelDialog.d.ts.map +1 -1
- package/dist/components/Panel/DeletePanelDialog.js +13 -11
- package/dist/components/Panel/DeletePanelDialog.js.map +1 -1
- package/dist/components/Panel/Panel.d.ts +2 -2
- package/dist/components/Panel/Panel.d.ts.map +1 -1
- package/dist/components/Panel/Panel.js +12 -22
- package/dist/components/Panel/Panel.js.map +1 -1
- package/dist/components/Panel/Panel.test.d.ts +1 -1
- package/dist/components/Panel/Panel.test.d.ts.map +1 -1
- package/dist/components/Panel/Panel.test.js +5 -3
- package/dist/components/Panel/Panel.test.js.map +1 -1
- package/dist/components/Panel/index.d.ts +1 -0
- package/dist/components/Panel/index.d.ts.map +1 -1
- package/dist/components/Panel/index.js +1 -0
- package/dist/components/Panel/index.js.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.js +2 -2
- package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.test.js +13 -5
- package/dist/components/PanelDrawer/PanelDrawer.test.js.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.d.ts +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.js +22 -16
- package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -1
- package/dist/components/PanelDrawer/PanelPreview.d.ts +2 -2
- package/dist/components/PanelDrawer/PanelPreview.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelPreview.js +9 -3
- package/dist/components/PanelDrawer/PanelPreview.js.map +1 -1
- package/dist/components/PanelGroupDialog/DeletePanelGroupDialog.d.ts +1 -2
- package/dist/components/PanelGroupDialog/DeletePanelGroupDialog.d.ts.map +1 -1
- package/dist/components/PanelGroupDialog/DeletePanelGroupDialog.js +13 -11
- package/dist/components/PanelGroupDialog/DeletePanelGroupDialog.js.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts +4 -2
- package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.js +73 -112
- package/dist/components/PanelGroupDialog/PanelGroupDialog.js.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.test.js +21 -15
- package/dist/components/PanelGroupDialog/PanelGroupDialog.test.js.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.d.ts +12 -0
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.d.ts.map +1 -0
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.js +82 -0
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.js.map +1 -0
- package/dist/components/PanelGroupDialog/index.d.ts +3 -0
- package/dist/components/PanelGroupDialog/index.d.ts.map +1 -0
- package/dist/components/PanelGroupDialog/index.js +16 -0
- package/dist/components/PanelGroupDialog/index.js.map +1 -0
- package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.js +11 -14
- package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.test.js +21 -14
- package/dist/components/TimeRangeControls/TimeRangeControls.test.js.map +1 -1
- package/dist/components/Variables/Variable.js +1 -0
- 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 +40 -6
- 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 +9 -5
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
- package/dist/components/Variables/VariableList.js +0 -1
- 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.d.ts +10 -5
- package/dist/context/DashboardProvider/DashboardProvider.d.ts.map +1 -1
- package/dist/context/DashboardProvider/DashboardProvider.js +26 -8
- package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -1
- package/dist/context/DashboardProvider/common.d.ts +7 -0
- package/dist/context/DashboardProvider/common.d.ts.map +1 -1
- package/dist/context/DashboardProvider/common.js +8 -1
- package/dist/context/DashboardProvider/common.js.map +1 -1
- package/dist/context/DashboardProvider/dashboard-provider-api.d.ts +65 -22
- package/dist/context/DashboardProvider/dashboard-provider-api.d.ts.map +1 -1
- package/dist/context/DashboardProvider/dashboard-provider-api.js +133 -26
- package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -1
- package/dist/context/DashboardProvider/delete-panel-group-slice.d.ts +23 -0
- package/dist/context/DashboardProvider/delete-panel-group-slice.d.ts.map +1 -0
- package/dist/context/DashboardProvider/delete-panel-group-slice.js +64 -0
- package/dist/context/DashboardProvider/delete-panel-group-slice.js.map +1 -0
- package/dist/context/DashboardProvider/delete-panel-slice.d.ts +36 -0
- package/dist/context/DashboardProvider/delete-panel-slice.d.ts.map +1 -0
- package/dist/context/DashboardProvider/delete-panel-slice.js +81 -0
- package/dist/context/DashboardProvider/delete-panel-slice.js.map +1 -0
- package/dist/context/DashboardProvider/index.d.ts +3 -0
- package/dist/context/DashboardProvider/index.d.ts.map +1 -1
- package/dist/context/DashboardProvider/index.js.map +1 -1
- package/dist/context/DashboardProvider/panel-editor-slice.d.ts +56 -0
- package/dist/context/DashboardProvider/panel-editor-slice.d.ts.map +1 -0
- package/dist/context/DashboardProvider/panel-editor-slice.js +178 -0
- package/dist/context/DashboardProvider/panel-editor-slice.js.map +1 -0
- package/dist/context/DashboardProvider/panel-group-editor-slice.d.ts +33 -0
- package/dist/context/DashboardProvider/panel-group-editor-slice.d.ts.map +1 -0
- package/dist/context/DashboardProvider/panel-group-editor-slice.js +83 -0
- package/dist/context/DashboardProvider/panel-group-editor-slice.js.map +1 -0
- package/dist/context/DashboardProvider/panel-group-slice.d.ts +60 -11
- package/dist/context/DashboardProvider/panel-group-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/panel-group-slice.js +85 -18
- package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-slice.d.ts +23 -0
- package/dist/context/DashboardProvider/panel-slice.d.ts.map +1 -0
- package/dist/context/DashboardProvider/panel-slice.js +32 -0
- package/dist/context/DashboardProvider/panel-slice.js.map +1 -0
- package/dist/context/TimeRangeProvider.d.ts +9 -2
- package/dist/context/TimeRangeProvider.d.ts.map +1 -1
- package/dist/context/TimeRangeProvider.js +15 -43
- package/dist/context/TimeRangeProvider.js.map +1 -1
- package/dist/context/index.d.ts +1 -1
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +1 -1
- package/dist/context/index.js.map +1 -1
- package/dist/context/useDashboardSpec.d.ts +11 -0
- package/dist/context/useDashboardSpec.d.ts.map +1 -0
- package/dist/context/useDashboardSpec.js +84 -0
- package/dist/context/useDashboardSpec.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/test/render.d.ts +2 -1
- package/dist/test/render.d.ts.map +1 -1
- package/dist/test/render.js +25 -5
- package/dist/test/render.js.map +1 -1
- package/dist/test/setup-tests.d.ts.map +1 -1
- package/dist/test/setup-tests.js +4 -0
- package/dist/test/setup-tests.js.map +1 -1
- package/dist/test/testDashboard.d.ts.map +1 -1
- package/dist/test/testDashboard.js +11 -10
- package/dist/test/testDashboard.js.map +1 -1
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +15 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/time-range-params.d.ts +25 -0
- package/dist/utils/time-range-params.d.ts.map +1 -0
- package/dist/utils/time-range-params.js +143 -0
- package/dist/utils/time-range-params.js.map +1 -0
- package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -1
- package/dist/views/ViewDashboard/DashboardApp.js +1 -4
- package/dist/views/ViewDashboard/DashboardApp.js.map +1 -1
- package/dist/views/ViewDashboard/ViewDashboard.d.ts.map +1 -1
- package/dist/views/ViewDashboard/ViewDashboard.js +5 -22
- package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -1
- package/dist/views/ViewDashboard/tests/panelGroups.test.js +45 -96
- package/dist/views/ViewDashboard/tests/panelGroups.test.js.map +1 -1
- package/package.json +5 -4
- package/dist/cjs/context/DashboardProvider/layout-slice.js +0 -200
- package/dist/cjs/context/DashboardProvider/panel-editing-slice.js +0 -156
- package/dist/cjs/context/QueryStringProvider.js +0 -89
- package/dist/context/DashboardProvider/layout-slice.d.ts +0 -57
- package/dist/context/DashboardProvider/layout-slice.d.ts.map +0 -1
- package/dist/context/DashboardProvider/layout-slice.js +0 -196
- package/dist/context/DashboardProvider/layout-slice.js.map +0 -1
- package/dist/context/DashboardProvider/panel-editing-slice.d.ts +0 -70
- package/dist/context/DashboardProvider/panel-editing-slice.d.ts.map +0 -1
- package/dist/context/DashboardProvider/panel-editing-slice.js +0 -152
- package/dist/context/DashboardProvider/panel-editing-slice.js.map +0 -1
- package/dist/context/QueryStringProvider.d.ts +0 -13
- package/dist/context/QueryStringProvider.d.ts.map +0 -1
- package/dist/context/QueryStringProvider.js +0 -40
- package/dist/context/QueryStringProvider.js.map +0 -1
|
@@ -24,15 +24,14 @@ const _components = require("@perses-dev/components");
|
|
|
24
24
|
const _context = require("../context");
|
|
25
25
|
const _gridLayout = require("./GridLayout");
|
|
26
26
|
function Dashboard(props) {
|
|
27
|
-
const
|
|
27
|
+
const panelGroupIds = (0, _context.usePanelGroupIds)();
|
|
28
28
|
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Box, {
|
|
29
29
|
...props,
|
|
30
30
|
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components.ErrorBoundary, {
|
|
31
31
|
FallbackComponent: _components.ErrorAlert,
|
|
32
|
-
children:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}, layout.id))
|
|
32
|
+
children: panelGroupIds.map((panelGroupId)=>/*#__PURE__*/ (0, _jsxRuntime.jsx)(_gridLayout.GridLayout, {
|
|
33
|
+
panelGroupId: panelGroupId
|
|
34
|
+
}, panelGroupId))
|
|
36
35
|
})
|
|
37
36
|
});
|
|
38
37
|
}
|
|
@@ -19,6 +19,7 @@ Object.defineProperty(exports, "DashboardToolbar", {
|
|
|
19
19
|
get: ()=>DashboardToolbar
|
|
20
20
|
});
|
|
21
21
|
const _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
+
const _react = require("react");
|
|
22
23
|
const _material = require("@mui/material");
|
|
23
24
|
const _pencilOutline = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/PencilOutline"));
|
|
24
25
|
const _plusBoxOutline = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/PlusBoxOutline"));
|
|
@@ -34,12 +35,23 @@ function _interopRequireDefault(obj) {
|
|
|
34
35
|
const DashboardToolbar = (props)=>{
|
|
35
36
|
const { dashboardName } = props;
|
|
36
37
|
const { isEditMode , setEditMode } = (0, _context.useEditMode)();
|
|
37
|
-
const {
|
|
38
|
-
const
|
|
38
|
+
const { openAddPanelGroup , openAddPanel , save } = (0, _context.useDashboardActions)();
|
|
39
|
+
const isLaptopSize = (0, _material.useMediaQuery)((0, _material.useTheme)().breakpoints.up('sm'));
|
|
40
|
+
const [originalSpec, setOriginalSpec] = (0, _react.useState)(undefined);
|
|
41
|
+
const { spec , resetSpec } = (0, _context.useDashboardSpec)();
|
|
39
42
|
const onEditButtonClick = ()=>{
|
|
43
|
+
setOriginalSpec(spec);
|
|
40
44
|
setEditMode(true);
|
|
41
45
|
};
|
|
42
46
|
const onCancelButtonClick = ()=>{
|
|
47
|
+
// Reset to the original spec and exit edit mode
|
|
48
|
+
if (originalSpec) {
|
|
49
|
+
resetSpec(originalSpec);
|
|
50
|
+
}
|
|
51
|
+
setEditMode(false);
|
|
52
|
+
};
|
|
53
|
+
const onSave = ()=>{
|
|
54
|
+
save();
|
|
43
55
|
setEditMode(false);
|
|
44
56
|
};
|
|
45
57
|
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
@@ -70,6 +82,7 @@ const DashboardToolbar = (props)=>{
|
|
|
70
82
|
children: [
|
|
71
83
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Button, {
|
|
72
84
|
variant: "contained",
|
|
85
|
+
onClick: onSave,
|
|
73
86
|
children: "Save"
|
|
74
87
|
}),
|
|
75
88
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Button, {
|
|
@@ -103,12 +116,12 @@ const DashboardToolbar = (props)=>{
|
|
|
103
116
|
children: [
|
|
104
117
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Button, {
|
|
105
118
|
startIcon: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_plusBoxOutline.default, {}),
|
|
106
|
-
onClick:
|
|
119
|
+
onClick: openAddPanelGroup,
|
|
107
120
|
children: "Add Panel Group"
|
|
108
121
|
}),
|
|
109
122
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Button, {
|
|
110
123
|
startIcon: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_chartBoxPlusOutline.default, {}),
|
|
111
|
-
onClick:
|
|
124
|
+
onClick: openAddPanel,
|
|
112
125
|
children: "Add Panel"
|
|
113
126
|
}),
|
|
114
127
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_components1.TimeRangeControls, {})
|
|
@@ -139,7 +152,7 @@ const DashboardToolbar = (props)=>{
|
|
|
139
152
|
},
|
|
140
153
|
children: [
|
|
141
154
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_components1.TimeRangeControls, {}),
|
|
142
|
-
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Button, {
|
|
155
|
+
isLaptopSize && /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Button, {
|
|
143
156
|
variant: "outlined",
|
|
144
157
|
startIcon: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pencilOutline.default, {}),
|
|
145
158
|
onClick: onEditButtonClick,
|
|
@@ -19,21 +19,13 @@ Object.defineProperty(exports, "GridItemContent", {
|
|
|
19
19
|
get: ()=>GridItemContent
|
|
20
20
|
});
|
|
21
21
|
const _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
-
const _core = require("@perses-dev/core");
|
|
23
22
|
const _context = require("../../context");
|
|
24
23
|
const _panel = require("../Panel/Panel");
|
|
25
24
|
function GridItemContent(props) {
|
|
26
|
-
const {
|
|
27
|
-
|
|
28
|
-
const { panels } = (0, _context.usePanels)();
|
|
29
|
-
const panelKey = (0, _core.getPanelKeyFromRef)(content);
|
|
30
|
-
const panelDefinition = panels[panelKey];
|
|
31
|
-
if (panelDefinition === undefined) {
|
|
32
|
-
throw new Error(`Panel with key '${panelKey}' was not found`);
|
|
33
|
-
}
|
|
25
|
+
const { panelGroupItemId } = props;
|
|
26
|
+
const panelDefinition = (0, _context.usePanel)(panelGroupItemId);
|
|
34
27
|
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_panel.Panel, {
|
|
35
28
|
definition: panelDefinition,
|
|
36
|
-
|
|
37
|
-
itemIndex: itemIndex
|
|
29
|
+
panelGroupItemId: panelGroupItemId
|
|
38
30
|
});
|
|
39
31
|
}
|
|
@@ -29,7 +29,10 @@ const _gridTitle = require("./GridTitle");
|
|
|
29
29
|
const _gridItemContent = require("./GridItemContent");
|
|
30
30
|
const ResponsiveGridLayout = (0, _reactGridLayout.WidthProvider)(_reactGridLayout.Responsive);
|
|
31
31
|
function GridLayout(props) {
|
|
32
|
-
const {
|
|
32
|
+
const { panelGroupId , ...others } = props;
|
|
33
|
+
const theme = (0, _material.useTheme)();
|
|
34
|
+
const groupDefinition = (0, _context.usePanelGroup)(panelGroupId);
|
|
35
|
+
const { updatePanelGroupLayouts } = (0, _context.usePanelGroupActions)(panelGroupId);
|
|
33
36
|
var ref;
|
|
34
37
|
const [isOpen, setIsOpen] = (0, _react.useState)((ref = !groupDefinition.isCollapsed) !== null && ref !== void 0 ? ref : true);
|
|
35
38
|
const { isEditMode } = (0, _context.useEditMode)();
|
|
@@ -48,7 +51,7 @@ function GridLayout(props) {
|
|
|
48
51
|
},
|
|
49
52
|
children: [
|
|
50
53
|
groupDefinition.title !== undefined && /*#__PURE__*/ (0, _jsxRuntime.jsx)(_gridTitle.GridTitle, {
|
|
51
|
-
|
|
54
|
+
panelGroupId: panelGroupId,
|
|
52
55
|
title: groupDefinition.title,
|
|
53
56
|
collapse: groupDefinition.isCollapsed === undefined ? undefined : {
|
|
54
57
|
isOpen,
|
|
@@ -61,17 +64,11 @@ function GridLayout(props) {
|
|
|
61
64
|
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(ResponsiveGridLayout, {
|
|
62
65
|
className: "layout",
|
|
63
66
|
breakpoints: {
|
|
64
|
-
|
|
65
|
-
md: 996,
|
|
66
|
-
sm: 768,
|
|
67
|
-
xs: 480,
|
|
67
|
+
sm: theme.breakpoints.values.sm,
|
|
68
68
|
xxs: 0
|
|
69
69
|
},
|
|
70
70
|
cols: {
|
|
71
|
-
lg: 24,
|
|
72
|
-
md: 24,
|
|
73
71
|
sm: 24,
|
|
74
|
-
xs: 24,
|
|
75
72
|
xxs: 2
|
|
76
73
|
},
|
|
77
74
|
rowHeight: 30,
|
|
@@ -81,22 +78,25 @@ function GridLayout(props) {
|
|
|
81
78
|
],
|
|
82
79
|
isDraggable: isEditMode,
|
|
83
80
|
isResizable: isEditMode,
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
81
|
+
containerPadding: [
|
|
82
|
+
0,
|
|
83
|
+
10
|
|
84
|
+
],
|
|
85
|
+
layouts: {
|
|
86
|
+
sm: groupDefinition.itemLayouts
|
|
87
|
+
},
|
|
88
|
+
onLayoutChange: updatePanelGroupLayouts,
|
|
89
|
+
children: groupDefinition.itemLayouts.map(({ i })=>/*#__PURE__*/ (0, _jsxRuntime.jsx)("div", {
|
|
91
90
|
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components.ErrorBoundary, {
|
|
92
91
|
FallbackComponent: _components.ErrorAlert,
|
|
93
92
|
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_gridItemContent.GridItemContent, {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
panelGroupItemId: {
|
|
94
|
+
panelGroupId,
|
|
95
|
+
panelGroupItemLayoutId: i
|
|
96
|
+
}
|
|
97
97
|
})
|
|
98
98
|
})
|
|
99
|
-
},
|
|
99
|
+
}, i))
|
|
100
100
|
})
|
|
101
101
|
})
|
|
102
102
|
]
|
|
@@ -35,12 +35,10 @@ function _interopRequireDefault(obj) {
|
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
37
|
function GridTitle(props) {
|
|
38
|
-
const {
|
|
38
|
+
const { panelGroupId , title , collapse } = props;
|
|
39
39
|
const [isHovered, setIsHovered] = (0, _react.useState)(false);
|
|
40
|
-
const {
|
|
41
|
-
const { addPanel } = (0, _context.usePanels)();
|
|
40
|
+
const { openAddPanel , openEditPanelGroup , deletePanelGroup , moveUp , moveDown } = (0, _context.usePanelGroupActions)(panelGroupId);
|
|
42
41
|
const { isEditMode } = (0, _context.useEditMode)();
|
|
43
|
-
const { layouts , swapPanelGroups } = (0, _context.useLayouts)();
|
|
44
42
|
const text = /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Typography, {
|
|
45
43
|
variant: "h2",
|
|
46
44
|
sx: {
|
|
@@ -73,29 +71,29 @@ function GridTitle(props) {
|
|
|
73
71
|
children: [
|
|
74
72
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
75
73
|
"aria-label": "add panel to group",
|
|
76
|
-
onClick:
|
|
74
|
+
onClick: openAddPanel,
|
|
77
75
|
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_plus.default, {})
|
|
78
76
|
}),
|
|
79
77
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
80
78
|
"aria-label": "edit group",
|
|
81
|
-
onClick:
|
|
79
|
+
onClick: openEditPanelGroup,
|
|
82
80
|
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pencilOutline.default, {})
|
|
83
81
|
}),
|
|
84
82
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
85
83
|
"aria-label": "delete group",
|
|
86
|
-
onClick:
|
|
84
|
+
onClick: deletePanelGroup,
|
|
87
85
|
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_deleteOutline.default, {})
|
|
88
86
|
}),
|
|
89
87
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
90
88
|
"aria-label": "move group down",
|
|
91
|
-
disabled:
|
|
92
|
-
onClick:
|
|
89
|
+
disabled: moveDown === undefined,
|
|
90
|
+
onClick: moveDown,
|
|
93
91
|
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_arrowDown.default, {})
|
|
94
92
|
}),
|
|
95
93
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
96
94
|
"aria-label": "move group up",
|
|
97
|
-
disabled:
|
|
98
|
-
onClick:
|
|
95
|
+
disabled: moveUp === undefined,
|
|
96
|
+
onClick: moveUp,
|
|
99
97
|
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_arrowUp.default, {})
|
|
100
98
|
})
|
|
101
99
|
]
|
|
@@ -28,7 +28,7 @@ function _interopRequireDefault(obj) {
|
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
const DeletePanelDialog = ()=>{
|
|
31
|
-
const { deletePanelDialog , closeDeletePanelDialog } = (0, _context.
|
|
31
|
+
const { deletePanelDialog , closeDeletePanelDialog } = (0, _context.useDeletePanelDialog)();
|
|
32
32
|
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Dialog, {
|
|
33
33
|
open: deletePanelDialog !== undefined,
|
|
34
34
|
children: [
|
|
@@ -52,25 +52,27 @@ const DeletePanelDialog = ()=>{
|
|
|
52
52
|
});
|
|
53
53
|
};
|
|
54
54
|
const DeletePanelForm = ({ deletePanelDialog })=>{
|
|
55
|
-
|
|
56
|
-
const { layouts } = (0, _context.useLayouts)();
|
|
57
|
-
const { deletePanels , closeDeletePanelDialog } = (0, _context.usePanels)();
|
|
55
|
+
const { deletePanel , closeDeletePanelDialog } = (0, _context.useDeletePanelDialog)();
|
|
58
56
|
const handleDelete = (e)=>{
|
|
59
57
|
e.preventDefault();
|
|
60
|
-
const {
|
|
61
|
-
|
|
62
|
-
layoutItem
|
|
63
|
-
]);
|
|
58
|
+
const { panelGroupItemId } = deletePanelDialog;
|
|
59
|
+
deletePanel(panelGroupItemId);
|
|
64
60
|
closeDeletePanelDialog();
|
|
65
61
|
};
|
|
66
62
|
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)("form", {
|
|
67
63
|
onSubmit: handleDelete,
|
|
68
64
|
children: [
|
|
69
|
-
/*#__PURE__*/ (0, _jsxRuntime.
|
|
65
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.DialogContent, {
|
|
70
66
|
sx: {
|
|
71
67
|
width: '500px'
|
|
72
68
|
},
|
|
73
|
-
children:
|
|
69
|
+
children: [
|
|
70
|
+
"Are you sure you want to delete ",
|
|
71
|
+
deletePanelDialog.panelName,
|
|
72
|
+
" from ",
|
|
73
|
+
deletePanelDialog.panelGroupName,
|
|
74
|
+
"? This action cannot be undone."
|
|
75
|
+
]
|
|
74
76
|
}),
|
|
75
77
|
/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.DialogActions, {
|
|
76
78
|
children: [
|
|
@@ -25,7 +25,7 @@ const _reactIntersectionObserver = require("react-intersection-observer");
|
|
|
25
25
|
const _components = require("@perses-dev/components");
|
|
26
26
|
const _material = require("@mui/material");
|
|
27
27
|
const _informationOutline = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/InformationOutline"));
|
|
28
|
-
const
|
|
28
|
+
const _pencilOutline = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/PencilOutline"));
|
|
29
29
|
const _deleteOutline = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/DeleteOutline"));
|
|
30
30
|
const _dragVertical = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/DragVertical"));
|
|
31
31
|
const _context = require("../../context");
|
|
@@ -36,7 +36,7 @@ function _interopRequireDefault(obj) {
|
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
38
|
function Panel(props) {
|
|
39
|
-
const { definition ,
|
|
39
|
+
const { definition , panelGroupItemId , ...others } = props;
|
|
40
40
|
const [contentElement, setContentElement] = (0, _react.useState)(null);
|
|
41
41
|
const [isHovered, setIsHovered] = (0, _react.useState)(false);
|
|
42
42
|
const { width , height } = (0, _useResizeObserver.default)({
|
|
@@ -60,13 +60,7 @@ function Panel(props) {
|
|
|
60
60
|
// TODO: adjust padding for small panels, consistent way to determine isLargePanel here and in StatChart
|
|
61
61
|
const panelPadding = 1.5;
|
|
62
62
|
const { isEditMode } = (0, _context.useEditMode)();
|
|
63
|
-
const {
|
|
64
|
-
const handleEditButtonClick = ()=>{
|
|
65
|
-
editPanel({
|
|
66
|
-
groupIndex,
|
|
67
|
-
itemIndex
|
|
68
|
-
});
|
|
69
|
-
};
|
|
63
|
+
const { openEditPanel , openDeletePanelDialog } = (0, _context.usePanelActions)(panelGroupItemId);
|
|
70
64
|
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Card, {
|
|
71
65
|
ref: ref,
|
|
72
66
|
sx: {
|
|
@@ -86,13 +80,11 @@ function Panel(props) {
|
|
|
86
80
|
sx: {
|
|
87
81
|
display: 'flex',
|
|
88
82
|
alignItems: 'center',
|
|
89
|
-
minHeight: '
|
|
83
|
+
minHeight: '32px'
|
|
90
84
|
},
|
|
91
85
|
children: [
|
|
92
86
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Typography, {
|
|
93
|
-
|
|
94
|
-
variant: "body2",
|
|
95
|
-
fontWeight: (theme)=>theme.typography.fontWeightMedium,
|
|
87
|
+
variant: "subtitle1",
|
|
96
88
|
whiteSpace: "nowrap",
|
|
97
89
|
overflow: "hidden",
|
|
98
90
|
textOverflow: "ellipsis",
|
|
@@ -112,9 +104,9 @@ function Panel(props) {
|
|
|
112
104
|
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_informationOutline.default, {
|
|
113
105
|
"aria-describedby": "info-tooltip",
|
|
114
106
|
"aria-hidden": false,
|
|
115
|
-
fontSize: "small",
|
|
116
107
|
sx: {
|
|
117
|
-
cursor: 'pointer'
|
|
108
|
+
cursor: 'pointer',
|
|
109
|
+
color: (theme)=>theme.palette.grey[700]
|
|
118
110
|
}
|
|
119
111
|
})
|
|
120
112
|
}),
|
|
@@ -126,16 +118,13 @@ function Panel(props) {
|
|
|
126
118
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(IconButton, {
|
|
127
119
|
"aria-label": "edit panel",
|
|
128
120
|
size: "small",
|
|
129
|
-
onClick:
|
|
130
|
-
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(
|
|
121
|
+
onClick: openEditPanel,
|
|
122
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pencilOutline.default, {})
|
|
131
123
|
}),
|
|
132
124
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(IconButton, {
|
|
133
125
|
"aria-label": "delete panel",
|
|
134
126
|
size: "small",
|
|
135
|
-
onClick:
|
|
136
|
-
groupIndex,
|
|
137
|
-
itemIndex
|
|
138
|
-
}),
|
|
127
|
+
onClick: openDeletePanelDialog,
|
|
139
128
|
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_deleteOutline.default, {})
|
|
140
129
|
}),
|
|
141
130
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(IconButton, {
|
|
@@ -156,7 +145,8 @@ function Panel(props) {
|
|
|
156
145
|
}),
|
|
157
146
|
sx: {
|
|
158
147
|
display: 'block',
|
|
159
|
-
|
|
148
|
+
paddingX: (theme)=>theme.spacing(panelPadding),
|
|
149
|
+
paddingY: '4px',
|
|
160
150
|
borderBottom: (theme)=>`solid 1px ${theme.palette.divider}`
|
|
161
151
|
}
|
|
162
152
|
}),
|
|
@@ -16,7 +16,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
const _jsxRuntime = require("react/jsx-runtime");
|
|
18
18
|
const _pluginSystem = require("@perses-dev/plugin-system");
|
|
19
|
-
require("intersection-observer");
|
|
20
19
|
const _react = require("@testing-library/react");
|
|
21
20
|
const _userEvent = /*#__PURE__*/ _interopRequireDefault(require("@testing-library/user-event"));
|
|
22
21
|
const _test = require("../../test");
|
|
@@ -44,8 +43,11 @@ describe('Panel', ()=>{
|
|
|
44
43
|
}
|
|
45
44
|
}
|
|
46
45
|
},
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
// TODO: This is coupled to ID generation which is not good and the tests will probably fail
|
|
47
|
+
panelGroupItemId: {
|
|
48
|
+
panelGroupId: 0,
|
|
49
|
+
panelGroupItemLayoutId: ''
|
|
50
|
+
}
|
|
49
51
|
};
|
|
50
52
|
};
|
|
51
53
|
// Helper to render the panel with some context set
|
|
@@ -15,6 +15,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
17
|
_exportStar(require("./Panel"), exports);
|
|
18
|
+
_exportStar(require("./DeletePanelDialog"), exports);
|
|
18
19
|
function _exportStar(from, to) {
|
|
19
20
|
Object.keys(from).forEach(function(k) {
|
|
20
21
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
|
|
@@ -25,7 +25,7 @@ const _components = require("@perses-dev/components");
|
|
|
25
25
|
const _context = require("../../context");
|
|
26
26
|
const _panelEditorForm = require("./PanelEditorForm");
|
|
27
27
|
const PanelDrawer = ()=>{
|
|
28
|
-
const
|
|
28
|
+
const panelEditor = (0, _context.usePanelEditor)();
|
|
29
29
|
// When the user clicks close, start closing but don't call the store yet to keep values stable during animtation
|
|
30
30
|
const [isClosing, setIsClosing] = (0, _react.useState)(false);
|
|
31
31
|
const handleClose = ()=>setIsClosing(true);
|
|
@@ -53,8 +53,8 @@ describe('Panel Drawer', ()=>{
|
|
|
53
53
|
};
|
|
54
54
|
it('should add new panel', async ()=>{
|
|
55
55
|
const storeApi = renderPanelDrawer();
|
|
56
|
-
// Open the drawer for a new panel
|
|
57
|
-
(0, _testUtils.act)(()=>storeApi.getState().
|
|
56
|
+
// Open the drawer for a new panel
|
|
57
|
+
(0, _testUtils.act)(()=>storeApi.getState().openAddPanel());
|
|
58
58
|
const nameInput = await _react.screen.findByLabelText(/Name/);
|
|
59
59
|
_userEvent.default.type(nameInput, 'New Panel');
|
|
60
60
|
_userEvent.default.click(_react.screen.getByText('Add'));
|
|
@@ -79,9 +79,17 @@ describe('Panel Drawer', ()=>{
|
|
|
79
79
|
it('should edit an existing panel', async ()=>{
|
|
80
80
|
const storeApi = renderPanelDrawer();
|
|
81
81
|
// Open the drawer for an existing panel
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
const group = Object.values(storeApi.getState().panelGroups).find((group)=>group.title === 'CPU Stats');
|
|
83
|
+
if (group === undefined) {
|
|
84
|
+
throw new Error('Test group not found');
|
|
85
|
+
}
|
|
86
|
+
const layout = Object.entries(group.itemPanelKeys).find(([, panelKey])=>panelKey === 'cpu');
|
|
87
|
+
if (layout === undefined) {
|
|
88
|
+
throw new Error('Test panel not found');
|
|
89
|
+
}
|
|
90
|
+
(0, _testUtils.act)(()=>storeApi.getState().openEditPanel({
|
|
91
|
+
panelGroupId: group.id,
|
|
92
|
+
panelGroupItemLayoutId: layout[0]
|
|
85
93
|
}));
|
|
86
94
|
const nameInput = await _react.screen.findByLabelText(/Name/);
|
|
87
95
|
_userEvent.default.clear(nameInput);
|
|
@@ -34,10 +34,10 @@ const _panelPreview = require("./PanelPreview");
|
|
|
34
34
|
function PanelEditorForm(props) {
|
|
35
35
|
var ref;
|
|
36
36
|
const { initialValues , onSubmit } = props;
|
|
37
|
-
const
|
|
37
|
+
const panelGroups = (0, _context.useListPanelGroups)();
|
|
38
38
|
const [name, setName] = (0, _react.useState)(initialValues.name);
|
|
39
39
|
const [description, setDescription] = (0, _react.useState)(initialValues.description);
|
|
40
|
-
const [
|
|
40
|
+
const [groupId, setGroupId] = (0, _react.useState)(initialValues.groupId);
|
|
41
41
|
const [kind, setKind] = (0, _react.useState)(initialValues.kind);
|
|
42
42
|
const [spec, setSpec] = (0, _react.useState)(initialValues.spec);
|
|
43
43
|
// Use common plugin editor logic even though we've split the inputs up in this form
|
|
@@ -58,35 +58,38 @@ function PanelEditorForm(props) {
|
|
|
58
58
|
if (typeof value === 'string') {
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
|
-
|
|
61
|
+
setGroupId(value);
|
|
62
62
|
};
|
|
63
63
|
const handleSubmit = (e)=>{
|
|
64
64
|
e.preventDefault();
|
|
65
|
-
if (spec === undefined) {
|
|
66
|
-
throw new Error('Cannot submit without a plugin spec');
|
|
67
|
-
}
|
|
68
65
|
const values = {
|
|
69
66
|
name,
|
|
70
67
|
description,
|
|
71
|
-
|
|
68
|
+
groupId,
|
|
72
69
|
kind,
|
|
73
70
|
spec
|
|
74
71
|
};
|
|
75
72
|
onSubmit(values);
|
|
76
73
|
};
|
|
77
74
|
var _title, ref1;
|
|
78
|
-
return
|
|
75
|
+
return(// Grid maxHeight allows user to scroll inside Drawer to see all content
|
|
76
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)("form", {
|
|
79
77
|
id: panelEditorFormId,
|
|
80
78
|
onSubmit: handleSubmit,
|
|
81
79
|
children: /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Grid, {
|
|
82
80
|
container: true,
|
|
83
81
|
spacing: 2,
|
|
82
|
+
sx: {
|
|
83
|
+
overflowY: 'scroll',
|
|
84
|
+
maxHeight: '90vh'
|
|
85
|
+
},
|
|
84
86
|
children: [
|
|
85
87
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Grid, {
|
|
86
88
|
item: true,
|
|
87
89
|
xs: 8,
|
|
88
90
|
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.TextField, {
|
|
89
91
|
required: true,
|
|
92
|
+
fullWidth: true,
|
|
90
93
|
label: "Name",
|
|
91
94
|
value: name,
|
|
92
95
|
variant: "outlined",
|
|
@@ -97,6 +100,7 @@ function PanelEditorForm(props) {
|
|
|
97
100
|
item: true,
|
|
98
101
|
xs: 4,
|
|
99
102
|
children: /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.FormControl, {
|
|
103
|
+
fullWidth: true,
|
|
100
104
|
children: [
|
|
101
105
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.InputLabel, {
|
|
102
106
|
id: "select-group",
|
|
@@ -106,12 +110,12 @@ function PanelEditorForm(props) {
|
|
|
106
110
|
required: true,
|
|
107
111
|
labelId: "select-group",
|
|
108
112
|
label: "Group",
|
|
109
|
-
value:
|
|
113
|
+
value: groupId,
|
|
110
114
|
onChange: handleGroupChange,
|
|
111
|
-
children:
|
|
112
|
-
value:
|
|
113
|
-
children: (_title =
|
|
114
|
-
},
|
|
115
|
+
children: panelGroups.map((panelGroup, index)=>/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.MenuItem, {
|
|
116
|
+
value: panelGroup.id,
|
|
117
|
+
children: (_title = panelGroup.title) !== null && _title !== void 0 ? _title : `Group ${index + 1}`
|
|
118
|
+
}, panelGroup.id))
|
|
115
119
|
})
|
|
116
120
|
]
|
|
117
121
|
})
|
|
@@ -120,6 +124,7 @@ function PanelEditorForm(props) {
|
|
|
120
124
|
item: true,
|
|
121
125
|
xs: 8,
|
|
122
126
|
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.TextField, {
|
|
127
|
+
fullWidth: true,
|
|
123
128
|
label: "Description",
|
|
124
129
|
value: description,
|
|
125
130
|
variant: "outlined",
|
|
@@ -131,6 +136,7 @@ function PanelEditorForm(props) {
|
|
|
131
136
|
xs: 4,
|
|
132
137
|
children: [
|
|
133
138
|
/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.FormControl, {
|
|
139
|
+
fullWidth: true,
|
|
134
140
|
disabled: pluginEditor.isLoading,
|
|
135
141
|
error: pluginEditor.error !== null,
|
|
136
142
|
children: [
|
|
@@ -169,7 +175,7 @@ function PanelEditorForm(props) {
|
|
|
169
175
|
name: name,
|
|
170
176
|
description: description,
|
|
171
177
|
spec: spec,
|
|
172
|
-
|
|
178
|
+
groupId: groupId
|
|
173
179
|
})
|
|
174
180
|
})
|
|
175
181
|
]
|
|
@@ -189,6 +195,6 @@ function PanelEditorForm(props) {
|
|
|
189
195
|
})
|
|
190
196
|
]
|
|
191
197
|
})
|
|
192
|
-
});
|
|
198
|
+
}));
|
|
193
199
|
}
|
|
194
200
|
const panelEditorFormId = 'panel-editor-form';
|
|
@@ -21,7 +21,7 @@ Object.defineProperty(exports, "PanelPreview", {
|
|
|
21
21
|
const _jsxRuntime = require("react/jsx-runtime");
|
|
22
22
|
const _material = require("@mui/material");
|
|
23
23
|
const _panel = require("../Panel");
|
|
24
|
-
function PanelPreview({ name , description , kind , spec ,
|
|
24
|
+
function PanelPreview({ name , description , kind , spec , groupId }) {
|
|
25
25
|
const previewValues = {
|
|
26
26
|
definition: {
|
|
27
27
|
kind: 'Panel',
|
|
@@ -36,9 +36,15 @@ function PanelPreview({ name , description , kind , spec , groupIndex }) {
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
// TODO: this shouldn't be necessary for preview
|
|
40
|
+
panelGroupItemId: {
|
|
41
|
+
panelGroupId: groupId,
|
|
42
|
+
panelGroupItemLayoutId: ''
|
|
43
|
+
}
|
|
41
44
|
};
|
|
45
|
+
if (!kind) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
42
48
|
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Box, {
|
|
43
49
|
height: 300,
|
|
44
50
|
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_panel.Panel, {
|