@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,6 +24,8 @@ const _material = require("@mui/material");
|
|
|
24
24
|
const _useImmer = require("use-immer");
|
|
25
25
|
const _pencil = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/Pencil"));
|
|
26
26
|
const _trashCan = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/TrashCan"));
|
|
27
|
+
const _arrowUp = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/ArrowUp"));
|
|
28
|
+
const _arrowDown = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/ArrowDown"));
|
|
27
29
|
const _variableEditorForm = require("./VariableEditorForm");
|
|
28
30
|
function _interopRequireDefault(obj) {
|
|
29
31
|
return obj && obj.__esModule ? obj : {
|
|
@@ -64,6 +66,27 @@ function VariableEditor(props) {
|
|
|
64
66
|
v.spec.display.hidden = visible === false;
|
|
65
67
|
});
|
|
66
68
|
};
|
|
69
|
+
const changeVariableOrder = (index, direction)=>{
|
|
70
|
+
setVariableDefinitions((draft)=>{
|
|
71
|
+
if (direction === 'up') {
|
|
72
|
+
const prevElement = draft[index - 1];
|
|
73
|
+
const currentElement = draft[index];
|
|
74
|
+
if (index === 0 || !prevElement || !currentElement) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
draft[index - 1] = currentElement;
|
|
78
|
+
draft[index] = prevElement;
|
|
79
|
+
} else {
|
|
80
|
+
const nextElement = draft[index + 1];
|
|
81
|
+
const currentElement1 = draft[index];
|
|
82
|
+
if (index === draft.length - 1 || !nextElement || !currentElement1) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
draft[index + 1] = currentElement1;
|
|
86
|
+
draft[index] = nextElement;
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
};
|
|
67
90
|
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Box, {
|
|
68
91
|
p: 4,
|
|
69
92
|
children: [
|
|
@@ -94,18 +117,19 @@ function VariableEditor(props) {
|
|
|
94
117
|
justifyContent: "end",
|
|
95
118
|
children: [
|
|
96
119
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Button, {
|
|
120
|
+
disabled: props.variableDefinitions === variableDefinitions,
|
|
121
|
+
variant: "contained",
|
|
97
122
|
onClick: ()=>{
|
|
98
|
-
props.
|
|
123
|
+
props.onChange(variableDefinitions);
|
|
99
124
|
},
|
|
100
|
-
children: "
|
|
125
|
+
children: "Apply"
|
|
101
126
|
}),
|
|
102
127
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Button, {
|
|
103
|
-
|
|
104
|
-
variant: "contained",
|
|
128
|
+
variant: "outlined",
|
|
105
129
|
onClick: ()=>{
|
|
106
|
-
props.
|
|
130
|
+
props.onCancel();
|
|
107
131
|
},
|
|
108
|
-
children: "
|
|
132
|
+
children: "Cancel"
|
|
109
133
|
})
|
|
110
134
|
]
|
|
111
135
|
}),
|
|
@@ -173,6 +197,16 @@ function VariableEditor(props) {
|
|
|
173
197
|
/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.TableCell, {
|
|
174
198
|
align: "right",
|
|
175
199
|
children: [
|
|
200
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
201
|
+
onClick: ()=>changeVariableOrder(idx, 'up'),
|
|
202
|
+
disabled: idx === 0,
|
|
203
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_arrowUp.default, {})
|
|
204
|
+
}),
|
|
205
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
206
|
+
onClick: ()=>changeVariableOrder(idx, 'down'),
|
|
207
|
+
disabled: idx === variableDefinitions.length - 1,
|
|
208
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_arrowDown.default, {})
|
|
209
|
+
}),
|
|
176
210
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
177
211
|
onClick: ()=>setVariableEditIdx(idx),
|
|
178
212
|
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pencil.default, {})
|
|
@@ -54,6 +54,7 @@ function VariableEditForm({ initialVariableDefinition , onChange , onCancel })
|
|
|
54
54
|
item: true,
|
|
55
55
|
xs: 6,
|
|
56
56
|
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.TextField, {
|
|
57
|
+
fullWidth: true,
|
|
57
58
|
label: "Name",
|
|
58
59
|
value: state.name,
|
|
59
60
|
onChange: (v)=>{
|
|
@@ -95,6 +96,7 @@ function VariableEditForm({ initialVariableDefinition , onChange , onCancel })
|
|
|
95
96
|
item: true,
|
|
96
97
|
xs: 6,
|
|
97
98
|
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.TextField, {
|
|
99
|
+
fullWidth: true,
|
|
98
100
|
label: "Label",
|
|
99
101
|
value: state.label,
|
|
100
102
|
onChange: (v)=>{
|
|
@@ -108,6 +110,7 @@ function VariableEditForm({ initialVariableDefinition , onChange , onCancel })
|
|
|
108
110
|
item: true,
|
|
109
111
|
xs: 12,
|
|
110
112
|
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.TextField, {
|
|
113
|
+
fullWidth: true,
|
|
111
114
|
label: "Description",
|
|
112
115
|
value: state.description,
|
|
113
116
|
onChange: (v)=>{
|
|
@@ -217,17 +220,18 @@ function VariableEditForm({ initialVariableDefinition , onChange , onCancel })
|
|
|
217
220
|
justifyContent: "end",
|
|
218
221
|
children: [
|
|
219
222
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Button, {
|
|
223
|
+
variant: "contained",
|
|
220
224
|
onClick: ()=>{
|
|
221
|
-
|
|
225
|
+
onChange((0, _variableEditorFormModel.getVariableDefinitionFromState)(state));
|
|
222
226
|
},
|
|
223
|
-
children: "
|
|
227
|
+
children: "Update"
|
|
224
228
|
}),
|
|
225
229
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Button, {
|
|
226
|
-
variant: "
|
|
230
|
+
variant: "outlined",
|
|
227
231
|
onClick: ()=>{
|
|
228
|
-
|
|
232
|
+
onCancel();
|
|
229
233
|
},
|
|
230
|
-
children: "
|
|
234
|
+
children: "Cancel"
|
|
231
235
|
})
|
|
232
236
|
]
|
|
233
237
|
})
|
|
@@ -39,7 +39,6 @@ function TemplateVariableList() {
|
|
|
39
39
|
const showVariables = isEditMode ? showVariablesInEditMode : true;
|
|
40
40
|
const { setVariableDefinitions } = (0, _context.useTemplateVariableActions)();
|
|
41
41
|
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Box, {
|
|
42
|
-
m: 2,
|
|
43
42
|
children: [
|
|
44
43
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Drawer, {
|
|
45
44
|
anchor: 'right',
|
|
@@ -18,6 +18,7 @@ _exportStar(require("./Dashboard"), exports);
|
|
|
18
18
|
_exportStar(require("./GridLayout"), exports);
|
|
19
19
|
_exportStar(require("./Panel"), exports);
|
|
20
20
|
_exportStar(require("./PanelDrawer"), exports);
|
|
21
|
+
_exportStar(require("./PanelGroupDialog"), exports);
|
|
21
22
|
_exportStar(require("./TimeRangeControls"), exports);
|
|
22
23
|
_exportStar(require("./Variables"), exports);
|
|
23
24
|
function _exportStar(from, to) {
|
|
@@ -31,9 +31,12 @@ const _middleware = require("zustand/middleware");
|
|
|
31
31
|
const _immer = require("zustand/middleware/immer");
|
|
32
32
|
const _shallow = /*#__PURE__*/ _interopRequireDefault(require("zustand/shallow"));
|
|
33
33
|
const _react = require("react");
|
|
34
|
+
const _panelGroupEditorSlice = require("./panel-group-editor-slice");
|
|
34
35
|
const _panelGroupSlice = require("./panel-group-slice");
|
|
35
|
-
const
|
|
36
|
-
const
|
|
36
|
+
const _panelEditorSlice = require("./panel-editor-slice");
|
|
37
|
+
const _panelSlice = require("./panel-slice");
|
|
38
|
+
const _deletePanelGroupSlice = require("./delete-panel-group-slice");
|
|
39
|
+
const _deletePanelSlice = require("./delete-panel-slice");
|
|
37
40
|
function _interopRequireDefault(obj) {
|
|
38
41
|
return obj && obj.__esModule ? obj : {
|
|
39
42
|
default: obj
|
|
@@ -51,16 +54,31 @@ function DashboardProvider(props) {
|
|
|
51
54
|
const { children , initialState: { dashboardSpec , isEditMode } , } = props;
|
|
52
55
|
const { layouts , panels } = dashboardSpec;
|
|
53
56
|
const dashboardStore = (0, _zustand.createStore)()((0, _immer.immer)((0, _middleware.devtools)((...args)=>{
|
|
54
|
-
const [set] = args;
|
|
57
|
+
const [set, get] = args;
|
|
55
58
|
return {
|
|
56
|
-
...(0, _panelGroupSlice.createPanelGroupSlice)(...args),
|
|
57
|
-
...(0,
|
|
58
|
-
...(0,
|
|
59
|
-
|
|
59
|
+
...(0, _panelGroupSlice.createPanelGroupSlice)(layouts)(...args),
|
|
60
|
+
...(0, _panelSlice.createPanelSlice)(panels)(...args),
|
|
61
|
+
...(0, _panelGroupEditorSlice.createPanelGroupEditorSlice)(...args),
|
|
62
|
+
...(0, _deletePanelGroupSlice.createDeletePanelGroupSlice)(...args),
|
|
63
|
+
...(0, _panelEditorSlice.createPanelEditorSlice)()(...args),
|
|
64
|
+
...(0, _deletePanelSlice.createDeletePanelSlice)()(...args),
|
|
65
|
+
defaultTimeRange: {
|
|
66
|
+
pastDuration: dashboardSpec.duration
|
|
67
|
+
},
|
|
60
68
|
isEditMode: !!isEditMode,
|
|
61
69
|
setEditMode: (isEditMode)=>set({
|
|
62
70
|
isEditMode
|
|
63
|
-
})
|
|
71
|
+
}),
|
|
72
|
+
reset: ()=>{
|
|
73
|
+
const { resetPanels , resetPanelGroups } = get();
|
|
74
|
+
resetPanels();
|
|
75
|
+
resetPanelGroups();
|
|
76
|
+
},
|
|
77
|
+
save: ()=>{
|
|
78
|
+
const { savePanels , savePanelGroups } = get();
|
|
79
|
+
savePanels();
|
|
80
|
+
savePanelGroups();
|
|
81
|
+
}
|
|
64
82
|
};
|
|
65
83
|
})));
|
|
66
84
|
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(DashboardContext.Provider, {
|
|
@@ -16,3 +16,13 @@
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", {
|
|
17
17
|
value: true
|
|
18
18
|
});
|
|
19
|
+
Object.defineProperty(exports, "generateId", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: ()=>generateId
|
|
22
|
+
});
|
|
23
|
+
function generateId() {
|
|
24
|
+
if (globalThis.dashboardStoreId === undefined) {
|
|
25
|
+
globalThis.dashboardStoreId = -1;
|
|
26
|
+
}
|
|
27
|
+
return globalThis.dashboardStoreId++;
|
|
28
|
+
}
|
|
@@ -22,11 +22,20 @@ function _export(target, all) {
|
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
24
|
useEditMode: ()=>useEditMode,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
useDashboardActions: ()=>useDashboardActions,
|
|
26
|
+
usePanelGroupIds: ()=>usePanelGroupIds,
|
|
27
|
+
useListPanelGroups: ()=>useListPanelGroups,
|
|
28
|
+
usePanelGroup: ()=>usePanelGroup,
|
|
29
|
+
usePanelGroupActions: ()=>usePanelGroupActions,
|
|
30
|
+
usePanelGroupEditor: ()=>usePanelGroupEditor,
|
|
31
|
+
useDeletePanelGroupDialog: ()=>useDeletePanelGroupDialog,
|
|
32
|
+
usePanel: ()=>usePanel,
|
|
33
|
+
usePanelActions: ()=>usePanelActions,
|
|
34
|
+
usePanelEditor: ()=>usePanelEditor,
|
|
35
|
+
useDeletePanelDialog: ()=>useDeletePanelDialog,
|
|
28
36
|
useDefaultTimeRange: ()=>useDefaultTimeRange
|
|
29
37
|
});
|
|
38
|
+
const _react = require("react");
|
|
30
39
|
const _dashboardProvider = require("./DashboardProvider");
|
|
31
40
|
function useEditMode() {
|
|
32
41
|
return (0, _dashboardProvider.useDashboardStore)(({ isEditMode , setEditMode })=>({
|
|
@@ -34,37 +43,121 @@ function useEditMode() {
|
|
|
34
43
|
setEditMode
|
|
35
44
|
}));
|
|
36
45
|
}
|
|
37
|
-
function
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
function useDashboardActions() {
|
|
47
|
+
const save = (0, _dashboardProvider.useDashboardStore)((store)=>store.save);
|
|
48
|
+
const reset = (0, _dashboardProvider.useDashboardStore)((store)=>store.reset);
|
|
49
|
+
const openAddPanelGroup = (0, _dashboardProvider.useDashboardStore)((store)=>store.openAddPanelGroup);
|
|
50
|
+
const openAddPanel = (0, _dashboardProvider.useDashboardStore)((store)=>store.openAddPanel);
|
|
51
|
+
return {
|
|
52
|
+
save,
|
|
53
|
+
reset,
|
|
54
|
+
openAddPanelGroup,
|
|
55
|
+
openAddPanel: ()=>openAddPanel(undefined)
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function usePanelGroupIds() {
|
|
59
|
+
return (0, _dashboardProvider.useDashboardStore)((store)=>store.panelGroupOrder);
|
|
60
|
+
}
|
|
61
|
+
function useListPanelGroups() {
|
|
62
|
+
const panelGroupIds = usePanelGroupIds();
|
|
63
|
+
const panelGroups = (0, _dashboardProvider.useDashboardStore)((store)=>store.panelGroups);
|
|
64
|
+
return (0, _react.useMemo)(()=>{
|
|
65
|
+
return panelGroupIds.map((id)=>{
|
|
66
|
+
const group = panelGroups[id];
|
|
67
|
+
if (group === undefined) {
|
|
68
|
+
throw new Error(`Invalid panel group Id found ${id}`);
|
|
69
|
+
}
|
|
70
|
+
return group;
|
|
71
|
+
});
|
|
72
|
+
}, [
|
|
73
|
+
panelGroupIds,
|
|
74
|
+
panelGroups
|
|
75
|
+
]);
|
|
76
|
+
}
|
|
77
|
+
function usePanelGroup(panelGroupId) {
|
|
78
|
+
const panelGroup = (0, _dashboardProvider.useDashboardStore)((store)=>store.panelGroups[panelGroupId]);
|
|
79
|
+
if (panelGroup === undefined) {
|
|
80
|
+
throw new Error(`Panel group with Id ${panelGroupId} was not found`);
|
|
81
|
+
}
|
|
82
|
+
return panelGroup;
|
|
83
|
+
}
|
|
84
|
+
function usePanelGroupActions(panelGroupId) {
|
|
85
|
+
const { moveUp , moveDown } = useMovePanelGroup(panelGroupId);
|
|
86
|
+
const openEditPanelGroup = (0, _dashboardProvider.useDashboardStore)((store)=>store.openEditPanelGroup);
|
|
87
|
+
const deletePanelGroup = (0, _dashboardProvider.useDashboardStore)((store)=>store.openDeletePanelGroupDialog);
|
|
88
|
+
const openAddPanel = (0, _dashboardProvider.useDashboardStore)((store)=>store.openAddPanel);
|
|
89
|
+
const updatePanelGroupLayouts = (0, _dashboardProvider.useDashboardStore)((store)=>store.updatePanelGroupLayouts);
|
|
90
|
+
return {
|
|
91
|
+
openEditPanelGroup: ()=>openEditPanelGroup(panelGroupId),
|
|
92
|
+
deletePanelGroup: ()=>deletePanelGroup(panelGroupId),
|
|
93
|
+
openAddPanel: ()=>openAddPanel(panelGroupId),
|
|
94
|
+
moveUp,
|
|
95
|
+
moveDown,
|
|
96
|
+
updatePanelGroupLayouts: (itemLayouts)=>updatePanelGroupLayouts(panelGroupId, itemLayouts)
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Returns functions for moving a panel group up or down. A function will be undefined if the panel group can't be
|
|
101
|
+
* moved in that direction.
|
|
102
|
+
*/ function useMovePanelGroup(panelGroupId) {
|
|
103
|
+
const currentIndex = (0, _dashboardProvider.useDashboardStore)((store)=>store.panelGroupOrder.findIndex((id)=>id === panelGroupId));
|
|
104
|
+
const panelGroupsLength = (0, _dashboardProvider.useDashboardStore)((store)=>store.panelGroupOrder.length);
|
|
105
|
+
const swapPanelGroups = (0, _dashboardProvider.useDashboardStore)((store)=>store.swapPanelGroups);
|
|
106
|
+
if (currentIndex < 0) {
|
|
107
|
+
throw new Error(`Could not find panel group with Id ${panelGroupId} in order array`);
|
|
108
|
+
}
|
|
109
|
+
const moveUp = ()=>swapPanelGroups(currentIndex, currentIndex - 1);
|
|
110
|
+
const moveDown = ()=>swapPanelGroups(currentIndex, currentIndex + 1);
|
|
111
|
+
return {
|
|
112
|
+
moveUp: currentIndex > 0 ? moveUp : undefined,
|
|
113
|
+
moveDown: currentIndex < panelGroupsLength - 1 ? moveDown : undefined
|
|
114
|
+
};
|
|
46
115
|
}
|
|
47
|
-
function
|
|
48
|
-
return (0, _dashboardProvider.useDashboardStore)((
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
116
|
+
function usePanelGroupEditor() {
|
|
117
|
+
return (0, _dashboardProvider.useDashboardStore)((store)=>store.panelGroupEditor);
|
|
118
|
+
}
|
|
119
|
+
function useDeletePanelGroupDialog() {
|
|
120
|
+
return (0, _dashboardProvider.useDashboardStore)(({ deletePanelGroupDialog , openDeletePanelGroupDialog , closeDeletePanelGroupDialog , deletePanelGroup })=>({
|
|
52
121
|
deletePanelGroupDialog,
|
|
53
122
|
openDeletePanelGroupDialog,
|
|
54
|
-
closeDeletePanelGroupDialog
|
|
123
|
+
closeDeletePanelGroupDialog,
|
|
124
|
+
deletePanelGroup
|
|
55
125
|
}));
|
|
56
126
|
}
|
|
57
|
-
function
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
127
|
+
function usePanel(panelGroupItemId) {
|
|
128
|
+
const { panelGroupId , panelGroupItemLayoutId: panelGroupLayoutId } = panelGroupItemId;
|
|
129
|
+
const panel = (0, _dashboardProvider.useDashboardStore)((store)=>{
|
|
130
|
+
var ref;
|
|
131
|
+
const panelKey = (ref = store.panelGroups[panelGroupId]) === null || ref === void 0 ? void 0 : ref.itemPanelKeys[panelGroupLayoutId];
|
|
132
|
+
if (panelKey === undefined) return;
|
|
133
|
+
return store.panels[panelKey];
|
|
134
|
+
});
|
|
135
|
+
if (panel === undefined) {
|
|
136
|
+
throw new Error(`Could not find panel for Id ${panelGroupItemId}`);
|
|
137
|
+
}
|
|
138
|
+
return panel;
|
|
139
|
+
}
|
|
140
|
+
function usePanelActions(panelGroupItemId) {
|
|
141
|
+
const openEditPanel = (0, _dashboardProvider.useDashboardStore)((store)=>store.openEditPanel);
|
|
142
|
+
const openDeletePanelDialog = (0, _dashboardProvider.useDashboardStore)((store)=>store.openDeletePanelDialog);
|
|
143
|
+
return {
|
|
144
|
+
openEditPanel: ()=>openEditPanel(panelGroupItemId),
|
|
145
|
+
openDeletePanelDialog: ()=>openDeletePanelDialog(panelGroupItemId)
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
function usePanelEditor() {
|
|
149
|
+
return (0, _dashboardProvider.useDashboardStore)((store)=>store.panelEditor);
|
|
150
|
+
}
|
|
151
|
+
function useDeletePanelDialog() {
|
|
152
|
+
const deletePanelDialog = (0, _dashboardProvider.useDashboardStore)((store)=>store.deletePanelDialog);
|
|
153
|
+
// TODO: Refactor similar to other dialogs/editors so these are on the editor state itself
|
|
154
|
+
const deletePanel = (0, _dashboardProvider.useDashboardStore)((store)=>store.deletePanel);
|
|
155
|
+
const closeDeletePanelDialog = (0, _dashboardProvider.useDashboardStore)((store)=>store.closeDeletePanelDialog);
|
|
156
|
+
return {
|
|
157
|
+
deletePanelDialog,
|
|
158
|
+
deletePanel,
|
|
159
|
+
closeDeletePanelDialog
|
|
160
|
+
};
|
|
68
161
|
}
|
|
69
162
|
function useDefaultTimeRange() {
|
|
70
163
|
return (0, _dashboardProvider.useDashboardStore)((state)=>state.defaultTimeRange);
|
|
@@ -0,0 +1,70 @@
|
|
|
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, "createDeletePanelGroupSlice", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: ()=>createDeletePanelGroupSlice
|
|
20
|
+
});
|
|
21
|
+
const createDeletePanelGroupSlice = (set, get)=>({
|
|
22
|
+
deletePanelGroup (panelGroupId) {
|
|
23
|
+
const { panelGroups , panelGroupOrder } = get();
|
|
24
|
+
const group = panelGroups[panelGroupId];
|
|
25
|
+
const idIndex = panelGroupOrder.findIndex((id)=>id === panelGroupId);
|
|
26
|
+
if (group === undefined || idIndex === -1) {
|
|
27
|
+
throw new Error(`Panel group ${panelGroupId} not found`);
|
|
28
|
+
}
|
|
29
|
+
// Get the panel keys for all the panel items in the group we're going to delete
|
|
30
|
+
const panelKeys = Object.values(group.itemPanelKeys);
|
|
31
|
+
set((draft)=>{
|
|
32
|
+
// Delete the panel group which also deletes all its items
|
|
33
|
+
delete draft.panelGroups[panelGroupId];
|
|
34
|
+
draft.panelGroupOrder.splice(idIndex, 1);
|
|
35
|
+
// Get all remaining panel keys in use
|
|
36
|
+
const usedPanelKeys = getUsedPanelKeys(draft.panelGroups);
|
|
37
|
+
// For the panel keys of the items that were just deleted, see if they're still used and if not, also delete the
|
|
38
|
+
// panel definition
|
|
39
|
+
for (const panelKey of panelKeys){
|
|
40
|
+
if (usedPanelKeys.has(panelKey)) continue;
|
|
41
|
+
delete draft.panels[panelKey];
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
openDeletePanelGroupDialog: (panelGroupId)=>{
|
|
46
|
+
const panelGroup = get().panelGroups[panelGroupId];
|
|
47
|
+
if (panelGroup === undefined) {
|
|
48
|
+
throw new Error(`Panel group with Id ${panelGroupId} not found`);
|
|
49
|
+
}
|
|
50
|
+
set((state)=>{
|
|
51
|
+
state.deletePanelGroupDialog = {
|
|
52
|
+
panelGroupId,
|
|
53
|
+
panelGroupName: panelGroup.title
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
closeDeletePanelGroupDialog: ()=>set((state)=>{
|
|
58
|
+
state.deletePanelGroupDialog = undefined;
|
|
59
|
+
})
|
|
60
|
+
});
|
|
61
|
+
// Helper to get the panel keys of all groups, returning a set to eliminate duplicates
|
|
62
|
+
function getUsedPanelKeys(panelGroups) {
|
|
63
|
+
const usedPanelKeys = new Set();
|
|
64
|
+
for (const group of Object.values(panelGroups)){
|
|
65
|
+
for (const panelKey of Object.values(group.itemPanelKeys)){
|
|
66
|
+
usedPanelKeys.add(panelKey);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return usedPanelKeys;
|
|
70
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
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, "createDeletePanelSlice", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: ()=>createDeletePanelSlice
|
|
20
|
+
});
|
|
21
|
+
function createDeletePanelSlice() {
|
|
22
|
+
// Return the state creator function for Zustand that uses the panels provided as intitial state
|
|
23
|
+
return (set, get)=>({
|
|
24
|
+
deletePanel (panelGroupItemId) {
|
|
25
|
+
set((draft)=>{
|
|
26
|
+
const { panelGroupId , panelGroupItemLayoutId: panelGroupLayoutId } = panelGroupItemId;
|
|
27
|
+
const existingGroup = draft.panelGroups[panelGroupId];
|
|
28
|
+
if (existingGroup === undefined) {
|
|
29
|
+
throw new Error(`Missing panel group ${panelGroupId}`);
|
|
30
|
+
}
|
|
31
|
+
const existingLayoutIdx = existingGroup.itemLayouts.findIndex((layout)=>layout.i === panelGroupLayoutId);
|
|
32
|
+
const existingPanelKey = existingGroup.itemPanelKeys[panelGroupLayoutId];
|
|
33
|
+
if (existingLayoutIdx === -1 || existingPanelKey === undefined) {
|
|
34
|
+
throw new Error(`Missing panel group item ${panelGroupLayoutId}`);
|
|
35
|
+
}
|
|
36
|
+
// remove panel from panel group
|
|
37
|
+
existingGroup.itemLayouts.splice(existingLayoutIdx, 1);
|
|
38
|
+
delete existingGroup.itemPanelKeys[panelGroupLayoutId];
|
|
39
|
+
// See if panel key is still used and if not, delete it
|
|
40
|
+
if (isPanelKeyStillUsed(draft.panelGroups, existingPanelKey) === false) {
|
|
41
|
+
delete draft.panels[existingPanelKey];
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
openDeletePanelDialog (panelGroupItemId) {
|
|
46
|
+
const { panelGroupId , panelGroupItemLayoutId: panelGroupLayoutId } = panelGroupItemId;
|
|
47
|
+
const { panels , panelGroups } = get();
|
|
48
|
+
const panelGroup = panelGroups[panelGroupId];
|
|
49
|
+
if (panelGroup === undefined) {
|
|
50
|
+
throw new Error(`Panel group not found ${panelGroupId}`);
|
|
51
|
+
}
|
|
52
|
+
const panelKey = panelGroup.itemPanelKeys[panelGroupLayoutId];
|
|
53
|
+
if (panelKey === undefined) {
|
|
54
|
+
throw new Error(`Could not find Panel Group item ${panelGroupLayoutId}`);
|
|
55
|
+
}
|
|
56
|
+
const panel = panels[panelKey];
|
|
57
|
+
if (panel === undefined) {
|
|
58
|
+
throw new Error(`Could not find panel ${panelKey}`);
|
|
59
|
+
}
|
|
60
|
+
set((state)=>{
|
|
61
|
+
var _title;
|
|
62
|
+
state.deletePanelDialog = {
|
|
63
|
+
panelGroupItemId: panelGroupItemId,
|
|
64
|
+
panelName: panel.spec.display.name,
|
|
65
|
+
panelGroupName: (_title = panelGroup.title) !== null && _title !== void 0 ? _title : ''
|
|
66
|
+
};
|
|
67
|
+
});
|
|
68
|
+
},
|
|
69
|
+
closeDeletePanelDialog () {
|
|
70
|
+
set((state)=>{
|
|
71
|
+
state.deletePanelDialog = undefined;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
// Helper function to determine if a panel key is still being used somewhere in Panel Groups
|
|
77
|
+
function isPanelKeyStillUsed(panelGroups, panelKey) {
|
|
78
|
+
for (const group of Object.values(panelGroups)){
|
|
79
|
+
const found = Object.values(group.itemPanelKeys).find((key)=>key === panelKey);
|
|
80
|
+
if (found !== undefined) {
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return false;
|
|
85
|
+
}
|