@perses-dev/dashboards 0.9.0 → 0.11.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 +6 -11
- package/dist/cjs/components/DashboardToolbar.js +12 -6
- package/dist/cjs/components/GridLayout/GridItemContent.js +7 -15
- package/dist/cjs/components/GridLayout/GridLayout.js +27 -22
- package/dist/cjs/components/GridLayout/GridTitle.js +27 -7
- package/dist/cjs/components/Panel/DeletePanelDialog.js +95 -0
- package/dist/cjs/components/Panel/Panel.js +12 -10
- package/dist/cjs/components/Panel/Panel.test.js +15 -6
- package/dist/cjs/components/Panel/PanelContent.js +3 -2
- package/dist/cjs/components/PanelDrawer/PanelDrawer.js +13 -12
- package/dist/cjs/components/PanelDrawer/PanelDrawer.test.js +9 -13
- package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +87 -39
- package/dist/cjs/components/PanelDrawer/PanelPreview.js +54 -0
- package/dist/cjs/components/PanelGroupDialog/DeletePanelGroupDialog.js +88 -0
- package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.js +70 -118
- package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.test.js +21 -36
- 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 +20 -11
- package/dist/cjs/components/Variables/VariableEditor.js +240 -0
- package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +236 -0
- package/dist/cjs/components/Variables/VariableEditorForm/index.js +28 -0
- package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +88 -0
- package/dist/cjs/components/Variables/VariableList.js +49 -69
- package/dist/cjs/components/Variables/index.js +1 -0
- package/dist/cjs/components/index.js +1 -0
- package/dist/cjs/context/DashboardProvider/DashboardProvider.js +82 -0
- package/dist/cjs/context/DashboardProvider/common.js +18 -0
- package/dist/cjs/context/DashboardProvider/dashboard-provider-api.js +164 -0
- package/dist/cjs/context/DashboardProvider/index.js +29 -0
- package/dist/cjs/context/DashboardProvider/panel-editor-slice.js +175 -0
- package/dist/cjs/context/DashboardProvider/panel-group-editor-slice.js +102 -0
- package/dist/cjs/context/DashboardProvider/panel-group-slice.js +208 -0
- package/dist/cjs/context/DatasourceStoreProvider.js +109 -7
- package/dist/cjs/context/TemplateVariableProvider.js +8 -1
- package/dist/cjs/context/TimeRangeProvider.js +20 -44
- package/dist/cjs/context/index.js +1 -3
- package/dist/cjs/context/useDashboardSpec.js +61 -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 +24 -11
- package/dist/cjs/utils/index.js +28 -0
- package/dist/cjs/utils/time-range-params.js +145 -0
- package/dist/cjs/views/ViewDashboard/DashboardApp.js +5 -8
- package/dist/cjs/views/ViewDashboard/ViewDashboard.js +5 -22
- package/dist/cjs/views/ViewDashboard/tests/panelGroups.test.js +114 -0
- package/dist/components/Dashboard.d.ts +1 -4
- package/dist/components/Dashboard.d.ts.map +1 -1
- package/dist/components/Dashboard.js +7 -12
- package/dist/components/Dashboard.js.map +1 -1
- package/dist/components/DashboardToolbar.d.ts.map +1 -1
- package/dist/components/DashboardToolbar.js +14 -8
- 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 +7 -15
- package/dist/components/GridLayout/GridItemContent.js.map +1 -1
- package/dist/components/GridLayout/GridLayout.d.ts +2 -4
- package/dist/components/GridLayout/GridLayout.d.ts.map +1 -1
- package/dist/components/GridLayout/GridLayout.js +28 -23
- 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 +28 -8
- package/dist/components/GridLayout/GridTitle.js.map +1 -1
- package/dist/components/Panel/DeletePanelDialog.d.ts +5 -0
- package/dist/components/Panel/DeletePanelDialog.d.ts.map +1 -0
- package/dist/components/Panel/DeletePanelDialog.js +84 -0
- package/dist/components/Panel/DeletePanelDialog.js.map +1 -0
- 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 +13 -11
- 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 +10 -6
- package/dist/components/Panel/Panel.test.js.map +1 -1
- package/dist/components/Panel/PanelContent.d.ts +4 -1
- package/dist/components/Panel/PanelContent.d.ts.map +1 -1
- package/dist/components/Panel/PanelContent.js +3 -2
- package/dist/components/Panel/PanelContent.js.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.js +14 -13
- package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.test.js +9 -13
- package/dist/components/PanelDrawer/PanelDrawer.test.js.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.d.ts +3 -3
- package/dist/components/PanelDrawer/PanelEditorForm.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.js +89 -41
- package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -1
- package/dist/components/PanelDrawer/PanelPreview.d.ts +4 -0
- package/dist/components/PanelDrawer/PanelPreview.d.ts.map +1 -0
- package/dist/components/PanelDrawer/PanelPreview.js +48 -0
- package/dist/components/PanelDrawer/PanelPreview.js.map +1 -0
- package/dist/components/PanelGroupDialog/DeletePanelGroupDialog.d.ts +3 -0
- package/dist/components/PanelGroupDialog/DeletePanelGroupDialog.d.ts.map +1 -0
- package/dist/components/PanelGroupDialog/DeletePanelGroupDialog.js +77 -0
- package/dist/components/PanelGroupDialog/DeletePanelGroupDialog.js.map +1 -0
- 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 -119
- package/dist/components/PanelGroupDialog/PanelGroupDialog.js.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.test.js +20 -35
- 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 +22 -13
- package/dist/components/Variables/Variable.js.map +1 -1
- package/dist/components/Variables/VariableEditor.d.ts +8 -0
- package/dist/components/Variables/VariableEditor.d.ts.map +1 -0
- package/dist/components/Variables/VariableEditor.js +229 -0
- package/dist/components/Variables/VariableEditor.js.map +1 -0
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts +8 -0
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -0
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +225 -0
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -0
- package/dist/components/Variables/VariableEditorForm/index.d.ts +2 -0
- package/dist/components/Variables/VariableEditorForm/index.d.ts.map +1 -0
- package/dist/components/Variables/VariableEditorForm/index.js +15 -0
- package/dist/components/Variables/VariableEditorForm/index.js.map +1 -0
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts +21 -0
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts.map +1 -0
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +76 -0
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -0
- package/dist/components/Variables/VariableList.d.ts.map +1 -1
- package/dist/components/Variables/VariableList.js +47 -72
- package/dist/components/Variables/VariableList.js.map +1 -1
- package/dist/components/Variables/index.d.ts +1 -0
- package/dist/components/Variables/index.d.ts.map +1 -1
- package/dist/components/Variables/index.js +1 -0
- package/dist/components/Variables/index.js.map +1 -1
- package/dist/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 +25 -0
- package/dist/context/DashboardProvider/DashboardProvider.d.ts.map +1 -0
- package/dist/context/DashboardProvider/DashboardProvider.js +64 -0
- package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -0
- package/dist/context/DashboardProvider/common.d.ts +5 -0
- package/dist/context/DashboardProvider/common.d.ts.map +1 -0
- package/dist/context/DashboardProvider/common.js +17 -0
- package/dist/context/DashboardProvider/common.js.map +1 -0
- package/dist/context/DashboardProvider/dashboard-provider-api.d.ts +74 -0
- package/dist/context/DashboardProvider/dashboard-provider-api.d.ts.map +1 -0
- package/dist/context/DashboardProvider/dashboard-provider-api.js +163 -0
- package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -0
- package/dist/context/DashboardProvider/index.d.ts +5 -0
- package/dist/context/DashboardProvider/index.d.ts.map +1 -0
- package/dist/context/DashboardProvider/index.js +16 -0
- package/dist/context/DashboardProvider/index.js.map +1 -0
- package/dist/context/DashboardProvider/panel-editor-slice.d.ts +85 -0
- package/dist/context/DashboardProvider/panel-editor-slice.d.ts.map +1 -0
- package/dist/context/DashboardProvider/panel-editor-slice.js +171 -0
- package/dist/context/DashboardProvider/panel-editor-slice.js.map +1 -0
- package/dist/context/DashboardProvider/panel-group-editor-slice.d.ts +40 -0
- package/dist/context/DashboardProvider/panel-group-editor-slice.d.ts.map +1 -0
- package/dist/context/DashboardProvider/panel-group-editor-slice.js +96 -0
- package/dist/context/DashboardProvider/panel-group-editor-slice.js.map +1 -0
- package/dist/context/DashboardProvider/panel-group-slice.d.ts +80 -0
- package/dist/context/DashboardProvider/panel-group-slice.d.ts.map +1 -0
- package/dist/context/DashboardProvider/panel-group-slice.js +204 -0
- package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -0
- package/dist/context/DatasourceStoreProvider.d.ts +10 -2
- package/dist/context/DatasourceStoreProvider.d.ts.map +1 -1
- package/dist/context/DatasourceStoreProvider.js +111 -9
- package/dist/context/DatasourceStoreProvider.js.map +1 -1
- package/dist/context/TemplateVariableProvider.d.ts +2 -0
- package/dist/context/TemplateVariableProvider.d.ts.map +1 -1
- package/dist/context/TemplateVariableProvider.js +8 -1
- package/dist/context/TemplateVariableProvider.js.map +1 -1
- package/dist/context/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 -3
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +1 -3
- package/dist/context/index.js.map +1 -1
- package/dist/context/useDashboardSpec.d.ts +3 -0
- package/dist/context/useDashboardSpec.d.ts.map +1 -0
- package/dist/context/useDashboardSpec.js +55 -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/plugin-registry.d.ts +2 -2
- package/dist/test/plugin-registry.d.ts.map +1 -1
- package/dist/test/plugin-registry.js.map +1 -1
- package/dist/test/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 +24 -11
- 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 +137 -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 +6 -9
- 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.d.ts +2 -0
- package/dist/views/ViewDashboard/tests/panelGroups.test.d.ts.map +1 -0
- package/dist/views/ViewDashboard/tests/panelGroups.test.js +107 -0
- package/dist/views/ViewDashboard/tests/panelGroups.test.js.map +1 -0
- package/package.json +5 -4
- package/dist/cjs/components/PanelDrawer/PanelSpecEditor.js +0 -40
- package/dist/cjs/components/PanelDrawer/PanelTypeSelect.js +0 -38
- package/dist/cjs/components/PanelDrawer/panel-editor-model.js +0 -140
- package/dist/cjs/context/DashboardAppSlice.js +0 -57
- package/dist/cjs/context/DashboardProvider.js +0 -128
- package/dist/cjs/context/LayoutsSlice.js +0 -55
- package/dist/cjs/context/QueryStringProvider.js +0 -89
- package/dist/components/PanelDrawer/PanelSpecEditor.d.ts +0 -7
- package/dist/components/PanelDrawer/PanelSpecEditor.d.ts.map +0 -1
- package/dist/components/PanelDrawer/PanelSpecEditor.js +0 -34
- package/dist/components/PanelDrawer/PanelSpecEditor.js.map +0 -1
- package/dist/components/PanelDrawer/PanelTypeSelect.d.ts +0 -8
- package/dist/components/PanelDrawer/PanelTypeSelect.d.ts.map +0 -1
- package/dist/components/PanelDrawer/PanelTypeSelect.js +0 -34
- package/dist/components/PanelDrawer/PanelTypeSelect.js.map +0 -1
- package/dist/components/PanelDrawer/panel-editor-model.d.ts +0 -27
- package/dist/components/PanelDrawer/panel-editor-model.d.ts.map +0 -1
- package/dist/components/PanelDrawer/panel-editor-model.js +0 -133
- package/dist/components/PanelDrawer/panel-editor-model.js.map +0 -1
- package/dist/context/DashboardAppSlice.d.ts +0 -26
- package/dist/context/DashboardAppSlice.d.ts.map +0 -1
- package/dist/context/DashboardAppSlice.js +0 -45
- package/dist/context/DashboardAppSlice.js.map +0 -1
- package/dist/context/DashboardProvider.d.ts +0 -36
- package/dist/context/DashboardProvider.d.ts.map +0 -1
- package/dist/context/DashboardProvider.js +0 -107
- package/dist/context/DashboardProvider.js.map +0 -1
- package/dist/context/LayoutsSlice.d.ts +0 -12
- package/dist/context/LayoutsSlice.d.ts.map +0 -1
- package/dist/context/LayoutsSlice.js +0 -43
- package/dist/context/LayoutsSlice.js.map +0 -1
- 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
|
@@ -10,129 +10,83 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
-
import {
|
|
15
|
-
import { IconButton, Dialog, DialogTitle, DialogContent, FormControl, InputLabel, TextField, Stack, Box, DialogActions, Button, Select, MenuItem } from '@mui/material';
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
|
+
import { IconButton, Dialog, DialogTitle, DialogContent, DialogActions, Button } from '@mui/material';
|
|
16
15
|
import CloseIcon from 'mdi-material-ui/Close';
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
const [
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
kind: 'Grid',
|
|
32
|
-
spec: {
|
|
33
|
-
display: {
|
|
34
|
-
title: name !== null && name !== void 0 ? name : '',
|
|
35
|
-
collapse: {
|
|
36
|
-
open: !isCollapsed
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
items: groupIndex === undefined ? [] : (_items = (ref = layouts[groupIndex]) === null || ref === void 0 ? void 0 : ref.spec.items) !== null && _items !== void 0 ? _items : []
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
updateLayout(newLayout, groupIndex);
|
|
43
|
-
closePanelGroupDialog();
|
|
16
|
+
import { useState } from 'react';
|
|
17
|
+
import { usePanelGroupEditor } from '../../context';
|
|
18
|
+
import { PanelGroupEditorForm, panelGroupEditorFormId } from './PanelGroupEditorForm';
|
|
19
|
+
/**
|
|
20
|
+
* A dialog for adding or editing a Panel Group. Open and initial state is controlled by the DashboardStore.
|
|
21
|
+
*/ export function PanelGroupDialog() {
|
|
22
|
+
const panelGroupEditor = usePanelGroupEditor();
|
|
23
|
+
// When the user clicks close, start closing but don't call the store yet to keep values stable during animtation
|
|
24
|
+
const [isClosing, setIsClosing] = useState(false);
|
|
25
|
+
const handleClose = ()=>setIsClosing(true);
|
|
26
|
+
// Don't call close on the store until the Dialog has completely transitioned out
|
|
27
|
+
const handleExited = ()=>{
|
|
28
|
+
panelGroupEditor === null || panelGroupEditor === void 0 ? void 0 : panelGroupEditor.close();
|
|
29
|
+
setIsClosing(false);
|
|
44
30
|
};
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
31
|
+
// Dialog is open if we have a model and we're not transitioning out
|
|
32
|
+
const isOpen = panelGroupEditor !== undefined && isClosing === false;
|
|
33
|
+
const handleSubmit = (values)=>{
|
|
34
|
+
// This shouldn't happen since we don't render the submit button until we have a model, but check to make TS happy
|
|
35
|
+
if (panelGroupEditor === undefined) {
|
|
36
|
+
throw new Error('Cannot apply changes');
|
|
37
|
+
}
|
|
38
|
+
panelGroupEditor.applyChanges(values);
|
|
39
|
+
handleClose();
|
|
48
40
|
};
|
|
49
|
-
return /*#__PURE__*/
|
|
50
|
-
open:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
variant: "outlined",
|
|
80
|
-
value: name,
|
|
81
|
-
onChange: (e)=>setName(e.target.value)
|
|
82
|
-
})
|
|
83
|
-
}),
|
|
84
|
-
/*#__PURE__*/ _jsxs(Box, {
|
|
85
|
-
sx: {
|
|
86
|
-
display: 'flex',
|
|
87
|
-
alignItems: 'center',
|
|
88
|
-
width: '100%',
|
|
89
|
-
justifyContent: 'space-between'
|
|
90
|
-
},
|
|
91
|
-
children: [
|
|
92
|
-
/*#__PURE__*/ _jsx(InputLabel, {
|
|
93
|
-
children: "Collapse State"
|
|
94
|
-
}),
|
|
95
|
-
/*#__PURE__*/ _jsxs(Select, {
|
|
96
|
-
required: true,
|
|
97
|
-
displayEmpty: true,
|
|
98
|
-
labelId: "select-collapse-state",
|
|
99
|
-
size: "small",
|
|
100
|
-
value: isCollapsed ? 'Close' : 'Open',
|
|
101
|
-
onChange: handleSelectCollapsedStateChange,
|
|
102
|
-
children: [
|
|
103
|
-
/*#__PURE__*/ _jsx(MenuItem, {
|
|
104
|
-
value: 'Open',
|
|
105
|
-
children: "Open"
|
|
106
|
-
}, 'open'),
|
|
107
|
-
/*#__PURE__*/ _jsx(MenuItem, {
|
|
108
|
-
value: 'Close',
|
|
109
|
-
children: "Close"
|
|
110
|
-
}, 'close')
|
|
111
|
-
]
|
|
112
|
-
})
|
|
113
|
-
]
|
|
114
|
-
})
|
|
115
|
-
]
|
|
116
|
-
})
|
|
117
|
-
}),
|
|
118
|
-
/*#__PURE__*/ _jsxs(DialogActions, {
|
|
119
|
-
children: [
|
|
120
|
-
/*#__PURE__*/ _jsx(Button, {
|
|
121
|
-
variant: "contained",
|
|
122
|
-
type: "submit",
|
|
123
|
-
children: isEditingPanelGroup ? 'Apply' : 'Add'
|
|
124
|
-
}),
|
|
125
|
-
/*#__PURE__*/ _jsx(Button, {
|
|
126
|
-
onClick: ()=>closePanelGroupDialog(),
|
|
127
|
-
children: "Cancel"
|
|
128
|
-
})
|
|
129
|
-
]
|
|
41
|
+
return /*#__PURE__*/ _jsx(Dialog, {
|
|
42
|
+
open: isOpen,
|
|
43
|
+
TransitionProps: {
|
|
44
|
+
onExited: handleExited
|
|
45
|
+
},
|
|
46
|
+
children: panelGroupEditor !== undefined && /*#__PURE__*/ _jsxs(_Fragment, {
|
|
47
|
+
children: [
|
|
48
|
+
/*#__PURE__*/ _jsxs(DialogTitle, {
|
|
49
|
+
children: [
|
|
50
|
+
panelGroupEditor.mode,
|
|
51
|
+
" Panel Group"
|
|
52
|
+
]
|
|
53
|
+
}),
|
|
54
|
+
/*#__PURE__*/ _jsx(IconButton, {
|
|
55
|
+
"aria-label": "Close",
|
|
56
|
+
onClick: panelGroupEditor.close,
|
|
57
|
+
sx: (theme)=>({
|
|
58
|
+
position: 'absolute',
|
|
59
|
+
top: theme.spacing(0.5),
|
|
60
|
+
right: theme.spacing(0.5)
|
|
61
|
+
}),
|
|
62
|
+
children: /*#__PURE__*/ _jsx(CloseIcon, {})
|
|
63
|
+
}),
|
|
64
|
+
/*#__PURE__*/ _jsx(DialogContent, {
|
|
65
|
+
sx: {
|
|
66
|
+
width: '500px'
|
|
67
|
+
},
|
|
68
|
+
children: /*#__PURE__*/ _jsx(PanelGroupEditorForm, {
|
|
69
|
+
initialValues: panelGroupEditor.initialValues,
|
|
70
|
+
onSubmit: handleSubmit
|
|
130
71
|
})
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
72
|
+
}),
|
|
73
|
+
/*#__PURE__*/ _jsxs(DialogActions, {
|
|
74
|
+
children: [
|
|
75
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
76
|
+
variant: "contained",
|
|
77
|
+
type: "submit",
|
|
78
|
+
form: panelGroupEditorFormId,
|
|
79
|
+
children: panelGroupEditor.mode === 'Edit' ? 'Apply' : 'Add'
|
|
80
|
+
}),
|
|
81
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
82
|
+
onClick: panelGroupEditor.close,
|
|
83
|
+
children: "Cancel"
|
|
84
|
+
})
|
|
85
|
+
]
|
|
86
|
+
})
|
|
87
|
+
]
|
|
88
|
+
})
|
|
134
89
|
});
|
|
135
|
-
}
|
|
136
|
-
export default PanelGroupDialog;
|
|
90
|
+
}
|
|
137
91
|
|
|
138
92
|
//# sourceMappingURL=PanelGroupDialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/PanelGroupDialog/PanelGroupDialog.tsx"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../src/components/PanelGroupDialog/PanelGroupDialog.tsx"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { IconButton, Dialog, DialogTitle, DialogContent, DialogActions, Button } from '@mui/material';\nimport CloseIcon from 'mdi-material-ui/Close';\nimport { useState } from 'react';\nimport { usePanelGroupEditor } from '../../context';\nimport { PanelGroupEditorForm, panelGroupEditorFormId, PanelGroupEditorFormProps } from './PanelGroupEditorForm';\n\n/**\n * A dialog for adding or editing a Panel Group. Open and initial state is controlled by the DashboardStore.\n */\nexport function PanelGroupDialog() {\n const panelGroupEditor = usePanelGroupEditor();\n\n // When the user clicks close, start closing but don't call the store yet to keep values stable during animtation\n const [isClosing, setIsClosing] = useState(false);\n const handleClose = () => setIsClosing(true);\n\n // Don't call close on the store until the Dialog has completely transitioned out\n const handleExited = () => {\n panelGroupEditor?.close();\n setIsClosing(false);\n };\n\n // Dialog is open if we have a model and we're not transitioning out\n const isOpen = panelGroupEditor !== undefined && isClosing === false;\n\n const handleSubmit: PanelGroupEditorFormProps['onSubmit'] = (values) => {\n // This shouldn't happen since we don't render the submit button until we have a model, but check to make TS happy\n if (panelGroupEditor === undefined) {\n throw new Error('Cannot apply changes');\n }\n panelGroupEditor.applyChanges(values);\n handleClose();\n };\n\n return (\n <Dialog open={isOpen} TransitionProps={{ onExited: handleExited }}>\n {panelGroupEditor !== undefined && (\n <>\n <DialogTitle>{panelGroupEditor.mode} Panel Group</DialogTitle>\n <IconButton\n aria-label=\"Close\"\n onClick={panelGroupEditor.close}\n sx={(theme) => ({\n position: 'absolute',\n top: theme.spacing(0.5),\n right: theme.spacing(0.5),\n })}\n >\n <CloseIcon />\n </IconButton>\n <DialogContent sx={{ width: '500px' }}>\n <PanelGroupEditorForm initialValues={panelGroupEditor.initialValues} onSubmit={handleSubmit} />\n </DialogContent>\n <DialogActions>\n <Button variant=\"contained\" type=\"submit\" form={panelGroupEditorFormId}>\n {panelGroupEditor.mode === 'Edit' ? 'Apply' : 'Add'}\n </Button>\n <Button onClick={panelGroupEditor.close}>Cancel</Button>\n </DialogActions>\n </>\n )}\n </Dialog>\n );\n}\n"],"names":["IconButton","Dialog","DialogTitle","DialogContent","DialogActions","Button","CloseIcon","useState","usePanelGroupEditor","PanelGroupEditorForm","panelGroupEditorFormId","PanelGroupDialog","panelGroupEditor","isClosing","setIsClosing","handleClose","handleExited","close","isOpen","undefined","handleSubmit","values","Error","applyChanges","open","TransitionProps","onExited","mode","aria-label","onClick","sx","theme","position","top","spacing","right","width","initialValues","onSubmit","variant","type","form"],"mappings":"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"}
|
|
@@ -16,7 +16,8 @@ import userEvent from '@testing-library/user-event';
|
|
|
16
16
|
import { act } from 'react-dom/test-utils';
|
|
17
17
|
import { DashboardProvider } from '../../context';
|
|
18
18
|
import { createDashboardProviderSpy, getTestDashboard, renderWithContext } from '../../test';
|
|
19
|
-
import
|
|
19
|
+
import testDashboard from '../../test/testDashboard';
|
|
20
|
+
import { PanelGroupDialog } from './PanelGroupDialog';
|
|
20
21
|
describe('Add Panel Group', ()=>{
|
|
21
22
|
const renderDialog = ()=>{
|
|
22
23
|
const { store , DashboardProviderSpy } = createDashboardProviderSpy();
|
|
@@ -37,56 +38,40 @@ describe('Add Panel Group', ()=>{
|
|
|
37
38
|
return storeApi;
|
|
38
39
|
};
|
|
39
40
|
it('should add new panel group', async ()=>{
|
|
40
|
-
// jest.spyOn(dashboardAppSlice, 'useDashboardApp').mockReturnValue(dashboardApp);
|
|
41
41
|
const storeApi = renderDialog();
|
|
42
42
|
// Open the dialog for a new panel group
|
|
43
|
-
act(()=>storeApi.getState().
|
|
43
|
+
act(()=>storeApi.getState().openAddPanelGroup());
|
|
44
44
|
const nameInput = await screen.findByLabelText(/Name/);
|
|
45
45
|
userEvent.type(nameInput, 'New Panel Group');
|
|
46
46
|
userEvent.click(screen.getByText('Add'));
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
open: true
|
|
55
|
-
}
|
|
56
|
-
},
|
|
47
|
+
// TODO: Figure out how to test this without coupling to the store state
|
|
48
|
+
const panelGroups = storeApi.getState().panelGroups;
|
|
49
|
+
expect(panelGroups).toMatchObject({
|
|
50
|
+
'3': {
|
|
51
|
+
id: 3,
|
|
52
|
+
title: 'New Panel Group',
|
|
53
|
+
isCollapsed: false,
|
|
57
54
|
items: []
|
|
58
55
|
}
|
|
59
56
|
});
|
|
60
57
|
});
|
|
61
58
|
it('should edit existing panel group', async ()=>{
|
|
59
|
+
var ref;
|
|
62
60
|
const storeApi = renderDialog();
|
|
63
61
|
// Open the dialog for an existing panel group
|
|
64
|
-
act(()=>storeApi.getState().
|
|
62
|
+
act(()=>storeApi.getState().openEditPanelGroup(0));
|
|
65
63
|
const nameInput = await screen.findByLabelText(/Name/);
|
|
66
64
|
userEvent.clear(nameInput);
|
|
67
65
|
userEvent.type(nameInput, 'New Name');
|
|
68
66
|
userEvent.click(screen.getByText('Apply'));
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
items: [
|
|
80
|
-
{
|
|
81
|
-
content: {
|
|
82
|
-
$ref: '#/spec/panels/cpu'
|
|
83
|
-
},
|
|
84
|
-
height: 4,
|
|
85
|
-
width: 12,
|
|
86
|
-
x: 0,
|
|
87
|
-
y: 0
|
|
88
|
-
}
|
|
89
|
-
]
|
|
67
|
+
// TODO: Figure out how to test this without coupling to the store state
|
|
68
|
+
const panelGroups = storeApi.getState().panelGroups;
|
|
69
|
+
expect(panelGroups).toMatchObject({
|
|
70
|
+
'0': {
|
|
71
|
+
id: 0,
|
|
72
|
+
title: 'New Name',
|
|
73
|
+
isCollapsed: false,
|
|
74
|
+
items: (ref = testDashboard.spec.layouts[0]) === null || ref === void 0 ? void 0 : ref.spec.items
|
|
90
75
|
}
|
|
91
76
|
});
|
|
92
77
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/PanelGroupDialog/PanelGroupDialog.test.tsx"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { screen } from '@testing-library/react';\nimport userEvent from '@testing-library/user-event';\nimport { act } from 'react-dom/test-utils';\nimport { DashboardProvider } from '../../context';\nimport { createDashboardProviderSpy, getTestDashboard, renderWithContext } from '../../test';\nimport PanelGroupDialog from './PanelGroupDialog';\n\ndescribe('Add Panel Group', () => {\n const renderDialog = () => {\n const { store, DashboardProviderSpy } = createDashboardProviderSpy();\n\n renderWithContext(\n <DashboardProvider initialState={{ dashboardSpec: getTestDashboard().spec, isEditMode: true }}>\n <DashboardProviderSpy />\n <PanelGroupDialog />\n </DashboardProvider>\n );\n\n const { value: storeApi } = store;\n if (storeApi === undefined) {\n throw new Error('Expected dashboard store to be set after initial render');\n }\n\n return storeApi;\n };\n\n it('should add new panel group', async () => {\n
|
|
1
|
+
{"version":3,"sources":["../../../src/components/PanelGroupDialog/PanelGroupDialog.test.tsx"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { screen } from '@testing-library/react';\nimport userEvent from '@testing-library/user-event';\nimport { act } from 'react-dom/test-utils';\nimport { DashboardProvider } from '../../context';\nimport { createDashboardProviderSpy, getTestDashboard, renderWithContext } from '../../test';\nimport testDashboard from '../../test/testDashboard';\nimport { PanelGroupDialog } from './PanelGroupDialog';\n\ndescribe('Add Panel Group', () => {\n const renderDialog = () => {\n const { store, DashboardProviderSpy } = createDashboardProviderSpy();\n\n renderWithContext(\n <DashboardProvider initialState={{ dashboardSpec: getTestDashboard().spec, isEditMode: true }}>\n <DashboardProviderSpy />\n <PanelGroupDialog />\n </DashboardProvider>\n );\n\n const { value: storeApi } = store;\n if (storeApi === undefined) {\n throw new Error('Expected dashboard store to be set after initial render');\n }\n\n return storeApi;\n };\n\n it('should add new panel group', async () => {\n const storeApi = renderDialog();\n\n // Open the dialog for a new panel group\n act(() => storeApi.getState().openAddPanelGroup());\n\n const nameInput = await screen.findByLabelText(/Name/);\n userEvent.type(nameInput, 'New Panel Group');\n userEvent.click(screen.getByText('Add'));\n\n // TODO: Figure out how to test this without coupling to the store state\n const panelGroups = storeApi.getState().panelGroups;\n expect(panelGroups).toMatchObject({\n '3': {\n id: 3,\n title: 'New Panel Group',\n isCollapsed: false,\n items: [],\n },\n });\n });\n\n it('should edit existing panel group', async () => {\n const storeApi = renderDialog();\n\n // Open the dialog for an existing panel group\n act(() => storeApi.getState().openEditPanelGroup(0));\n\n const nameInput = await screen.findByLabelText(/Name/);\n userEvent.clear(nameInput);\n userEvent.type(nameInput, 'New Name');\n userEvent.click(screen.getByText('Apply'));\n\n // TODO: Figure out how to test this without coupling to the store state\n const panelGroups = storeApi.getState().panelGroups;\n expect(panelGroups).toMatchObject({\n '0': {\n id: 0,\n title: 'New Name',\n isCollapsed: false,\n items: testDashboard.spec.layouts[0]?.spec.items,\n },\n });\n });\n});\n"],"names":["screen","userEvent","act","DashboardProvider","createDashboardProviderSpy","getTestDashboard","renderWithContext","testDashboard","PanelGroupDialog","describe","renderDialog","store","DashboardProviderSpy","initialState","dashboardSpec","spec","isEditMode","value","storeApi","undefined","Error","it","getState","openAddPanelGroup","nameInput","findByLabelText","type","click","getByText","panelGroups","expect","toMatchObject","id","title","isCollapsed","items","openEditPanelGroup","clear","layouts"],"mappings":"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"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { PanelGroupEditorValues } from '../../context';
|
|
3
|
+
export interface PanelGroupEditorFormProps {
|
|
4
|
+
initialValues: PanelGroupEditorValues;
|
|
5
|
+
onSubmit: (next: PanelGroupEditorValues) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function PanelGroupEditorForm(props: PanelGroupEditorFormProps): JSX.Element;
|
|
8
|
+
/**
|
|
9
|
+
* The `id` attribute added to the `PanelGroupEditorForm` component, allowing submit buttons to live outside the form.
|
|
10
|
+
*/
|
|
11
|
+
export declare const panelGroupEditorFormId = "panel-group-editor-form";
|
|
12
|
+
//# sourceMappingURL=PanelGroupEditorForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PanelGroupEditorForm.d.ts","sourceRoot":"","sources":["../../../src/components/PanelGroupDialog/PanelGroupEditorForm.tsx"],"names":[],"mappings":";AAeA,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAIvD,MAAM,WAAW,yBAAyB;IACxC,aAAa,EAAE,sBAAsB,CAAC;IACtC,QAAQ,EAAE,CAAC,IAAI,EAAE,sBAAsB,KAAK,IAAI,CAAC;CAClD;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,eAsCpE;AAED;;GAEG;AACH,eAAO,MAAM,sBAAsB,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
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
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
import { useState } from 'react';
|
|
15
|
+
import { FormControl, InputLabel, TextField, Select, MenuItem } from '@mui/material';
|
|
16
|
+
export function PanelGroupEditorForm(props) {
|
|
17
|
+
const { initialValues , onSubmit } = props;
|
|
18
|
+
const [title, setTitle] = useState(initialValues.title);
|
|
19
|
+
const [isCollapsed, setIsCollapsed] = useState(initialValues.isCollapsed);
|
|
20
|
+
const handleCollapsedChange = (e)=>{
|
|
21
|
+
const next = e.target.value;
|
|
22
|
+
setIsCollapsed(next === 'Closed');
|
|
23
|
+
};
|
|
24
|
+
const handleSubmit = (e)=>{
|
|
25
|
+
e.preventDefault();
|
|
26
|
+
onSubmit({
|
|
27
|
+
title,
|
|
28
|
+
isCollapsed
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
return /*#__PURE__*/ _jsxs("form", {
|
|
32
|
+
id: panelGroupEditorFormId,
|
|
33
|
+
onSubmit: handleSubmit,
|
|
34
|
+
children: [
|
|
35
|
+
/*#__PURE__*/ _jsx(FormControl, {
|
|
36
|
+
fullWidth: true,
|
|
37
|
+
margin: "normal",
|
|
38
|
+
children: /*#__PURE__*/ _jsx(TextField, {
|
|
39
|
+
required: true,
|
|
40
|
+
label: "Name",
|
|
41
|
+
variant: "outlined",
|
|
42
|
+
value: title,
|
|
43
|
+
onChange: (e)=>setTitle(e.target.value)
|
|
44
|
+
})
|
|
45
|
+
}),
|
|
46
|
+
/*#__PURE__*/ _jsxs(FormControl, {
|
|
47
|
+
fullWidth: true,
|
|
48
|
+
margin: "normal",
|
|
49
|
+
children: [
|
|
50
|
+
/*#__PURE__*/ _jsx(InputLabel, {
|
|
51
|
+
id: "select-collapse-state",
|
|
52
|
+
children: "Collapse State"
|
|
53
|
+
}),
|
|
54
|
+
/*#__PURE__*/ _jsxs(Select, {
|
|
55
|
+
required: true,
|
|
56
|
+
displayEmpty: true,
|
|
57
|
+
labelId: "select-collapse-state",
|
|
58
|
+
label: "Collapse State",
|
|
59
|
+
size: "small",
|
|
60
|
+
value: isCollapsed ? 'Closed' : 'Open',
|
|
61
|
+
onChange: handleCollapsedChange,
|
|
62
|
+
children: [
|
|
63
|
+
/*#__PURE__*/ _jsx(MenuItem, {
|
|
64
|
+
value: "Open",
|
|
65
|
+
children: "Open"
|
|
66
|
+
}),
|
|
67
|
+
/*#__PURE__*/ _jsx(MenuItem, {
|
|
68
|
+
value: "Closed",
|
|
69
|
+
children: "Closed"
|
|
70
|
+
})
|
|
71
|
+
]
|
|
72
|
+
})
|
|
73
|
+
]
|
|
74
|
+
})
|
|
75
|
+
]
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* The `id` attribute added to the `PanelGroupEditorForm` component, allowing submit buttons to live outside the form.
|
|
80
|
+
*/ export const panelGroupEditorFormId = 'panel-group-editor-form';
|
|
81
|
+
|
|
82
|
+
//# sourceMappingURL=PanelGroupEditorForm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/PanelGroupDialog/PanelGroupEditorForm.tsx"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { FormEventHandler, useState } from 'react';\nimport { FormControl, InputLabel, TextField, Select, SelectProps, MenuItem } from '@mui/material';\nimport { PanelGroupEditorValues } from '../../context';\n\ntype CollapsedState = 'Open' | 'Closed';\n\nexport interface PanelGroupEditorFormProps {\n initialValues: PanelGroupEditorValues;\n onSubmit: (next: PanelGroupEditorValues) => void;\n}\n\nexport function PanelGroupEditorForm(props: PanelGroupEditorFormProps) {\n const { initialValues, onSubmit } = props;\n\n const [title, setTitle] = useState(initialValues.title);\n const [isCollapsed, setIsCollapsed] = useState(initialValues.isCollapsed);\n\n const handleCollapsedChange: SelectProps<CollapsedState>['onChange'] = (e) => {\n const next = e.target.value;\n setIsCollapsed(next === 'Closed');\n };\n\n const handleSubmit: FormEventHandler = (e) => {\n e.preventDefault();\n onSubmit({ title, isCollapsed });\n };\n\n return (\n <form id={panelGroupEditorFormId} onSubmit={handleSubmit}>\n <FormControl fullWidth margin=\"normal\">\n <TextField required label=\"Name\" variant=\"outlined\" value={title} onChange={(e) => setTitle(e.target.value)} />\n </FormControl>\n <FormControl fullWidth margin=\"normal\">\n <InputLabel id=\"select-collapse-state\">Collapse State</InputLabel>\n <Select<CollapsedState>\n required\n displayEmpty\n labelId=\"select-collapse-state\"\n label=\"Collapse State\"\n size=\"small\"\n value={isCollapsed ? 'Closed' : 'Open'}\n onChange={handleCollapsedChange}\n >\n <MenuItem value=\"Open\">Open</MenuItem>\n <MenuItem value=\"Closed\">Closed</MenuItem>\n </Select>\n </FormControl>\n </form>\n );\n}\n\n/**\n * The `id` attribute added to the `PanelGroupEditorForm` component, allowing submit buttons to live outside the form.\n */\nexport const panelGroupEditorFormId = 'panel-group-editor-form';\n"],"names":["useState","FormControl","InputLabel","TextField","Select","MenuItem","PanelGroupEditorForm","props","initialValues","onSubmit","title","setTitle","isCollapsed","setIsCollapsed","handleCollapsedChange","e","next","target","value","handleSubmit","preventDefault","form","id","panelGroupEditorFormId","fullWidth","margin","required","label","variant","onChange","displayEmpty","labelId","size"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC;AAAA,SAA2BA,QAAQ,QAAQ,OAAO,CAAC;AACnD,SAASC,WAAW,EAAEC,UAAU,EAAEC,SAAS,EAAEC,MAAM,EAAeC,QAAQ,QAAQ,eAAe,CAAC;AAUlG,OAAO,SAASC,oBAAoB,CAACC,KAAgC,EAAE;IACrE,MAAM,EAAEC,aAAa,CAAA,EAAEC,QAAQ,CAAA,EAAE,GAAGF,KAAK,AAAC;IAE1C,MAAM,CAACG,KAAK,EAAEC,QAAQ,CAAC,GAAGX,QAAQ,CAACQ,aAAa,CAACE,KAAK,CAAC,AAAC;IACxD,MAAM,CAACE,WAAW,EAAEC,cAAc,CAAC,GAAGb,QAAQ,CAACQ,aAAa,CAACI,WAAW,CAAC,AAAC;IAE1E,MAAME,qBAAqB,GAA4C,CAACC,CAAC,GAAK;QAC5E,MAAMC,IAAI,GAAGD,CAAC,CAACE,MAAM,CAACC,KAAK,AAAC;QAC5BL,cAAc,CAACG,IAAI,KAAK,QAAQ,CAAC,CAAC;IACpC,CAAC,AAAC;IAEF,MAAMG,YAAY,GAAqB,CAACJ,CAAC,GAAK;QAC5CA,CAAC,CAACK,cAAc,EAAE,CAAC;QACnBX,QAAQ,CAAC;YAAEC,KAAK;YAAEE,WAAW;SAAE,CAAC,CAAC;IACnC,CAAC,AAAC;IAEF,qBACE,MAACS,MAAI;QAACC,EAAE,EAAEC,sBAAsB;QAAEd,QAAQ,EAAEU,YAAY;;0BACtD,KAAClB,WAAW;gBAACuB,SAAS;gBAACC,MAAM,EAAC,QAAQ;0BACpC,cAAA,KAACtB,SAAS;oBAACuB,QAAQ;oBAACC,KAAK,EAAC,MAAM;oBAACC,OAAO,EAAC,UAAU;oBAACV,KAAK,EAAER,KAAK;oBAAEmB,QAAQ,EAAE,CAACd,CAAC,GAAKJ,QAAQ,CAACI,CAAC,CAACE,MAAM,CAACC,KAAK,CAAC;kBAAI;cACnG;0BACd,MAACjB,WAAW;gBAACuB,SAAS;gBAACC,MAAM,EAAC,QAAQ;;kCACpC,KAACvB,UAAU;wBAACoB,EAAE,EAAC,uBAAuB;kCAAC,gBAAc;sBAAa;kCAClE,MAAClB,MAAM;wBACLsB,QAAQ;wBACRI,YAAY;wBACZC,OAAO,EAAC,uBAAuB;wBAC/BJ,KAAK,EAAC,gBAAgB;wBACtBK,IAAI,EAAC,OAAO;wBACZd,KAAK,EAAEN,WAAW,GAAG,QAAQ,GAAG,MAAM;wBACtCiB,QAAQ,EAAEf,qBAAqB;;0CAE/B,KAACT,QAAQ;gCAACa,KAAK,EAAC,MAAM;0CAAC,MAAI;8BAAW;0CACtC,KAACb,QAAQ;gCAACa,KAAK,EAAC,QAAQ;0CAAC,QAAM;8BAAW;;sBACnC;;cACG;;MACT,CACP;AACJ,CAAC;AAED;;CAEC,GACD,OAAO,MAAMK,sBAAsB,GAAG,yBAAyB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/PanelGroupDialog/index.ts"],"names":[],"mappings":"AAaA,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
export * from './PanelGroupDialog';
|
|
14
|
+
export * from './DeletePanelGroupDialog';
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/PanelGroupDialog/index.ts"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './PanelGroupDialog';\nexport * from './DeletePanelGroupDialog';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimeRangeControls.d.ts","sourceRoot":"","sources":["../../../src/components/TimeRangeControls/TimeRangeControls.tsx"],"names":[],"mappings":";AAeA,OAAO,EAAyC,UAAU,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"TimeRangeControls.d.ts","sourceRoot":"","sources":["../../../src/components/TimeRangeControls/TimeRangeControls.tsx"],"names":[],"mappings":";AAeA,OAAO,EAAyC,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAW3F,eAAO,MAAM,YAAY,EAAE,UAAU,EAUpC,CAAC;AAEF,wBAAgB,iBAAiB,gBAsDhC"}
|
|
@@ -11,12 +11,11 @@
|
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
-
import { useRef, useState } from 'react';
|
|
14
|
+
import { useRef, useState, useMemo } from 'react';
|
|
15
15
|
import { Box, FormControl, Popover, Stack } from '@mui/material';
|
|
16
16
|
import { AbsoluteTimePicker, TimeRangeSelector } from '@perses-dev/components';
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import { useDashboard } from '../../context';
|
|
17
|
+
import { isRelativeTimeRange, toAbsoluteTimeRange } from '@perses-dev/core';
|
|
18
|
+
import { useDashboardTimeRange } from '../../context';
|
|
20
19
|
// TODO: add time shortcut if one does not match duration
|
|
21
20
|
export const TIME_OPTIONS = [
|
|
22
21
|
{
|
|
@@ -75,14 +74,14 @@ export const TIME_OPTIONS = [
|
|
|
75
74
|
}
|
|
76
75
|
];
|
|
77
76
|
export function TimeRangeControls() {
|
|
78
|
-
const { timeRange , setTimeRange } =
|
|
79
|
-
const { dashboard } = useDashboard();
|
|
80
|
-
const { queryString } = useQueryString();
|
|
81
|
-
const defaultTimeRange = getDefaultTimeRange(dashboard.duration, queryString);
|
|
82
|
-
// selected form value can be relative or absolute, timeRange from plugin-system is only absolute
|
|
83
|
-
const [selectedTimeRange, setSelectedTimeRange] = useState(defaultTimeRange);
|
|
77
|
+
const { timeRange , setTimeRange } = useDashboardTimeRange();
|
|
84
78
|
const [showCustomDateSelector, setShowCustomDateSelector] = useState(false);
|
|
85
79
|
const anchorEl = useRef();
|
|
80
|
+
const convertedTimeRange = useMemo(()=>{
|
|
81
|
+
return isRelativeTimeRange(timeRange) ? toAbsoluteTimeRange(timeRange) : timeRange;
|
|
82
|
+
}, [
|
|
83
|
+
timeRange
|
|
84
|
+
]);
|
|
86
85
|
return /*#__PURE__*/ _jsxs(Stack, {
|
|
87
86
|
direction: "row",
|
|
88
87
|
spacing: 1,
|
|
@@ -99,10 +98,9 @@ export function TimeRangeControls() {
|
|
|
99
98
|
padding: theme.spacing(2)
|
|
100
99
|
}),
|
|
101
100
|
children: /*#__PURE__*/ _jsx(AbsoluteTimePicker, {
|
|
102
|
-
initialTimeRange:
|
|
101
|
+
initialTimeRange: convertedTimeRange,
|
|
103
102
|
onChange: (timeRange)=>{
|
|
104
103
|
setTimeRange(timeRange);
|
|
105
|
-
setSelectedTimeRange(timeRange);
|
|
106
104
|
setShowCustomDateSelector(false);
|
|
107
105
|
}
|
|
108
106
|
})
|
|
@@ -113,7 +111,7 @@ export function TimeRangeControls() {
|
|
|
113
111
|
ref: anchorEl,
|
|
114
112
|
children: /*#__PURE__*/ _jsx(TimeRangeSelector, {
|
|
115
113
|
timeOptions: TIME_OPTIONS,
|
|
116
|
-
value:
|
|
114
|
+
value: timeRange,
|
|
117
115
|
onSelectChange: (event)=>{
|
|
118
116
|
const duration = event.target.value;
|
|
119
117
|
const relativeTimeInput = {
|
|
@@ -121,7 +119,6 @@ export function TimeRangeControls() {
|
|
|
121
119
|
end: new Date()
|
|
122
120
|
};
|
|
123
121
|
setTimeRange(relativeTimeInput);
|
|
124
|
-
setSelectedTimeRange(relativeTimeInput);
|
|
125
122
|
setShowCustomDateSelector(false);
|
|
126
123
|
},
|
|
127
124
|
onCustomClick: ()=>{
|