@perses-dev/dashboards 0.12.0 → 0.14.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 → Dashboard/Dashboard.js} +2 -2
- package/dist/cjs/components/Dashboard/index.js +28 -0
- package/dist/cjs/components/{DashboardToolbar.js → DashboardToolbar/DashboardToolbar.js} +15 -34
- package/dist/cjs/components/DashboardToolbar/index.js +28 -0
- package/dist/cjs/components/{Panel → DeletePanelDialog}/DeletePanelDialog.js +2 -3
- package/dist/cjs/components/DeletePanelDialog/index.js +28 -0
- package/dist/cjs/components/{PanelGroupDialog → DeletePanelGroupDialog}/DeletePanelGroupDialog.js +0 -0
- package/dist/cjs/components/DeletePanelGroupDialog/index.js +28 -0
- package/dist/cjs/components/GridLayout/GridItemContent.js +11 -1
- package/dist/cjs/components/Panel/Panel.js +30 -89
- package/dist/cjs/components/Panel/Panel.test.js +93 -47
- package/dist/cjs/components/Panel/PanelHeader.js +116 -0
- package/dist/cjs/components/Panel/index.js +0 -1
- package/dist/cjs/components/PanelDrawer/PanelDrawer.js +1 -2
- package/dist/cjs/components/PanelDrawer/PanelDrawer.test.js +9 -15
- package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +7 -5
- package/dist/cjs/components/PanelDrawer/PanelPreview.js +13 -20
- package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.test.js +1 -1
- package/dist/cjs/components/PanelGroupDialog/index.js +0 -1
- package/dist/cjs/components/TimeRangeControls/TimeRangeControls.test.js +1 -1
- package/dist/cjs/components/UnsavedChangesConfirmationDialog/UnsavedChangesConfirmationDialog.js +67 -0
- package/dist/cjs/components/UnsavedChangesConfirmationDialog/index.js +28 -0
- package/dist/cjs/components/Variables/Variable.js +18 -11
- package/dist/cjs/components/index.js +4 -0
- package/dist/cjs/context/DashboardProvider/DashboardProvider.js +24 -18
- package/dist/cjs/context/DashboardProvider/common.js +1 -1
- package/dist/cjs/context/DashboardProvider/dashboard-provider-api.js +2 -4
- package/dist/cjs/context/DashboardProvider/panel-group-slice.js +47 -52
- package/dist/cjs/context/DashboardProvider/panel-slice.js +2 -13
- package/dist/cjs/context/{TemplateVariableProvider.js → TemplateVariableProvider/TemplateVariableProvider.js} +25 -12
- package/dist/cjs/context/TemplateVariableProvider/index.js +28 -0
- package/dist/cjs/context/TemplateVariableProvider/query-params.js +79 -0
- package/dist/cjs/context/TemplateVariableProvider/query-params.test.js +82 -0
- package/dist/cjs/context/index.js +1 -1
- package/dist/cjs/context/{useDashboardSpec.js → useDashboard.js} +20 -16
- package/dist/cjs/test/plugin-registry.js +14 -54
- package/dist/cjs/test/render.js +6 -2
- package/dist/cjs/utils/component-ids.js +31 -0
- package/dist/cjs/views/ViewDashboard/DashboardApp.js +42 -11
- package/dist/cjs/views/ViewDashboard/ViewDashboard.js +4 -3
- package/dist/cjs/views/ViewDashboard/tests/panelGroups.test.js +1 -1
- package/dist/components/{Dashboard.d.ts → Dashboard/Dashboard.d.ts} +0 -0
- package/dist/components/Dashboard/Dashboard.d.ts.map +1 -0
- package/dist/components/{Dashboard.js → Dashboard/Dashboard.js} +2 -2
- package/dist/components/Dashboard/Dashboard.js.map +1 -0
- package/dist/components/Dashboard/index.d.ts +2 -0
- package/dist/components/Dashboard/index.d.ts.map +1 -0
- package/dist/components/Dashboard/index.js +15 -0
- package/dist/components/Dashboard/index.js.map +1 -0
- package/dist/components/{DashboardToolbar.d.ts → DashboardToolbar/DashboardToolbar.d.ts} +3 -0
- package/dist/components/DashboardToolbar/DashboardToolbar.d.ts.map +1 -0
- package/dist/components/{DashboardToolbar.js → DashboardToolbar/DashboardToolbar.js} +11 -30
- package/dist/components/DashboardToolbar/DashboardToolbar.js.map +1 -0
- package/dist/components/DashboardToolbar/index.d.ts +2 -0
- package/dist/components/DashboardToolbar/index.d.ts.map +1 -0
- package/dist/components/DashboardToolbar/index.js +15 -0
- package/dist/components/DashboardToolbar/index.js.map +1 -0
- package/dist/components/DeletePanelDialog/DeletePanelDialog.d.ts +3 -0
- package/dist/components/DeletePanelDialog/DeletePanelDialog.d.ts.map +1 -0
- package/dist/components/{Panel → DeletePanelDialog}/DeletePanelDialog.js +1 -2
- package/dist/components/DeletePanelDialog/DeletePanelDialog.js.map +1 -0
- package/dist/components/DeletePanelDialog/index.d.ts +2 -0
- package/dist/components/DeletePanelDialog/index.d.ts.map +1 -0
- package/dist/components/DeletePanelDialog/index.js +15 -0
- package/dist/components/DeletePanelDialog/index.js.map +1 -0
- package/dist/components/{PanelGroupDialog → DeletePanelGroupDialog}/DeletePanelGroupDialog.d.ts +0 -0
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.d.ts.map +1 -0
- package/dist/components/{PanelGroupDialog → DeletePanelGroupDialog}/DeletePanelGroupDialog.js +0 -0
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js.map +1 -0
- package/dist/components/DeletePanelGroupDialog/index.d.ts +2 -0
- package/dist/components/DeletePanelGroupDialog/index.d.ts.map +1 -0
- package/dist/components/DeletePanelGroupDialog/index.js +15 -0
- package/dist/components/DeletePanelGroupDialog/index.js.map +1 -0
- package/dist/components/GridLayout/GridItemContent.d.ts.map +1 -1
- package/dist/components/GridLayout/GridItemContent.js +12 -2
- package/dist/components/GridLayout/GridItemContent.js.map +1 -1
- package/dist/components/Panel/Panel.d.ts +3 -3
- package/dist/components/Panel/Panel.d.ts.map +1 -1
- package/dist/components/Panel/Panel.js +32 -91
- package/dist/components/Panel/Panel.js.map +1 -1
- package/dist/components/Panel/Panel.test.js +95 -49
- package/dist/components/Panel/Panel.test.js.map +1 -1
- package/dist/components/Panel/PanelHeader.d.ts +16 -0
- package/dist/components/Panel/PanelHeader.d.ts.map +1 -0
- package/dist/components/Panel/PanelHeader.js +105 -0
- package/dist/components/Panel/PanelHeader.js.map +1 -0
- package/dist/components/Panel/index.d.ts +0 -1
- package/dist/components/Panel/index.d.ts.map +1 -1
- package/dist/components/Panel/index.js +0 -1
- package/dist/components/Panel/index.js.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.js +1 -2
- package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.test.js +10 -16
- package/dist/components/PanelDrawer/PanelDrawer.test.js.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.js +8 -6
- 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 +13 -20
- package/dist/components/PanelDrawer/PanelPreview.js.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.test.js +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.test.js.map +1 -1
- package/dist/components/PanelGroupDialog/index.d.ts +0 -1
- package/dist/components/PanelGroupDialog/index.d.ts.map +1 -1
- package/dist/components/PanelGroupDialog/index.js +0 -1
- package/dist/components/PanelGroupDialog/index.js.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.test.js +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.test.js.map +1 -1
- package/dist/components/UnsavedChangesConfirmationDialog/UnsavedChangesConfirmationDialog.d.ts +8 -0
- package/dist/components/UnsavedChangesConfirmationDialog/UnsavedChangesConfirmationDialog.d.ts.map +1 -0
- package/dist/components/UnsavedChangesConfirmationDialog/UnsavedChangesConfirmationDialog.js +56 -0
- package/dist/components/UnsavedChangesConfirmationDialog/UnsavedChangesConfirmationDialog.js.map +1 -0
- package/dist/components/UnsavedChangesConfirmationDialog/index.d.ts +2 -0
- package/dist/components/UnsavedChangesConfirmationDialog/index.d.ts.map +1 -0
- package/dist/components/UnsavedChangesConfirmationDialog/index.js +15 -0
- package/dist/components/UnsavedChangesConfirmationDialog/index.js.map +1 -0
- package/dist/components/Variables/Variable.d.ts.map +1 -1
- package/dist/components/Variables/Variable.js +19 -12
- package/dist/components/Variables/Variable.js.map +1 -1
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +4 -0
- package/dist/components/index.js.map +1 -1
- package/dist/context/DashboardProvider/DashboardProvider.d.ts +4 -4
- package/dist/context/DashboardProvider/DashboardProvider.d.ts.map +1 -1
- package/dist/context/DashboardProvider/DashboardProvider.js +26 -20
- package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -1
- package/dist/context/DashboardProvider/common.d.ts +1 -1
- package/dist/context/DashboardProvider/common.d.ts.map +1 -1
- package/dist/context/DashboardProvider/common.js +1 -1
- package/dist/context/DashboardProvider/common.js.map +1 -1
- package/dist/context/DashboardProvider/dashboard-provider-api.d.ts +1 -2
- package/dist/context/DashboardProvider/dashboard-provider-api.d.ts.map +1 -1
- package/dist/context/DashboardProvider/dashboard-provider-api.js +2 -4
- package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -1
- package/dist/context/DashboardProvider/index.d.ts +1 -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-group-slice.d.ts +1 -15
- package/dist/context/DashboardProvider/panel-group-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/panel-group-slice.js +38 -49
- package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-slice.d.ts +0 -9
- package/dist/context/DashboardProvider/panel-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/panel-slice.js +2 -13
- package/dist/context/DashboardProvider/panel-slice.js.map +1 -1
- package/dist/context/{TemplateVariableProvider.d.ts → TemplateVariableProvider/TemplateVariableProvider.d.ts} +0 -0
- package/dist/context/TemplateVariableProvider/TemplateVariableProvider.d.ts.map +1 -0
- package/dist/context/{TemplateVariableProvider.js → TemplateVariableProvider/TemplateVariableProvider.js} +25 -12
- package/dist/context/TemplateVariableProvider/TemplateVariableProvider.js.map +1 -0
- package/dist/context/TemplateVariableProvider/index.d.ts +2 -0
- package/dist/context/TemplateVariableProvider/index.d.ts.map +1 -0
- package/dist/context/TemplateVariableProvider/index.js +15 -0
- package/dist/context/TemplateVariableProvider/index.js.map +1 -0
- package/dist/context/TemplateVariableProvider/query-params.d.ts +12 -0
- package/dist/context/TemplateVariableProvider/query-params.d.ts.map +1 -0
- package/dist/context/TemplateVariableProvider/query-params.js +64 -0
- package/dist/context/TemplateVariableProvider/query-params.js.map +1 -0
- package/dist/context/TemplateVariableProvider/query-params.test.d.ts +2 -0
- package/dist/context/TemplateVariableProvider/query-params.test.d.ts.map +1 -0
- package/dist/context/TemplateVariableProvider/query-params.test.js +80 -0
- package/dist/context/TemplateVariableProvider/query-params.test.js.map +1 -0
- 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/useDashboard.d.ts +6 -0
- package/dist/context/useDashboard.d.ts.map +1 -0
- package/dist/context/{useDashboardSpec.js → useDashboard.js} +19 -15
- package/dist/context/useDashboard.js.map +1 -0
- package/dist/test/plugin-registry.d.ts +2 -11
- package/dist/test/plugin-registry.d.ts.map +1 -1
- package/dist/test/plugin-registry.js +12 -49
- package/dist/test/plugin-registry.js.map +1 -1
- package/dist/test/render.d.ts.map +1 -1
- package/dist/test/render.js +6 -2
- package/dist/test/render.js.map +1 -1
- package/dist/utils/component-ids.d.ts +8 -0
- package/dist/utils/component-ids.d.ts.map +1 -0
- package/dist/utils/component-ids.js +27 -0
- package/dist/utils/component-ids.js.map +1 -0
- 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 +42 -6
- 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 +4 -3
- package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -1
- package/dist/views/ViewDashboard/tests/panelGroups.test.js +1 -1
- package/dist/views/ViewDashboard/tests/panelGroups.test.js.map +1 -1
- package/package.json +5 -4
- package/dist/components/Dashboard.d.ts.map +0 -1
- package/dist/components/Dashboard.js.map +0 -1
- package/dist/components/DashboardToolbar.d.ts.map +0 -1
- package/dist/components/DashboardToolbar.js.map +0 -1
- package/dist/components/Panel/DeletePanelDialog.d.ts +0 -4
- package/dist/components/Panel/DeletePanelDialog.d.ts.map +0 -1
- package/dist/components/Panel/DeletePanelDialog.js.map +0 -1
- package/dist/components/PanelGroupDialog/DeletePanelGroupDialog.d.ts.map +0 -1
- package/dist/components/PanelGroupDialog/DeletePanelGroupDialog.js.map +0 -1
- package/dist/context/TemplateVariableProvider.d.ts.map +0 -1
- package/dist/context/TemplateVariableProvider.js.map +0 -1
- package/dist/context/useDashboardSpec.d.ts +0 -11
- package/dist/context/useDashboardSpec.d.ts.map +0 -1
- package/dist/context/useDashboardSpec.js.map +0 -1
|
@@ -21,8 +21,8 @@ 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("
|
|
25
|
-
const _gridLayout = require("
|
|
24
|
+
const _context = require("../../context");
|
|
25
|
+
const _gridLayout = require("../GridLayout");
|
|
26
26
|
function Dashboard(props) {
|
|
27
27
|
const panelGroupIds = (0, _context.usePanelGroupIds)();
|
|
28
28
|
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Box, {
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
_exportStar(require("./Dashboard"), exports);
|
|
18
|
+
function _exportStar(from, to) {
|
|
19
|
+
Object.keys(from).forEach(function(k) {
|
|
20
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function() {
|
|
23
|
+
return from[k];
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
return from;
|
|
28
|
+
}
|
|
@@ -19,39 +19,29 @@ Object.defineProperty(exports, "DashboardToolbar", {
|
|
|
19
19
|
get: ()=>DashboardToolbar
|
|
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 _pencilOutline = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/PencilOutline"));
|
|
25
24
|
const _plusBoxOutline = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/PlusBoxOutline"));
|
|
26
25
|
const _chartBoxPlusOutline = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/ChartBoxPlusOutline"));
|
|
27
26
|
const _components = require("@perses-dev/components");
|
|
28
|
-
const _context = require("
|
|
29
|
-
const
|
|
27
|
+
const _context = require("../../context");
|
|
28
|
+
const _variables = require("../Variables");
|
|
29
|
+
const _timeRangeControls = require("../TimeRangeControls");
|
|
30
30
|
function _interopRequireDefault(obj) {
|
|
31
31
|
return obj && obj.__esModule ? obj : {
|
|
32
32
|
default: obj
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
const DashboardToolbar = (props)=>{
|
|
36
|
-
const { dashboardName } = props;
|
|
36
|
+
const { dashboardName , dashboardTitleComponent , onEditButtonClick , onCancelButtonClick } = props;
|
|
37
37
|
const { isEditMode , setEditMode } = (0, _context.useEditMode)();
|
|
38
|
-
const { openAddPanelGroup , openAddPanel
|
|
38
|
+
const { openAddPanelGroup , openAddPanel } = (0, _context.useDashboardActions)();
|
|
39
39
|
const isLaptopSize = (0, _material.useMediaQuery)((0, _material.useTheme)().breakpoints.up('sm'));
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
setEditMode(true);
|
|
45
|
-
};
|
|
46
|
-
const onCancelButtonClick = ()=>{
|
|
47
|
-
// Reset to the original spec and exit edit mode
|
|
48
|
-
if (originalSpec) {
|
|
49
|
-
resetSpec(originalSpec);
|
|
50
|
-
}
|
|
51
|
-
setEditMode(false);
|
|
52
|
-
};
|
|
40
|
+
const dashboardTitle = dashboardTitleComponent ? dashboardTitleComponent : /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Typography, {
|
|
41
|
+
variant: "h2",
|
|
42
|
+
children: dashboardName
|
|
43
|
+
});
|
|
53
44
|
const onSave = ()=>{
|
|
54
|
-
save();
|
|
55
45
|
setEditMode(false);
|
|
56
46
|
};
|
|
57
47
|
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
@@ -66,13 +56,7 @@ const DashboardToolbar = (props)=>{
|
|
|
66
56
|
padding: 2,
|
|
67
57
|
display: "flex",
|
|
68
58
|
children: [
|
|
69
|
-
|
|
70
|
-
variant: "h2",
|
|
71
|
-
children: [
|
|
72
|
-
"Edit ",
|
|
73
|
-
dashboardName
|
|
74
|
-
]
|
|
75
|
-
}),
|
|
59
|
+
dashboardTitle,
|
|
76
60
|
/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
77
61
|
direction: "row",
|
|
78
62
|
spacing: 1,
|
|
@@ -105,7 +89,7 @@ const DashboardToolbar = (props)=>{
|
|
|
105
89
|
children: [
|
|
106
90
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_components.ErrorBoundary, {
|
|
107
91
|
FallbackComponent: _components.ErrorAlert,
|
|
108
|
-
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(
|
|
92
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_variables.TemplateVariableList, {})
|
|
109
93
|
}),
|
|
110
94
|
/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
111
95
|
direction: 'row',
|
|
@@ -124,7 +108,7 @@ const DashboardToolbar = (props)=>{
|
|
|
124
108
|
onClick: openAddPanel,
|
|
125
109
|
children: "Add Panel"
|
|
126
110
|
}),
|
|
127
|
-
/*#__PURE__*/ (0, _jsxRuntime.jsx)(
|
|
111
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_timeRangeControls.TimeRangeControls, {})
|
|
128
112
|
]
|
|
129
113
|
})
|
|
130
114
|
]
|
|
@@ -140,10 +124,7 @@ const DashboardToolbar = (props)=>{
|
|
|
140
124
|
width: '100%'
|
|
141
125
|
},
|
|
142
126
|
children: [
|
|
143
|
-
|
|
144
|
-
variant: "h2",
|
|
145
|
-
children: dashboardName
|
|
146
|
-
}),
|
|
127
|
+
dashboardTitle,
|
|
147
128
|
/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
148
129
|
direction: "row",
|
|
149
130
|
spacing: 2,
|
|
@@ -151,7 +132,7 @@ const DashboardToolbar = (props)=>{
|
|
|
151
132
|
marginLeft: 'auto'
|
|
152
133
|
},
|
|
153
134
|
children: [
|
|
154
|
-
/*#__PURE__*/ (0, _jsxRuntime.jsx)(
|
|
135
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_timeRangeControls.TimeRangeControls, {}),
|
|
155
136
|
isLaptopSize && /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Button, {
|
|
156
137
|
variant: "outlined",
|
|
157
138
|
startIcon: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pencilOutline.default, {}),
|
|
@@ -169,7 +150,7 @@ const DashboardToolbar = (props)=>{
|
|
|
169
150
|
paddingY: 2,
|
|
170
151
|
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components.ErrorBoundary, {
|
|
171
152
|
FallbackComponent: _components.ErrorAlert,
|
|
172
|
-
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(
|
|
153
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_variables.TemplateVariableList, {})
|
|
173
154
|
})
|
|
174
155
|
})
|
|
175
156
|
]
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
_exportStar(require("./DashboardToolbar"), exports);
|
|
18
|
+
function _exportStar(from, to) {
|
|
19
|
+
Object.keys(from).forEach(function(k) {
|
|
20
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function() {
|
|
23
|
+
return from[k];
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
return from;
|
|
28
|
+
}
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
-
Object.defineProperty(exports, "
|
|
17
|
+
Object.defineProperty(exports, "DeletePanelDialog", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()=>
|
|
19
|
+
get: ()=>DeletePanelDialog
|
|
20
20
|
});
|
|
21
21
|
const _jsxRuntime = require("react/jsx-runtime");
|
|
22
22
|
const _material = require("@mui/material");
|
|
@@ -90,4 +90,3 @@ const DeletePanelForm = ({ deletePanelDialog })=>{
|
|
|
90
90
|
]
|
|
91
91
|
});
|
|
92
92
|
};
|
|
93
|
-
const _default = DeletePanelDialog;
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
_exportStar(require("./DeletePanelDialog"), exports);
|
|
18
|
+
function _exportStar(from, to) {
|
|
19
|
+
Object.keys(from).forEach(function(k) {
|
|
20
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function() {
|
|
23
|
+
return from[k];
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
return from;
|
|
28
|
+
}
|
package/dist/cjs/components/{PanelGroupDialog → DeletePanelGroupDialog}/DeletePanelGroupDialog.js
RENAMED
|
File without changes
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
_exportStar(require("./DeletePanelGroupDialog"), exports);
|
|
18
|
+
function _exportStar(from, to) {
|
|
19
|
+
Object.keys(from).forEach(function(k) {
|
|
20
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function() {
|
|
23
|
+
return from[k];
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
return from;
|
|
28
|
+
}
|
|
@@ -24,8 +24,18 @@ const _panel = require("../Panel/Panel");
|
|
|
24
24
|
function GridItemContent(props) {
|
|
25
25
|
const { panelGroupItemId } = props;
|
|
26
26
|
const panelDefinition = (0, _context.usePanel)(panelGroupItemId);
|
|
27
|
+
const { isEditMode } = (0, _context.useEditMode)();
|
|
28
|
+
const { openEditPanel , openDeletePanelDialog } = (0, _context.usePanelActions)(panelGroupItemId);
|
|
29
|
+
// Provide actions to the panel when in edit mode
|
|
30
|
+
let editHandlers = undefined;
|
|
31
|
+
if (isEditMode) {
|
|
32
|
+
editHandlers = {
|
|
33
|
+
onEditPanelClick: openEditPanel,
|
|
34
|
+
onDeletePanelClick: openDeletePanelDialog
|
|
35
|
+
};
|
|
36
|
+
}
|
|
27
37
|
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_panel.Panel, {
|
|
28
38
|
definition: panelDefinition,
|
|
29
|
-
|
|
39
|
+
editHandlers: editHandlers
|
|
30
40
|
});
|
|
31
41
|
}
|
|
@@ -24,11 +24,8 @@ 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
|
|
28
|
-
const
|
|
29
|
-
const _deleteOutline = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/DeleteOutline"));
|
|
30
|
-
const _dragVertical = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/DragVertical"));
|
|
31
|
-
const _context = require("../../context");
|
|
27
|
+
const _componentIds = require("../../utils/component-ids");
|
|
28
|
+
const _panelHeader = require("./PanelHeader");
|
|
32
29
|
const _panelContent = require("./PanelContent");
|
|
33
30
|
function _interopRequireDefault(obj) {
|
|
34
31
|
return obj && obj.__esModule ? obj : {
|
|
@@ -36,7 +33,10 @@ function _interopRequireDefault(obj) {
|
|
|
36
33
|
};
|
|
37
34
|
}
|
|
38
35
|
function Panel(props) {
|
|
39
|
-
const { definition ,
|
|
36
|
+
const { definition , editHandlers , onMouseEnter , onMouseLeave , sx , ...others } = props;
|
|
37
|
+
// Make sure we have an ID we can use for aria attributes
|
|
38
|
+
const generatedPanelId = (0, _componentIds.useId)('Panel');
|
|
39
|
+
const headerId = `${generatedPanelId}-header`;
|
|
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)({
|
|
@@ -59,102 +59,47 @@ function Panel(props) {
|
|
|
59
59
|
});
|
|
60
60
|
// TODO: adjust padding for small panels, consistent way to determine isLargePanel here and in StatChart
|
|
61
61
|
const panelPadding = 1.5;
|
|
62
|
-
const
|
|
63
|
-
|
|
62
|
+
const handleMouseEnter = (e)=>{
|
|
63
|
+
setIsHovered(true);
|
|
64
|
+
onMouseEnter === null || onMouseEnter === void 0 ? void 0 : onMouseEnter(e);
|
|
65
|
+
};
|
|
66
|
+
const handleMouseLeave = (e)=>{
|
|
67
|
+
setIsHovered(false);
|
|
68
|
+
onMouseLeave === null || onMouseLeave === void 0 ? void 0 : onMouseLeave(e);
|
|
69
|
+
};
|
|
64
70
|
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Card, {
|
|
65
71
|
ref: ref,
|
|
66
|
-
|
|
67
|
-
|
|
72
|
+
component: "section",
|
|
73
|
+
sx: (0, _components.combineSx)({
|
|
68
74
|
width: '100%',
|
|
69
75
|
height: '100%',
|
|
70
76
|
display: 'flex',
|
|
71
77
|
flexFlow: 'column nowrap'
|
|
72
|
-
},
|
|
78
|
+
}, sx),
|
|
73
79
|
variant: "outlined",
|
|
80
|
+
onMouseEnter: handleMouseEnter,
|
|
81
|
+
onMouseLeave: handleMouseLeave,
|
|
82
|
+
"aria-labelledby": headerId,
|
|
83
|
+
"aria-describedby": headerId,
|
|
74
84
|
...others,
|
|
75
|
-
onMouseEnter: ()=>setIsHovered(true),
|
|
76
|
-
onMouseLeave: ()=>setIsHovered(false),
|
|
77
85
|
children: [
|
|
78
|
-
/*#__PURE__*/ (0, _jsxRuntime.jsx)(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
},
|
|
85
|
-
children: [
|
|
86
|
-
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Typography, {
|
|
87
|
-
variant: "subtitle1",
|
|
88
|
-
whiteSpace: "nowrap",
|
|
89
|
-
overflow: "hidden",
|
|
90
|
-
textOverflow: "ellipsis",
|
|
91
|
-
children: definition.spec.display.name
|
|
92
|
-
}),
|
|
93
|
-
/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Box, {
|
|
94
|
-
sx: {
|
|
95
|
-
display: 'flex',
|
|
96
|
-
alignItems: 'center',
|
|
97
|
-
marginLeft: 'auto'
|
|
98
|
-
},
|
|
99
|
-
children: [
|
|
100
|
-
!isEditMode && isHovered && definition.spec.display.description && /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components.InfoTooltip, {
|
|
101
|
-
id: "info-tooltip",
|
|
102
|
-
description: definition.spec.display.description,
|
|
103
|
-
placement: _components.TooltipPlacement.Bottom,
|
|
104
|
-
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_informationOutline.default, {
|
|
105
|
-
"aria-describedby": "info-tooltip",
|
|
106
|
-
"aria-hidden": false,
|
|
107
|
-
sx: {
|
|
108
|
-
cursor: 'pointer',
|
|
109
|
-
color: (theme)=>theme.palette.grey[700]
|
|
110
|
-
}
|
|
111
|
-
})
|
|
112
|
-
}),
|
|
113
|
-
isEditMode && isHovered && /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
114
|
-
direction: "row",
|
|
115
|
-
alignItems: "center",
|
|
116
|
-
spacing: 0.5,
|
|
117
|
-
children: [
|
|
118
|
-
/*#__PURE__*/ (0, _jsxRuntime.jsx)(IconButton, {
|
|
119
|
-
"aria-label": "edit panel",
|
|
120
|
-
size: "small",
|
|
121
|
-
onClick: openEditPanel,
|
|
122
|
-
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pencilOutline.default, {})
|
|
123
|
-
}),
|
|
124
|
-
/*#__PURE__*/ (0, _jsxRuntime.jsx)(IconButton, {
|
|
125
|
-
"aria-label": "delete panel",
|
|
126
|
-
size: "small",
|
|
127
|
-
onClick: openDeletePanelDialog,
|
|
128
|
-
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_deleteOutline.default, {})
|
|
129
|
-
}),
|
|
130
|
-
/*#__PURE__*/ (0, _jsxRuntime.jsx)(IconButton, {
|
|
131
|
-
"aria-label": "drag handle",
|
|
132
|
-
size: "small",
|
|
133
|
-
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_dragVertical.default, {
|
|
134
|
-
className: "drag-handle",
|
|
135
|
-
sx: {
|
|
136
|
-
cursor: 'grab'
|
|
137
|
-
}
|
|
138
|
-
})
|
|
139
|
-
})
|
|
140
|
-
]
|
|
141
|
-
})
|
|
142
|
-
]
|
|
143
|
-
})
|
|
144
|
-
]
|
|
145
|
-
}),
|
|
86
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_panelHeader.PanelHeader, {
|
|
87
|
+
id: headerId,
|
|
88
|
+
title: definition.spec.display.name,
|
|
89
|
+
description: definition.spec.display.description,
|
|
90
|
+
editHandlers: editHandlers,
|
|
91
|
+
isHovered: isHovered,
|
|
146
92
|
sx: {
|
|
147
|
-
|
|
148
|
-
paddingX: (theme)=>theme.spacing(panelPadding),
|
|
149
|
-
paddingY: '4px',
|
|
150
|
-
borderBottom: (theme)=>`solid 1px ${theme.palette.divider}`
|
|
93
|
+
paddingX: (theme)=>theme.spacing(panelPadding)
|
|
151
94
|
}
|
|
152
95
|
}),
|
|
153
96
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.CardContent, {
|
|
97
|
+
component: "figure",
|
|
154
98
|
sx: {
|
|
155
99
|
position: 'relative',
|
|
156
100
|
overflow: 'hidden',
|
|
157
101
|
flexGrow: 1,
|
|
102
|
+
margin: 0,
|
|
158
103
|
padding: (theme)=>theme.spacing(panelPadding),
|
|
159
104
|
// Override MUI default style for last-child
|
|
160
105
|
':last-child': {
|
|
@@ -174,7 +119,3 @@ function Panel(props) {
|
|
|
174
119
|
]
|
|
175
120
|
});
|
|
176
121
|
}
|
|
177
|
-
const IconButton = (0, _material.styled)(_material.IconButton)(({ theme })=>({
|
|
178
|
-
borderRadius: theme.shape.borderRadius,
|
|
179
|
-
padding: '4px'
|
|
180
|
-
}));
|
|
@@ -15,11 +15,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
17
|
const _jsxRuntime = require("react/jsx-runtime");
|
|
18
|
-
const _pluginSystem = require("@perses-dev/plugin-system");
|
|
19
18
|
const _react = require("@testing-library/react");
|
|
20
19
|
const _userEvent = /*#__PURE__*/ _interopRequireDefault(require("@testing-library/user-event"));
|
|
21
20
|
const _test = require("../../test");
|
|
22
|
-
const _context = require("../../context");
|
|
23
21
|
const _panel = require("./Panel");
|
|
24
22
|
function _interopRequireDefault(obj) {
|
|
25
23
|
return obj && obj.__esModule ? obj : {
|
|
@@ -27,57 +25,105 @@ function _interopRequireDefault(obj) {
|
|
|
27
25
|
};
|
|
28
26
|
}
|
|
29
27
|
describe('Panel', ()=>{
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
plugin: {
|
|
41
|
-
kind: 'FakePanel',
|
|
42
|
-
spec: {}
|
|
43
|
-
}
|
|
28
|
+
const createTestPanel = ()=>({
|
|
29
|
+
kind: 'Panel',
|
|
30
|
+
spec: {
|
|
31
|
+
display: {
|
|
32
|
+
name: 'Fake Panel Title',
|
|
33
|
+
description: 'This is a fake panel'
|
|
34
|
+
},
|
|
35
|
+
plugin: {
|
|
36
|
+
kind: 'TimeSeriesChart',
|
|
37
|
+
spec: {}
|
|
44
38
|
}
|
|
45
|
-
},
|
|
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
39
|
}
|
|
51
|
-
};
|
|
52
|
-
};
|
|
40
|
+
});
|
|
53
41
|
// Helper to render the panel with some context set
|
|
54
|
-
const renderPanel = (
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_context.DashboardProvider, {
|
|
60
|
-
initialState: {
|
|
61
|
-
dashboardSpec: (0, _test.getTestDashboard)().spec,
|
|
62
|
-
isEditMode
|
|
63
|
-
},
|
|
64
|
-
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_panel.Panel, {
|
|
65
|
-
...createPanelProps()
|
|
66
|
-
})
|
|
67
|
-
})
|
|
42
|
+
const renderPanel = (definition, editHandlers)=>{
|
|
43
|
+
definition !== null && definition !== void 0 ? definition : definition = createTestPanel();
|
|
44
|
+
(0, _test.renderWithContext)(/*#__PURE__*/ (0, _jsxRuntime.jsx)(_panel.Panel, {
|
|
45
|
+
definition: definition,
|
|
46
|
+
editHandlers: editHandlers
|
|
68
47
|
}));
|
|
69
48
|
};
|
|
70
|
-
|
|
49
|
+
// Helper to get the panel once rendered
|
|
50
|
+
const getPanel = ()=>_react.screen.getByRole('region', {
|
|
51
|
+
name: 'Fake Panel Title'
|
|
52
|
+
});
|
|
53
|
+
it('should render panel', async ()=>{
|
|
71
54
|
renderPanel();
|
|
72
|
-
|
|
73
|
-
|
|
55
|
+
const panel = getPanel();
|
|
56
|
+
expect(panel).toBeInTheDocument();
|
|
57
|
+
// Should diplay header with panel's title
|
|
58
|
+
const header = _react.screen.getByRole('banner');
|
|
59
|
+
expect(header).toHaveTextContent('Fake Panel Title');
|
|
60
|
+
// Should display chart's content from the fake panel plugin
|
|
61
|
+
const content = _react.screen.getByRole('figure');
|
|
62
|
+
await (0, _react.waitFor)(()=>{
|
|
63
|
+
expect(content).toHaveTextContent('TimeSeriesChart panel');
|
|
64
|
+
});
|
|
65
|
+
expect(content);
|
|
66
|
+
});
|
|
67
|
+
it('shows panel description', async ()=>{
|
|
68
|
+
renderPanel();
|
|
69
|
+
const panel = getPanel();
|
|
70
|
+
// Description button should not be visible until hover on panel
|
|
71
|
+
const missingButton = _react.screen.queryByRole('button', {
|
|
72
|
+
name: /description/i
|
|
73
|
+
});
|
|
74
|
+
expect(missingButton).not.toBeInTheDocument();
|
|
75
|
+
_userEvent.default.hover(panel);
|
|
76
|
+
const descriptionButton = _react.screen.getByRole('button', {
|
|
77
|
+
name: /description/i
|
|
78
|
+
});
|
|
79
|
+
expect(descriptionButton).toBeInTheDocument();
|
|
80
|
+
// Can hover to see panel description in tooltip
|
|
81
|
+
_userEvent.default.hover(descriptionButton);
|
|
82
|
+
const tooltip = await _react.screen.findByRole('tooltip');
|
|
83
|
+
expect(tooltip).toHaveTextContent('This is a fake panel');
|
|
84
|
+
});
|
|
85
|
+
it('does not show description when panel does not have one', ()=>{
|
|
86
|
+
// Render a panel without a description set
|
|
87
|
+
const withoutDescription = createTestPanel();
|
|
88
|
+
withoutDescription.spec.display.description = undefined;
|
|
89
|
+
renderPanel(withoutDescription);
|
|
90
|
+
const panel = getPanel();
|
|
91
|
+
_userEvent.default.hover(panel);
|
|
92
|
+
const descriptionButton = _react.screen.queryByRole('button', {
|
|
93
|
+
name: /description/i
|
|
94
|
+
});
|
|
95
|
+
expect(descriptionButton).not.toBeInTheDocument();
|
|
96
|
+
});
|
|
97
|
+
it('does not show description in edit mode', ()=>{
|
|
98
|
+
renderPanel(undefined, {
|
|
99
|
+
onEditPanelClick: jest.fn(),
|
|
100
|
+
onDeletePanelClick: jest.fn()
|
|
101
|
+
});
|
|
102
|
+
const panel = getPanel();
|
|
103
|
+
_userEvent.default.hover(panel);
|
|
104
|
+
const descriptionButton = _react.screen.queryByRole('button', {
|
|
105
|
+
name: /description/i
|
|
106
|
+
});
|
|
107
|
+
expect(descriptionButton).not.toBeInTheDocument();
|
|
74
108
|
});
|
|
75
|
-
it('
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
109
|
+
it('can trigger panel actions in edit mode', ()=>{
|
|
110
|
+
const onEditPanelClick = jest.fn();
|
|
111
|
+
const onDeletePanelClick = jest.fn();
|
|
112
|
+
renderPanel(undefined, {
|
|
113
|
+
onEditPanelClick,
|
|
114
|
+
onDeletePanelClick
|
|
115
|
+
});
|
|
116
|
+
const panel = getPanel();
|
|
117
|
+
_userEvent.default.hover(panel);
|
|
118
|
+
const editButton = _react.screen.getByRole('button', {
|
|
119
|
+
name: /edit/i
|
|
120
|
+
});
|
|
121
|
+
_userEvent.default.click(editButton);
|
|
122
|
+
const deleteButton = _react.screen.getByRole('button', {
|
|
123
|
+
name: /delete/i
|
|
124
|
+
});
|
|
125
|
+
_userEvent.default.click(deleteButton);
|
|
126
|
+
expect(onEditPanelClick).toHaveBeenCalledTimes(1);
|
|
127
|
+
expect(onDeletePanelClick).toHaveBeenCalledTimes(1);
|
|
82
128
|
});
|
|
83
129
|
});
|