@perses-dev/dashboards 0.9.0 → 0.10.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 +7 -11
- package/dist/cjs/components/DashboardToolbar.js +4 -4
- package/dist/cjs/components/GridLayout/GridItemContent.js +13 -13
- package/dist/cjs/components/GridLayout/GridLayout.js +24 -21
- package/dist/cjs/components/GridLayout/GridTitle.js +27 -5
- package/dist/cjs/components/Panel/DeletePanelDialog.js +91 -0
- package/dist/cjs/components/Panel/Panel.js +16 -5
- package/dist/cjs/components/Panel/Panel.test.js +12 -4
- package/dist/cjs/components/Panel/PanelContent.js +3 -2
- package/dist/cjs/components/PanelDrawer/PanelDrawer.js +13 -12
- package/dist/cjs/components/PanelDrawer/PanelDrawer.test.js +8 -12
- package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +77 -35
- package/dist/cjs/components/PanelDrawer/PanelPreview.js +48 -0
- package/dist/cjs/components/PanelGroupDialog/DeletePanelGroupDialog.js +86 -0
- package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.js +12 -19
- package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.test.js +10 -31
- package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +2 -2
- package/dist/cjs/components/Variables/Variable.js +19 -11
- package/dist/cjs/components/Variables/VariableEditor.js +207 -0
- package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +236 -0
- package/dist/cjs/components/Variables/VariableEditorForm/index.js +28 -0
- package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +88 -0
- package/dist/cjs/components/Variables/VariableList.js +50 -69
- package/dist/cjs/components/Variables/index.js +1 -0
- package/dist/cjs/context/DashboardProvider/DashboardProvider.js +70 -0
- package/dist/cjs/context/DashboardProvider/common.js +18 -0
- package/dist/cjs/context/DashboardProvider/dashboard-provider-api.js +71 -0
- package/dist/cjs/context/DashboardProvider/index.js +29 -0
- package/dist/cjs/context/DashboardProvider/layout-slice.js +200 -0
- package/dist/cjs/context/DashboardProvider/panel-editing-slice.js +156 -0
- package/dist/{context/DashboardAppSlice.js → cjs/context/DashboardProvider/panel-group-slice.js} +18 -25
- package/dist/cjs/context/DatasourceStoreProvider.js +109 -7
- package/dist/cjs/context/TemplateVariableProvider.js +8 -1
- package/dist/cjs/context/index.js +0 -2
- package/dist/cjs/test/testDashboard.js +13 -1
- package/dist/cjs/views/ViewDashboard/DashboardApp.js +6 -7
- package/dist/cjs/views/ViewDashboard/tests/panelGroups.test.js +165 -0
- package/dist/components/Dashboard.d.ts +1 -4
- package/dist/components/Dashboard.d.ts.map +1 -1
- package/dist/components/Dashboard.js +8 -12
- package/dist/components/Dashboard.js.map +1 -1
- package/dist/components/DashboardToolbar.d.ts.map +1 -1
- package/dist/components/DashboardToolbar.js +5 -5
- package/dist/components/DashboardToolbar.js.map +1 -1
- package/dist/components/GridLayout/GridItemContent.d.ts +3 -3
- package/dist/components/GridLayout/GridItemContent.d.ts.map +1 -1
- package/dist/components/GridLayout/GridItemContent.js +14 -14
- 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 +24 -21
- 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 +28 -6
- package/dist/components/GridLayout/GridTitle.js.map +1 -1
- package/dist/components/Panel/DeletePanelDialog.d.ts +5 -0
- package/dist/components/Panel/DeletePanelDialog.d.ts.map +1 -0
- package/dist/components/Panel/DeletePanelDialog.js +80 -0
- package/dist/components/Panel/DeletePanelDialog.js.map +1 -0
- package/dist/components/Panel/Panel.d.ts +1 -1
- package/dist/components/Panel/Panel.d.ts.map +1 -1
- package/dist/components/Panel/Panel.js +17 -6
- package/dist/components/Panel/Panel.js.map +1 -1
- package/dist/components/Panel/Panel.test.js +7 -4
- package/dist/components/Panel/Panel.test.js.map +1 -1
- package/dist/components/Panel/PanelContent.d.ts +4 -1
- package/dist/components/Panel/PanelContent.d.ts.map +1 -1
- package/dist/components/Panel/PanelContent.js +3 -2
- package/dist/components/Panel/PanelContent.js.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.js +14 -13
- package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.test.js +8 -12
- package/dist/components/PanelDrawer/PanelDrawer.test.js.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.d.ts +3 -3
- package/dist/components/PanelDrawer/PanelEditorForm.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.js +78 -36
- package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -1
- package/dist/components/PanelDrawer/PanelPreview.d.ts +4 -0
- package/dist/components/PanelDrawer/PanelPreview.d.ts.map +1 -0
- package/dist/components/PanelDrawer/PanelPreview.js +42 -0
- package/dist/components/PanelDrawer/PanelPreview.js.map +1 -0
- package/dist/components/PanelGroupDialog/DeletePanelGroupDialog.d.ts +4 -0
- package/dist/components/PanelGroupDialog/DeletePanelGroupDialog.d.ts.map +1 -0
- package/dist/components/PanelGroupDialog/DeletePanelGroupDialog.js +75 -0
- package/dist/components/PanelGroupDialog/DeletePanelGroupDialog.js.map +1 -0
- package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.js +13 -20
- package/dist/components/PanelGroupDialog/PanelGroupDialog.js.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.test.js +10 -31
- package/dist/components/PanelGroupDialog/PanelGroupDialog.test.js.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.js +3 -3
- package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
- package/dist/components/Variables/Variable.js +21 -13
- package/dist/components/Variables/Variable.js.map +1 -1
- package/dist/components/Variables/VariableEditor.d.ts +8 -0
- package/dist/components/Variables/VariableEditor.d.ts.map +1 -0
- package/dist/components/Variables/VariableEditor.js +196 -0
- package/dist/components/Variables/VariableEditor.js.map +1 -0
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts +8 -0
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -0
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +225 -0
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -0
- package/dist/components/Variables/VariableEditorForm/index.d.ts +2 -0
- package/dist/components/Variables/VariableEditorForm/index.d.ts.map +1 -0
- package/dist/components/Variables/VariableEditorForm/index.js +15 -0
- package/dist/components/Variables/VariableEditorForm/index.js.map +1 -0
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts +21 -0
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts.map +1 -0
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +76 -0
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -0
- package/dist/components/Variables/VariableList.d.ts.map +1 -1
- package/dist/components/Variables/VariableList.js +48 -72
- package/dist/components/Variables/VariableList.js.map +1 -1
- package/dist/components/Variables/index.d.ts +1 -0
- package/dist/components/Variables/index.d.ts.map +1 -1
- package/dist/components/Variables/index.js +1 -0
- package/dist/components/Variables/index.js.map +1 -1
- package/dist/context/DashboardProvider/DashboardProvider.d.ts +23 -0
- package/dist/context/DashboardProvider/DashboardProvider.d.ts.map +1 -0
- package/dist/context/DashboardProvider/DashboardProvider.js +52 -0
- package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -0
- package/dist/context/DashboardProvider/common.d.ts +5 -0
- package/dist/context/DashboardProvider/common.d.ts.map +1 -0
- package/dist/context/DashboardProvider/common.js +17 -0
- package/dist/context/DashboardProvider/common.js.map +1 -0
- package/dist/context/DashboardProvider/dashboard-provider-api.d.ts +32 -0
- package/dist/context/DashboardProvider/dashboard-provider-api.d.ts.map +1 -0
- package/dist/context/DashboardProvider/dashboard-provider-api.js +56 -0
- package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -0
- package/dist/context/DashboardProvider/index.d.ts +3 -0
- package/dist/context/DashboardProvider/index.d.ts.map +1 -0
- package/dist/context/DashboardProvider/index.js +16 -0
- package/dist/context/DashboardProvider/index.js.map +1 -0
- package/dist/context/DashboardProvider/layout-slice.d.ts +57 -0
- package/dist/context/DashboardProvider/layout-slice.d.ts.map +1 -0
- package/dist/context/DashboardProvider/layout-slice.js +196 -0
- package/dist/context/DashboardProvider/layout-slice.js.map +1 -0
- package/dist/context/DashboardProvider/panel-editing-slice.d.ts +70 -0
- package/dist/context/DashboardProvider/panel-editing-slice.d.ts.map +1 -0
- package/dist/context/DashboardProvider/panel-editing-slice.js +152 -0
- package/dist/context/DashboardProvider/panel-editing-slice.js.map +1 -0
- package/dist/context/DashboardProvider/panel-group-slice.d.ts +15 -0
- package/dist/context/DashboardProvider/panel-group-slice.d.ts.map +1 -0
- package/dist/context/DashboardProvider/panel-group-slice.js +32 -0
- package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -0
- package/dist/context/DatasourceStoreProvider.d.ts +10 -2
- package/dist/context/DatasourceStoreProvider.d.ts.map +1 -1
- package/dist/context/DatasourceStoreProvider.js +111 -9
- package/dist/context/DatasourceStoreProvider.js.map +1 -1
- package/dist/context/TemplateVariableProvider.d.ts +2 -0
- package/dist/context/TemplateVariableProvider.d.ts.map +1 -1
- package/dist/context/TemplateVariableProvider.js +8 -1
- package/dist/context/TemplateVariableProvider.js.map +1 -1
- package/dist/context/index.d.ts +0 -2
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +0 -2
- package/dist/context/index.js.map +1 -1
- package/dist/test/plugin-registry.d.ts +2 -2
- package/dist/test/plugin-registry.d.ts.map +1 -1
- package/dist/test/plugin-registry.js.map +1 -1
- package/dist/test/testDashboard.d.ts.map +1 -1
- package/dist/test/testDashboard.js +13 -1
- package/dist/test/testDashboard.js.map +1 -1
- package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -1
- package/dist/views/ViewDashboard/DashboardApp.js +6 -7
- package/dist/views/ViewDashboard/DashboardApp.js.map +1 -1
- package/dist/views/ViewDashboard/tests/panelGroups.test.d.ts +2 -0
- package/dist/views/ViewDashboard/tests/panelGroups.test.d.ts.map +1 -0
- package/dist/views/ViewDashboard/tests/panelGroups.test.js +158 -0
- package/dist/views/ViewDashboard/tests/panelGroups.test.js.map +1 -0
- package/package.json +4 -4
- package/dist/cjs/components/PanelDrawer/PanelSpecEditor.js +0 -40
- package/dist/cjs/components/PanelDrawer/PanelTypeSelect.js +0 -38
- package/dist/cjs/components/PanelDrawer/panel-editor-model.js +0 -140
- package/dist/cjs/context/DashboardAppSlice.js +0 -57
- package/dist/cjs/context/DashboardProvider.js +0 -128
- package/dist/cjs/context/LayoutsSlice.js +0 -55
- package/dist/components/PanelDrawer/PanelSpecEditor.d.ts +0 -7
- package/dist/components/PanelDrawer/PanelSpecEditor.d.ts.map +0 -1
- package/dist/components/PanelDrawer/PanelSpecEditor.js +0 -34
- package/dist/components/PanelDrawer/PanelSpecEditor.js.map +0 -1
- package/dist/components/PanelDrawer/PanelTypeSelect.d.ts +0 -8
- package/dist/components/PanelDrawer/PanelTypeSelect.d.ts.map +0 -1
- package/dist/components/PanelDrawer/PanelTypeSelect.js +0 -34
- package/dist/components/PanelDrawer/PanelTypeSelect.js.map +0 -1
- package/dist/components/PanelDrawer/panel-editor-model.d.ts +0 -27
- package/dist/components/PanelDrawer/panel-editor-model.d.ts.map +0 -1
- package/dist/components/PanelDrawer/panel-editor-model.js +0 -133
- package/dist/components/PanelDrawer/panel-editor-model.js.map +0 -1
- package/dist/context/DashboardAppSlice.d.ts +0 -26
- package/dist/context/DashboardAppSlice.d.ts.map +0 -1
- package/dist/context/DashboardAppSlice.js.map +0 -1
- package/dist/context/DashboardProvider.d.ts +0 -36
- package/dist/context/DashboardProvider.d.ts.map +0 -1
- package/dist/context/DashboardProvider.js +0 -107
- package/dist/context/DashboardProvider.js.map +0 -1
- package/dist/context/LayoutsSlice.d.ts +0 -12
- package/dist/context/LayoutsSlice.d.ts.map +0 -1
- package/dist/context/LayoutsSlice.js +0 -43
- package/dist/context/LayoutsSlice.js.map +0 -1
|
@@ -21,22 +21,18 @@ Object.defineProperty(exports, "Dashboard", {
|
|
|
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 _context = require("../context");
|
|
24
25
|
const _gridLayout = require("./GridLayout");
|
|
25
26
|
function Dashboard(props) {
|
|
26
|
-
const {
|
|
27
|
+
const { layouts } = (0, _context.useLayouts)();
|
|
27
28
|
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Box, {
|
|
28
|
-
...
|
|
29
|
+
...props,
|
|
29
30
|
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components.ErrorBoundary, {
|
|
30
31
|
FallbackComponent: _components.ErrorAlert,
|
|
31
|
-
children:
|
|
32
|
-
groupIndex:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
content: definition.content,
|
|
36
|
-
spec: spec,
|
|
37
|
-
groupIndex: groupIndex
|
|
38
|
-
})
|
|
39
|
-
}, `${JSON.stringify(spec.layouts)} ${idx}`))
|
|
32
|
+
children: layouts.map((layout, groupIndex)=>/*#__PURE__*/ (0, _jsxRuntime.jsx)(_gridLayout.GridLayout, {
|
|
33
|
+
groupIndex: groupIndex,
|
|
34
|
+
groupDefinition: layout
|
|
35
|
+
}, layout.id))
|
|
40
36
|
})
|
|
41
37
|
});
|
|
42
38
|
}
|
|
@@ -34,7 +34,8 @@ function _interopRequireDefault(obj) {
|
|
|
34
34
|
const DashboardToolbar = (props)=>{
|
|
35
35
|
const { dashboardName } = props;
|
|
36
36
|
const { isEditMode , setEditMode } = (0, _context.useEditMode)();
|
|
37
|
-
const {
|
|
37
|
+
const { openPanelGroupDialog } = (0, _context.usePanelGroupDialog)();
|
|
38
|
+
const { addPanel } = (0, _context.usePanels)();
|
|
38
39
|
const onEditButtonClick = ()=>{
|
|
39
40
|
setEditMode(true);
|
|
40
41
|
};
|
|
@@ -85,6 +86,7 @@ const DashboardToolbar = (props)=>{
|
|
|
85
86
|
sx: {
|
|
86
87
|
display: 'flex',
|
|
87
88
|
width: '100%',
|
|
89
|
+
alignItems: 'flex-start',
|
|
88
90
|
padding: (theme)=>theme.spacing(2)
|
|
89
91
|
},
|
|
90
92
|
children: [
|
|
@@ -106,9 +108,7 @@ const DashboardToolbar = (props)=>{
|
|
|
106
108
|
}),
|
|
107
109
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Button, {
|
|
108
110
|
startIcon: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_chartBoxPlusOutline.default, {}),
|
|
109
|
-
onClick: ()=>
|
|
110
|
-
groupIndex: 0
|
|
111
|
-
}),
|
|
111
|
+
onClick: ()=>addPanel(0),
|
|
112
112
|
children: "Add Panel"
|
|
113
113
|
}),
|
|
114
114
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_components1.TimeRangeControls, {})
|
|
@@ -19,21 +19,21 @@ Object.defineProperty(exports, "GridItemContent", {
|
|
|
19
19
|
get: ()=>GridItemContent
|
|
20
20
|
});
|
|
21
21
|
const _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
-
const _components = require("@perses-dev/components");
|
|
23
22
|
const _core = require("@perses-dev/core");
|
|
23
|
+
const _context = require("../../context");
|
|
24
24
|
const _panel = require("../Panel/Panel");
|
|
25
25
|
function GridItemContent(props) {
|
|
26
|
-
const { content ,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
});
|
|
34
|
-
} catch (err) {
|
|
35
|
-
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components.ErrorAlert, {
|
|
36
|
-
error: err
|
|
37
|
-
});
|
|
26
|
+
const { content , groupIndex , itemIndex } = props;
|
|
27
|
+
// Find the panel referenced in content in the store
|
|
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`);
|
|
38
33
|
}
|
|
34
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_panel.Panel, {
|
|
35
|
+
definition: panelDefinition,
|
|
36
|
+
groupIndex: groupIndex,
|
|
37
|
+
itemIndex: itemIndex
|
|
38
|
+
});
|
|
39
39
|
}
|
|
@@ -22,29 +22,17 @@ const _jsxRuntime = require("react/jsx-runtime");
|
|
|
22
22
|
const _react = require("react");
|
|
23
23
|
const _reactGridLayout = require("react-grid-layout");
|
|
24
24
|
const _material = require("@mui/material");
|
|
25
|
+
const _components = require("@perses-dev/components");
|
|
25
26
|
const _styles = require("../../css/styles");
|
|
26
27
|
const _context = require("../../context");
|
|
27
28
|
const _gridTitle = require("./GridTitle");
|
|
29
|
+
const _gridItemContent = require("./GridItemContent");
|
|
28
30
|
const ResponsiveGridLayout = (0, _reactGridLayout.WidthProvider)(_reactGridLayout.Responsive);
|
|
29
31
|
function GridLayout(props) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const [isOpen, setIsOpen] = (0, _react.useState)((ref2 = (ref = spec.display) === null || ref === void 0 ? void 0 : (ref1 = ref.collapse) === null || ref1 === void 0 ? void 0 : ref1.open) !== null && ref2 !== void 0 ? ref2 : true);
|
|
32
|
+
const { groupIndex , groupDefinition , ...others } = props;
|
|
33
|
+
var ref;
|
|
34
|
+
const [isOpen, setIsOpen] = (0, _react.useState)((ref = !groupDefinition.isCollapsed) !== null && ref !== void 0 ? ref : true);
|
|
34
35
|
const { isEditMode } = (0, _context.useEditMode)();
|
|
35
|
-
const gridItems = [];
|
|
36
|
-
spec.items.forEach((item, idx)=>{
|
|
37
|
-
const { x , y , width: w , height: h } = item;
|
|
38
|
-
gridItems.push(/*#__PURE__*/ (0, _jsxRuntime.jsx)("div", {
|
|
39
|
-
"data-grid": {
|
|
40
|
-
x,
|
|
41
|
-
y,
|
|
42
|
-
w,
|
|
43
|
-
h
|
|
44
|
-
},
|
|
45
|
-
children: renderGridItemContent(item, groupIndex)
|
|
46
|
-
}, idx));
|
|
47
|
-
});
|
|
48
36
|
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
49
37
|
children: [
|
|
50
38
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.GlobalStyles, {
|
|
@@ -59,10 +47,10 @@ function GridLayout(props) {
|
|
|
59
47
|
}
|
|
60
48
|
},
|
|
61
49
|
children: [
|
|
62
|
-
|
|
50
|
+
groupDefinition.title !== undefined && /*#__PURE__*/ (0, _jsxRuntime.jsx)(_gridTitle.GridTitle, {
|
|
63
51
|
groupIndex: groupIndex,
|
|
64
|
-
title:
|
|
65
|
-
collapse:
|
|
52
|
+
title: groupDefinition.title,
|
|
53
|
+
collapse: groupDefinition.isCollapsed === undefined ? undefined : {
|
|
66
54
|
isOpen,
|
|
67
55
|
onToggleOpen: ()=>setIsOpen((current)=>!current)
|
|
68
56
|
}
|
|
@@ -93,7 +81,22 @@ function GridLayout(props) {
|
|
|
93
81
|
],
|
|
94
82
|
isDraggable: isEditMode,
|
|
95
83
|
isResizable: isEditMode,
|
|
96
|
-
children:
|
|
84
|
+
children: groupDefinition.items.map(({ x , y , width , height , content }, itemIndex)=>/*#__PURE__*/ (0, _jsxRuntime.jsx)("div", {
|
|
85
|
+
"data-grid": {
|
|
86
|
+
x,
|
|
87
|
+
y,
|
|
88
|
+
w: width,
|
|
89
|
+
h: height
|
|
90
|
+
},
|
|
91
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components.ErrorBoundary, {
|
|
92
|
+
FallbackComponent: _components.ErrorAlert,
|
|
93
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_gridItemContent.GridItemContent, {
|
|
94
|
+
groupIndex: groupIndex,
|
|
95
|
+
itemIndex: itemIndex,
|
|
96
|
+
content: content
|
|
97
|
+
})
|
|
98
|
+
})
|
|
99
|
+
}, itemIndex))
|
|
97
100
|
})
|
|
98
101
|
})
|
|
99
102
|
]
|
|
@@ -19,12 +19,15 @@ Object.defineProperty(exports, "GridTitle", {
|
|
|
19
19
|
get: ()=>GridTitle
|
|
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 _chevronUp = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/ChevronUp"));
|
|
24
25
|
const _chevronDown = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/ChevronDown"));
|
|
25
26
|
const _plus = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/Plus"));
|
|
26
27
|
const _pencilOutline = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/PencilOutline"));
|
|
27
|
-
const
|
|
28
|
+
const _arrowUp = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/ArrowUp"));
|
|
29
|
+
const _arrowDown = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/ArrowDown"));
|
|
30
|
+
const _deleteOutline = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/DeleteOutline"));
|
|
28
31
|
const _context = require("../../context");
|
|
29
32
|
function _interopRequireDefault(obj) {
|
|
30
33
|
return obj && obj.__esModule ? obj : {
|
|
@@ -34,8 +37,10 @@ function _interopRequireDefault(obj) {
|
|
|
34
37
|
function GridTitle(props) {
|
|
35
38
|
const { groupIndex , title , collapse } = props;
|
|
36
39
|
const [isHovered, setIsHovered] = (0, _react.useState)(false);
|
|
37
|
-
const {
|
|
40
|
+
const { openPanelGroupDialog , openDeletePanelGroupDialog } = (0, _context.usePanelGroupDialog)();
|
|
41
|
+
const { addPanel } = (0, _context.usePanels)();
|
|
38
42
|
const { isEditMode } = (0, _context.useEditMode)();
|
|
43
|
+
const { layouts , swapPanelGroups } = (0, _context.useLayouts)();
|
|
39
44
|
const text = /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Typography, {
|
|
40
45
|
variant: "h2",
|
|
41
46
|
sx: {
|
|
@@ -67,14 +72,31 @@ function GridTitle(props) {
|
|
|
67
72
|
},
|
|
68
73
|
children: [
|
|
69
74
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}),
|
|
75
|
+
"aria-label": "add panel to group",
|
|
76
|
+
onClick: ()=>addPanel(groupIndex),
|
|
73
77
|
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_plus.default, {})
|
|
74
78
|
}),
|
|
75
79
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
80
|
+
"aria-label": "edit group",
|
|
76
81
|
onClick: ()=>openPanelGroupDialog(groupIndex),
|
|
77
82
|
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pencilOutline.default, {})
|
|
83
|
+
}),
|
|
84
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
85
|
+
"aria-label": "delete group",
|
|
86
|
+
onClick: ()=>openDeletePanelGroupDialog(groupIndex),
|
|
87
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_deleteOutline.default, {})
|
|
88
|
+
}),
|
|
89
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
90
|
+
"aria-label": "move group down",
|
|
91
|
+
disabled: groupIndex === layouts.length - 1,
|
|
92
|
+
onClick: ()=>swapPanelGroups(groupIndex, groupIndex + 1),
|
|
93
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_arrowDown.default, {})
|
|
94
|
+
}),
|
|
95
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
96
|
+
"aria-label": "move group up",
|
|
97
|
+
disabled: groupIndex === 0,
|
|
98
|
+
onClick: ()=>swapPanelGroups(groupIndex, groupIndex - 1),
|
|
99
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_arrowUp.default, {})
|
|
78
100
|
})
|
|
79
101
|
]
|
|
80
102
|
})
|
|
@@ -0,0 +1,91 @@
|
|
|
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, "default", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: ()=>_default
|
|
20
|
+
});
|
|
21
|
+
const _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
+
const _material = require("@mui/material");
|
|
23
|
+
const _close = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/Close"));
|
|
24
|
+
const _context = require("../../context");
|
|
25
|
+
function _interopRequireDefault(obj) {
|
|
26
|
+
return obj && obj.__esModule ? obj : {
|
|
27
|
+
default: obj
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
const DeletePanelDialog = ()=>{
|
|
31
|
+
const { deletePanelDialog , closeDeletePanelDialog } = (0, _context.usePanels)();
|
|
32
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Dialog, {
|
|
33
|
+
open: deletePanelDialog !== undefined,
|
|
34
|
+
children: [
|
|
35
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.DialogTitle, {
|
|
36
|
+
children: "Delete Panel"
|
|
37
|
+
}),
|
|
38
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
39
|
+
"aria-label": "Close",
|
|
40
|
+
onClick: ()=>closeDeletePanelDialog(),
|
|
41
|
+
sx: (theme)=>({
|
|
42
|
+
position: 'absolute',
|
|
43
|
+
top: theme.spacing(0.5),
|
|
44
|
+
right: theme.spacing(0.5)
|
|
45
|
+
}),
|
|
46
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_close.default, {})
|
|
47
|
+
}),
|
|
48
|
+
deletePanelDialog && /*#__PURE__*/ (0, _jsxRuntime.jsx)(DeletePanelForm, {
|
|
49
|
+
deletePanelDialog: deletePanelDialog
|
|
50
|
+
})
|
|
51
|
+
]
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
const DeletePanelForm = ({ deletePanelDialog })=>{
|
|
55
|
+
var ref;
|
|
56
|
+
const { layouts } = (0, _context.useLayouts)();
|
|
57
|
+
const { deletePanels , closeDeletePanelDialog } = (0, _context.usePanels)();
|
|
58
|
+
const handleDelete = (e)=>{
|
|
59
|
+
e.preventDefault();
|
|
60
|
+
const { layoutItem } = deletePanelDialog;
|
|
61
|
+
deletePanels([
|
|
62
|
+
layoutItem
|
|
63
|
+
]);
|
|
64
|
+
closeDeletePanelDialog();
|
|
65
|
+
};
|
|
66
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)("form", {
|
|
67
|
+
onSubmit: handleDelete,
|
|
68
|
+
children: [
|
|
69
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.DialogContent, {
|
|
70
|
+
sx: {
|
|
71
|
+
width: '500px'
|
|
72
|
+
},
|
|
73
|
+
children: `Are you sure you want to delete ${deletePanelDialog.panelName} from ${(ref = layouts[deletePanelDialog.layoutItem.groupIndex]) === null || ref === void 0 ? void 0 : ref.title}? This action cannot be undone.`
|
|
74
|
+
}),
|
|
75
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.DialogActions, {
|
|
76
|
+
children: [
|
|
77
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Button, {
|
|
78
|
+
variant: "contained",
|
|
79
|
+
type: "submit",
|
|
80
|
+
children: "Delete"
|
|
81
|
+
}),
|
|
82
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Button, {
|
|
83
|
+
onClick: ()=>closeDeletePanelDialog(),
|
|
84
|
+
children: "Cancel"
|
|
85
|
+
})
|
|
86
|
+
]
|
|
87
|
+
})
|
|
88
|
+
]
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
const _default = DeletePanelDialog;
|
|
@@ -26,6 +26,7 @@ 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
28
|
const _pencil = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/Pencil"));
|
|
29
|
+
const _deleteOutline = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/DeleteOutline"));
|
|
29
30
|
const _dragVertical = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/DragVertical"));
|
|
30
31
|
const _context = require("../../context");
|
|
31
32
|
const _panelContent = require("./PanelContent");
|
|
@@ -35,7 +36,7 @@ function _interopRequireDefault(obj) {
|
|
|
35
36
|
};
|
|
36
37
|
}
|
|
37
38
|
function Panel(props) {
|
|
38
|
-
const { definition , groupIndex ,
|
|
39
|
+
const { definition , groupIndex , itemIndex , ...others } = props;
|
|
39
40
|
const [contentElement, setContentElement] = (0, _react.useState)(null);
|
|
40
41
|
const [isHovered, setIsHovered] = (0, _react.useState)(false);
|
|
41
42
|
const { width , height } = (0, _useResizeObserver.default)({
|
|
@@ -59,11 +60,11 @@ function Panel(props) {
|
|
|
59
60
|
// TODO: adjust padding for small panels, consistent way to determine isLargePanel here and in StatChart
|
|
60
61
|
const panelPadding = 1.5;
|
|
61
62
|
const { isEditMode } = (0, _context.useEditMode)();
|
|
62
|
-
const {
|
|
63
|
+
const { editPanel , openDeletePanelDialog } = (0, _context.usePanels)();
|
|
63
64
|
const handleEditButtonClick = ()=>{
|
|
64
|
-
|
|
65
|
+
editPanel({
|
|
65
66
|
groupIndex,
|
|
66
|
-
|
|
67
|
+
itemIndex
|
|
67
68
|
});
|
|
68
69
|
};
|
|
69
70
|
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Card, {
|
|
@@ -128,6 +129,15 @@ function Panel(props) {
|
|
|
128
129
|
onClick: handleEditButtonClick,
|
|
129
130
|
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pencil.default, {})
|
|
130
131
|
}),
|
|
132
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(IconButton, {
|
|
133
|
+
"aria-label": "delete panel",
|
|
134
|
+
size: "small",
|
|
135
|
+
onClick: ()=>openDeletePanelDialog({
|
|
136
|
+
groupIndex,
|
|
137
|
+
itemIndex
|
|
138
|
+
}),
|
|
139
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_deleteOutline.default, {})
|
|
140
|
+
}),
|
|
131
141
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(IconButton, {
|
|
132
142
|
"aria-label": "drag handle",
|
|
133
143
|
size: "small",
|
|
@@ -165,7 +175,8 @@ function Panel(props) {
|
|
|
165
175
|
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components.ErrorBoundary, {
|
|
166
176
|
FallbackComponent: _components.ErrorAlert,
|
|
167
177
|
children: inView === true && /*#__PURE__*/ (0, _jsxRuntime.jsx)(_panelContent.PanelContent, {
|
|
168
|
-
|
|
178
|
+
panelPluginKind: definition.spec.plugin.kind,
|
|
179
|
+
spec: definition.spec.plugin.spec,
|
|
169
180
|
contentDimensions: contentDimensions
|
|
170
181
|
})
|
|
171
182
|
})
|
|
@@ -18,9 +18,15 @@ const _jsxRuntime = require("react/jsx-runtime");
|
|
|
18
18
|
const _pluginSystem = require("@perses-dev/plugin-system");
|
|
19
19
|
require("intersection-observer");
|
|
20
20
|
const _react = require("@testing-library/react");
|
|
21
|
+
const _userEvent = /*#__PURE__*/ _interopRequireDefault(require("@testing-library/user-event"));
|
|
21
22
|
const _test = require("../../test");
|
|
22
23
|
const _context = require("../../context");
|
|
23
24
|
const _panel = require("./Panel");
|
|
25
|
+
function _interopRequireDefault(obj) {
|
|
26
|
+
return obj && obj.__esModule ? obj : {
|
|
27
|
+
default: obj
|
|
28
|
+
};
|
|
29
|
+
}
|
|
24
30
|
describe('Panel', ()=>{
|
|
25
31
|
// Helper to create panel props for rendering tests
|
|
26
32
|
const createPanelProps = ()=>{
|
|
@@ -39,7 +45,7 @@ describe('Panel', ()=>{
|
|
|
39
45
|
}
|
|
40
46
|
},
|
|
41
47
|
groupIndex: 0,
|
|
42
|
-
|
|
48
|
+
itemIndex: 0
|
|
43
49
|
};
|
|
44
50
|
};
|
|
45
51
|
// Helper to render the panel with some context set
|
|
@@ -66,8 +72,10 @@ describe('Panel', ()=>{
|
|
|
66
72
|
});
|
|
67
73
|
it('should render edit icons when in edit mode', ()=>{
|
|
68
74
|
renderPanel(true);
|
|
69
|
-
_react.screen.
|
|
70
|
-
|
|
71
|
-
_react.screen.
|
|
75
|
+
const panelTitle = _react.screen.getByText('Fake Panel');
|
|
76
|
+
_userEvent.default.hover(panelTitle);
|
|
77
|
+
_react.screen.getByLabelText('drag handle');
|
|
78
|
+
_react.screen.getByLabelText('edit panel');
|
|
79
|
+
_react.screen.getByLabelText('delete panel');
|
|
72
80
|
});
|
|
73
81
|
});
|
|
@@ -22,7 +22,7 @@ const _jsxRuntime = require("react/jsx-runtime");
|
|
|
22
22
|
const _pluginSystem = require("@perses-dev/plugin-system");
|
|
23
23
|
const _material = require("@mui/material");
|
|
24
24
|
function PanelContent(props) {
|
|
25
|
-
const {
|
|
25
|
+
const { panelPluginKind , contentDimensions , ...others } = props;
|
|
26
26
|
const { data: plugin , isLoading } = (0, _pluginSystem.usePlugin)('Panel', panelPluginKind, {
|
|
27
27
|
useErrorBoundary: true
|
|
28
28
|
});
|
|
@@ -38,6 +38,7 @@ function PanelContent(props) {
|
|
|
38
38
|
throw new Error(`Missing PanelComponent from panel plugin for kind '${panelPluginKind}'`);
|
|
39
39
|
}
|
|
40
40
|
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(PanelComponent, {
|
|
41
|
-
...
|
|
41
|
+
...others,
|
|
42
|
+
contentDimensions: contentDimensions
|
|
42
43
|
});
|
|
43
44
|
}
|
|
@@ -23,27 +23,25 @@ const _react = require("react");
|
|
|
23
23
|
const _material = require("@mui/material");
|
|
24
24
|
const _components = require("@perses-dev/components");
|
|
25
25
|
const _context = require("../../context");
|
|
26
|
-
const _panelEditorModel = require("./panel-editor-model");
|
|
27
26
|
const _panelEditorForm = require("./PanelEditorForm");
|
|
28
27
|
const PanelDrawer = ()=>{
|
|
29
|
-
const {
|
|
30
|
-
const model = (0, _panelEditorModel.usePanelDrawerModel)();
|
|
28
|
+
const { panelEditor } = (0, _context.usePanels)();
|
|
31
29
|
// When the user clicks close, start closing but don't call the store yet to keep values stable during animtation
|
|
32
30
|
const [isClosing, setIsClosing] = (0, _react.useState)(false);
|
|
33
31
|
const handleClose = ()=>setIsClosing(true);
|
|
34
32
|
// Don't call closeDrawer on the store until the Drawer has completely transitioned out
|
|
35
33
|
const handleExited = ()=>{
|
|
36
|
-
|
|
34
|
+
panelEditor === null || panelEditor === void 0 ? void 0 : panelEditor.close();
|
|
37
35
|
setIsClosing(false);
|
|
38
36
|
};
|
|
39
37
|
// Drawer is open if we have a model and we're not transitioning out
|
|
40
|
-
const isOpen =
|
|
38
|
+
const isOpen = panelEditor !== undefined && isClosing === false;
|
|
41
39
|
const handleSubmit = (values)=>{
|
|
42
40
|
// This shouldn't happen since we don't render the submit button until we have a model, but check to make TS happy
|
|
43
|
-
if (
|
|
41
|
+
if (panelEditor === undefined) {
|
|
44
42
|
throw new Error('Cannot apply changes');
|
|
45
43
|
}
|
|
46
|
-
|
|
44
|
+
panelEditor.applyChanges(values);
|
|
47
45
|
handleClose();
|
|
48
46
|
};
|
|
49
47
|
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components.Drawer, {
|
|
@@ -52,7 +50,7 @@ const PanelDrawer = ()=>{
|
|
|
52
50
|
SlideProps: {
|
|
53
51
|
onExited: handleExited
|
|
54
52
|
},
|
|
55
|
-
children:
|
|
53
|
+
children: panelEditor !== undefined && /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
56
54
|
children: [
|
|
57
55
|
/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Box, {
|
|
58
56
|
sx: {
|
|
@@ -63,9 +61,12 @@ const PanelDrawer = ()=>{
|
|
|
63
61
|
borderBottom: (theme)=>`1px solid ${theme.palette.grey[100]}`
|
|
64
62
|
},
|
|
65
63
|
children: [
|
|
66
|
-
/*#__PURE__*/ (0, _jsxRuntime.
|
|
64
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Typography, {
|
|
67
65
|
variant: "h2",
|
|
68
|
-
children:
|
|
66
|
+
children: [
|
|
67
|
+
panelEditor.mode,
|
|
68
|
+
" Panel"
|
|
69
|
+
]
|
|
69
70
|
}),
|
|
70
71
|
/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
71
72
|
direction: "row",
|
|
@@ -78,7 +79,7 @@ const PanelDrawer = ()=>{
|
|
|
78
79
|
type: "submit",
|
|
79
80
|
variant: "contained",
|
|
80
81
|
form: _panelEditorForm.panelEditorFormId,
|
|
81
|
-
children:
|
|
82
|
+
children: panelEditor.mode === 'Add' ? 'Add' : 'Apply'
|
|
82
83
|
}),
|
|
83
84
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Button, {
|
|
84
85
|
variant: "outlined",
|
|
@@ -91,7 +92,7 @@ const PanelDrawer = ()=>{
|
|
|
91
92
|
}),
|
|
92
93
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_panelEditorForm.PanelEditorForm, {
|
|
93
94
|
onSubmit: handleSubmit,
|
|
94
|
-
initialValues:
|
|
95
|
+
initialValues: panelEditor.initialValues
|
|
95
96
|
})
|
|
96
97
|
]
|
|
97
98
|
})
|
|
@@ -30,7 +30,7 @@ function _interopRequireDefault(obj) {
|
|
|
30
30
|
describe('Panel Drawer', ()=>{
|
|
31
31
|
const renderPanelDrawer = ()=>{
|
|
32
32
|
const { addMockPlugin , pluginRegistryProps } = (0, _test.mockPluginRegistryProps)();
|
|
33
|
-
addMockPlugin('Panel', '
|
|
33
|
+
addMockPlugin('Panel', 'TimeSeriesChart', _test.FAKE_PANEL_PLUGIN);
|
|
34
34
|
const { store , DashboardProviderSpy } = (0, _test.createDashboardProviderSpy)();
|
|
35
35
|
(0, _test.renderWithContext)(/*#__PURE__*/ (0, _jsxRuntime.jsx)(_pluginSystem.PluginRegistry, {
|
|
36
36
|
...pluginRegistryProps,
|
|
@@ -54,10 +54,8 @@ describe('Panel Drawer', ()=>{
|
|
|
54
54
|
it('should add new panel', async ()=>{
|
|
55
55
|
const storeApi = renderPanelDrawer();
|
|
56
56
|
// Open the drawer for a new panel (i.e. no panel key)
|
|
57
|
-
(0, _testUtils.act)(()=>storeApi.getState().
|
|
58
|
-
|
|
59
|
-
}));
|
|
60
|
-
const nameInput = await _react.screen.findByLabelText(/Panel Name/);
|
|
57
|
+
(0, _testUtils.act)(()=>storeApi.getState().addPanel(0));
|
|
58
|
+
const nameInput = await _react.screen.findByLabelText(/Name/);
|
|
61
59
|
_userEvent.default.type(nameInput, 'New Panel');
|
|
62
60
|
_userEvent.default.click(_react.screen.getByText('Add'));
|
|
63
61
|
// TODO: Assert drawer is closed?
|
|
@@ -68,8 +66,7 @@ describe('Panel Drawer', ()=>{
|
|
|
68
66
|
kind: 'Panel',
|
|
69
67
|
spec: {
|
|
70
68
|
display: {
|
|
71
|
-
name: 'New Panel'
|
|
72
|
-
description: ''
|
|
69
|
+
name: 'New Panel'
|
|
73
70
|
},
|
|
74
71
|
plugin: {
|
|
75
72
|
kind: '',
|
|
@@ -82,11 +79,11 @@ describe('Panel Drawer', ()=>{
|
|
|
82
79
|
it('should edit an existing panel', async ()=>{
|
|
83
80
|
const storeApi = renderPanelDrawer();
|
|
84
81
|
// Open the drawer for an existing panel
|
|
85
|
-
(0, _testUtils.act)(()=>storeApi.getState().
|
|
82
|
+
(0, _testUtils.act)(()=>storeApi.getState().editPanel({
|
|
86
83
|
groupIndex: 0,
|
|
87
|
-
|
|
84
|
+
itemIndex: 0
|
|
88
85
|
}));
|
|
89
|
-
const nameInput = await _react.screen.findByLabelText(/
|
|
86
|
+
const nameInput = await _react.screen.findByLabelText(/Name/);
|
|
90
87
|
_userEvent.default.clear(nameInput);
|
|
91
88
|
_userEvent.default.type(nameInput, 'cpu usage');
|
|
92
89
|
_userEvent.default.click(_react.screen.getByText('Apply'));
|
|
@@ -96,8 +93,7 @@ describe('Panel Drawer', ()=>{
|
|
|
96
93
|
kind: 'Panel',
|
|
97
94
|
spec: {
|
|
98
95
|
display: {
|
|
99
|
-
name: 'cpu usage'
|
|
100
|
-
description: ''
|
|
96
|
+
name: 'cpu usage'
|
|
101
97
|
},
|
|
102
98
|
plugin: {
|
|
103
99
|
kind: 'TimeSeriesChart',
|