@perses-dev/dashboards 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/Dashboard.js +7 -11
- package/dist/cjs/components/DashboardToolbar.js +4 -4
- package/dist/cjs/components/GridLayout/GridItemContent.js +13 -13
- package/dist/cjs/components/GridLayout/GridLayout.js +24 -21
- package/dist/cjs/components/GridLayout/GridTitle.js +27 -5
- package/dist/cjs/components/Panel/DeletePanelDialog.js +91 -0
- package/dist/cjs/components/Panel/Panel.js +16 -5
- package/dist/cjs/components/Panel/Panel.test.js +12 -4
- package/dist/cjs/components/Panel/PanelContent.js +3 -2
- package/dist/cjs/components/PanelDrawer/PanelDrawer.js +13 -12
- package/dist/cjs/components/PanelDrawer/PanelDrawer.test.js +8 -12
- package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +77 -35
- package/dist/cjs/components/PanelDrawer/PanelPreview.js +48 -0
- package/dist/cjs/components/PanelGroupDialog/DeletePanelGroupDialog.js +86 -0
- package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.js +12 -19
- package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.test.js +10 -31
- package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +2 -2
- package/dist/cjs/components/Variables/Variable.js +19 -11
- package/dist/cjs/components/Variables/VariableEditor.js +207 -0
- package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +236 -0
- package/dist/cjs/components/Variables/VariableEditorForm/index.js +28 -0
- package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +88 -0
- package/dist/cjs/components/Variables/VariableList.js +50 -69
- package/dist/cjs/components/Variables/index.js +1 -0
- package/dist/cjs/context/DashboardProvider/DashboardProvider.js +70 -0
- package/dist/cjs/context/DashboardProvider/common.js +18 -0
- package/dist/cjs/context/DashboardProvider/dashboard-provider-api.js +71 -0
- package/dist/cjs/context/DashboardProvider/index.js +29 -0
- package/dist/cjs/context/DashboardProvider/layout-slice.js +200 -0
- package/dist/cjs/context/DashboardProvider/panel-editing-slice.js +156 -0
- package/dist/{context/DashboardAppSlice.js → cjs/context/DashboardProvider/panel-group-slice.js} +18 -25
- package/dist/cjs/context/DatasourceStoreProvider.js +109 -7
- package/dist/cjs/context/TemplateVariableProvider.js +8 -1
- package/dist/cjs/context/index.js +0 -2
- package/dist/cjs/test/testDashboard.js +13 -1
- package/dist/cjs/views/ViewDashboard/DashboardApp.js +6 -7
- package/dist/cjs/views/ViewDashboard/tests/panelGroups.test.js +165 -0
- package/dist/components/Dashboard.d.ts +1 -4
- package/dist/components/Dashboard.d.ts.map +1 -1
- package/dist/components/Dashboard.js +8 -12
- package/dist/components/Dashboard.js.map +1 -1
- package/dist/components/DashboardToolbar.d.ts.map +1 -1
- package/dist/components/DashboardToolbar.js +5 -5
- package/dist/components/DashboardToolbar.js.map +1 -1
- package/dist/components/GridLayout/GridItemContent.d.ts +3 -3
- package/dist/components/GridLayout/GridItemContent.d.ts.map +1 -1
- package/dist/components/GridLayout/GridItemContent.js +14 -14
- package/dist/components/GridLayout/GridItemContent.js.map +1 -1
- package/dist/components/GridLayout/GridLayout.d.ts +2 -3
- package/dist/components/GridLayout/GridLayout.d.ts.map +1 -1
- package/dist/components/GridLayout/GridLayout.js +24 -21
- package/dist/components/GridLayout/GridLayout.js.map +1 -1
- package/dist/components/GridLayout/GridTitle.d.ts.map +1 -1
- package/dist/components/GridLayout/GridTitle.js +28 -6
- package/dist/components/GridLayout/GridTitle.js.map +1 -1
- package/dist/components/Panel/DeletePanelDialog.d.ts +5 -0
- package/dist/components/Panel/DeletePanelDialog.d.ts.map +1 -0
- package/dist/components/Panel/DeletePanelDialog.js +80 -0
- package/dist/components/Panel/DeletePanelDialog.js.map +1 -0
- package/dist/components/Panel/Panel.d.ts +1 -1
- package/dist/components/Panel/Panel.d.ts.map +1 -1
- package/dist/components/Panel/Panel.js +17 -6
- package/dist/components/Panel/Panel.js.map +1 -1
- package/dist/components/Panel/Panel.test.js +7 -4
- package/dist/components/Panel/Panel.test.js.map +1 -1
- package/dist/components/Panel/PanelContent.d.ts +4 -1
- package/dist/components/Panel/PanelContent.d.ts.map +1 -1
- package/dist/components/Panel/PanelContent.js +3 -2
- package/dist/components/Panel/PanelContent.js.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.js +14 -13
- package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.test.js +8 -12
- package/dist/components/PanelDrawer/PanelDrawer.test.js.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.d.ts +3 -3
- package/dist/components/PanelDrawer/PanelEditorForm.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.js +78 -36
- package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -1
- package/dist/components/PanelDrawer/PanelPreview.d.ts +4 -0
- package/dist/components/PanelDrawer/PanelPreview.d.ts.map +1 -0
- package/dist/components/PanelDrawer/PanelPreview.js +42 -0
- package/dist/components/PanelDrawer/PanelPreview.js.map +1 -0
- package/dist/components/PanelGroupDialog/DeletePanelGroupDialog.d.ts +4 -0
- package/dist/components/PanelGroupDialog/DeletePanelGroupDialog.d.ts.map +1 -0
- package/dist/components/PanelGroupDialog/DeletePanelGroupDialog.js +75 -0
- package/dist/components/PanelGroupDialog/DeletePanelGroupDialog.js.map +1 -0
- package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.js +13 -20
- package/dist/components/PanelGroupDialog/PanelGroupDialog.js.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.test.js +10 -31
- package/dist/components/PanelGroupDialog/PanelGroupDialog.test.js.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.js +3 -3
- package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
- package/dist/components/Variables/Variable.js +21 -13
- package/dist/components/Variables/Variable.js.map +1 -1
- package/dist/components/Variables/VariableEditor.d.ts +8 -0
- package/dist/components/Variables/VariableEditor.d.ts.map +1 -0
- package/dist/components/Variables/VariableEditor.js +196 -0
- package/dist/components/Variables/VariableEditor.js.map +1 -0
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts +8 -0
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -0
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +225 -0
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -0
- package/dist/components/Variables/VariableEditorForm/index.d.ts +2 -0
- package/dist/components/Variables/VariableEditorForm/index.d.ts.map +1 -0
- package/dist/components/Variables/VariableEditorForm/index.js +15 -0
- package/dist/components/Variables/VariableEditorForm/index.js.map +1 -0
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts +21 -0
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts.map +1 -0
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +76 -0
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -0
- package/dist/components/Variables/VariableList.d.ts.map +1 -1
- package/dist/components/Variables/VariableList.js +48 -72
- package/dist/components/Variables/VariableList.js.map +1 -1
- package/dist/components/Variables/index.d.ts +1 -0
- package/dist/components/Variables/index.d.ts.map +1 -1
- package/dist/components/Variables/index.js +1 -0
- package/dist/components/Variables/index.js.map +1 -1
- package/dist/context/DashboardProvider/DashboardProvider.d.ts +23 -0
- package/dist/context/DashboardProvider/DashboardProvider.d.ts.map +1 -0
- package/dist/context/DashboardProvider/DashboardProvider.js +52 -0
- package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -0
- package/dist/context/DashboardProvider/common.d.ts +5 -0
- package/dist/context/DashboardProvider/common.d.ts.map +1 -0
- package/dist/context/DashboardProvider/common.js +17 -0
- package/dist/context/DashboardProvider/common.js.map +1 -0
- package/dist/context/DashboardProvider/dashboard-provider-api.d.ts +32 -0
- package/dist/context/DashboardProvider/dashboard-provider-api.d.ts.map +1 -0
- package/dist/context/DashboardProvider/dashboard-provider-api.js +56 -0
- package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -0
- package/dist/context/DashboardProvider/index.d.ts +3 -0
- package/dist/context/DashboardProvider/index.d.ts.map +1 -0
- package/dist/context/DashboardProvider/index.js +16 -0
- package/dist/context/DashboardProvider/index.js.map +1 -0
- package/dist/context/DashboardProvider/layout-slice.d.ts +57 -0
- package/dist/context/DashboardProvider/layout-slice.d.ts.map +1 -0
- package/dist/context/DashboardProvider/layout-slice.js +196 -0
- package/dist/context/DashboardProvider/layout-slice.js.map +1 -0
- package/dist/context/DashboardProvider/panel-editing-slice.d.ts +70 -0
- package/dist/context/DashboardProvider/panel-editing-slice.d.ts.map +1 -0
- package/dist/context/DashboardProvider/panel-editing-slice.js +152 -0
- package/dist/context/DashboardProvider/panel-editing-slice.js.map +1 -0
- package/dist/context/DashboardProvider/panel-group-slice.d.ts +15 -0
- package/dist/context/DashboardProvider/panel-group-slice.d.ts.map +1 -0
- package/dist/context/DashboardProvider/panel-group-slice.js +32 -0
- package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -0
- package/dist/context/DatasourceStoreProvider.d.ts +10 -2
- package/dist/context/DatasourceStoreProvider.d.ts.map +1 -1
- package/dist/context/DatasourceStoreProvider.js +111 -9
- package/dist/context/DatasourceStoreProvider.js.map +1 -1
- package/dist/context/TemplateVariableProvider.d.ts +2 -0
- package/dist/context/TemplateVariableProvider.d.ts.map +1 -1
- package/dist/context/TemplateVariableProvider.js +8 -1
- package/dist/context/TemplateVariableProvider.js.map +1 -1
- package/dist/context/index.d.ts +0 -2
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +0 -2
- package/dist/context/index.js.map +1 -1
- package/dist/test/plugin-registry.d.ts +2 -2
- package/dist/test/plugin-registry.d.ts.map +1 -1
- package/dist/test/plugin-registry.js.map +1 -1
- package/dist/test/testDashboard.d.ts.map +1 -1
- package/dist/test/testDashboard.js +13 -1
- package/dist/test/testDashboard.js.map +1 -1
- package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -1
- package/dist/views/ViewDashboard/DashboardApp.js +6 -7
- package/dist/views/ViewDashboard/DashboardApp.js.map +1 -1
- package/dist/views/ViewDashboard/tests/panelGroups.test.d.ts +2 -0
- package/dist/views/ViewDashboard/tests/panelGroups.test.d.ts.map +1 -0
- package/dist/views/ViewDashboard/tests/panelGroups.test.js +158 -0
- package/dist/views/ViewDashboard/tests/panelGroups.test.js.map +1 -0
- package/package.json +4 -4
- package/dist/cjs/components/PanelDrawer/PanelSpecEditor.js +0 -40
- package/dist/cjs/components/PanelDrawer/PanelTypeSelect.js +0 -38
- package/dist/cjs/components/PanelDrawer/panel-editor-model.js +0 -140
- package/dist/cjs/context/DashboardAppSlice.js +0 -57
- package/dist/cjs/context/DashboardProvider.js +0 -128
- package/dist/cjs/context/LayoutsSlice.js +0 -55
- package/dist/components/PanelDrawer/PanelSpecEditor.d.ts +0 -7
- package/dist/components/PanelDrawer/PanelSpecEditor.d.ts.map +0 -1
- package/dist/components/PanelDrawer/PanelSpecEditor.js +0 -34
- package/dist/components/PanelDrawer/PanelSpecEditor.js.map +0 -1
- package/dist/components/PanelDrawer/PanelTypeSelect.d.ts +0 -8
- package/dist/components/PanelDrawer/PanelTypeSelect.d.ts.map +0 -1
- package/dist/components/PanelDrawer/PanelTypeSelect.js +0 -34
- package/dist/components/PanelDrawer/PanelTypeSelect.js.map +0 -1
- package/dist/components/PanelDrawer/panel-editor-model.d.ts +0 -27
- package/dist/components/PanelDrawer/panel-editor-model.d.ts.map +0 -1
- package/dist/components/PanelDrawer/panel-editor-model.js +0 -133
- package/dist/components/PanelDrawer/panel-editor-model.js.map +0 -1
- package/dist/context/DashboardAppSlice.d.ts +0 -26
- package/dist/context/DashboardAppSlice.d.ts.map +0 -1
- package/dist/context/DashboardAppSlice.js.map +0 -1
- package/dist/context/DashboardProvider.d.ts +0 -36
- package/dist/context/DashboardProvider.d.ts.map +0 -1
- package/dist/context/DashboardProvider.js +0 -107
- package/dist/context/DashboardProvider.js.map +0 -1
- package/dist/context/LayoutsSlice.d.ts +0 -12
- package/dist/context/LayoutsSlice.d.ts.map +0 -1
- package/dist/context/LayoutsSlice.js +0 -43
- package/dist/context/LayoutsSlice.js.map +0 -1
|
@@ -18,13 +18,14 @@ import { ErrorBoundary, ErrorAlert, InfoTooltip, TooltipPlacement } from '@perse
|
|
|
18
18
|
import { Box, Card, CardHeader, CardContent, Typography, IconButton as MuiIconButton, Stack, styled } from '@mui/material';
|
|
19
19
|
import InformationOutlineIcon from 'mdi-material-ui/InformationOutline';
|
|
20
20
|
import PencilIcon from 'mdi-material-ui/Pencil';
|
|
21
|
+
import DeleteIcon from 'mdi-material-ui/DeleteOutline';
|
|
21
22
|
import DragIcon from 'mdi-material-ui/DragVertical';
|
|
22
|
-
import {
|
|
23
|
+
import { usePanels, useEditMode } from '../../context';
|
|
23
24
|
import { PanelContent } from './PanelContent';
|
|
24
25
|
/**
|
|
25
26
|
* Renders a PanelDefinition's content inside of a Card.
|
|
26
27
|
*/ export function Panel(props) {
|
|
27
|
-
const { definition , groupIndex ,
|
|
28
|
+
const { definition , groupIndex , itemIndex , ...others } = props;
|
|
28
29
|
const [contentElement, setContentElement] = useState(null);
|
|
29
30
|
const [isHovered, setIsHovered] = useState(false);
|
|
30
31
|
const { width , height } = useResizeObserver({
|
|
@@ -48,11 +49,11 @@ import { PanelContent } from './PanelContent';
|
|
|
48
49
|
// TODO: adjust padding for small panels, consistent way to determine isLargePanel here and in StatChart
|
|
49
50
|
const panelPadding = 1.5;
|
|
50
51
|
const { isEditMode } = useEditMode();
|
|
51
|
-
const {
|
|
52
|
+
const { editPanel , openDeletePanelDialog } = usePanels();
|
|
52
53
|
const handleEditButtonClick = ()=>{
|
|
53
|
-
|
|
54
|
+
editPanel({
|
|
54
55
|
groupIndex,
|
|
55
|
-
|
|
56
|
+
itemIndex
|
|
56
57
|
});
|
|
57
58
|
};
|
|
58
59
|
return /*#__PURE__*/ _jsxs(Card, {
|
|
@@ -117,6 +118,15 @@ import { PanelContent } from './PanelContent';
|
|
|
117
118
|
onClick: handleEditButtonClick,
|
|
118
119
|
children: /*#__PURE__*/ _jsx(PencilIcon, {})
|
|
119
120
|
}),
|
|
121
|
+
/*#__PURE__*/ _jsx(IconButton, {
|
|
122
|
+
"aria-label": "delete panel",
|
|
123
|
+
size: "small",
|
|
124
|
+
onClick: ()=>openDeletePanelDialog({
|
|
125
|
+
groupIndex,
|
|
126
|
+
itemIndex
|
|
127
|
+
}),
|
|
128
|
+
children: /*#__PURE__*/ _jsx(DeleteIcon, {})
|
|
129
|
+
}),
|
|
120
130
|
/*#__PURE__*/ _jsx(IconButton, {
|
|
121
131
|
"aria-label": "drag handle",
|
|
122
132
|
size: "small",
|
|
@@ -154,7 +164,8 @@ import { PanelContent } from './PanelContent';
|
|
|
154
164
|
children: /*#__PURE__*/ _jsx(ErrorBoundary, {
|
|
155
165
|
FallbackComponent: ErrorAlert,
|
|
156
166
|
children: inView === true && /*#__PURE__*/ _jsx(PanelContent, {
|
|
157
|
-
|
|
167
|
+
panelPluginKind: definition.spec.plugin.kind,
|
|
168
|
+
spec: definition.spec.plugin.spec,
|
|
158
169
|
contentDimensions: contentDimensions
|
|
159
170
|
})
|
|
160
171
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Panel/Panel.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 { useState, useMemo } from 'react';\nimport useResizeObserver from 'use-resize-observer';\nimport { useInView } from 'react-intersection-observer';\nimport { ErrorBoundary, ErrorAlert, InfoTooltip, TooltipPlacement } from '@perses-dev/components';\nimport { PanelDefinition } from '@perses-dev/core';\nimport {\n Box,\n Card,\n CardProps,\n CardHeader,\n CardContent,\n Typography,\n IconButton as MuiIconButton,\n Stack,\n styled,\n} from '@mui/material';\nimport InformationOutlineIcon from 'mdi-material-ui/InformationOutline';\nimport PencilIcon from 'mdi-material-ui/Pencil';\nimport DragIcon from 'mdi-material-ui/DragVertical';\nimport { useDashboardApp, useEditMode } from '../../context';\nimport { PanelContent } from './PanelContent';\n\nexport interface PanelProps extends CardProps {\n definition: PanelDefinition;\n groupIndex: number;\n panelKey: string;\n}\n\n/**\n * Renders a PanelDefinition's content inside of a Card.\n */\nexport function Panel(props: PanelProps) {\n const { definition, groupIndex, panelKey, ...others } = props;\n\n const [contentElement, setContentElement] = useState<HTMLDivElement | null>(null);\n const [isHovered, setIsHovered] = useState(false);\n\n const { width, height } = useResizeObserver({ ref: contentElement });\n\n const contentDimensions = useMemo(() => {\n if (width === undefined || height === undefined) return undefined;\n return { width, height };\n }, [width, height]);\n\n const { ref, inView } = useInView({\n threshold: 0.3,\n initialInView: false,\n triggerOnce: true,\n });\n\n // TODO: adjust padding for small panels, consistent way to determine isLargePanel here and in StatChart\n const panelPadding = 1.5;\n\n const { isEditMode } = useEditMode();\n\n const { openPanelDrawer } = useDashboardApp();\n\n const handleEditButtonClick = () => {\n openPanelDrawer({ groupIndex, panelKey });\n };\n\n return (\n <Card\n ref={ref}\n sx={{\n ...others.sx,\n width: '100%',\n height: '100%',\n display: 'flex',\n flexFlow: 'column nowrap',\n }}\n variant=\"outlined\"\n {...others}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n >\n <CardHeader\n title={\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n minHeight: '24px',\n }}\n >\n <Typography\n component=\"h2\"\n variant=\"body2\"\n fontWeight={(theme) => theme.typography.fontWeightMedium}\n whiteSpace=\"nowrap\"\n overflow=\"hidden\"\n textOverflow=\"ellipsis\"\n >\n {definition.spec.display.name}\n </Typography>\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n marginLeft: 'auto',\n }}\n >\n {!isEditMode && isHovered && definition.spec.display.description && (\n <InfoTooltip\n id=\"info-tooltip\"\n description={definition.spec.display.description}\n placement={TooltipPlacement.Bottom}\n >\n <InformationOutlineIcon\n aria-describedby=\"info-tooltip\"\n aria-hidden={false}\n fontSize=\"small\"\n sx={{ cursor: 'pointer' }}\n />\n </InfoTooltip>\n )}\n {isEditMode && isHovered && (\n <Stack direction=\"row\" alignItems=\"center\" spacing={0.5}>\n <IconButton aria-label=\"edit panel\" size=\"small\" onClick={handleEditButtonClick}>\n <PencilIcon />\n </IconButton>\n <IconButton aria-label=\"drag handle\" size=\"small\">\n <DragIcon className=\"drag-handle\" sx={{ cursor: 'grab' }} />\n </IconButton>\n </Stack>\n )}\n </Box>\n </Box>\n }\n sx={{\n display: 'block',\n padding: (theme) => theme.spacing(1, panelPadding),\n borderBottom: (theme) => `solid 1px ${theme.palette.divider}`,\n }}\n />\n <CardContent\n sx={{\n position: 'relative',\n overflow: 'hidden',\n flexGrow: 1,\n padding: (theme) => theme.spacing(panelPadding),\n // Override MUI default style for last-child\n ':last-child': {\n padding: (theme) => theme.spacing(panelPadding),\n },\n }}\n ref={setContentElement}\n >\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n {inView === true && <PanelContent definition={definition} contentDimensions={contentDimensions} />}\n </ErrorBoundary>\n </CardContent>\n </Card>\n );\n}\n\nconst IconButton = styled(MuiIconButton)(({ theme }) => ({\n borderRadius: theme.shape.borderRadius,\n padding: '4px',\n}));\n"],"names":["useState","useMemo","useResizeObserver","useInView","ErrorBoundary","ErrorAlert","InfoTooltip","TooltipPlacement","Box","Card","CardHeader","CardContent","Typography","IconButton","MuiIconButton","Stack","styled","InformationOutlineIcon","PencilIcon","DragIcon","useDashboardApp","useEditMode","PanelContent","Panel","props","definition","groupIndex","panelKey","others","contentElement","setContentElement","isHovered","setIsHovered","width","height","ref","contentDimensions","undefined","inView","threshold","initialInView","triggerOnce","panelPadding","isEditMode","openPanelDrawer","handleEditButtonClick","sx","display","flexFlow","variant","onMouseEnter","onMouseLeave","title","alignItems","minHeight","component","fontWeight","theme","typography","fontWeightMedium","whiteSpace","overflow","textOverflow","spec","name","marginLeft","description","id","placement","Bottom","aria-describedby","aria-hidden","fontSize","cursor","direction","spacing","aria-label","size","onClick","className","padding","borderBottom","palette","divider","position","flexGrow","FallbackComponent","borderRadius","shape"],"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,SAASA,QAAQ,EAAEC,OAAO,QAAQ,OAAO,CAAC;AAC1C,OAAOC,iBAAiB,MAAM,qBAAqB,CAAC;AACpD,SAASC,SAAS,QAAQ,6BAA6B,CAAC;AACxD,SAASC,aAAa,EAAEC,UAAU,EAAEC,WAAW,EAAEC,gBAAgB,QAAQ,wBAAwB,CAAC;AAElG,SACEC,GAAG,EACHC,IAAI,EAEJC,UAAU,EACVC,WAAW,EACXC,UAAU,EACVC,UAAU,IAAIC,aAAa,EAC3BC,KAAK,EACLC,MAAM,QACD,eAAe,CAAC;AACvB,OAAOC,sBAAsB,MAAM,oCAAoC,CAAC;AACxE,OAAOC,UAAU,MAAM,wBAAwB,CAAC;AAChD,OAAOC,QAAQ,MAAM,8BAA8B,CAAC;AACpD,SAASC,eAAe,EAAEC,WAAW,QAAQ,eAAe,CAAC;AAC7D,SAASC,YAAY,QAAQ,gBAAgB,CAAC;AAQ9C;;CAEC,GACD,OAAO,SAASC,KAAK,CAACC,KAAiB,EAAE;I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8BACzCiC,MAAM,KAAK,IAAI,kBAAI,KAAChB,YAAY;wBAACG,UAAU,EAAEA,UAAU;wBAAEW,iBAAiB,EAAEA,iBAAiB;sBAAI;kBACpF;cACJ;;MACT,CACP;AACJ,CAAC;AAED,MAAMvB,UAAU,GAAGG,MAAM,CAACF,aAAa,CAAC,CAAC,CAAC,EAAE2C,KAAK,CAAA,EAAE,GAAM,CAAA;QACvD8B,YAAY,EAAE9B,KAAK,CAAC+B,KAAK,CAACD,YAAY;QACtCP,OAAO,EAAE,KAAK;KACf,CAAA,AAAC,CAAC,AAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Panel/Panel.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 { useState, useMemo } from 'react';\nimport useResizeObserver from 'use-resize-observer';\nimport { useInView } from 'react-intersection-observer';\nimport { ErrorBoundary, ErrorAlert, InfoTooltip, TooltipPlacement } from '@perses-dev/components';\nimport { PanelDefinition } from '@perses-dev/core';\nimport {\n Box,\n Card,\n CardProps,\n CardHeader,\n CardContent,\n Typography,\n IconButton as MuiIconButton,\n Stack,\n styled,\n} from '@mui/material';\nimport InformationOutlineIcon from 'mdi-material-ui/InformationOutline';\nimport PencilIcon from 'mdi-material-ui/Pencil';\nimport DeleteIcon from 'mdi-material-ui/DeleteOutline';\nimport DragIcon from 'mdi-material-ui/DragVertical';\nimport { usePanels, useEditMode } from '../../context';\nimport { PanelContent } from './PanelContent';\n\nexport interface PanelProps extends CardProps {\n definition: PanelDefinition;\n groupIndex: number;\n itemIndex: number;\n}\n\n/**\n * Renders a PanelDefinition's content inside of a Card.\n */\nexport function Panel(props: PanelProps) {\n const { definition, groupIndex, itemIndex, ...others } = props;\n\n const [contentElement, setContentElement] = useState<HTMLDivElement | null>(null);\n const [isHovered, setIsHovered] = useState(false);\n\n const { width, height } = useResizeObserver({ ref: contentElement });\n\n const contentDimensions = useMemo(() => {\n if (width === undefined || height === undefined) return undefined;\n return { width, height };\n }, [width, height]);\n\n const { ref, inView } = useInView({\n threshold: 0.3,\n initialInView: false,\n triggerOnce: true,\n });\n\n // TODO: adjust padding for small panels, consistent way to determine isLargePanel here and in StatChart\n const panelPadding = 1.5;\n\n const { isEditMode } = useEditMode();\n\n const { editPanel, openDeletePanelDialog } = usePanels();\n\n const handleEditButtonClick = () => {\n editPanel({ groupIndex, itemIndex });\n };\n\n return (\n <Card\n ref={ref}\n sx={{\n ...others.sx,\n width: '100%',\n height: '100%',\n display: 'flex',\n flexFlow: 'column nowrap',\n }}\n variant=\"outlined\"\n {...others}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n >\n <CardHeader\n title={\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n minHeight: '24px',\n }}\n >\n <Typography\n component=\"h2\"\n variant=\"body2\"\n fontWeight={(theme) => theme.typography.fontWeightMedium}\n whiteSpace=\"nowrap\"\n overflow=\"hidden\"\n textOverflow=\"ellipsis\"\n >\n {definition.spec.display.name}\n </Typography>\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n marginLeft: 'auto',\n }}\n >\n {!isEditMode && isHovered && definition.spec.display.description && (\n <InfoTooltip\n id=\"info-tooltip\"\n description={definition.spec.display.description}\n placement={TooltipPlacement.Bottom}\n >\n <InformationOutlineIcon\n aria-describedby=\"info-tooltip\"\n aria-hidden={false}\n fontSize=\"small\"\n sx={{ cursor: 'pointer' }}\n />\n </InfoTooltip>\n )}\n {isEditMode && isHovered && (\n <Stack direction=\"row\" alignItems=\"center\" spacing={0.5}>\n <IconButton aria-label=\"edit panel\" size=\"small\" onClick={handleEditButtonClick}>\n <PencilIcon />\n </IconButton>\n <IconButton\n aria-label=\"delete panel\"\n size=\"small\"\n onClick={() => openDeletePanelDialog({ groupIndex, itemIndex })}\n >\n <DeleteIcon />\n </IconButton>\n <IconButton aria-label=\"drag handle\" size=\"small\">\n <DragIcon className=\"drag-handle\" sx={{ cursor: 'grab' }} />\n </IconButton>\n </Stack>\n )}\n </Box>\n </Box>\n }\n sx={{\n display: 'block',\n padding: (theme) => theme.spacing(1, panelPadding),\n borderBottom: (theme) => `solid 1px ${theme.palette.divider}`,\n }}\n />\n <CardContent\n sx={{\n position: 'relative',\n overflow: 'hidden',\n flexGrow: 1,\n padding: (theme) => theme.spacing(panelPadding),\n // Override MUI default style for last-child\n ':last-child': {\n padding: (theme) => theme.spacing(panelPadding),\n },\n }}\n ref={setContentElement}\n >\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n {inView === true && (\n <PanelContent\n panelPluginKind={definition.spec.plugin.kind}\n spec={definition.spec.plugin.spec}\n contentDimensions={contentDimensions}\n />\n )}\n </ErrorBoundary>\n </CardContent>\n </Card>\n );\n}\n\nconst IconButton = styled(MuiIconButton)(({ theme }) => ({\n borderRadius: theme.shape.borderRadius,\n padding: '4px',\n}));\n"],"names":["useState","useMemo","useResizeObserver","useInView","ErrorBoundary","ErrorAlert","InfoTooltip","TooltipPlacement","Box","Card","CardHeader","CardContent","Typography","IconButton","MuiIconButton","Stack","styled","InformationOutlineIcon","PencilIcon","DeleteIcon","DragIcon","usePanels","useEditMode","PanelContent","Panel","props","definition","groupIndex","itemIndex","others","contentElement","setContentElement","isHovered","setIsHovered","width","height","ref","contentDimensions","undefined","inView","threshold","initialInView","triggerOnce","panelPadding","isEditMode","editPanel","openDeletePanelDialog","handleEditButtonClick","sx","display","flexFlow","variant","onMouseEnter","onMouseLeave","title","alignItems","minHeight","component","fontWeight","theme","typography","fontWeightMedium","whiteSpace","overflow","textOverflow","spec","name","marginLeft","description","id","placement","Bottom","aria-describedby","aria-hidden","fontSize","cursor","direction","spacing","aria-label","size","onClick","className","padding","borderBottom","palette","divider","position","flexGrow","FallbackComponent","panelPluginKind","plugin","kind","borderRadius","shape"],"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,SAASA,QAAQ,EAAEC,OAAO,QAAQ,OAAO,CAAC;AAC1C,OAAOC,iBAAiB,MAAM,qBAAqB,CAAC;AACpD,SAASC,SAAS,QAAQ,6BAA6B,CAAC;AACxD,SAASC,aAAa,EAAEC,UAAU,EAAEC,WAAW,EAAEC,gBAAgB,QAAQ,wBAAwB,CAAC;AAElG,SACEC,GAAG,EACHC,IAAI,EAEJC,UAAU,EACVC,WAAW,EACXC,UAAU,EACVC,UAAU,IAAIC,aAAa,EAC3BC,KAAK,EACLC,MAAM,QACD,eAAe,CAAC;AACvB,OAAOC,sBAAsB,MAAM,oCAAoC,CAAC;AACxE,OAAOC,UAAU,MAAM,wBAAwB,CAAC;AAChD,OAAOC,UAAU,MAAM,+BAA+B,CAAC;AACvD,OAAOC,QAAQ,MAAM,8BAA8B,CAAC;AACpD,SAASC,SAAS,EAAEC,WAAW,QAAQ,eAAe,CAAC;AACvD,SAASC,YAAY,QAAQ,gBAAgB,CAAC;AAQ9C;;CAEC,GACD,OAAO,SAASC,KAAK,CAACC,KAAiB,EAAE;IACvC,MAAM,EAAEC,UAAU,CAAA,EAAEC,UAAU,CAAA,EAAEC,SAAS,CAAA,EAAE,GAAGC,MAAM,EAAE,GAAGJ,KAAK,AAAC;IAE/D,MAAM,CAACK,cAAc,EAAEC,iBAAiB,CAAC,GAAG/B,QAAQ,CAAwB,IAAI,CAAC,AAAC;IAClF,MAAM,CAACgC,SAAS,EAAEC,YAAY,CAAC,GAAGjC,QAAQ,CAAC,K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,EAAE/D,UAAU,CAACuC,IAAI,CAACyB,MAAM,CAACC,IAAI;wBAC5C1B,IAAI,EAAEvC,UAAU,CAACuC,IAAI,CAACyB,MAAM,CAACzB,IAAI;wBACjC5B,iBAAiB,EAAEA,iBAAiB;sBACpC,AACH;kBACa;cACJ;;MACT,CACP;AACJ,CAAC;AAED,MAAMxB,UAAU,GAAGG,MAAM,CAACF,aAAa,CAAC,CAAC,CAAC,EAAE6C,KAAK,CAAA,EAAE,GAAM,CAAA;QACvDiC,YAAY,EAAEjC,KAAK,CAACkC,KAAK,CAACD,YAAY;QACtCV,OAAO,EAAE,KAAK;KACf,CAAA,AAAC,CAAC,AAAC"}
|
|
@@ -14,6 +14,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
14
14
|
import { PluginRegistry } from '@perses-dev/plugin-system';
|
|
15
15
|
import 'intersection-observer'; // TODO: Why do we need this side-effect? Should it be in test setup somewhere?
|
|
16
16
|
import { screen } from '@testing-library/react';
|
|
17
|
+
import userEvent from '@testing-library/user-event';
|
|
17
18
|
import { renderWithContext, mockPluginRegistryProps, FAKE_PANEL_PLUGIN, getTestDashboard } from '../../test';
|
|
18
19
|
import { DashboardProvider } from '../../context';
|
|
19
20
|
import { Panel } from './Panel';
|
|
@@ -35,7 +36,7 @@ describe('Panel', ()=>{
|
|
|
35
36
|
}
|
|
36
37
|
},
|
|
37
38
|
groupIndex: 0,
|
|
38
|
-
|
|
39
|
+
itemIndex: 0
|
|
39
40
|
};
|
|
40
41
|
};
|
|
41
42
|
// Helper to render the panel with some context set
|
|
@@ -62,9 +63,11 @@ describe('Panel', ()=>{
|
|
|
62
63
|
});
|
|
63
64
|
it('should render edit icons when in edit mode', ()=>{
|
|
64
65
|
renderPanel(true);
|
|
65
|
-
screen.
|
|
66
|
-
|
|
67
|
-
screen.
|
|
66
|
+
const panelTitle = screen.getByText('Fake Panel');
|
|
67
|
+
userEvent.hover(panelTitle);
|
|
68
|
+
screen.getByLabelText('drag handle');
|
|
69
|
+
screen.getByLabelText('edit panel');
|
|
70
|
+
screen.getByLabelText('delete panel');
|
|
68
71
|
});
|
|
69
72
|
});
|
|
70
73
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Panel/Panel.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 { PluginRegistry } from '@perses-dev/plugin-system';\nimport 'intersection-observer'; // TODO: Why do we need this side-effect? Should it be in test setup somewhere?\nimport { screen } from '@testing-library/react';\nimport { renderWithContext, mockPluginRegistryProps, FAKE_PANEL_PLUGIN, getTestDashboard } from '../../test';\nimport { DashboardProvider } from '../../context';\nimport { Panel, PanelProps } from './Panel';\n\ndescribe('Panel', () => {\n // Helper to create panel props for rendering tests\n const createPanelProps = (): PanelProps => {\n return {\n definition: {\n kind: 'Panel',\n spec: {\n display: {\n name: 'Fake Panel',\n description: 'This is a fake panel',\n },\n plugin: {\n kind: 'FakePanel',\n spec: {},\n },\n },\n },\n groupIndex: 0,\n
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Panel/Panel.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 { PluginRegistry } from '@perses-dev/plugin-system';\nimport 'intersection-observer'; // TODO: Why do we need this side-effect? Should it be in test setup somewhere?\nimport { screen } from '@testing-library/react';\nimport userEvent from '@testing-library/user-event';\nimport { renderWithContext, mockPluginRegistryProps, FAKE_PANEL_PLUGIN, getTestDashboard } from '../../test';\nimport { DashboardProvider } from '../../context';\nimport { Panel, PanelProps } from './Panel';\n\ndescribe('Panel', () => {\n // Helper to create panel props for rendering tests\n const createPanelProps = (): PanelProps => {\n return {\n definition: {\n kind: 'Panel',\n spec: {\n display: {\n name: 'Fake Panel',\n description: 'This is a fake panel',\n },\n plugin: {\n kind: 'FakePanel',\n spec: {},\n },\n },\n },\n groupIndex: 0,\n itemIndex: 0,\n };\n };\n\n // Helper to render the panel with some context set\n const renderPanel = (isEditMode = false) => {\n const { addMockPlugin, pluginRegistryProps } = mockPluginRegistryProps();\n addMockPlugin('Panel', 'FakePanel', FAKE_PANEL_PLUGIN);\n\n renderWithContext(\n <PluginRegistry {...pluginRegistryProps}>\n <DashboardProvider initialState={{ dashboardSpec: getTestDashboard().spec, isEditMode }}>\n <Panel {...createPanelProps()} />\n </DashboardProvider>\n </PluginRegistry>\n );\n };\n\n it('should render name and info icon', async () => {\n renderPanel();\n await screen.findByText('Fake Panel');\n screen.queryByLabelText('info-tooltip');\n });\n\n it('should render edit icons when in edit mode', () => {\n renderPanel(true);\n const panelTitle = screen.getByText('Fake Panel');\n userEvent.hover(panelTitle);\n screen.getByLabelText('drag handle');\n screen.getByLabelText('edit panel');\n screen.getByLabelText('delete panel');\n });\n});\n"],"names":["PluginRegistry","screen","userEvent","renderWithContext","mockPluginRegistryProps","FAKE_PANEL_PLUGIN","getTestDashboard","DashboardProvider","Panel","describe","createPanelProps","definition","kind","spec","display","name","description","plugin","groupIndex","itemIndex","renderPanel","isEditMode","addMockPlugin","pluginRegistryProps","initialState","dashboardSpec","it","findByText","queryByLabelText","panelTitle","getByText","hover","getByLabelText"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE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B,gBAAgB,EAAE,CAACO,IAAI;oBAAEQ,UAAU;iBAAE;0BACrF,cAAA,KAACb,KAAK;oBAAE,GAAGE,gBAAgB,EAAE;kBAAI;cACf;UACL,CAClB,CAAC;IACJ,CAAC,AAAC;IAEFgB,EAAE,CAAC,kCAAkC,EAAE,UAAY;QACjDN,WAAW,EAAE,CAAC;QACd,MAAMnB,MAAM,CAAC0B,UAAU,CAAC,YAAY,CAAC,CAAC;QACtC1B,MAAM,CAAC2B,gBAAgB,CAAC,cAAc,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEHF,EAAE,CAAC,4CAA4C,EAAE,IAAM;QACrDN,WAAW,CAAC,IAAI,CAAC,CAAC;QAClB,MAAMS,UAAU,GAAG5B,MAAM,CAAC6B,SAAS,CAAC,YAAY,CAAC,AAAC;QAClD5B,SAAS,CAAC6B,KAAK,CAACF,UAAU,CAAC,CAAC;QAC5B5B,MAAM,CAAC+B,cAAc,CAAC,aAAa,CAAC,CAAC;QACrC/B,MAAM,CAAC+B,cAAc,CAAC,YAAY,CAAC,CAAC;QACpC/B,MAAM,CAAC+B,cAAc,CAAC,cAAc,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { PanelProps } from '@perses-dev/plugin-system';
|
|
3
|
-
|
|
3
|
+
import { UnknownSpec } from '@perses-dev/core';
|
|
4
|
+
export interface PanelContentProps extends PanelProps<UnknownSpec> {
|
|
5
|
+
panelPluginKind: string;
|
|
6
|
+
}
|
|
4
7
|
/**
|
|
5
8
|
* A small wrapper component that renders the appropriate PanelComponent from a Panel plugin based on the panel
|
|
6
9
|
* definition's kind. Used so that an ErrorBoundary can be wrapped around this.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PanelContent.d.ts","sourceRoot":"","sources":["../../../src/components/Panel/PanelContent.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAa,UAAU,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"PanelContent.d.ts","sourceRoot":"","sources":["../../../src/components/Panel/PanelContent.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAa,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAElE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,MAAM,WAAW,iBAAkB,SAAQ,UAAU,CAAC,WAAW,CAAC;IAChE,eAAe,EAAE,MAAM,CAAC;CACzB;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,eAcpD"}
|
|
@@ -17,7 +17,7 @@ import { Skeleton } from '@mui/material';
|
|
|
17
17
|
* A small wrapper component that renders the appropriate PanelComponent from a Panel plugin based on the panel
|
|
18
18
|
* definition's kind. Used so that an ErrorBoundary can be wrapped around this.
|
|
19
19
|
*/ export function PanelContent(props) {
|
|
20
|
-
const {
|
|
20
|
+
const { panelPluginKind , contentDimensions , ...others } = props;
|
|
21
21
|
const { data: plugin , isLoading } = usePlugin('Panel', panelPluginKind, {
|
|
22
22
|
useErrorBoundary: true
|
|
23
23
|
});
|
|
@@ -33,7 +33,8 @@ import { Skeleton } from '@mui/material';
|
|
|
33
33
|
throw new Error(`Missing PanelComponent from panel plugin for kind '${panelPluginKind}'`);
|
|
34
34
|
}
|
|
35
35
|
return /*#__PURE__*/ _jsx(PanelComponent, {
|
|
36
|
-
...
|
|
36
|
+
...others,
|
|
37
|
+
contentDimensions: contentDimensions
|
|
37
38
|
});
|
|
38
39
|
}
|
|
39
40
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Panel/PanelContent.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 { usePlugin, PanelProps } from '@perses-dev/plugin-system';\nimport { Skeleton } from '@mui/material';\n\nexport
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Panel/PanelContent.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 { usePlugin, PanelProps } from '@perses-dev/plugin-system';\nimport { Skeleton } from '@mui/material';\nimport { UnknownSpec } from '@perses-dev/core';\n\nexport interface PanelContentProps extends PanelProps<UnknownSpec> {\n panelPluginKind: string;\n}\n\n/**\n * A small wrapper component that renders the appropriate PanelComponent from a Panel plugin based on the panel\n * definition's kind. Used so that an ErrorBoundary can be wrapped around this.\n */\nexport function PanelContent(props: PanelContentProps) {\n const { panelPluginKind, contentDimensions, ...others } = props;\n const { data: plugin, isLoading } = usePlugin('Panel', panelPluginKind, { useErrorBoundary: true });\n const PanelComponent = plugin?.PanelComponent;\n\n if (isLoading) {\n return <Skeleton variant=\"rectangular\" width={contentDimensions?.width} height={contentDimensions?.height} />;\n }\n\n if (PanelComponent === undefined) {\n throw new Error(`Missing PanelComponent from panel plugin for kind '${panelPluginKind}'`);\n }\n\n return <PanelComponent {...others} contentDimensions={contentDimensions} />;\n}\n"],"names":["usePlugin","Skeleton","PanelContent","props","panelPluginKind","contentDimensions","others","data","plugin","isLoading","useErrorBoundary","PanelComponent","variant","width","height","undefined","Error"],"mappings":"AAAA,oCAAoC;AACp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
|
1
|
-
{"version":3,"file":"PanelDrawer.d.ts","sourceRoot":"","sources":["../../../src/components/PanelDrawer/PanelDrawer.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"PanelDrawer.d.ts","sourceRoot":"","sources":["../../../src/components/PanelDrawer/PanelDrawer.tsx"],"names":[],"mappings":";AAmBA;;GAEG;AACH,eAAO,MAAM,WAAW,mBAuDvB,CAAC"}
|
|
@@ -14,30 +14,28 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
14
14
|
import { useState } from 'react';
|
|
15
15
|
import { Stack, Box, Button, Typography } from '@mui/material';
|
|
16
16
|
import { Drawer } from '@perses-dev/components';
|
|
17
|
-
import {
|
|
18
|
-
import { usePanelDrawerModel } from './panel-editor-model';
|
|
17
|
+
import { usePanels } from '../../context';
|
|
19
18
|
import { PanelEditorForm, panelEditorFormId } from './PanelEditorForm';
|
|
20
19
|
/**
|
|
21
20
|
* The Add/Edit panel drawer for editing a panel's options.
|
|
22
21
|
*/ export const PanelDrawer = ()=>{
|
|
23
|
-
const {
|
|
24
|
-
const model = usePanelDrawerModel();
|
|
22
|
+
const { panelEditor } = usePanels();
|
|
25
23
|
// When the user clicks close, start closing but don't call the store yet to keep values stable during animtation
|
|
26
24
|
const [isClosing, setIsClosing] = useState(false);
|
|
27
25
|
const handleClose = ()=>setIsClosing(true);
|
|
28
26
|
// Don't call closeDrawer on the store until the Drawer has completely transitioned out
|
|
29
27
|
const handleExited = ()=>{
|
|
30
|
-
|
|
28
|
+
panelEditor === null || panelEditor === void 0 ? void 0 : panelEditor.close();
|
|
31
29
|
setIsClosing(false);
|
|
32
30
|
};
|
|
33
31
|
// Drawer is open if we have a model and we're not transitioning out
|
|
34
|
-
const isOpen =
|
|
32
|
+
const isOpen = panelEditor !== undefined && isClosing === false;
|
|
35
33
|
const handleSubmit = (values)=>{
|
|
36
34
|
// This shouldn't happen since we don't render the submit button until we have a model, but check to make TS happy
|
|
37
|
-
if (
|
|
35
|
+
if (panelEditor === undefined) {
|
|
38
36
|
throw new Error('Cannot apply changes');
|
|
39
37
|
}
|
|
40
|
-
|
|
38
|
+
panelEditor.applyChanges(values);
|
|
41
39
|
handleClose();
|
|
42
40
|
};
|
|
43
41
|
return /*#__PURE__*/ _jsx(Drawer, {
|
|
@@ -46,7 +44,7 @@ import { PanelEditorForm, panelEditorFormId } from './PanelEditorForm';
|
|
|
46
44
|
SlideProps: {
|
|
47
45
|
onExited: handleExited
|
|
48
46
|
},
|
|
49
|
-
children:
|
|
47
|
+
children: panelEditor !== undefined && /*#__PURE__*/ _jsxs(_Fragment, {
|
|
50
48
|
children: [
|
|
51
49
|
/*#__PURE__*/ _jsxs(Box, {
|
|
52
50
|
sx: {
|
|
@@ -57,9 +55,12 @@ import { PanelEditorForm, panelEditorFormId } from './PanelEditorForm';
|
|
|
57
55
|
borderBottom: (theme)=>`1px solid ${theme.palette.grey[100]}`
|
|
58
56
|
},
|
|
59
57
|
children: [
|
|
60
|
-
/*#__PURE__*/
|
|
58
|
+
/*#__PURE__*/ _jsxs(Typography, {
|
|
61
59
|
variant: "h2",
|
|
62
|
-
children:
|
|
60
|
+
children: [
|
|
61
|
+
panelEditor.mode,
|
|
62
|
+
" Panel"
|
|
63
|
+
]
|
|
63
64
|
}),
|
|
64
65
|
/*#__PURE__*/ _jsxs(Stack, {
|
|
65
66
|
direction: "row",
|
|
@@ -72,7 +73,7 @@ import { PanelEditorForm, panelEditorFormId } from './PanelEditorForm';
|
|
|
72
73
|
type: "submit",
|
|
73
74
|
variant: "contained",
|
|
74
75
|
form: panelEditorFormId,
|
|
75
|
-
children:
|
|
76
|
+
children: panelEditor.mode === 'Add' ? 'Add' : 'Apply'
|
|
76
77
|
}),
|
|
77
78
|
/*#__PURE__*/ _jsx(Button, {
|
|
78
79
|
variant: "outlined",
|
|
@@ -85,7 +86,7 @@ import { PanelEditorForm, panelEditorFormId } from './PanelEditorForm';
|
|
|
85
86
|
}),
|
|
86
87
|
/*#__PURE__*/ _jsx(PanelEditorForm, {
|
|
87
88
|
onSubmit: handleSubmit,
|
|
88
|
-
initialValues:
|
|
89
|
+
initialValues: panelEditor.initialValues
|
|
89
90
|
})
|
|
90
91
|
]
|
|
91
92
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/PanelDrawer/PanelDrawer.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 { useState } from 'react';\nimport { Stack, Box, Button, Typography } from '@mui/material';\nimport { Drawer } from '@perses-dev/components';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../src/components/PanelDrawer/PanelDrawer.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 { useState } from 'react';\nimport { Stack, Box, Button, Typography } from '@mui/material';\nimport { Drawer } from '@perses-dev/components';\nimport { usePanels } from '../../context';\nimport { PanelEditorForm, panelEditorFormId, PanelEditorFormProps } from './PanelEditorForm';\n\n/**\n * The Add/Edit panel drawer for editing a panel's options.\n */\nexport const PanelDrawer = () => {\n const { panelEditor } = usePanels();\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 closeDrawer on the store until the Drawer has completely transitioned out\n const handleExited = () => {\n panelEditor?.close();\n setIsClosing(false);\n };\n\n // Drawer is open if we have a model and we're not transitioning out\n const isOpen = panelEditor !== undefined && isClosing === false;\n\n const handleSubmit: PanelEditorFormProps['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 (panelEditor === undefined) {\n throw new Error('Cannot apply changes');\n }\n panelEditor.applyChanges(values);\n handleClose();\n };\n\n return (\n <Drawer isOpen={isOpen} onClose={handleClose} SlideProps={{ onExited: handleExited }}>\n {/* When the drawer is opened, we should have panel editor state (this also ensures the form state gets reset between opens) */}\n {panelEditor !== undefined && (\n <>\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n marginBottom: (theme) => theme.spacing(2),\n paddingBottom: (theme) => theme.spacing(2),\n borderBottom: (theme) => `1px solid ${theme.palette.grey[100]}`,\n }}\n >\n <Typography variant=\"h2\">{panelEditor.mode} Panel</Typography>\n <Stack direction=\"row\" spacing={1} sx={{ marginLeft: 'auto' }}>\n {/* Using the 'form' attribute lets us have a submit button like this outside the form element */}\n <Button type=\"submit\" variant=\"contained\" form={panelEditorFormId}>\n {panelEditor.mode === 'Add' ? 'Add' : 'Apply'}\n </Button>\n <Button variant=\"outlined\" onClick={handleClose}>\n Cancel\n </Button>\n </Stack>\n </Box>\n <PanelEditorForm onSubmit={handleSubmit} initialValues={panelEditor.initialValues} />\n </>\n )}\n </Drawer>\n );\n};\n"],"names":["useState","Stack","Box","Button","Typography","Drawer","usePanels","PanelEditorForm","panelEditorFormId","PanelDrawer","panelEditor","isClosing","setIsClosing","handleClose","handleExited","close","isOpen","undefined","handleSubmit","values","Error","applyChanges","onClose","SlideProps","onExited","sx","display","alignItems","marginBottom","theme","spacing","paddingBottom","borderBottom","palette","grey","variant","mode","direction","marginLeft","type","form","onClick","onSubmit","initialValues"],"mappings":"AAAA,oCAAoC;AACp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'./PanelDrawer';
|
|
|
21
21
|
describe('Panel Drawer', ()=>{
|
|
22
22
|
const renderPanelDrawer = ()=>{
|
|
23
23
|
const { addMockPlugin , pluginRegistryProps } = mockPluginRegistryProps();
|
|
24
|
-
addMockPlugin('Panel', '
|
|
24
|
+
addMockPlugin('Panel', 'TimeSeriesChart', FAKE_PANEL_PLUGIN);
|
|
25
25
|
const { store , DashboardProviderSpy } = createDashboardProviderSpy();
|
|
26
26
|
renderWithContext(/*#__PURE__*/ _jsx(PluginRegistry, {
|
|
27
27
|
...pluginRegistryProps,
|
|
@@ -45,10 +45,8 @@ describe('Panel Drawer', ()=>{
|
|
|
45
45
|
it('should add new panel', async ()=>{
|
|
46
46
|
const storeApi = renderPanelDrawer();
|
|
47
47
|
// Open the drawer for a new panel (i.e. no panel key)
|
|
48
|
-
act(()=>storeApi.getState().
|
|
49
|
-
|
|
50
|
-
}));
|
|
51
|
-
const nameInput = await screen.findByLabelText(/Panel Name/);
|
|
48
|
+
act(()=>storeApi.getState().addPanel(0));
|
|
49
|
+
const nameInput = await screen.findByLabelText(/Name/);
|
|
52
50
|
userEvent.type(nameInput, 'New Panel');
|
|
53
51
|
userEvent.click(screen.getByText('Add'));
|
|
54
52
|
// TODO: Assert drawer is closed?
|
|
@@ -59,8 +57,7 @@ describe('Panel Drawer', ()=>{
|
|
|
59
57
|
kind: 'Panel',
|
|
60
58
|
spec: {
|
|
61
59
|
display: {
|
|
62
|
-
name: 'New Panel'
|
|
63
|
-
description: ''
|
|
60
|
+
name: 'New Panel'
|
|
64
61
|
},
|
|
65
62
|
plugin: {
|
|
66
63
|
kind: '',
|
|
@@ -73,11 +70,11 @@ describe('Panel Drawer', ()=>{
|
|
|
73
70
|
it('should edit an existing panel', async ()=>{
|
|
74
71
|
const storeApi = renderPanelDrawer();
|
|
75
72
|
// Open the drawer for an existing panel
|
|
76
|
-
act(()=>storeApi.getState().
|
|
73
|
+
act(()=>storeApi.getState().editPanel({
|
|
77
74
|
groupIndex: 0,
|
|
78
|
-
|
|
75
|
+
itemIndex: 0
|
|
79
76
|
}));
|
|
80
|
-
const nameInput = await screen.findByLabelText(/
|
|
77
|
+
const nameInput = await screen.findByLabelText(/Name/);
|
|
81
78
|
userEvent.clear(nameInput);
|
|
82
79
|
userEvent.type(nameInput, 'cpu usage');
|
|
83
80
|
userEvent.click(screen.getByText('Apply'));
|
|
@@ -87,8 +84,7 @@ describe('Panel Drawer', ()=>{
|
|
|
87
84
|
kind: 'Panel',
|
|
88
85
|
spec: {
|
|
89
86
|
display: {
|
|
90
|
-
name: 'cpu usage'
|
|
91
|
-
description: ''
|
|
87
|
+
name: 'cpu usage'
|
|
92
88
|
},
|
|
93
89
|
plugin: {
|
|
94
90
|
kind: 'TimeSeriesChart',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/PanelDrawer/PanelDrawer.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 { PluginRegistry } from '@perses-dev/plugin-system';\nimport { screen } from '@testing-library/react';\nimport userEvent from '@testing-library/user-event';\nimport { act } from 'react-dom/test-utils';\nimport {\n createDashboardProviderSpy,\n FAKE_PANEL_PLUGIN,\n getTestDashboard,\n mockPluginRegistryProps,\n renderWithContext,\n} from '../../test';\nimport { DashboardProvider } from '../../context/DashboardProvider';\nimport { PanelDrawer } from './PanelDrawer';\n\ndescribe('Panel Drawer', () => {\n const renderPanelDrawer = () => {\n const { addMockPlugin, pluginRegistryProps } = mockPluginRegistryProps();\n addMockPlugin('Panel', '
|
|
1
|
+
{"version":3,"sources":["../../../src/components/PanelDrawer/PanelDrawer.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 { PluginRegistry } from '@perses-dev/plugin-system';\nimport { screen } from '@testing-library/react';\nimport userEvent from '@testing-library/user-event';\nimport { act } from 'react-dom/test-utils';\nimport {\n createDashboardProviderSpy,\n FAKE_PANEL_PLUGIN,\n getTestDashboard,\n mockPluginRegistryProps,\n renderWithContext,\n} from '../../test';\nimport { DashboardProvider } from '../../context/DashboardProvider';\nimport { PanelDrawer } from './PanelDrawer';\n\ndescribe('Panel Drawer', () => {\n const renderPanelDrawer = () => {\n const { addMockPlugin, pluginRegistryProps } = mockPluginRegistryProps();\n addMockPlugin('Panel', 'TimeSeriesChart', FAKE_PANEL_PLUGIN);\n\n const { store, DashboardProviderSpy } = createDashboardProviderSpy();\n\n renderWithContext(\n <PluginRegistry {...pluginRegistryProps}>\n <DashboardProvider initialState={{ dashboardSpec: getTestDashboard().spec, isEditMode: true }}>\n <DashboardProviderSpy />\n <PanelDrawer />\n </DashboardProvider>\n </PluginRegistry>\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', async () => {\n const storeApi = renderPanelDrawer();\n\n // Open the drawer for a new panel (i.e. no panel key)\n act(() => storeApi.getState().addPanel(0));\n\n const nameInput = await screen.findByLabelText(/Name/);\n userEvent.type(nameInput, 'New Panel');\n userEvent.click(screen.getByText('Add'));\n\n // TODO: Assert drawer is closed?\n const panels = storeApi.getState().panels;\n expect(panels).toMatchObject({\n // Should have the new panel in the store\n NewPanel: {\n kind: 'Panel',\n spec: {\n display: { name: 'New Panel' },\n plugin: {\n kind: '',\n spec: {},\n },\n },\n },\n });\n });\n\n it('should edit an existing panel', async () => {\n const storeApi = renderPanelDrawer();\n\n // Open the drawer for an existing panel\n act(() => storeApi.getState().editPanel({ groupIndex: 0, itemIndex: 0 }));\n\n const nameInput = await screen.findByLabelText(/Name/);\n userEvent.clear(nameInput);\n userEvent.type(nameInput, 'cpu usage');\n userEvent.click(screen.getByText('Apply'));\n\n const panels = storeApi.getState().panels;\n expect(panels).toMatchObject({\n cpu: {\n kind: 'Panel',\n spec: {\n display: { name: 'cpu usage' },\n plugin: {\n kind: 'TimeSeriesChart',\n spec: {},\n },\n },\n },\n });\n });\n});\n"],"names":["PluginRegistry","screen","userEvent","act","createDashboardProviderSpy","FAKE_PANEL_PLUGIN","getTestDashboard","mockPluginRegistryProps","renderWithContext","DashboardProvider","PanelDrawer","describe","renderPanelDrawer","addMockPlugin","pluginRegistryProps","store","DashboardProviderSpy","initialState","dashboardSpec","spec","isEditMode","value","storeApi","undefined","Error","it","getState","addPanel","nameInput","findByLabelText","type","click","getByText","panels","expect","toMatchObject","NewPanel","kind","display","name","plugin","editPanel","groupIndex","itemIndex","clear","cpu"],"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,SAASA,cAAc,QAAQ,2BAA2B,CAAC;AAC3D,SAASC,MAAM,QAAQ,wBAAwB,CAAC;AAChD,OAAOC,SAAS,MAAM,6BAA6B,CAAC;AACpD,SAASC,GAAG,QAAQ,sBAAsB,CAAC;AAC3C,SACEC,0BAA0B,EAC1BC,iBAAiB,EACjBC,gBAAgB,EAChBC,uBAAuB,EACvBC,iBAAiB,QACZ,YAAY,CAAC;AACpB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qBAAE;oBAC9BC,MAAM,EAAE;wBACNH,IAAI,EAAE,iBAAiB;wBACvBlB,IAAI,EAAE,EAAE;qBACT;iBACF;aACF;SACF,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { PanelEditorValues } from '../../context/DashboardProvider/panel-editing-slice';
|
|
3
3
|
export interface PanelEditorFormProps {
|
|
4
|
-
initialValues:
|
|
5
|
-
onSubmit: (values:
|
|
4
|
+
initialValues: PanelEditorValues;
|
|
5
|
+
onSubmit: (values: PanelEditorValues) => void;
|
|
6
6
|
}
|
|
7
7
|
export declare function PanelEditorForm(props: PanelEditorFormProps): JSX.Element;
|
|
8
8
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PanelEditorForm.d.ts","sourceRoot":"","sources":["../../../src/components/PanelDrawer/PanelEditorForm.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"PanelEditorForm.d.ts","sourceRoot":"","sources":["../../../src/components/PanelDrawer/PanelEditorForm.tsx"],"names":[],"mappings":";AA4BA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qDAAqD,CAAC;AAGxF,MAAM,WAAW,oBAAoB;IACnC,aAAa,EAAE,iBAAiB,CAAC;IACjC,QAAQ,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,IAAI,CAAC;CAC/C;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,eA+F1D;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB,sBAAsB,CAAC"}
|