@perses-dev/dashboards 0.46.0-rc1 → 0.47.0-rc0
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/DashboardStickyToolbar/DashboardStickyToolbar.js +2 -2
- package/dist/cjs/components/Datasources/DatasourceEditor.js +15 -13
- package/dist/cjs/components/EmptyDashboard/EmptyDashboard.js +1 -1
- package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +30 -38
- package/dist/cjs/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +2 -2
- package/dist/cjs/components/SaveDashboardButton/SaveDashboardButton.js +2 -2
- package/dist/cjs/components/Variables/EditVariablesButton.js +4 -4
- package/dist/cjs/components/Variables/{TemplateVariable.js → Variable.js} +16 -19
- package/dist/cjs/components/Variables/VariableEditor.js +19 -17
- package/dist/cjs/components/Variables/VariableList.js +17 -17
- package/dist/cjs/components/Variables/index.js +2 -2
- package/dist/cjs/constants/styles.js +7 -7
- package/dist/cjs/context/DashboardProvider/panel-editor-slice.js +4 -4
- package/dist/cjs/context/{TemplateVariableProvider/TemplateVariableProvider.js → VariableProvider/VariableProvider.js} +51 -56
- package/dist/cjs/context/{TemplateVariableProvider → VariableProvider}/hydrationUtils.js +8 -8
- package/dist/cjs/{validation → context/VariableProvider}/index.js +2 -2
- package/dist/cjs/context/{TemplateVariableProvider → VariableProvider}/query-params.js +1 -1
- package/dist/cjs/context/{TemplateVariableProvider → VariableProvider}/utils.js +1 -1
- package/dist/cjs/context/index.js +2 -2
- package/dist/cjs/context/useDashboard.js +4 -4
- package/dist/cjs/stories/decorators/{WithTemplateVariables.js → WithVariables.js} +8 -8
- package/dist/cjs/stories/decorators/index.js +2 -2
- package/dist/cjs/views/ViewDashboard/ViewDashboard.js +3 -3
- package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js +3 -3
- package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js.map +1 -1
- package/dist/components/Datasources/DatasourceEditor.d.ts.map +1 -1
- package/dist/components/Datasources/DatasourceEditor.js +16 -14
- package/dist/components/Datasources/DatasourceEditor.js.map +1 -1
- package/dist/components/EmptyDashboard/EmptyDashboard.js +1 -1
- package/dist/components/EmptyDashboard/EmptyDashboard.js.map +1 -1
- package/dist/components/GridLayout/GridLayout.d.ts +1 -1
- package/dist/components/GridLayout/GridLayout.d.ts.map +1 -1
- package/dist/components/GridLayout/GridLayout.js.map +1 -1
- package/dist/components/GridLayout/GridTitle.d.ts +1 -1
- package/dist/components/GridLayout/GridTitle.d.ts.map +1 -1
- package/dist/components/GridLayout/GridTitle.js.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.d.ts +1 -2
- package/dist/components/PanelDrawer/PanelEditorForm.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.js +31 -39
- package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -1
- package/dist/components/PanelDrawer/PanelPreview.d.ts +1 -1
- package/dist/components/PanelDrawer/PanelPreview.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelPreview.js.map +1 -1
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +3 -3
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js.map +1 -1
- package/dist/components/SaveDashboardButton/SaveDashboardButton.js +3 -3
- package/dist/components/SaveDashboardButton/SaveDashboardButton.js.map +1 -1
- package/dist/components/Variables/EditVariablesButton.js +5 -5
- package/dist/components/Variables/EditVariablesButton.js.map +1 -1
- package/dist/components/Variables/{TemplateVariable.d.ts → Variable.d.ts} +3 -3
- package/dist/components/Variables/Variable.d.ts.map +1 -0
- package/dist/components/Variables/{TemplateVariable.js → Variable.js} +17 -20
- package/dist/components/Variables/Variable.js.map +1 -0
- package/dist/components/Variables/VariableEditor.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditor.js +20 -18
- package/dist/components/Variables/VariableEditor.js.map +1 -1
- package/dist/components/Variables/VariableList.d.ts +2 -2
- package/dist/components/Variables/VariableList.d.ts.map +1 -1
- package/dist/components/Variables/VariableList.js +15 -15
- package/dist/components/Variables/VariableList.js.map +1 -1
- package/dist/components/Variables/index.d.ts +1 -1
- package/dist/components/Variables/index.d.ts.map +1 -1
- package/dist/components/Variables/index.js +2 -2
- package/dist/components/Variables/index.js.map +1 -1
- package/dist/constants/styles.d.ts +2 -2
- package/dist/constants/styles.d.ts.map +1 -1
- package/dist/constants/styles.js +3 -3
- package/dist/constants/styles.js.map +1 -1
- package/dist/context/DashboardProvider/dashboard-provider-api.d.ts +2 -1
- package/dist/context/DashboardProvider/dashboard-provider-api.d.ts.map +1 -1
- package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -1
- package/dist/context/DashboardProvider/delete-panel-group-slice.d.ts +2 -1
- package/dist/context/DashboardProvider/delete-panel-group-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/delete-panel-group-slice.js.map +1 -1
- package/dist/context/DashboardProvider/index.d.ts +1 -2
- 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 +2 -9
- package/dist/context/DashboardProvider/panel-editor-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/panel-editor-slice.js +1 -1
- package/dist/context/DashboardProvider/panel-editor-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-group-editor-slice.d.ts +2 -1
- package/dist/context/DashboardProvider/panel-group-editor-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/panel-group-editor-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-group-slice.d.ts +1 -2
- package/dist/context/DashboardProvider/panel-group-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -1
- package/dist/context/DashboardProvider/view-panel-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/view-panel-slice.js.map +1 -1
- package/dist/context/DatasourceStoreProvider.d.ts +5 -5
- package/dist/context/DatasourceStoreProvider.d.ts.map +1 -1
- package/dist/context/DatasourceStoreProvider.js.map +1 -1
- package/dist/context/VariableProvider/VariableProvider.d.ts +126 -0
- package/dist/context/VariableProvider/VariableProvider.d.ts.map +1 -0
- package/dist/context/{TemplateVariableProvider/TemplateVariableProvider.js → VariableProvider/VariableProvider.js} +40 -41
- package/dist/context/VariableProvider/VariableProvider.js.map +1 -0
- package/dist/context/{TemplateVariableProvider → VariableProvider}/hydrationUtils.d.ts +1 -1
- package/dist/context/VariableProvider/hydrationUtils.d.ts.map +1 -0
- package/dist/context/{TemplateVariableProvider → VariableProvider}/hydrationUtils.js +6 -6
- package/dist/context/VariableProvider/hydrationUtils.js.map +1 -0
- package/dist/context/VariableProvider/index.d.ts +2 -0
- package/dist/context/VariableProvider/index.d.ts.map +1 -0
- package/dist/{validation → context/VariableProvider}/index.js +2 -2
- package/dist/context/VariableProvider/index.js.map +1 -0
- package/dist/context/VariableProvider/query-params.d.ts.map +1 -0
- package/dist/context/{TemplateVariableProvider → VariableProvider}/query-params.js +1 -1
- package/dist/context/VariableProvider/query-params.js.map +1 -0
- package/dist/context/VariableProvider/utils.d.ts.map +1 -0
- package/dist/context/{TemplateVariableProvider → VariableProvider}/utils.js +1 -1
- package/dist/context/VariableProvider/utils.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 +2 -2
- package/dist/context/index.js.map +1 -1
- package/dist/context/useDashboard.d.ts.map +1 -1
- package/dist/context/useDashboard.js +4 -4
- package/dist/context/useDashboard.js.map +1 -1
- package/dist/stories/decorators/{WithTemplateVariables.js → WithVariables.js} +8 -8
- package/dist/stories/decorators/WithVariables.js.map +1 -0
- package/dist/stories/decorators/index.js +2 -2
- package/dist/stories/decorators/index.js.map +1 -1
- package/dist/test/datasource-provider.d.ts +2 -2
- package/dist/test/datasource-provider.d.ts.map +1 -1
- package/dist/test/datasource-provider.js.map +1 -1
- package/dist/views/ViewDashboard/ViewDashboard.d.ts +2 -2
- package/dist/views/ViewDashboard/ViewDashboard.d.ts.map +1 -1
- package/dist/views/ViewDashboard/ViewDashboard.js +4 -4
- package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -1
- package/package.json +7 -7
- package/dist/cjs/context/TemplateVariableProvider/index.js +0 -30
- package/dist/cjs/validation/panel.js +0 -39
- package/dist/components/Variables/TemplateVariable.d.ts.map +0 -1
- package/dist/components/Variables/TemplateVariable.js.map +0 -1
- package/dist/context/TemplateVariableProvider/TemplateVariableProvider.d.ts +0 -77
- package/dist/context/TemplateVariableProvider/TemplateVariableProvider.d.ts.map +0 -1
- package/dist/context/TemplateVariableProvider/TemplateVariableProvider.js.map +0 -1
- package/dist/context/TemplateVariableProvider/hydrationUtils.d.ts.map +0 -1
- package/dist/context/TemplateVariableProvider/hydrationUtils.js.map +0 -1
- package/dist/context/TemplateVariableProvider/index.d.ts +0 -2
- package/dist/context/TemplateVariableProvider/index.d.ts.map +0 -1
- package/dist/context/TemplateVariableProvider/index.js +0 -15
- package/dist/context/TemplateVariableProvider/index.js.map +0 -1
- package/dist/context/TemplateVariableProvider/query-params.d.ts.map +0 -1
- package/dist/context/TemplateVariableProvider/query-params.js.map +0 -1
- package/dist/context/TemplateVariableProvider/utils.d.ts.map +0 -1
- package/dist/context/TemplateVariableProvider/utils.js.map +0 -1
- package/dist/stories/decorators/WithTemplateVariables.js.map +0 -1
- package/dist/validation/index.d.ts +0 -2
- package/dist/validation/index.d.ts.map +0 -1
- package/dist/validation/index.js.map +0 -1
- package/dist/validation/panel.d.ts +0 -67
- package/dist/validation/panel.d.ts.map +0 -1
- package/dist/validation/panel.js +0 -31
- package/dist/validation/panel.js.map +0 -1
- /package/dist/context/{TemplateVariableProvider → VariableProvider}/query-params.d.ts +0 -0
- /package/dist/context/{TemplateVariableProvider → VariableProvider}/utils.d.ts +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -84,7 +84,7 @@ function DashboardStickyToolbar(props) {
|
|
|
84
84
|
},
|
|
85
85
|
gap: 1,
|
|
86
86
|
children: [
|
|
87
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(_Variables.
|
|
87
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_Variables.VariableList, {}),
|
|
88
88
|
props.initialVariableIsSticky && /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
|
|
89
89
|
style: {
|
|
90
90
|
width: 'fit-content',
|
|
@@ -84,20 +84,22 @@ function DatasourceEditor(props) {
|
|
|
84
84
|
});
|
|
85
85
|
};
|
|
86
86
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, {
|
|
87
|
-
children: datasourceEdit ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
87
|
+
children: datasourceEdit ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.ValidationProvider, {
|
|
88
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.DatasourceEditorForm, {
|
|
89
|
+
initialDatasourceDefinition: datasourceEdit,
|
|
90
|
+
initialAction: datasourceFormAction,
|
|
91
|
+
isDraft: true,
|
|
92
|
+
onSave: (def)=>{
|
|
93
|
+
setDatasources((draft)=>{
|
|
94
|
+
delete draft[datasourceEdit.name]; // to tackle the case where datasource name has been changed
|
|
95
|
+
draft[def.name] = def.spec;
|
|
96
|
+
setDatasourceEdit(null);
|
|
97
|
+
});
|
|
98
|
+
},
|
|
99
|
+
onClose: ()=>{
|
|
95
100
|
setDatasourceEdit(null);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
onClose: ()=>{
|
|
99
|
-
setDatasourceEdit(null);
|
|
100
|
-
}
|
|
101
|
+
}
|
|
102
|
+
})
|
|
101
103
|
}) : /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
102
104
|
children: [
|
|
103
105
|
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
|
|
@@ -32,7 +32,7 @@ const DEFAULT_DESCRIPTION = {
|
|
|
32
32
|
view: 'This dashboard is currently empty. Get started by clicking the edit button.'
|
|
33
33
|
};
|
|
34
34
|
// Constants from specifics in designs to make the default messaging look good.
|
|
35
|
-
const CONTAINER_WIDTH = '
|
|
35
|
+
const CONTAINER_WIDTH = '500px';
|
|
36
36
|
const PRIMARY_CONTENT_WIDTH = '289px';
|
|
37
37
|
const COMMON_BUTTON_PROPS = {
|
|
38
38
|
variant: 'outlined',
|
|
@@ -36,14 +36,12 @@ const _pluginsystem = require("@perses-dev/plugin-system");
|
|
|
36
36
|
const _reacthookform = require("react-hook-form");
|
|
37
37
|
const _zod = require("@hookform/resolvers/zod");
|
|
38
38
|
const _context = require("../../context");
|
|
39
|
-
const _validation = require("../../validation");
|
|
40
39
|
const _PanelPreview = require("./PanelPreview");
|
|
41
40
|
const _usePanelEditor = require("./usePanelEditor");
|
|
42
41
|
function PanelEditorForm(props) {
|
|
43
|
-
const { initialValues
|
|
42
|
+
const { initialValues, initialAction, onSave, onClose } = props;
|
|
44
43
|
const panelGroups = (0, _context.useListPanelGroups)();
|
|
45
|
-
const
|
|
46
|
-
const { panelDefinition, setName, setDescription, setLinks, setQueries, setPlugin, setPanelDefinition } = (0, _usePanelEditor.usePanelEditor)(initialPanelDef);
|
|
44
|
+
const { panelDefinition, setName, setDescription, setLinks, setQueries, setPlugin, setPanelDefinition } = (0, _usePanelEditor.usePanelEditor)(initialValues.panelDefinition);
|
|
47
45
|
const { plugin } = panelDefinition.spec;
|
|
48
46
|
const [isDiscardDialogOpened, setDiscardDialogOpened] = (0, _react.useState)(false);
|
|
49
47
|
// Use common plugin editor logic even though we've split the inputs up in this form
|
|
@@ -70,23 +68,15 @@ function PanelEditorForm(props) {
|
|
|
70
68
|
});
|
|
71
69
|
const titleAction = (0, _pluginsystem.getTitleAction)(initialAction, true);
|
|
72
70
|
const submitText = (0, _pluginsystem.getSubmitText)(initialAction, true);
|
|
71
|
+
const { panelEditorSchema } = (0, _pluginsystem.useValidationSchemas)();
|
|
73
72
|
const form = (0, _reacthookform.useForm)({
|
|
74
|
-
resolver: (0, _zod.zodResolver)(
|
|
73
|
+
resolver: (0, _zod.zodResolver)(panelEditorSchema),
|
|
75
74
|
mode: 'onBlur',
|
|
76
|
-
defaultValues:
|
|
77
|
-
name: initialPanelDef.spec.display.name,
|
|
78
|
-
groupId: initialGroupId,
|
|
79
|
-
description: initialPanelDef.spec.display.description,
|
|
80
|
-
selection: pluginEditor.pendingSelection ? pluginEditor.pendingSelection : {
|
|
81
|
-
type: 'Panel',
|
|
82
|
-
kind: plugin.kind
|
|
83
|
-
},
|
|
84
|
-
links: initialPanelDef.spec.links
|
|
85
|
-
}
|
|
75
|
+
defaultValues: initialValues
|
|
86
76
|
});
|
|
87
77
|
const links = (0, _reacthookform.useWatch)({
|
|
88
78
|
control: form.control,
|
|
89
|
-
name: 'links'
|
|
79
|
+
name: 'panelDefinition.spec.links'
|
|
90
80
|
});
|
|
91
81
|
(0, _react.useEffect)(()=>{
|
|
92
82
|
setLinks(links);
|
|
@@ -94,25 +84,15 @@ function PanelEditorForm(props) {
|
|
|
94
84
|
setLinks,
|
|
95
85
|
links
|
|
96
86
|
]);
|
|
97
|
-
const processForm = ()=>{
|
|
98
|
-
|
|
99
|
-
groupId,
|
|
100
|
-
panelDefinition
|
|
101
|
-
};
|
|
102
|
-
onSave(values);
|
|
87
|
+
const processForm = (data)=>{
|
|
88
|
+
onSave(data);
|
|
103
89
|
};
|
|
104
90
|
// When user click on cancel, several possibilities:
|
|
105
91
|
// - create action: ask for discard approval
|
|
106
92
|
// - update action: ask for discard approval if changed
|
|
107
93
|
// - read action: don´t ask for discard approval
|
|
108
94
|
function handleCancel() {
|
|
109
|
-
if (JSON.stringify({
|
|
110
|
-
groupId: initialGroupId,
|
|
111
|
-
panelDefinition: initialPanelDef
|
|
112
|
-
}) !== JSON.stringify({
|
|
113
|
-
groupId,
|
|
114
|
-
panelDefinition
|
|
115
|
-
})) {
|
|
95
|
+
if (JSON.stringify(initialValues) !== JSON.stringify(form.getValues())) {
|
|
116
96
|
setDiscardDialogOpened(true);
|
|
117
97
|
} else {
|
|
118
98
|
onClose();
|
|
@@ -181,16 +161,19 @@ function PanelEditorForm(props) {
|
|
|
181
161
|
item: true,
|
|
182
162
|
xs: 8,
|
|
183
163
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
184
|
-
|
|
185
|
-
|
|
164
|
+
control: form.control,
|
|
165
|
+
name: "panelDefinition.spec.display.name",
|
|
166
|
+
render: ({ field, fieldState })=>/*#__PURE__*/ {
|
|
186
167
|
var _fieldState_error;
|
|
187
|
-
|
|
168
|
+
var _field_value;
|
|
169
|
+
return (0, _jsxruntime.jsx)(_material.TextField, {
|
|
188
170
|
...field,
|
|
189
171
|
required: true,
|
|
190
172
|
fullWidth: true,
|
|
191
173
|
label: "Name",
|
|
192
174
|
error: !!fieldState.error,
|
|
193
175
|
helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
|
|
176
|
+
value: (_field_value = field.value) !== null && _field_value !== void 0 ? _field_value : '',
|
|
194
177
|
onChange: (event)=>{
|
|
195
178
|
field.onChange(event);
|
|
196
179
|
setName(event.target.value);
|
|
@@ -203,6 +186,7 @@ function PanelEditorForm(props) {
|
|
|
203
186
|
item: true,
|
|
204
187
|
xs: 4,
|
|
205
188
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
189
|
+
control: form.control,
|
|
206
190
|
name: "groupId",
|
|
207
191
|
render: ({ field, fieldState })=>{
|
|
208
192
|
var _fieldState_error;
|
|
@@ -216,7 +200,6 @@ function PanelEditorForm(props) {
|
|
|
216
200
|
helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
|
|
217
201
|
onChange: (event)=>{
|
|
218
202
|
field.onChange(event);
|
|
219
|
-
setGroupId(+event.target.value);
|
|
220
203
|
},
|
|
221
204
|
children: panelGroups.map((panelGroup, index)=>/*#__PURE__*/ {
|
|
222
205
|
var _panelGroup_title;
|
|
@@ -233,15 +216,18 @@ function PanelEditorForm(props) {
|
|
|
233
216
|
item: true,
|
|
234
217
|
xs: 8,
|
|
235
218
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
236
|
-
|
|
237
|
-
|
|
219
|
+
control: form.control,
|
|
220
|
+
name: "panelDefinition.spec.display.description",
|
|
221
|
+
render: ({ field, fieldState })=>/*#__PURE__*/ {
|
|
238
222
|
var _fieldState_error;
|
|
239
|
-
|
|
223
|
+
var _field_value;
|
|
224
|
+
return (0, _jsxruntime.jsx)(_material.TextField, {
|
|
240
225
|
...field,
|
|
241
226
|
fullWidth: true,
|
|
242
227
|
label: "Description",
|
|
243
228
|
error: !!fieldState.error,
|
|
244
229
|
helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
|
|
230
|
+
value: (_field_value = field.value) !== null && _field_value !== void 0 ? _field_value : '',
|
|
245
231
|
onChange: (event)=>{
|
|
246
232
|
field.onChange(event);
|
|
247
233
|
setDescription(event.target.value);
|
|
@@ -254,7 +240,8 @@ function PanelEditorForm(props) {
|
|
|
254
240
|
item: true,
|
|
255
241
|
xs: 4,
|
|
256
242
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
257
|
-
|
|
243
|
+
control: form.control,
|
|
244
|
+
name: "panelDefinition.spec.plugin.kind",
|
|
258
245
|
render: ({ field, fieldState })=>/*#__PURE__*/ {
|
|
259
246
|
var _pluginEditor_error, _fieldState_error;
|
|
260
247
|
var _pluginEditor_error_message;
|
|
@@ -269,8 +256,12 @@ function PanelEditorForm(props) {
|
|
|
269
256
|
disabled: pluginEditor.isLoading,
|
|
270
257
|
error: !!pluginEditor.error || !!fieldState.error,
|
|
271
258
|
helperText: (_pluginEditor_error_message = (_pluginEditor_error = pluginEditor.error) === null || _pluginEditor_error === void 0 ? void 0 : _pluginEditor_error.message) !== null && _pluginEditor_error_message !== void 0 ? _pluginEditor_error_message : (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
|
|
259
|
+
value: {
|
|
260
|
+
type: 'Panel',
|
|
261
|
+
kind: field.value
|
|
262
|
+
},
|
|
272
263
|
onChange: (event)=>{
|
|
273
|
-
field.onChange(event);
|
|
264
|
+
field.onChange(event.kind);
|
|
274
265
|
pluginEditor.onSelectionChange(event);
|
|
275
266
|
}
|
|
276
267
|
});
|
|
@@ -300,6 +291,7 @@ function PanelEditorForm(props) {
|
|
|
300
291
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.ErrorBoundary, {
|
|
301
292
|
FallbackComponent: _components.ErrorAlert,
|
|
302
293
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.PanelSpecEditor, {
|
|
294
|
+
control: form.control,
|
|
303
295
|
panelDefinition: panelDefinition,
|
|
304
296
|
onJSONChange: handlePanelDefinitionChange,
|
|
305
297
|
onQueriesChange: (queries)=>{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -35,7 +35,7 @@ const SaveChangesConfirmationDialog = ()=>{
|
|
|
35
35
|
const isSavedVariableModified = (_dialog_isSavedVariableModified = dialog === null || dialog === void 0 ? void 0 : dialog.isSavedVariableModified) !== null && _dialog_isSavedVariableModified !== void 0 ? _dialog_isSavedVariableModified : true;
|
|
36
36
|
const [saveDefaultTimeRange, setSaveDefaultTimeRange] = (0, _react.useState)(isSavedDurationModified);
|
|
37
37
|
const [saveDefaultVariables, setSaveDefaultVariables] = (0, _react.useState)(isSavedVariableModified);
|
|
38
|
-
const { getSavedVariablesStatus } = (0, _context.
|
|
38
|
+
const { getSavedVariablesStatus } = (0, _context.useVariableDefinitionActions)();
|
|
39
39
|
const { modifiedVariableNames } = getSavedVariablesStatus();
|
|
40
40
|
const isOpen = dialog !== undefined;
|
|
41
41
|
const { timeRange } = (0, _pluginsystem.useTimeRange)();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -29,7 +29,7 @@ const _context = require("../../context");
|
|
|
29
29
|
const SaveDashboardButton = ({ onSave, isDisabled, variant = 'contained' })=>{
|
|
30
30
|
const [isSavingDashboard, setSavingDashboard] = (0, _react.useState)(false);
|
|
31
31
|
const { dashboard, setDashboard } = (0, _context.useDashboard)();
|
|
32
|
-
const { getSavedVariablesStatus, setVariableDefaultValues } = (0, _context.
|
|
32
|
+
const { getSavedVariablesStatus, setVariableDefaultValues } = (0, _context.useVariableDefinitionActions)();
|
|
33
33
|
const { isSavedVariableModified } = getSavedVariablesStatus();
|
|
34
34
|
const { timeRange } = (0, _pluginsystem.useTimeRange)();
|
|
35
35
|
const { setEditMode } = (0, _context.useEditMode)();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -36,10 +36,10 @@ function _interop_require_default(obj) {
|
|
|
36
36
|
}
|
|
37
37
|
function EditVariablesButton({ variant = 'text', label = 'Variables', color = 'primary', fullWidth }) {
|
|
38
38
|
const [isVariableEditorOpen, setIsVariableEditorOpen] = (0, _react.useState)(false);
|
|
39
|
-
const variableDefinitions = (0, _context.
|
|
40
|
-
const externalVariableDefinitions = (0, _context.
|
|
39
|
+
const variableDefinitions = (0, _context.useVariableDefinitions)();
|
|
40
|
+
const externalVariableDefinitions = (0, _context.useExternalVariableDefinitions)();
|
|
41
41
|
const builtinVariableDefinitions = (0, _pluginsystem.useBuiltinVariableDefinitions)();
|
|
42
|
-
const { setVariableDefinitions } = (0, _context.
|
|
42
|
+
const { setVariableDefinitions } = (0, _context.useVariableDefinitionActions)();
|
|
43
43
|
const openVariableEditor = ()=>{
|
|
44
44
|
setIsVariableEditorOpen(true);
|
|
45
45
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -21,8 +21,8 @@ function _export(target, all) {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
|
-
|
|
25
|
-
return
|
|
24
|
+
Variable: function() {
|
|
25
|
+
return Variable;
|
|
26
26
|
},
|
|
27
27
|
useListVariableState: function() {
|
|
28
28
|
return useListVariableState;
|
|
@@ -46,9 +46,9 @@ function variableOptionToVariableValue(options) {
|
|
|
46
46
|
}
|
|
47
47
|
return options.value;
|
|
48
48
|
}
|
|
49
|
-
function
|
|
49
|
+
function Variable({ name, source }) {
|
|
50
50
|
var _ctx_definition;
|
|
51
|
-
const ctx = (0, _context.
|
|
51
|
+
const ctx = (0, _context.useVariableDefinitionAndState)(name, source);
|
|
52
52
|
const kind = (_ctx_definition = ctx.definition) === null || _ctx_definition === void 0 ? void 0 : _ctx_definition.kind;
|
|
53
53
|
switch(kind){
|
|
54
54
|
case 'TextVariable':
|
|
@@ -193,7 +193,6 @@ function useListVariableState(spec, state, variablesOptionsQuery) {
|
|
|
193
193
|
};
|
|
194
194
|
}
|
|
195
195
|
const StyledPopper = (props)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Popper, {
|
|
196
|
-
placeholder: undefined,
|
|
197
196
|
...props,
|
|
198
197
|
sx: {
|
|
199
198
|
minWidth: 'fit-content'
|
|
@@ -204,23 +203,23 @@ const LETTER_HSIZE = 8; // approximation
|
|
|
204
203
|
const ARROW_OFFSET = 40; // right offset for list variables (= take into account the dropdown toggle size)
|
|
205
204
|
const getWidthPx = (inputValue, kind)=>{
|
|
206
205
|
const width = (inputValue.length + 1) * LETTER_HSIZE + (kind === 'list' ? ARROW_OFFSET : 0);
|
|
207
|
-
if (width < _constants.
|
|
208
|
-
return _constants.
|
|
209
|
-
} else if (width > _constants.
|
|
210
|
-
return _constants.
|
|
206
|
+
if (width < _constants.MIN_VARIABLE_WIDTH) {
|
|
207
|
+
return _constants.MIN_VARIABLE_WIDTH;
|
|
208
|
+
} else if (width > _constants.MAX_VARIABLE_WIDTH) {
|
|
209
|
+
return _constants.MAX_VARIABLE_WIDTH;
|
|
211
210
|
} else {
|
|
212
211
|
return width;
|
|
213
212
|
}
|
|
214
213
|
};
|
|
215
214
|
function ListVariable({ name, source }) {
|
|
216
215
|
var _definition_spec_display;
|
|
217
|
-
const ctx = (0, _context.
|
|
216
|
+
const ctx = (0, _context.useVariableDefinitionAndState)(name, source);
|
|
218
217
|
const definition = ctx.definition;
|
|
219
218
|
const variablesOptionsQuery = (0, _pluginsystem.useListVariablePluginValues)(definition);
|
|
220
|
-
const { setVariableValue, setVariableLoading, setVariableOptions } = (0, _context.
|
|
219
|
+
const { setVariableValue, setVariableLoading, setVariableOptions } = (0, _context.useVariableDefinitionActions)();
|
|
221
220
|
const { selectedOptions, value, loading, options, viewOptions } = useListVariableState(definition === null || definition === void 0 ? void 0 : definition.spec, ctx.state, variablesOptionsQuery);
|
|
222
221
|
const [inputValue, setInputValue] = (0, _react.useState)('');
|
|
223
|
-
const [inputWidth, setInputWidth] = (0, _react.useState)(_constants.
|
|
222
|
+
const [inputWidth, setInputWidth] = (0, _react.useState)(_constants.MIN_VARIABLE_WIDTH);
|
|
224
223
|
var _definition_spec_display_name;
|
|
225
224
|
const title = (_definition_spec_display_name = definition === null || definition === void 0 ? void 0 : (_definition_spec_display = definition.spec.display) === null || _definition_spec_display === void 0 ? void 0 : _definition_spec_display.name) !== null && _definition_spec_display_name !== void 0 ? _definition_spec_display_name : name;
|
|
226
225
|
const allowMultiple = (definition === null || definition === void 0 ? void 0 : definition.spec.allowMultiple) === true;
|
|
@@ -283,9 +282,8 @@ function ListVariable({ name, source }) {
|
|
|
283
282
|
'& .MuiInputBase-root': {
|
|
284
283
|
minHeight: '38px'
|
|
285
284
|
},
|
|
286
|
-
'& .
|
|
287
|
-
|
|
288
|
-
paddingLeft: '5px'
|
|
285
|
+
'& .MuiAutocomplete-tag': {
|
|
286
|
+
margin: '1px 2px'
|
|
289
287
|
}
|
|
290
288
|
},
|
|
291
289
|
value: selectedOptions,
|
|
@@ -311,13 +309,13 @@ function ListVariable({ name, source }) {
|
|
|
311
309
|
}
|
|
312
310
|
function TextVariable({ name, source }) {
|
|
313
311
|
var _definition_spec_display;
|
|
314
|
-
const ctx = (0, _context.
|
|
312
|
+
const ctx = (0, _context.useVariableDefinitionAndState)(name, source);
|
|
315
313
|
const state = ctx.state;
|
|
316
314
|
const definition = ctx.definition;
|
|
317
315
|
var _state_value;
|
|
318
316
|
const [tempValue, setTempValue] = (0, _react.useState)((_state_value = state === null || state === void 0 ? void 0 : state.value) !== null && _state_value !== void 0 ? _state_value : '');
|
|
319
317
|
const [inputWidth, setInputWidth] = (0, _react.useState)(getWidthPx(tempValue, 'text'));
|
|
320
|
-
const { setVariableValue } = (0, _context.
|
|
318
|
+
const { setVariableValue } = (0, _context.useVariableDefinitionActions)();
|
|
321
319
|
(0, _react.useEffect)(()=>{
|
|
322
320
|
var _state_value;
|
|
323
321
|
setTempValue((_state_value = state === null || state === void 0 ? void 0 : state.value) !== null && _state_value !== void 0 ? _state_value : '');
|
|
@@ -328,7 +326,6 @@ function TextVariable({ name, source }) {
|
|
|
328
326
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
329
327
|
title: tempValue,
|
|
330
328
|
value: tempValue,
|
|
331
|
-
//onChange={(e) => setTempValue(e.target.value)}
|
|
332
329
|
onChange: (e)=>{
|
|
333
330
|
setTempValue(e.target.value);
|
|
334
331
|
setInputWidth(getWidthPx(e.target.value, 'text'));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -43,7 +43,7 @@ const _ChevronUp = /*#__PURE__*/ _interop_require_default(require("mdi-material-
|
|
|
43
43
|
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
44
44
|
const _components = require("@perses-dev/components");
|
|
45
45
|
const _context = require("../../context");
|
|
46
|
-
const _hydrationUtils = require("../../context/
|
|
46
|
+
const _hydrationUtils = require("../../context/VariableProvider/hydrationUtils");
|
|
47
47
|
const _BuiltinVariableAccordions = require("./BuiltinVariableAccordions");
|
|
48
48
|
function _interop_require_default(obj) {
|
|
49
49
|
return obj && obj.__esModule ? obj : {
|
|
@@ -77,7 +77,7 @@ function VariableEditor(props) {
|
|
|
77
77
|
]);
|
|
78
78
|
const [variableState] = (0, _react.useMemo)(()=>{
|
|
79
79
|
return [
|
|
80
|
-
(0, _hydrationUtils.
|
|
80
|
+
(0, _hydrationUtils.hydrateVariableDefinitionStates)(variableDefinitions, {}, externalVariableDefinitions)
|
|
81
81
|
];
|
|
82
82
|
}, [
|
|
83
83
|
externalVariableDefinitions,
|
|
@@ -166,22 +166,24 @@ function VariableEditor(props) {
|
|
|
166
166
|
};
|
|
167
167
|
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
168
168
|
children: [
|
|
169
|
-
currentEditingVariableDefinition && /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
draft
|
|
169
|
+
currentEditingVariableDefinition && /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.ValidationProvider, {
|
|
170
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.VariableEditorForm, {
|
|
171
|
+
initialVariableDefinition: currentEditingVariableDefinition,
|
|
172
|
+
initialAction: variableFormAction,
|
|
173
|
+
isDraft: true,
|
|
174
|
+
onSave: (definition)=>{
|
|
175
|
+
setVariableDefinitions((draft)=>{
|
|
176
|
+
draft[variableEditIdx] = definition;
|
|
177
|
+
setVariableEditIdx(null);
|
|
178
|
+
});
|
|
179
|
+
},
|
|
180
|
+
onClose: ()=>{
|
|
181
|
+
if (variableFormAction === 'create') {
|
|
182
|
+
removeVariable(variableEditIdx);
|
|
183
|
+
}
|
|
176
184
|
setVariableEditIdx(null);
|
|
177
|
-
});
|
|
178
|
-
},
|
|
179
|
-
onClose: ()=>{
|
|
180
|
-
if (variableFormAction === 'create') {
|
|
181
|
-
removeVariable(variableEditIdx);
|
|
182
185
|
}
|
|
183
|
-
|
|
184
|
-
}
|
|
186
|
+
})
|
|
185
187
|
}),
|
|
186
188
|
!currentEditingVariableDefinition && /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
187
189
|
children: [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -21,48 +21,48 @@ function _export(target, all) {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
|
-
|
|
25
|
-
return
|
|
24
|
+
VariableList: function() {
|
|
25
|
+
return VariableList;
|
|
26
26
|
},
|
|
27
|
-
|
|
28
|
-
return
|
|
27
|
+
VariableListItem: function() {
|
|
28
|
+
return VariableListItem;
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
const _jsxruntime = require("react/jsx-runtime");
|
|
32
32
|
const _material = require("@mui/material");
|
|
33
33
|
const _context = require("../../context");
|
|
34
34
|
const _constants = require("../../constants");
|
|
35
|
-
const
|
|
36
|
-
function
|
|
37
|
-
const variableDefinitions = (0, _context.
|
|
38
|
-
const externalVariableDefinitions = (0, _context.
|
|
35
|
+
const _Variable = require("./Variable");
|
|
36
|
+
function VariableList() {
|
|
37
|
+
const variableDefinitions = (0, _context.useVariableDefinitions)();
|
|
38
|
+
const externalVariableDefinitions = (0, _context.useExternalVariableDefinitions)();
|
|
39
39
|
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
40
40
|
children: [
|
|
41
41
|
externalVariableDefinitions.slice().reverse() // We reverse to have the most prioritized on top
|
|
42
|
-
.map((def)=>def.definitions.map((v)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(
|
|
42
|
+
.map((def)=>def.definitions.map((v)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(VariableListItem, {
|
|
43
43
|
spec: v.spec,
|
|
44
44
|
source: def.source
|
|
45
45
|
}, v.spec.name + def.source))),
|
|
46
|
-
variableDefinitions.map((v)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(
|
|
46
|
+
variableDefinitions.map((v)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(VariableListItem, {
|
|
47
47
|
spec: v.spec
|
|
48
48
|
}, v.spec.name))
|
|
49
49
|
]
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function VariableListItem({ spec, source }) {
|
|
53
53
|
var _ctx_state, _spec_display;
|
|
54
|
-
const ctx = (0, _context.
|
|
54
|
+
const ctx = (0, _context.useVariableDefinitionAndState)(spec.name, source);
|
|
55
55
|
if ((_ctx_state = ctx.state) === null || _ctx_state === void 0 ? void 0 : _ctx_state.overridden) {
|
|
56
56
|
return null;
|
|
57
57
|
}
|
|
58
58
|
var _ref, _ref1;
|
|
59
59
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
|
|
60
60
|
display: ((_spec_display = spec.display) === null || _spec_display === void 0 ? void 0 : _spec_display.hidden) ? 'none' : undefined,
|
|
61
|
-
minWidth: `${_constants.
|
|
62
|
-
maxWidth: `${_constants.
|
|
61
|
+
minWidth: `${_constants.MIN_VARIABLE_WIDTH}px`,
|
|
62
|
+
maxWidth: `${_constants.MAX_VARIABLE_WIDTH}px`,
|
|
63
63
|
flexShrink: 0,
|
|
64
|
-
"data-testid": '
|
|
65
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(
|
|
64
|
+
"data-testid": 'variable-' + spec.name,
|
|
65
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Variable.Variable, {
|
|
66
66
|
name: spec.name,
|
|
67
67
|
source: source
|
|
68
68
|
}, (_ref = spec.name + source) !== null && _ref !== void 0 ? _ref : '')
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -16,7 +16,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
_export_star(require("./BuiltinVariableAccordions"), exports);
|
|
18
18
|
_export_star(require("./EditVariablesButton"), exports);
|
|
19
|
-
_export_star(require("./
|
|
19
|
+
_export_star(require("./Variable"), exports);
|
|
20
20
|
_export_star(require("./VariableEditor"), exports);
|
|
21
21
|
_export_star(require("./VariableList"), exports);
|
|
22
22
|
function _export_star(from, to) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -21,11 +21,11 @@ function _export(target, all) {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
|
-
|
|
25
|
-
return
|
|
24
|
+
MAX_VARIABLE_WIDTH: function() {
|
|
25
|
+
return MAX_VARIABLE_WIDTH;
|
|
26
26
|
},
|
|
27
|
-
|
|
28
|
-
return
|
|
27
|
+
MIN_VARIABLE_WIDTH: function() {
|
|
28
|
+
return MIN_VARIABLE_WIDTH;
|
|
29
29
|
},
|
|
30
30
|
editButtonStyle: function() {
|
|
31
31
|
return editButtonStyle;
|
|
@@ -38,5 +38,5 @@ const editButtonStyle = {
|
|
|
38
38
|
marginRight: 0.5
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
|
-
const
|
|
42
|
-
const
|
|
41
|
+
const MIN_VARIABLE_WIDTH = 120;
|
|
42
|
+
const MAX_VARIABLE_WIDTH = 500;
|
|
@@ -20,7 +20,7 @@ Object.defineProperty(exports, "createPanelEditorSlice", {
|
|
|
20
20
|
return createPanelEditorSlice;
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
|
-
const
|
|
23
|
+
const _utils = require("../../utils");
|
|
24
24
|
const _common = require("./common");
|
|
25
25
|
const _panelgroupslice = require("./panel-group-slice");
|
|
26
26
|
function createPanelEditorSlice() {
|
|
@@ -76,7 +76,7 @@ function createPanelEditorSlice() {
|
|
|
76
76
|
newGroup.itemLayouts.push({
|
|
77
77
|
i: existingLayout.i,
|
|
78
78
|
x: 0,
|
|
79
|
-
y: (0,
|
|
79
|
+
y: (0, _utils.getYForNewRow)(newGroup),
|
|
80
80
|
w: existingLayout.w,
|
|
81
81
|
h: existingLayout.h
|
|
82
82
|
});
|
|
@@ -113,7 +113,7 @@ function createPanelEditorSlice() {
|
|
|
113
113
|
},
|
|
114
114
|
applyChanges: (next)=>{
|
|
115
115
|
const name = next.panelDefinition.spec.display.name;
|
|
116
|
-
const panelKey = (0,
|
|
116
|
+
const panelKey = (0, _utils.getValidPanelKey)(name, get().panels);
|
|
117
117
|
set((state)=>{
|
|
118
118
|
// Add a panel
|
|
119
119
|
state.panels[panelKey] = next.panelDefinition;
|
|
@@ -125,7 +125,7 @@ function createPanelEditorSlice() {
|
|
|
125
125
|
const layout = {
|
|
126
126
|
i: (0, _common.generateId)().toString(),
|
|
127
127
|
x: 0,
|
|
128
|
-
y: (0,
|
|
128
|
+
y: (0, _utils.getYForNewRow)(group),
|
|
129
129
|
w: 12,
|
|
130
130
|
h: 6
|
|
131
131
|
};
|