@perses-dev/dashboards 0.21.1 → 0.22.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/AddGroupButton/AddGroupButton.js +43 -0
- package/dist/cjs/components/AddGroupButton/index.js +28 -0
- package/dist/cjs/components/AddPanelButton/AddPanelButton.js +43 -0
- package/dist/cjs/components/AddPanelButton/index.js +28 -0
- package/dist/cjs/components/Dashboard/Dashboard.js +1 -1
- package/dist/cjs/components/Dashboard/index.js +1 -1
- package/dist/cjs/components/DashboardToolbar/DashboardToolbar.js +47 -22
- package/dist/cjs/components/DashboardToolbar/index.js +1 -1
- package/dist/cjs/components/DeletePanelDialog/DeletePanelDialog.js +1 -1
- package/dist/cjs/components/DeletePanelDialog/index.js +1 -1
- package/dist/cjs/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +1 -1
- package/dist/cjs/components/DeletePanelGroupDialog/index.js +1 -1
- package/dist/cjs/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js +1 -1
- package/dist/cjs/components/DiscardChangesConfirmationDialog/index.js +1 -1
- package/dist/cjs/components/DownloadButton/DownloadButton.js +17 -53
- package/dist/cjs/components/DownloadButton/index.js +1 -1
- package/dist/cjs/components/GridLayout/GridContainer.js +2 -1
- package/dist/cjs/components/GridLayout/GridItemContent.js +1 -1
- package/dist/cjs/components/GridLayout/GridLayout.js +2 -1
- package/dist/cjs/components/GridLayout/GridTitle.js +14 -11
- package/dist/cjs/components/GridLayout/index.js +1 -1
- package/dist/cjs/components/Panel/Panel.js +2 -1
- package/dist/cjs/components/Panel/Panel.test.js +1 -1
- package/dist/cjs/components/Panel/PanelContent.js +1 -1
- package/dist/cjs/components/Panel/PanelHeader.js +9 -8
- package/dist/cjs/components/Panel/index.js +1 -1
- package/dist/cjs/components/PanelDrawer/PanelDrawer.js +2 -1
- package/dist/cjs/components/PanelDrawer/PanelDrawer.test.js +1 -1
- package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +1 -1
- package/dist/cjs/components/PanelDrawer/PanelPreview.js +1 -1
- package/dist/cjs/components/PanelDrawer/index.js +1 -1
- package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.js +3 -1
- package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.test.js +1 -1
- package/dist/cjs/components/PanelGroupDialog/PanelGroupEditorForm.js +1 -1
- package/dist/cjs/components/PanelGroupDialog/index.js +1 -1
- package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +14 -16
- package/dist/cjs/components/TimeRangeControls/TimeRangeControls.test.js +1 -1
- package/dist/cjs/components/TimeRangeControls/index.js +1 -1
- package/dist/cjs/components/ToolbarIconButton/ToolbarIconButton.js +35 -0
- package/dist/cjs/components/ToolbarIconButton/index.js +28 -0
- package/dist/cjs/components/Variables/EditVariablesButton.js +74 -0
- package/dist/cjs/components/Variables/Variable.js +1 -1
- package/dist/cjs/components/Variables/VariableEditor.js +9 -5
- package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +6 -7
- package/dist/cjs/components/Variables/VariableEditorForm/index.js +1 -1
- package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +1 -1
- package/dist/cjs/components/Variables/VariableList.js +38 -110
- package/dist/cjs/components/Variables/index.js +4 -2
- package/dist/cjs/components/Variables/variable-model.js +1 -1
- package/dist/cjs/components/Variables/variable-model.test.js +1 -1
- package/dist/cjs/components/index.js +5 -2
- package/dist/cjs/constants/index.js +28 -0
- package/dist/cjs/constants/user-interface-text.js +59 -0
- package/dist/cjs/context/DashboardProvider/DashboardProvider.js +1 -1
- package/dist/cjs/context/DashboardProvider/common.js +1 -1
- package/dist/cjs/context/DashboardProvider/dashboard-provider-api.js +1 -1
- package/dist/cjs/context/DashboardProvider/delete-panel-group-slice.js +1 -1
- package/dist/cjs/context/DashboardProvider/delete-panel-slice.js +1 -1
- package/dist/cjs/context/DashboardProvider/discard-changes-dialog-slice.js +1 -1
- package/dist/cjs/context/DashboardProvider/index.js +1 -1
- package/dist/cjs/context/DashboardProvider/panel-editor-slice.js +1 -1
- package/dist/cjs/context/DashboardProvider/panel-group-editor-slice.js +1 -1
- package/dist/cjs/context/DashboardProvider/panel-group-slice.js +1 -1
- package/dist/cjs/context/DashboardProvider/panel-slice.js +1 -1
- package/dist/cjs/context/DatasourceStoreProvider.js +1 -1
- package/dist/cjs/context/TemplateVariableProvider/TemplateVariableProvider.js +8 -8
- package/dist/cjs/context/TemplateVariableProvider/index.js +1 -1
- package/dist/cjs/context/TemplateVariableProvider/query-params.js +1 -1
- package/dist/cjs/context/TemplateVariableProvider/query-params.test.js +1 -1
- package/dist/cjs/context/index.js +1 -1
- package/dist/cjs/context/useDashboard.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/test/dashboard-provider.js +1 -1
- package/dist/cjs/test/index.js +1 -1
- package/dist/cjs/test/plugin-registry.js +1 -1
- package/dist/cjs/test/render.js +1 -1
- package/dist/cjs/test/setup-tests.js +1 -1
- package/dist/cjs/test/testDashboard.js +1 -1
- package/dist/cjs/utils/functions.js +1 -1
- package/dist/cjs/utils/index.js +28 -0
- package/dist/cjs/views/ViewDashboard/DashboardApp.js +1 -1
- package/dist/cjs/views/ViewDashboard/ViewDashboard.js +1 -1
- package/dist/cjs/views/ViewDashboard/index.js +1 -1
- package/dist/cjs/views/ViewDashboard/tests/panelGroups.test.js +1 -1
- package/dist/cjs/views/index.js +1 -1
- package/dist/components/AddGroupButton/AddGroupButton.d.ts +3 -0
- package/dist/components/AddGroupButton/AddGroupButton.d.ts.map +1 -0
- package/dist/components/AddGroupButton/AddGroupButton.js +32 -0
- package/dist/components/AddGroupButton/AddGroupButton.js.map +1 -0
- package/dist/components/AddGroupButton/index.d.ts +2 -0
- package/dist/components/AddGroupButton/index.d.ts.map +1 -0
- package/dist/components/AddGroupButton/index.js +15 -0
- package/dist/components/AddGroupButton/index.js.map +1 -0
- package/dist/components/AddPanelButton/AddPanelButton.d.ts +3 -0
- package/dist/components/AddPanelButton/AddPanelButton.d.ts.map +1 -0
- package/dist/components/AddPanelButton/AddPanelButton.js +32 -0
- package/dist/components/AddPanelButton/AddPanelButton.js.map +1 -0
- package/dist/components/AddPanelButton/index.d.ts +2 -0
- package/dist/components/AddPanelButton/index.d.ts.map +1 -0
- package/dist/components/AddPanelButton/index.js +15 -0
- package/dist/components/AddPanelButton/index.js.map +1 -0
- package/dist/components/Dashboard/Dashboard.js +1 -1
- package/dist/components/Dashboard/Dashboard.js.map +1 -1
- package/dist/components/Dashboard/index.js +1 -1
- package/dist/components/Dashboard/index.js.map +1 -1
- package/dist/components/DashboardToolbar/DashboardToolbar.d.ts.map +1 -1
- package/dist/components/DashboardToolbar/DashboardToolbar.js +48 -23
- package/dist/components/DashboardToolbar/DashboardToolbar.js.map +1 -1
- package/dist/components/DashboardToolbar/index.js +1 -1
- package/dist/components/DashboardToolbar/index.js.map +1 -1
- package/dist/components/DeletePanelDialog/DeletePanelDialog.js +1 -1
- package/dist/components/DeletePanelDialog/DeletePanelDialog.js.map +1 -1
- package/dist/components/DeletePanelDialog/index.js +1 -1
- package/dist/components/DeletePanelDialog/index.js.map +1 -1
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +1 -1
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js.map +1 -1
- package/dist/components/DeletePanelGroupDialog/index.js +1 -1
- package/dist/components/DeletePanelGroupDialog/index.js.map +1 -1
- package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js +1 -1
- package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js.map +1 -1
- package/dist/components/DiscardChangesConfirmationDialog/index.js +1 -1
- package/dist/components/DiscardChangesConfirmationDialog/index.js.map +1 -1
- package/dist/components/DownloadButton/DownloadButton.d.ts +5 -1
- package/dist/components/DownloadButton/DownloadButton.d.ts.map +1 -1
- package/dist/components/DownloadButton/DownloadButton.js +18 -15
- package/dist/components/DownloadButton/DownloadButton.js.map +1 -1
- package/dist/components/DownloadButton/index.js +1 -1
- package/dist/components/DownloadButton/index.js.map +1 -1
- package/dist/components/GridLayout/GridContainer.d.ts.map +1 -1
- package/dist/components/GridLayout/GridContainer.js +2 -1
- package/dist/components/GridLayout/GridContainer.js.map +1 -1
- package/dist/components/GridLayout/GridItemContent.js +1 -1
- package/dist/components/GridLayout/GridItemContent.js.map +1 -1
- package/dist/components/GridLayout/GridLayout.js +2 -1
- 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 +14 -11
- package/dist/components/GridLayout/GridTitle.js.map +1 -1
- package/dist/components/GridLayout/index.js +1 -1
- package/dist/components/GridLayout/index.js.map +1 -1
- package/dist/components/Panel/Panel.d.ts.map +1 -1
- package/dist/components/Panel/Panel.js +2 -1
- package/dist/components/Panel/Panel.js.map +1 -1
- package/dist/components/Panel/Panel.test.js +1 -1
- package/dist/components/Panel/Panel.test.js.map +1 -1
- package/dist/components/Panel/PanelContent.js +1 -1
- package/dist/components/Panel/PanelContent.js.map +1 -1
- package/dist/components/Panel/PanelHeader.d.ts.map +1 -1
- package/dist/components/Panel/PanelHeader.js +9 -8
- package/dist/components/Panel/PanelHeader.js.map +1 -1
- package/dist/components/Panel/index.js +1 -1
- package/dist/components/Panel/index.js.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.js +2 -1
- package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.test.js +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.test.js.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.js +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -1
- package/dist/components/PanelDrawer/PanelPreview.js +1 -1
- package/dist/components/PanelDrawer/PanelPreview.js.map +1 -1
- package/dist/components/PanelDrawer/index.js +1 -1
- package/dist/components/PanelDrawer/index.js.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.js +3 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.js.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.test.js +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.test.js.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.js +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.js.map +1 -1
- package/dist/components/PanelGroupDialog/index.js +1 -1
- package/dist/components/PanelGroupDialog/index.js.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.js +15 -17
- package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.test.js +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.test.js.map +1 -1
- package/dist/components/TimeRangeControls/index.js +1 -1
- package/dist/components/TimeRangeControls/index.js.map +1 -1
- package/dist/components/ToolbarIconButton/ToolbarIconButton.d.ts +6 -0
- package/dist/components/ToolbarIconButton/ToolbarIconButton.d.ts.map +1 -0
- package/dist/components/ToolbarIconButton/ToolbarIconButton.js +29 -0
- package/dist/components/ToolbarIconButton/ToolbarIconButton.js.map +1 -0
- package/dist/components/ToolbarIconButton/index.d.ts +2 -0
- package/dist/components/ToolbarIconButton/index.d.ts.map +1 -0
- package/dist/components/ToolbarIconButton/index.js +15 -0
- package/dist/components/ToolbarIconButton/index.js.map +1 -0
- package/dist/components/Variables/EditVariablesButton.d.ts +3 -0
- package/dist/components/Variables/EditVariablesButton.d.ts.map +1 -0
- package/dist/components/Variables/EditVariablesButton.js +63 -0
- package/dist/components/Variables/EditVariablesButton.js.map +1 -0
- package/dist/components/Variables/Variable.js +1 -1
- package/dist/components/Variables/Variable.js.map +1 -1
- package/dist/components/Variables/VariableEditor.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditor.js +9 -5
- package/dist/components/Variables/VariableEditor.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +8 -9
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/index.js +1 -1
- package/dist/components/Variables/VariableEditorForm/index.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +1 -1
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -1
- package/dist/components/Variables/VariableList.d.ts.map +1 -1
- package/dist/components/Variables/VariableList.js +40 -73
- package/dist/components/Variables/VariableList.js.map +1 -1
- package/dist/components/Variables/index.d.ts +3 -1
- package/dist/components/Variables/index.d.ts.map +1 -1
- package/dist/components/Variables/index.js +4 -2
- package/dist/components/Variables/index.js.map +1 -1
- package/dist/components/Variables/variable-model.js +1 -1
- package/dist/components/Variables/variable-model.js.map +1 -1
- package/dist/components/Variables/variable-model.test.js +1 -1
- package/dist/components/Variables/variable-model.test.js.map +1 -1
- package/dist/components/index.d.ts +4 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +5 -2
- package/dist/components/index.js.map +1 -1
- package/dist/constants/index.d.ts +2 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/constants/index.js +15 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/constants/user-interface-text.d.ts +28 -0
- package/dist/constants/user-interface-text.d.ts.map +1 -0
- package/dist/constants/user-interface-text.js +47 -0
- package/dist/constants/user-interface-text.js.map +1 -0
- package/dist/context/DashboardProvider/DashboardProvider.js +1 -1
- package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -1
- package/dist/context/DashboardProvider/common.js +1 -1
- package/dist/context/DashboardProvider/common.js.map +1 -1
- package/dist/context/DashboardProvider/dashboard-provider-api.js +1 -1
- package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -1
- package/dist/context/DashboardProvider/delete-panel-group-slice.js +1 -1
- package/dist/context/DashboardProvider/delete-panel-group-slice.js.map +1 -1
- package/dist/context/DashboardProvider/delete-panel-slice.js +1 -1
- package/dist/context/DashboardProvider/delete-panel-slice.js.map +1 -1
- package/dist/context/DashboardProvider/discard-changes-dialog-slice.js +1 -1
- package/dist/context/DashboardProvider/discard-changes-dialog-slice.js.map +1 -1
- package/dist/context/DashboardProvider/index.js +1 -1
- package/dist/context/DashboardProvider/index.js.map +1 -1
- package/dist/context/DashboardProvider/panel-editor-slice.js +1 -1
- package/dist/context/DashboardProvider/panel-editor-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-group-editor-slice.js +1 -1
- package/dist/context/DashboardProvider/panel-group-editor-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-group-slice.js +1 -1
- package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-slice.js +1 -1
- package/dist/context/DashboardProvider/panel-slice.js.map +1 -1
- package/dist/context/DatasourceStoreProvider.js +1 -1
- package/dist/context/DatasourceStoreProvider.js.map +1 -1
- package/dist/context/TemplateVariableProvider/TemplateVariableProvider.js +8 -8
- package/dist/context/TemplateVariableProvider/TemplateVariableProvider.js.map +1 -1
- package/dist/context/TemplateVariableProvider/index.js +1 -1
- package/dist/context/TemplateVariableProvider/index.js.map +1 -1
- package/dist/context/TemplateVariableProvider/query-params.js +1 -1
- package/dist/context/TemplateVariableProvider/query-params.js.map +1 -1
- package/dist/context/TemplateVariableProvider/query-params.test.js +1 -1
- package/dist/context/TemplateVariableProvider/query-params.test.js.map +1 -1
- package/dist/context/index.js +1 -1
- package/dist/context/index.js.map +1 -1
- package/dist/context/useDashboard.js +1 -1
- package/dist/context/useDashboard.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/test/dashboard-provider.js +1 -1
- package/dist/test/dashboard-provider.js.map +1 -1
- package/dist/test/index.js +1 -1
- package/dist/test/index.js.map +1 -1
- package/dist/test/plugin-registry.js +1 -1
- package/dist/test/plugin-registry.js.map +1 -1
- package/dist/test/render.js +1 -1
- package/dist/test/render.js.map +1 -1
- package/dist/test/setup-tests.js +1 -1
- package/dist/test/setup-tests.js.map +1 -1
- package/dist/test/testDashboard.js +1 -1
- package/dist/test/testDashboard.js.map +1 -1
- package/dist/utils/functions.js +1 -1
- package/dist/utils/functions.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/views/ViewDashboard/DashboardApp.js +1 -1
- package/dist/views/ViewDashboard/DashboardApp.js.map +1 -1
- package/dist/views/ViewDashboard/ViewDashboard.js +1 -1
- package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -1
- package/dist/views/ViewDashboard/index.js +1 -1
- package/dist/views/ViewDashboard/index.js.map +1 -1
- package/dist/views/ViewDashboard/tests/panelGroups.test.js +1 -1
- package/dist/views/ViewDashboard/tests/panelGroups.test.js.map +1 -1
- package/dist/views/index.js +1 -1
- package/dist/views/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2023 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -11,14 +11,17 @@
|
|
|
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, Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
|
-
import
|
|
14
|
+
import { useRef } from 'react';
|
|
15
15
|
import DownloadIcon from 'mdi-material-ui/DownloadOutline';
|
|
16
|
-
import {
|
|
16
|
+
import { InfoTooltip } from '@perses-dev/components';
|
|
17
|
+
import { TOOLTIP_TEXT } from '../../constants';
|
|
17
18
|
import { useDashboard } from '../../context';
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
import { ToolbarIconButton } from '../ToolbarIconButton';
|
|
20
|
+
// Button that enables downloading the dashboard as a JSON file
|
|
21
|
+
export function DownloadButton({ heightPx }) {
|
|
20
22
|
const { dashboard } = useDashboard();
|
|
21
23
|
const hiddenLinkRef = useRef(null);
|
|
24
|
+
const height = heightPx === undefined ? undefined : `${heightPx}px`;
|
|
22
25
|
const onDownloadButtonClick = ()=>{
|
|
23
26
|
if (!hiddenLinkRef || !hiddenLinkRef.current) return;
|
|
24
27
|
// Create blob URL
|
|
@@ -35,10 +38,16 @@ export function DownloadButton() {
|
|
|
35
38
|
};
|
|
36
39
|
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
37
40
|
children: [
|
|
38
|
-
/*#__PURE__*/ _jsx(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
/*#__PURE__*/ _jsx(InfoTooltip, {
|
|
42
|
+
description: TOOLTIP_TEXT.downloadDashboard,
|
|
43
|
+
children: /*#__PURE__*/ _jsx(ToolbarIconButton, {
|
|
44
|
+
"aria-label": TOOLTIP_TEXT.downloadDashboard,
|
|
45
|
+
onClick: onDownloadButtonClick,
|
|
46
|
+
sx: {
|
|
47
|
+
height
|
|
48
|
+
},
|
|
49
|
+
children: /*#__PURE__*/ _jsx(DownloadIcon, {})
|
|
50
|
+
})
|
|
42
51
|
}),
|
|
43
52
|
/*#__PURE__*/ _jsx("a", {
|
|
44
53
|
ref: hiddenLinkRef,
|
|
@@ -50,11 +59,5 @@ export function DownloadButton() {
|
|
|
50
59
|
]
|
|
51
60
|
});
|
|
52
61
|
}
|
|
53
|
-
const DownloadIconButton = styled(IconButton)(({ theme })=>({
|
|
54
|
-
border: `1px solid ${theme.palette.grey[300]}`,
|
|
55
|
-
borderRadius: theme.shape.borderRadius,
|
|
56
|
-
padding: '4px',
|
|
57
|
-
color: theme.palette.grey[900]
|
|
58
|
-
}));
|
|
59
62
|
|
|
60
63
|
//# sourceMappingURL=DownloadButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/DownloadButton/DownloadButton.tsx"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../src/components/DownloadButton/DownloadButton.tsx"],"sourcesContent":["// Copyright 2023 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 { useRef } from 'react';\nimport DownloadIcon from 'mdi-material-ui/DownloadOutline';\nimport { InfoTooltip } from '@perses-dev/components';\nimport { TOOLTIP_TEXT } from '../../constants';\nimport { useDashboard } from '../../context';\nimport { ToolbarIconButton } from '../ToolbarIconButton';\n\ninterface DownloadButtonProps {\n // The button look best at heights >= 28 pixels\n heightPx?: number;\n}\n\n// Button that enables downloading the dashboard as a JSON file\nexport function DownloadButton({ heightPx }: DownloadButtonProps) {\n const { dashboard } = useDashboard();\n const hiddenLinkRef = useRef<HTMLAnchorElement>(null);\n const height = heightPx === undefined ? undefined : `${heightPx}px`;\n\n const onDownloadButtonClick = () => {\n if (!hiddenLinkRef || !hiddenLinkRef.current) return;\n // Create blob URL\n const hiddenLinkUrl = URL.createObjectURL(\n new Blob([JSON.stringify(dashboard)], {\n type: 'application/json',\n })\n );\n // Simulate click\n hiddenLinkRef.current.href = hiddenLinkUrl;\n hiddenLinkRef.current.click();\n // Remove blob URL (for memory management)\n URL.revokeObjectURL(hiddenLinkUrl);\n };\n\n return (\n <>\n <InfoTooltip description={TOOLTIP_TEXT.downloadDashboard}>\n <ToolbarIconButton aria-label={TOOLTIP_TEXT.downloadDashboard} onClick={onDownloadButtonClick} sx={{ height }}>\n <DownloadIcon />\n </ToolbarIconButton>\n </InfoTooltip>\n {/* Hidden link to download the dashboard as a JSON file */}\n {/* eslint-disable jsx-a11y/anchor-has-content */}\n {/* eslint-disable jsx-a11y/anchor-is-valid */}\n <a ref={hiddenLinkRef} style={{ display: 'none' }} download={`${dashboard.metadata.name}.json`} />\n </>\n );\n}\n"],"names":["useRef","DownloadIcon","InfoTooltip","TOOLTIP_TEXT","useDashboard","ToolbarIconButton","DownloadButton","heightPx","dashboard","hiddenLinkRef","height","undefined","onDownloadButtonClick","current","hiddenLinkUrl","URL","createObjectURL","Blob","JSON","stringify","type","href","click","revokeObjectURL","description","downloadDashboard","aria-label","onClick","sx","a","ref","style","display","download","metadata","name"],"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,MAAM,QAAQ,OAAO,CAAC;AAC/B,OAAOC,YAAY,MAAM,iCAAiC,CAAC;AAC3D,SAASC,WAAW,QAAQ,wBAAwB,CAAC;AACrD,SAASC,YAAY,QAAQ,iBAAiB,CAAC;AAC/C,SAASC,YAAY,QAAQ,eAAe,CAAC;AAC7C,SAASC,iBAAiB,QAAQ,sBAAsB,CAAC;AAOzD,+DAA+D;AAC/D,OAAO,SAASC,cAAc,CAAC,EAAEC,QAAQ,CAAA,EAAuB,EAAE;IAChE,MAAM,EAAEC,SAAS,CAAA,EAAE,GAAGJ,YAAY,EAAE,AAAC;IACrC,MAAMK,aAAa,GAAGT,MAAM,CAAoB,IAAI,CAAC,AAAC;IACtD,MAAMU,MAAM,GAAGH,QAAQ,KAAKI,SAAS,GAAGA,SAAS,GAAG,CAAC,EAAEJ,QAAQ,CAAC,EAAE,CAAC,AAAC;IAEpE,MAAMK,qBAAqB,GAAG,IAAM;QAClC,IAAI,CAACH,aAAa,IAAI,CAACA,aAAa,CAACI,OAAO,EAAE,OAAO;QACrD,kBAAkB;QAClB,MAAMC,aAAa,GAAGC,GAAG,CAACC,eAAe,CACvC,IAAIC,IAAI,CAAC;YAACC,IAAI,CAACC,SAAS,CAACX,SAAS,CAAC;SAAC,EAAE;YACpCY,IAAI,EAAE,kBAAkB;SACzB,CAAC,CACH,AAAC;QACF,iBAAiB;QACjBX,aAAa,CAACI,OAAO,CAACQ,IAAI,GAAGP,aAAa,CAAC;QAC3CL,aAAa,CAACI,OAAO,CAACS,KAAK,EAAE,CAAC;QAC9B,0CAA0C;QAC1CP,GAAG,CAACQ,eAAe,CAACT,aAAa,CAAC,CAAC;IACrC,CAAC,AAAC;IAEF,qBACE;;0BACE,KAACZ,WAAW;gBAACsB,WAAW,EAAErB,YAAY,CAACsB,iBAAiB;0BACtD,cAAA,KAACpB,iBAAiB;oBAACqB,YAAU,EAAEvB,YAAY,CAACsB,iBAAiB;oBAAEE,OAAO,EAAEf,qBAAqB;oBAAEgB,EAAE,EAAE;wBAAElB,MAAM;qBAAE;8BAC3G,cAAA,KAACT,YAAY,KAAG;kBACE;cACR;0BAId,KAAC4B,GAAC;gBAACC,GAAG,EAAErB,aAAa;gBAAEsB,KAAK,EAAE;oBAAEC,OAAO,EAAE,MAAM;iBAAE;gBAAEC,QAAQ,EAAE,CAAC,EAAEzB,SAAS,CAAC0B,QAAQ,CAACC,IAAI,CAAC,KAAK,CAAC;cAAI;;MACjG,CACH;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/DownloadButton/index.ts"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../src/components/DownloadButton/index.ts"],"sourcesContent":["// Copyright 2023 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 './DownloadButton';\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,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GridContainer.d.ts","sourceRoot":"","sources":["../../../src/components/GridLayout/GridContainer.tsx"],"names":[],"mappings":";AAgBA,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,
|
|
1
|
+
{"version":3,"file":"GridContainer.d.ts","sourceRoot":"","sources":["../../../src/components/GridLayout/GridContainer.tsx"],"names":[],"mappings":";AAgBA,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,eAsBtD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2023 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -34,6 +34,7 @@ export function GridContainer(props) {
|
|
|
34
34
|
transitionProperty: isFirstRender ? 'none' : 'transform'
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
|
+
"data-testid": "panel-group",
|
|
37
38
|
children: props.children
|
|
38
39
|
});
|
|
39
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/GridLayout/GridContainer.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 { useEffect, useState } from 'react';\nimport { styled } from '@mui/material';\n\nexport interface GridContainerProps {\n children: React.ReactNode;\n}\n\nexport function GridContainer(props: GridContainerProps) {\n const [isFirstRender, setIsFirstRender] = useState(true);\n useEffect(() => {\n if (isFirstRender) {\n setIsFirstRender(false);\n }\n }, [isFirstRender]);\n\n return (\n <ReactGridLayoutContainer\n sx={{\n // This adds spcing between grids (rows) in the overall dashboard\n '& + &': { marginTop: (theme) => theme.spacing(1) },\n // This disables the animation of grid items when a grid is first rendered\n // (see https://github.com/react-grid-layout/react-grid-layout/issues/103)\n '& .react-grid-item.cssTransforms': { transitionProperty: isFirstRender ? 'none' : 'transform' },\n }}\n >\n {props.children}\n </ReactGridLayoutContainer>\n );\n}\n\n/**\n * These are the classes needed by react-grid-layout from their CSS stylesheet.\n */\nconst ReactGridLayoutContainer = styled('section')(({ theme }) => ({\n '& .react-grid-layout': {\n position: 'relative',\n transition: 'height 200ms ease',\n },\n '& .react-grid-item': {\n transition: 'all 200ms ease',\n transitionProperty: 'left, top',\n },\n '& .react-grid-item img': {\n pointerEvents: 'none',\n userSelect: 'none',\n },\n '& .react-grid-item.cssTransforms': {\n transitionProperty: 'transform',\n },\n '& .react-grid-item.resizing': {\n zIndex: 1,\n willChange: 'width, height',\n },\n '& .react-grid-item.react-draggable-dragging': {\n transition: 'none',\n zIndex: 3,\n willChange: 'transform',\n },\n '& .react-grid-item.dropping': {\n visibility: 'hidden',\n },\n '& .react-grid-item.react-grid-placeholder': {\n background: theme.palette.primary.main,\n opacity: 0.2,\n transitionDuration: '100ms',\n zIndex: 2,\n userSelect: 'none',\n WebkitUserSelect: 'none',\n MozUserSelect: 'none',\n msUserSelect: 'none',\n OUserSelect: 'none',\n },\n\n '& .react-grid-item > .react-resizable-handle': {\n position: 'absolute',\n width: '20px',\n height: '20px',\n },\n '& .react-grid-item > .react-resizable-handle::after': {\n content: '\"\"',\n position: 'absolute',\n right: '3px',\n bottom: '3px',\n width: '5px',\n height: '5px',\n borderRight: `2px solid ${theme.palette.text.secondary}`,\n borderBottom: `2px solid ${theme.palette.text.secondary}`,\n },\n\n '& .react-resizable-hide > .react-resizable-handle': {\n display: 'none',\n },\n\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-sw': {\n bottom: '0',\n left: '0',\n cursor: 'sw-resize',\n transform: 'rotate(90deg)',\n },\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-se': {\n bottom: '0',\n right: '0',\n cursor: 'se-resize',\n },\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-nw': {\n top: '0',\n left: '0',\n cursor: 'nw-resize',\n transform: 'rotate(180deg)',\n },\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-ne': {\n top: '0',\n right: '0',\n cursor: 'ne-resize',\n transform: 'rotate(270deg)',\n },\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-w, &.react-grid-item > .react-resizable-handle.react-resizable-handle-e':\n {\n top: '50%',\n marginTop: '-10px',\n cursor: 'ew-resize',\n },\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-w': {\n left: '0',\n transform: 'rotate(135deg)',\n },\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-e': {\n right: '0',\n transform: 'rotate(315deg)',\n },\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-n, &.react-grid-item > .react-resizable-handle.react-resizable-handle-s':\n {\n left: '50%',\n marginLeft: '-10px',\n cursor: 'ns-resize',\n },\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-n': {\n top: '0',\n transform: 'rotate(225deg)',\n },\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-s': {\n bottom: '0',\n transform: 'rotate(45deg)',\n },\n '& .react-resizable': {\n position: 'relative',\n },\n '& .react-resizable-handle': {\n position: 'absolute',\n width: '20px',\n height: '20px',\n backgroundRepeat: 'no-repeat',\n backgroundOrigin: 'content-box',\n boxSizing: 'border-box',\n backgroundImage: `url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2IDYiIHN0eWxlPSJiYWNrZ3JvdW5kLWNvbG9yOiNmZmZmZmYwMCIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSI2cHgiIGhlaWdodD0iNnB4Ij48ZyBvcGFjaXR5PSIwLjMwMiI+PHBhdGggZD0iTSA2IDYgTCAwIDYgTCAwIDQuMiBMIDQgNC4yIEwgNC4yIDQuMiBMIDQuMiAwIEwgNiAwIEwgNiA2IEwgNiA2IFoiIGZpbGw9IiMwMDAwMDAiLz48L2c+PC9zdmc+')`,\n backgroundPosition: 'bottom right',\n padding: '0 3px 3px 0',\n },\n '& .react-resizable-handle-sw': {\n bottom: '0',\n left: '0',\n cursor: 'sw-resize',\n transform: 'rotate(90deg)',\n },\n '& .react-resizable-handle-se': {\n bottom: '0',\n right: '0',\n cursor: 'se-resize',\n },\n '& .react-resizable-handle-nw': {\n top: '0',\n left: '0',\n cursor: 'nw-resize',\n transform: 'rotate(180deg)',\n },\n '& .react-resizable-handle-ne': {\n top: '0',\n right: '0',\n cursor: 'ne-resize',\n transform: 'rotate(270deg)',\n },\n '& .react-resizable-handle-w, .react-resizable-handle-e': {\n top: '50%',\n marginTop: '-10px',\n cursor: 'ew-resize',\n },\n '& .react-resizable-handle-w': {\n left: '0',\n transform: 'rotate(135deg)',\n },\n '& .react-resizable-handle-e': {\n right: '0',\n transform: 'rotate(315deg)',\n },\n '& .react-resizable-handle-n, .react-resizable-handle-s': {\n left: '50%',\n marginLeft: '-10px',\n cursor: 'ns-resize',\n },\n '& .react-resizable-handle-n': {\n top: '0',\n transform: 'rotate(225deg)',\n },\n '& .react-resizable-handle-s': {\n bottom: '0',\n transform: 'rotate(45deg)',\n },\n}));\n"],"names":["useEffect","useState","styled","GridContainer","props","isFirstRender","setIsFirstRender","ReactGridLayoutContainer","sx","marginTop","theme","spacing","transitionProperty","children","position","transition","pointerEvents","userSelect","zIndex","willChange","visibility","background","palette","primary","main","opacity","transitionDuration","WebkitUserSelect","MozUserSelect","msUserSelect","OUserSelect","width","height","content","right","bottom","borderRight","text","secondary","borderBottom","display","left","cursor","transform","top","marginLeft","backgroundRepeat","backgroundOrigin","boxSizing","backgroundImage","backgroundPosition","padding"],"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,SAAS,EAAEC,QAAQ,QAAQ,OAAO,CAAC;AAC5C,SAASC,MAAM,QAAQ,eAAe,CAAC;AAMvC,OAAO,SAASC,aAAa,CAACC,KAAyB,EAAE;IACvD,MAAM,CAACC,aAAa,EAAEC,gBAAgB,CAAC,GAAGL,QAAQ,CAAC,IAAI,CAAC,AAAC;IACzDD,SAAS,CAAC,IAAM;QACd,IAAIK,aAAa,EAAE;YACjBC,gBAAgB,CAAC,KAAK,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC,EAAE;QAACD,aAAa;KAAC,CAAC,CAAC;IAEpB,qBACE,KAACE,wBAAwB;QACvBC,EAAE,EAAE;YACF,iEAAiE;YACjE,OAAO,EAAE;gBAAEC,SAAS,EAAE,CAACC,KAAK,GAAKA,KAAK,CAACC,OAAO,CAAC,CAAC,CAAC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;QACD,wDAAwD,EAAE;YACxDF,IAAI,EAAE,KAAK;YACXI,UAAU,EAAE,OAAO;YACnBH,MAAM,EAAE,WAAW;SACpB;QACD,6BAA6B,EAAE;YAC7BE,GAAG,EAAE,GAAG;YACRD,SAAS,EAAE,gBAAgB;SAC5B;QACD,6BAA6B,EAAE;YAC7BR,MAAM,EAAE,GAAG;YACXQ,SAAS,EAAE,eAAe;SAC3B;KACF,CAAA,AAAC,CAAC,AAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/GridLayout/GridContainer.tsx"],"sourcesContent":["// Copyright 2023 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 { useEffect, useState } from 'react';\nimport { styled } from '@mui/material';\n\nexport interface GridContainerProps {\n children: React.ReactNode;\n}\n\nexport function GridContainer(props: GridContainerProps) {\n const [isFirstRender, setIsFirstRender] = useState(true);\n useEffect(() => {\n if (isFirstRender) {\n setIsFirstRender(false);\n }\n }, [isFirstRender]);\n\n return (\n <ReactGridLayoutContainer\n sx={{\n // This adds spcing between grids (rows) in the overall dashboard\n '& + &': { marginTop: (theme) => theme.spacing(1) },\n // This disables the animation of grid items when a grid is first rendered\n // (see https://github.com/react-grid-layout/react-grid-layout/issues/103)\n '& .react-grid-item.cssTransforms': { transitionProperty: isFirstRender ? 'none' : 'transform' },\n }}\n data-testid=\"panel-group\"\n >\n {props.children}\n </ReactGridLayoutContainer>\n );\n}\n\n/**\n * These are the classes needed by react-grid-layout from their CSS stylesheet.\n */\nconst ReactGridLayoutContainer = styled('section')(({ theme }) => ({\n '& .react-grid-layout': {\n position: 'relative',\n transition: 'height 200ms ease',\n },\n '& .react-grid-item': {\n transition: 'all 200ms ease',\n transitionProperty: 'left, top',\n },\n '& .react-grid-item img': {\n pointerEvents: 'none',\n userSelect: 'none',\n },\n '& .react-grid-item.cssTransforms': {\n transitionProperty: 'transform',\n },\n '& .react-grid-item.resizing': {\n zIndex: 1,\n willChange: 'width, height',\n },\n '& .react-grid-item.react-draggable-dragging': {\n transition: 'none',\n zIndex: 3,\n willChange: 'transform',\n },\n '& .react-grid-item.dropping': {\n visibility: 'hidden',\n },\n '& .react-grid-item.react-grid-placeholder': {\n background: theme.palette.primary.main,\n opacity: 0.2,\n transitionDuration: '100ms',\n zIndex: 2,\n userSelect: 'none',\n WebkitUserSelect: 'none',\n MozUserSelect: 'none',\n msUserSelect: 'none',\n OUserSelect: 'none',\n },\n\n '& .react-grid-item > .react-resizable-handle': {\n position: 'absolute',\n width: '20px',\n height: '20px',\n },\n '& .react-grid-item > .react-resizable-handle::after': {\n content: '\"\"',\n position: 'absolute',\n right: '3px',\n bottom: '3px',\n width: '5px',\n height: '5px',\n borderRight: `2px solid ${theme.palette.text.secondary}`,\n borderBottom: `2px solid ${theme.palette.text.secondary}`,\n },\n\n '& .react-resizable-hide > .react-resizable-handle': {\n display: 'none',\n },\n\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-sw': {\n bottom: '0',\n left: '0',\n cursor: 'sw-resize',\n transform: 'rotate(90deg)',\n },\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-se': {\n bottom: '0',\n right: '0',\n cursor: 'se-resize',\n },\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-nw': {\n top: '0',\n left: '0',\n cursor: 'nw-resize',\n transform: 'rotate(180deg)',\n },\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-ne': {\n top: '0',\n right: '0',\n cursor: 'ne-resize',\n transform: 'rotate(270deg)',\n },\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-w, &.react-grid-item > .react-resizable-handle.react-resizable-handle-e':\n {\n top: '50%',\n marginTop: '-10px',\n cursor: 'ew-resize',\n },\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-w': {\n left: '0',\n transform: 'rotate(135deg)',\n },\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-e': {\n right: '0',\n transform: 'rotate(315deg)',\n },\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-n, &.react-grid-item > .react-resizable-handle.react-resizable-handle-s':\n {\n left: '50%',\n marginLeft: '-10px',\n cursor: 'ns-resize',\n },\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-n': {\n top: '0',\n transform: 'rotate(225deg)',\n },\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-s': {\n bottom: '0',\n transform: 'rotate(45deg)',\n },\n '& .react-resizable': {\n position: 'relative',\n },\n '& .react-resizable-handle': {\n position: 'absolute',\n width: '20px',\n height: '20px',\n backgroundRepeat: 'no-repeat',\n backgroundOrigin: 'content-box',\n boxSizing: 'border-box',\n backgroundImage: `url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2IDYiIHN0eWxlPSJiYWNrZ3JvdW5kLWNvbG9yOiNmZmZmZmYwMCIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSI2cHgiIGhlaWdodD0iNnB4Ij48ZyBvcGFjaXR5PSIwLjMwMiI+PHBhdGggZD0iTSA2IDYgTCAwIDYgTCAwIDQuMiBMIDQgNC4yIEwgNC4yIDQuMiBMIDQuMiAwIEwgNiAwIEwgNiA2IEwgNiA2IFoiIGZpbGw9IiMwMDAwMDAiLz48L2c+PC9zdmc+')`,\n backgroundPosition: 'bottom right',\n padding: '0 3px 3px 0',\n },\n '& .react-resizable-handle-sw': {\n bottom: '0',\n left: '0',\n cursor: 'sw-resize',\n transform: 'rotate(90deg)',\n },\n '& .react-resizable-handle-se': {\n bottom: '0',\n right: '0',\n cursor: 'se-resize',\n },\n '& .react-resizable-handle-nw': {\n top: '0',\n left: '0',\n cursor: 'nw-resize',\n transform: 'rotate(180deg)',\n },\n '& .react-resizable-handle-ne': {\n top: '0',\n right: '0',\n cursor: 'ne-resize',\n transform: 'rotate(270deg)',\n },\n '& .react-resizable-handle-w, .react-resizable-handle-e': {\n top: '50%',\n marginTop: '-10px',\n cursor: 'ew-resize',\n },\n '& .react-resizable-handle-w': {\n left: '0',\n transform: 'rotate(135deg)',\n },\n '& .react-resizable-handle-e': {\n right: '0',\n transform: 'rotate(315deg)',\n },\n '& .react-resizable-handle-n, .react-resizable-handle-s': {\n left: '50%',\n marginLeft: '-10px',\n cursor: 'ns-resize',\n },\n '& .react-resizable-handle-n': {\n top: '0',\n transform: 'rotate(225deg)',\n },\n '& .react-resizable-handle-s': {\n bottom: '0',\n transform: 'rotate(45deg)',\n },\n}));\n"],"names":["useEffect","useState","styled","GridContainer","props","isFirstRender","setIsFirstRender","ReactGridLayoutContainer","sx","marginTop","theme","spacing","transitionProperty","data-testid","children","position","transition","pointerEvents","userSelect","zIndex","willChange","visibility","background","palette","primary","main","opacity","transitionDuration","WebkitUserSelect","MozUserSelect","msUserSelect","OUserSelect","width","height","content","right","bottom","borderRight","text","secondary","borderBottom","display","left","cursor","transform","top","marginLeft","backgroundRepeat","backgroundOrigin","boxSizing","backgroundImage","backgroundPosition","padding"],"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,SAAS,EAAEC,QAAQ,QAAQ,OAAO,CAAC;AAC5C,SAASC,MAAM,QAAQ,eAAe,CAAC;AAMvC,OAAO,SAASC,aAAa,CAACC,KAAyB,EAAE;IACvD,MAAM,CAACC,aAAa,EAAEC,gBAAgB,CAAC,GAAGL,QAAQ,CAAC,IAAI,CAAC,AAAC;IACzDD,SAA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ACVQ,MAAM,EAAE,WAAW;YACnBC,SAAS,EAAE,gBAAgB;SAC5B;QACD,wDAAwD,EAAE;YACxDC,GAAG,EAAE,KAAK;YACVpC,SAAS,EAAE,OAAO;YAClBkC,MAAM,EAAE,WAAW;SACpB;QACD,6BAA6B,EAAE;YAC7BD,IAAI,EAAE,GAAG;YACTE,SAAS,EAAE,gBAAgB;SAC5B;QACD,6BAA6B,EAAE;YAC7BT,KAAK,EAAE,GAAG;YACVS,SAAS,EAAE,gBAAgB;SAC5B;QACD,wDAAwD,EAAE;YACxDF,IAAI,EAAE,KAAK;YACXI,UAAU,EAAE,OAAO;YACnBH,MAAM,EAAE,WAAW;SACpB;QACD,6BAA6B,EAAE;YAC7BE,GAAG,EAAE,GAAG;YACRD,SAAS,EAAE,gBAAgB;SAC5B;QACD,6BAA6B,EAAE;YAC7BR,MAAM,EAAE,GAAG;YACXQ,SAAS,EAAE,eAAe;SAC3B;KACF,CAAA,AAAC,CAAC,AAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/GridLayout/GridItemContent.tsx"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../src/components/GridLayout/GridItemContent.tsx"],"sourcesContent":["// Copyright 2023 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 { PanelGroupItemId, useEditMode, usePanel, usePanelActions } from '../../context';\nimport { Panel, PanelProps } from '../Panel/Panel';\n\nexport interface GridItemContentProps {\n panelGroupItemId: PanelGroupItemId;\n}\n\n/**\n * Resolves the reference to panel content in a GridItemDefinition and renders the panel.\n */\nexport function GridItemContent(props: GridItemContentProps) {\n const { panelGroupItemId } = props;\n const panelDefinition = usePanel(panelGroupItemId);\n const { isEditMode } = useEditMode();\n const { openEditPanel, openDeletePanelDialog } = usePanelActions(panelGroupItemId);\n\n // Provide actions to the panel when in edit mode\n let editHandlers: PanelProps['editHandlers'] = undefined;\n if (isEditMode) {\n editHandlers = {\n onEditPanelClick: openEditPanel,\n onDeletePanelClick: openDeletePanelDialog,\n };\n }\n\n return <Panel definition={panelDefinition} editHandlers={editHandlers} />;\n}\n"],"names":["useEditMode","usePanel","usePanelActions","Panel","GridItemContent","props","panelGroupItemId","panelDefinition","isEditMode","openEditPanel","openDeletePanelDialog","editHandlers","undefined","onEditPanelClick","onDeletePanelClick","definition"],"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,WAAW,EAAEC,QAAQ,EAAEC,eAAe,QAAQ,eAAe,CAAC;AACzF,SAASC,KAAK,QAAoB,gBAAgB,CAAC;AAMnD;;CAEC,GACD,OAAO,SAASC,eAAe,CAACC,KAA2B,EAAE;IAC3D,MAAM,EAAEC,gBAAgB,CAAA,EAAE,GAAGD,KAAK,AAAC;IACnC,MAAME,eAAe,GAAGN,QAAQ,CAACK,gBAAgB,CAAC,AAAC;IACnD,MAAM,EAAEE,UAAU,CAAA,EAAE,GAAGR,WAAW,EAAE,AAAC;IACrC,MAAM,EAAES,aAAa,CAAA,EAAEC,qBAAqB,CAAA,EAAE,GAAGR,eAAe,CAACI,gBAAgB,CAAC,AAAC;IAEnF,iDAAiD;IACjD,IAAIK,YAAY,GAA+BC,SAAS,AAAC;IACzD,IAAIJ,UAAU,EAAE;QACdG,YAAY,GAAG;YACbE,gBAAgB,EAAEJ,aAAa;YAC/BK,kBAAkB,EAAEJ,qBAAqB;SAC1C,CAAC;IACJ,CAAC;IAED,qBAAO,KAACP,KAAK;QAACY,UAAU,EAAER,eAAe;QAAEI,YAAY,EAAEA,YAAY;MAAI,CAAC;AAC5E,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2023 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -55,6 +55,7 @@ const SMALL_LAYOUT_BREAKPOINT = 'sm';
|
|
|
55
55
|
in: isOpen,
|
|
56
56
|
unmountOnExit: true,
|
|
57
57
|
appear: false,
|
|
58
|
+
"data-testid": "panel-group-content",
|
|
58
59
|
children: /*#__PURE__*/ _jsx(ResponsiveGridLayout, {
|
|
59
60
|
className: "layout",
|
|
60
61
|
breakpoints: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/GridLayout/GridLayout.tsx"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../src/components/GridLayout/GridLayout.tsx"],"sourcesContent":["// Copyright 2023 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.\nimport { useState } from 'react';\nimport { Responsive, WidthProvider, Layouts, Layout } from 'react-grid-layout';\nimport { Collapse, useTheme } from '@mui/material';\nimport { ErrorAlert, ErrorBoundary } from '@perses-dev/components';\nimport { useEditMode, usePanelGroup, usePanelGroupActions, PanelGroupId } from '../../context';\nimport { GridTitle } from './GridTitle';\nimport { GridItemContent } from './GridItemContent';\nimport { GridContainer } from './GridContainer';\n\nconst ResponsiveGridLayout = WidthProvider(Responsive);\n\nexport interface GridLayoutProps {\n panelGroupId: PanelGroupId;\n}\n\nconst SMALL_LAYOUT_BREAKPOINT = 'sm' as const;\n\n/**\n * Layout component that arranges children in a Grid based on the definition.\n */\nexport function GridLayout(props: GridLayoutProps) {\n const { panelGroupId /*...others */ } = props;\n const theme = useTheme();\n const groupDefinition = usePanelGroup(panelGroupId);\n const { updatePanelGroupLayouts } = usePanelGroupActions(panelGroupId);\n\n const [isOpen, setIsOpen] = useState(!groupDefinition.isCollapsed ?? true);\n const { isEditMode } = useEditMode();\n\n const handleLayoutChange = (currentLayout: Layout[], allLayouts: Layouts) => {\n // Using the value from `allLayouts` instead of `currentLayout` because of\n // a bug in react-layout-grid where `currentLayout` does not adjust properly\n // when going to a smaller breakpoint and then back to a larger breakpoint.\n // https://github.com/react-grid-layout/react-grid-layout/issues/1663\n const smallLayout = allLayouts[SMALL_LAYOUT_BREAKPOINT];\n if (smallLayout) {\n updatePanelGroupLayouts(smallLayout);\n }\n };\n\n return (\n <GridContainer>\n {groupDefinition.title !== undefined && (\n <GridTitle\n panelGroupId={panelGroupId}\n title={groupDefinition.title}\n collapse={\n groupDefinition.isCollapsed === undefined\n ? undefined\n : { isOpen, onToggleOpen: () => setIsOpen((current) => !current) }\n }\n />\n )}\n <Collapse in={isOpen} unmountOnExit appear={false} data-testid=\"panel-group-content\">\n <ResponsiveGridLayout\n className=\"layout\"\n breakpoints={{ sm: theme.breakpoints.values.sm, xxs: 0 }}\n cols={{ sm: 24, xxs: 2 }}\n rowHeight={30}\n draggableHandle={'.drag-handle'}\n resizeHandles={['se']}\n isDraggable={isEditMode}\n isResizable={isEditMode}\n containerPadding={[0, 10]}\n layouts={{ [SMALL_LAYOUT_BREAKPOINT]: groupDefinition.itemLayouts }}\n onLayoutChange={handleLayoutChange}\n >\n {groupDefinition.itemLayouts.map(({ i }) => (\n <div key={i}>\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <GridItemContent panelGroupItemId={{ panelGroupId, panelGroupItemLayoutId: i }} />\n </ErrorBoundary>\n </div>\n ))}\n </ResponsiveGridLayout>\n </Collapse>\n </GridContainer>\n );\n}\n"],"names":["useState","Responsive","WidthProvider","Collapse","useTheme","ErrorAlert","ErrorBoundary","useEditMode","usePanelGroup","usePanelGroupActions","GridTitle","GridItemContent","GridContainer","ResponsiveGridLayout","SMALL_LAYOUT_BREAKPOINT","GridLayout","props","panelGroupId","theme","groupDefinition","updatePanelGroupLayouts","isOpen","setIsOpen","isCollapsed","isEditMode","handleLayoutChange","currentLayout","allLayouts","smallLayout","title","undefined","collapse","onToggleOpen","current","in","unmountOnExit","appear","data-testid","className","breakpoints","sm","values","xxs","cols","rowHeight","draggableHandle","resizeHandles","isDraggable","isResizable","containerPadding","layouts","itemLayouts","onLayoutChange","map","i","div","FallbackComponent","panelGroupItemId","panelGroupItemLayoutId"],"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;AACjC;AAAA,SAASA,QAAQ,QAAQ,OAAO,CAAC;AACjC,SAASC,UAAU,EAAEC,aAAa,QAAyB,mBAAmB,CAAC;AAC/E,SAASC,QAAQ,EAAEC,QAAQ,QAAQ,eAAe,CAAC;AACnD,SAASC,UAAU,EAAEC,aAAa,QAAQ,wBAAwB,CAAC;AACnE,SAASC,WAAW,EAAEC,aAAa,EAAEC,oBAAoB,QAAsB,eAAe,CAAC;AAC/F,SAASC,SAAS,QAAQ,aAAa,CAAC;AACxC,SAASC,eAAe,QAAQ,mBAAmB,CAAC;AACpD,SAASC,aAAa,QAAQ,iBAAiB,CAAC;AAEhD,MAAMC,oBAAoB,GAAGX,aAAa,CAACD,UAAU,CAAC,AAAC;AAMvD,MAAMa,uBAAuB,GAAG,IAAI,AAAS,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;gBAACC,MAAM,EAAE,KAAK;gBAAEC,aAAW,EAAC,qBAAqB;0BAClF,cAAA,KAACxB,oBAAoB;oBACnByB,SAAS,EAAC,QAAQ;oBAClBC,WAAW,EAAE;wBAAEC,EAAE,EAAEtB,KAAK,CAACqB,WAAW,CAACE,MAAM,CAACD,EAAE;wBAAEE,GAAG,EAAE,CAAC;qBAAE;oBACxDC,IAAI,EAAE;wBAAEH,EAAE,EAAE,EAAE;wBAAEE,GAAG,EAAE,CAAC;qBAAE;oBACxBE,SAAS,EAAE,EAAE;oBACbC,eAAe,EAAE,cAAc;oBAC/BC,aAAa,EAAE;wBAAC,IAAI;qBAAC;oBACrBC,WAAW,EAAEvB,UAAU;oBACvBwB,WAAW,EAAExB,UAAU;oBACvByB,gBAAgB,EAAE;AAAC,yBAAC;AAAE,0BAAE;qBAAC;oBACzBC,OAAO,EAAE;wBAAE,CAACpC,uBAAuB,CAAC,EAAEK,eAAe,CAACgC,WAAW;qBAAE;oBACnEC,cAAc,EAAE3B,kBAAkB;8BAEjCN,eAAe,CAACgC,WAAW,CAACE,GAAG,CAAC,CAAC,EAAEC,CAAC,CAAA,EAAE,iBACrC,KAACC,KAAG;sCACF,cAAA,KAACjD,aAAa;gCAACkD,iBAAiB,EAAEnD,UAAU;0CAC1C,cAAA,KAACM,eAAe;oCAAC8C,gBAAgB,EAAE;wCAAExC,YAAY;wCAAEyC,sBAAsB,EAAEJ,CAAC;qCAAE;kCAAI;8BACpE;2BAHRA,CAAC,CAIL,AACP,CAAC;kBACmB;cACd;;MACG,CAChB;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GridTitle.d.ts","sourceRoot":"","sources":["../../../src/components/GridLayout/GridTitle.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"GridTitle.d.ts","sourceRoot":"","sources":["../../../src/components/GridLayout/GridTitle.tsx"],"names":[],"mappings":";AAuBA,OAAO,EAAqC,YAAY,EAA6B,MAAM,eAAe,CAAC;AAE3G,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,YAAY,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE;QACT,MAAM,EAAE,OAAO,CAAC;QAChB,YAAY,EAAE,MAAM,IAAI,CAAC;KAC1B,CAAC;CACH;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,eAiF9C"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2023 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -20,6 +20,7 @@ import ArrowUpIcon from 'mdi-material-ui/ArrowUp';
|
|
|
20
20
|
import ArrowDownIcon from 'mdi-material-ui/ArrowDown';
|
|
21
21
|
import DeleteIcon from 'mdi-material-ui/DeleteOutline';
|
|
22
22
|
import { InfoTooltip } from '@perses-dev/components';
|
|
23
|
+
import { ARIA_LABEL_TEXT, TOOLTIP_TEXT } from '../../constants';
|
|
23
24
|
import { usePanelGroupActions, useEditMode, useDeletePanelGroupDialog } from '../../context';
|
|
24
25
|
/**
|
|
25
26
|
* Renders the title for a Grid section, optionally also supporting expanding
|
|
@@ -44,10 +45,12 @@ import { usePanelGroupActions, useEditMode, useDeletePanelGroupDialog } from '..
|
|
|
44
45
|
padding: (theme)=>theme.spacing(1),
|
|
45
46
|
backgroundColor: ({ palette })=>palette.mode === 'dark' ? palette.background.paper : palette.background.default
|
|
46
47
|
},
|
|
48
|
+
"data-testid": "panel-group-header",
|
|
47
49
|
children: collapse ? /*#__PURE__*/ _jsxs(_Fragment, {
|
|
48
50
|
children: [
|
|
49
51
|
/*#__PURE__*/ _jsx(IconButton, {
|
|
50
52
|
onClick: collapse.onToggleOpen,
|
|
53
|
+
"aria-label": `${collapse.isOpen ? 'collapse' : 'expand'} group ${title}`,
|
|
51
54
|
children: collapse.isOpen ? /*#__PURE__*/ _jsx(ExpandedIcon, {}) : /*#__PURE__*/ _jsx(CollapsedIcon, {})
|
|
52
55
|
}),
|
|
53
56
|
text,
|
|
@@ -56,42 +59,42 @@ import { usePanelGroupActions, useEditMode, useDeletePanelGroupDialog } from '..
|
|
|
56
59
|
marginLeft: "auto",
|
|
57
60
|
children: [
|
|
58
61
|
/*#__PURE__*/ _jsx(InfoTooltip, {
|
|
59
|
-
description:
|
|
62
|
+
description: TOOLTIP_TEXT.addPanelToGroup,
|
|
60
63
|
children: /*#__PURE__*/ _jsx(IconButton, {
|
|
61
|
-
"aria-label":
|
|
64
|
+
"aria-label": ARIA_LABEL_TEXT.addPanelToGroup(title),
|
|
62
65
|
onClick: openAddPanel,
|
|
63
66
|
children: /*#__PURE__*/ _jsx(AddPanelIcon, {})
|
|
64
67
|
})
|
|
65
68
|
}),
|
|
66
69
|
/*#__PURE__*/ _jsx(InfoTooltip, {
|
|
67
|
-
description:
|
|
70
|
+
description: TOOLTIP_TEXT.editGroup,
|
|
68
71
|
children: /*#__PURE__*/ _jsx(IconButton, {
|
|
69
|
-
"aria-label":
|
|
72
|
+
"aria-label": ARIA_LABEL_TEXT.editGroup(title),
|
|
70
73
|
onClick: openEditPanelGroup,
|
|
71
74
|
children: /*#__PURE__*/ _jsx(PencilIcon, {})
|
|
72
75
|
})
|
|
73
76
|
}),
|
|
74
77
|
/*#__PURE__*/ _jsx(InfoTooltip, {
|
|
75
|
-
description:
|
|
78
|
+
description: TOOLTIP_TEXT.deleteGroup,
|
|
76
79
|
children: /*#__PURE__*/ _jsx(IconButton, {
|
|
77
|
-
"aria-label":
|
|
80
|
+
"aria-label": ARIA_LABEL_TEXT.deleteGroup(title),
|
|
78
81
|
onClick: ()=>openDeletePanelGroupDialog(panelGroupId),
|
|
79
82
|
children: /*#__PURE__*/ _jsx(DeleteIcon, {})
|
|
80
83
|
})
|
|
81
84
|
}),
|
|
82
85
|
/*#__PURE__*/ _jsx(InfoTooltip, {
|
|
83
|
-
description:
|
|
86
|
+
description: TOOLTIP_TEXT.moveGroupDown,
|
|
84
87
|
children: /*#__PURE__*/ _jsx(IconButton, {
|
|
85
|
-
"aria-label":
|
|
88
|
+
"aria-label": ARIA_LABEL_TEXT.moveGroupDown(title),
|
|
86
89
|
disabled: moveDown === undefined,
|
|
87
90
|
onClick: moveDown,
|
|
88
91
|
children: /*#__PURE__*/ _jsx(ArrowDownIcon, {})
|
|
89
92
|
})
|
|
90
93
|
}),
|
|
91
94
|
/*#__PURE__*/ _jsx(InfoTooltip, {
|
|
92
|
-
description:
|
|
95
|
+
description: TOOLTIP_TEXT.moveGroupUp,
|
|
93
96
|
children: /*#__PURE__*/ _jsx(IconButton, {
|
|
94
|
-
"aria-label":
|
|
97
|
+
"aria-label": ARIA_LABEL_TEXT.moveGroupUp(title),
|
|
95
98
|
disabled: moveUp === undefined,
|
|
96
99
|
onClick: moveUp,
|
|
97
100
|
children: /*#__PURE__*/ _jsx(ArrowUpIcon, {})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/GridLayout/GridTitle.tsx"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../src/components/GridLayout/GridTitle.tsx"],"sourcesContent":["// Copyright 2023 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 { Box, IconButton, Stack, Typography } from '@mui/material';\nimport ExpandedIcon from 'mdi-material-ui/ChevronDown';\nimport CollapsedIcon from 'mdi-material-ui/ChevronRight';\nimport AddPanelIcon from 'mdi-material-ui/ChartBoxPlusOutline';\nimport PencilIcon from 'mdi-material-ui/PencilOutline';\nimport ArrowUpIcon from 'mdi-material-ui/ArrowUp';\nimport ArrowDownIcon from 'mdi-material-ui/ArrowDown';\nimport DeleteIcon from 'mdi-material-ui/DeleteOutline';\nimport { InfoTooltip } from '@perses-dev/components';\nimport { ARIA_LABEL_TEXT, TOOLTIP_TEXT } from '../../constants';\nimport { usePanelGroupActions, useEditMode, PanelGroupId, useDeletePanelGroupDialog } from '../../context';\n\nexport interface GridTitleProps {\n panelGroupId: PanelGroupId;\n title: string;\n collapse?: {\n isOpen: boolean;\n onToggleOpen: () => void;\n };\n}\n\n/**\n * Renders the title for a Grid section, optionally also supporting expanding\n * and collapsing\n */\nexport function GridTitle(props: GridTitleProps) {\n const { panelGroupId, title, collapse } = props;\n\n const { openAddPanel, openEditPanelGroup, moveUp, moveDown } = usePanelGroupActions(panelGroupId);\n const { openDeletePanelGroupDialog } = useDeletePanelGroupDialog();\n const { isEditMode } = useEditMode();\n\n const text = (\n <Typography variant=\"h2\" sx={{ marginLeft: collapse !== undefined ? 1 : undefined }}>\n {title}\n </Typography>\n );\n\n return (\n <Box\n sx={{\n display: 'flex',\n justifyContent: 'start',\n alignItems: 'center',\n padding: (theme) => theme.spacing(1),\n backgroundColor: ({ palette }) =>\n palette.mode === 'dark' ? palette.background.paper : palette.background.default,\n }}\n data-testid=\"panel-group-header\"\n >\n {collapse ? (\n <>\n <IconButton\n onClick={collapse.onToggleOpen}\n aria-label={`${collapse.isOpen ? 'collapse' : 'expand'} group ${title}`}\n >\n {collapse.isOpen ? <ExpandedIcon /> : <CollapsedIcon />}\n </IconButton>\n {text}\n {isEditMode && (\n <Stack direction=\"row\" marginLeft=\"auto\">\n <InfoTooltip description={TOOLTIP_TEXT.addPanelToGroup}>\n <IconButton aria-label={ARIA_LABEL_TEXT.addPanelToGroup(title)} onClick={openAddPanel}>\n <AddPanelIcon />\n </IconButton>\n </InfoTooltip>\n <InfoTooltip description={TOOLTIP_TEXT.editGroup}>\n <IconButton aria-label={ARIA_LABEL_TEXT.editGroup(title)} onClick={openEditPanelGroup}>\n <PencilIcon />\n </IconButton>\n </InfoTooltip>\n <InfoTooltip description={TOOLTIP_TEXT.deleteGroup}>\n <IconButton\n aria-label={ARIA_LABEL_TEXT.deleteGroup(title)}\n onClick={() => openDeletePanelGroupDialog(panelGroupId)}\n >\n <DeleteIcon />\n </IconButton>\n </InfoTooltip>\n <InfoTooltip description={TOOLTIP_TEXT.moveGroupDown}>\n <IconButton\n aria-label={ARIA_LABEL_TEXT.moveGroupDown(title)}\n disabled={moveDown === undefined}\n onClick={moveDown}\n >\n <ArrowDownIcon />\n </IconButton>\n </InfoTooltip>\n <InfoTooltip description={TOOLTIP_TEXT.moveGroupUp}>\n <IconButton\n aria-label={ARIA_LABEL_TEXT.moveGroupUp(title)}\n disabled={moveUp === undefined}\n onClick={moveUp}\n >\n <ArrowUpIcon />\n </IconButton>\n </InfoTooltip>\n </Stack>\n )}\n </>\n ) : (\n // If we don't need expand/collapse, just render the title text\n text\n )}\n </Box>\n );\n}\n"],"names":["Box","IconButton","Stack","Typography","ExpandedIcon","CollapsedIcon","AddPanelIcon","PencilIcon","ArrowUpIcon","ArrowDownIcon","DeleteIcon","InfoTooltip","ARIA_LABEL_TEXT","TOOLTIP_TEXT","usePanelGroupActions","useEditMode","useDeletePanelGroupDialog","GridTitle","props","panelGroupId","title","collapse","openAddPanel","openEditPanelGroup","moveUp","moveDown","openDeletePanelGroupDialog","isEditMode","text","variant","sx","marginLeft","undefined","display","justifyContent","alignItems","padding","theme","spacing","backgroundColor","palette","mode","background","paper","default","data-testid","onClick","onToggleOpen","aria-label","isOpen","direction","description","addPanelToGroup","editGroup","deleteGroup","moveGroupDown","disabled","moveGroupUp"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE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ChD,cAAA,KAACrD,UAAU;gCACT+C,YAAU,EAAEpC,eAAe,CAAC0C,WAAW,CAAClC,KAAK,CAAC;gCAC9C0B,OAAO,EAAE,IAAMpB,0BAA0B,CAACP,YAAY,CAAC;0CAEvD,cAAA,KAACT,UAAU,KAAG;8BACH;0BACD;sCACd,KAACC,WAAW;4BAACwC,WAAW,EAAEtC,YAAY,CAAC0C,aAAa;sCAClD,cAAA,KAACtD,UAAU;gCACT+C,YAAU,EAAEpC,eAAe,CAAC2C,aAAa,CAACnC,KAAK,CAAC;gCAChDoC,QAAQ,EAAE/B,QAAQ,KAAKO,SAAS;gCAChCc,OAAO,EAAErB,QAAQ;0CAEjB,cAAA,KAAChB,aAAa,KAAG;8BACN;0BACD;sCACd,KAACE,WAAW;4BAACwC,WAAW,EAAEtC,YAAY,CAAC4C,WAAW;sCAChD,cAAA,KAACxD,UAAU;gCACT+C,YAAU,EAAEpC,eAAe,CAAC6C,WAAW,CAACrC,KAAK,CAAC;gCAC9CoC,QAAQ,EAAEhC,MAAM,KAAKQ,SAAS;gCAC9Bc,OAAO,EAAEtB,MAAM;0CAEf,cAAA,KAAChB,WAAW,KAAG;8BACJ;0BACD;;kBACR,AACT;;UACA,GAEH,+DAA+D;QAC/DoB,IAAI,AACL;MACG,CACN;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/GridLayout/index.ts"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../src/components/GridLayout/index.ts"],"sourcesContent":["// Copyright 2023 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 './GridLayout';\nexport * from './GridItemContent';\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,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Panel.d.ts","sourceRoot":"","sources":["../../../src/components/Panel/Panel.tsx"],"names":[],"mappings":";AAiBA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAQ,SAAS,EAAe,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAe,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAG9D,MAAM,WAAW,UAAW,SAAQ,SAAS,CAAC,SAAS,CAAC;IACtD,UAAU,EAAE,eAAe,CAAC;IAC5B,YAAY,CAAC,EAAE,gBAAgB,CAAC,cAAc,CAAC,CAAC;CACjD;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"Panel.d.ts","sourceRoot":"","sources":["../../../src/components/Panel/Panel.tsx"],"names":[],"mappings":";AAiBA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAQ,SAAS,EAAe,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAe,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAG9D,MAAM,WAAW,UAAW,SAAQ,SAAS,CAAC,SAAS,CAAC;IACtD,UAAU,EAAE,eAAe,CAAC;IAC5B,YAAY,CAAC,EAAE,gBAAgB,CAAC,cAAc,CAAC,CAAC;CACjD;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,eA4FtC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2023 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -69,6 +69,7 @@ import { PanelContent } from './PanelContent';
|
|
|
69
69
|
onMouseLeave: handleMouseLeave,
|
|
70
70
|
"aria-labelledby": headerId,
|
|
71
71
|
"aria-describedby": headerId,
|
|
72
|
+
"data-testid": "panel",
|
|
72
73
|
...others,
|
|
73
74
|
children: [
|
|
74
75
|
/*#__PURE__*/ _jsx(PanelHeader, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Panel/Panel.tsx"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Panel/Panel.tsx"],"sourcesContent":["// Copyright 2023 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, combineSx, useId } from '@perses-dev/components';\nimport { PanelDefinition } from '@perses-dev/core';\nimport { Card, CardProps, CardContent } from '@mui/material';\nimport { PanelHeader, PanelHeaderProps } from './PanelHeader';\nimport { PanelContent } from './PanelContent';\n\nexport interface PanelProps extends CardProps<'section'> {\n definition: PanelDefinition;\n editHandlers?: PanelHeaderProps['editHandlers'];\n}\n\n/**\n * Renders a PanelDefinition's content inside of a Card.\n */\nexport function Panel(props: PanelProps) {\n const { definition, editHandlers, onMouseEnter, onMouseLeave, sx, ...others } = props;\n\n // Make sure we have an ID we can use for aria attributes\n const generatedPanelId = useId('Panel');\n const headerId = `${generatedPanelId}-header`;\n\n const [contentElement, setContentElement] = useState<HTMLElement | 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 handleMouseEnter: CardProps['onMouseEnter'] = (e) => {\n setIsHovered(true);\n onMouseEnter?.(e);\n };\n\n const handleMouseLeave: CardProps['onMouseLeave'] = (e) => {\n setIsHovered(false);\n onMouseLeave?.(e);\n };\n\n return (\n <Card\n ref={ref}\n component=\"section\"\n sx={combineSx(\n {\n width: '100%',\n height: '100%',\n display: 'flex',\n flexFlow: 'column nowrap',\n },\n sx\n )}\n variant=\"outlined\"\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n aria-labelledby={headerId}\n aria-describedby={headerId}\n data-testid=\"panel\"\n {...others}\n >\n <PanelHeader\n id={headerId}\n title={definition.spec.display.name}\n description={definition.spec.display.description}\n editHandlers={editHandlers}\n isHovered={isHovered}\n sx={{ paddingX: (theme) => theme.spacing(panelPadding) }}\n />\n <CardContent\n component=\"figure\"\n sx={{\n position: 'relative',\n overflow: 'hidden',\n flexGrow: 1,\n margin: 0,\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} resetKeys={[definition.spec.plugin.spec]}>\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"],"names":["useState","useMemo","useResizeObserver","useInView","ErrorBoundary","ErrorAlert","combineSx","useId","Card","CardContent","PanelHeader","PanelContent","Panel","props","definition","editHandlers","onMouseEnter","onMouseLeave","sx","others","generatedPanelId","headerId","contentElement","setContentElement","isHovered","setIsHovered","width","height","ref","contentDimensions","undefined","inView","threshold","initialInView","triggerOnce","panelPadding","handleMouseEnter","e","handleMouseLeave","component","display","flexFlow","variant","aria-labelledby","aria-describedby","data-testid","id","title","spec","name","description","paddingX","theme","spacing","position","overflow","flexGrow","margin","padding","FallbackComponent","resetKeys","plugin","panelPluginKind","kind"],"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,SAAS,EAAEC,KAAK,QAAQ,wBAAwB,CAAC;AAErF,SAASC,IAAI,EAAaC,WAAW,QAAQ,eAAe,CAAC;AAC7D,SAASC,WAAW,QAA0B,eAAe,CAAC;AAC9D,SAASC,YAAY,QAAQ,gBAAgB,CAAC;AAO9C;;CAEC,GACD,OAAO,SAASC,KAAK,CAACC,KAAiB,EAAE;IACvC,MAAM,EAAEC,UAAU,CAAA,EAAEC,YAAY,CAAA,EAAEC,YAAY,CAAA,EAAEC,YAAY,CAAA,EAAEC,EAAE,CAAA,EAAE,GAAGC,MAAM,EAAE,GAAGN,KAAK,AAAC;IAEtF,yDAAyD;IACzD,MAAMO,gBAAgB,GAAGb,KAAK,CAAC,OAAO,CAAC,AAAC;IACxC,MAAM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ACuD,iBAAiB,EAAEtD,UAAU;oBAAEuD,SAAS,EAAE;wBAAC9C,UAAU,CAACkC,IAAI,CAACa,MAAM,CAACb,IAAI;qBAAC;8BACnFjB,MAAM,KAAK,IAAI,kBACd,KAACpB,YAAY;wBACXmD,eAAe,EAAEhD,UAAU,CAACkC,IAAI,CAACa,MAAM,CAACE,IAAI;wBAC5Cf,IAAI,EAAElC,UAAU,CAACkC,IAAI,CAACa,MAAM,CAACb,IAAI;wBACjCnB,iBAAiB,EAAEA,iBAAiB;sBACpC,AACH;kBACa;cACJ;;MACT,CACP;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Panel/Panel.test.tsx"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Panel/Panel.test.tsx"],"sourcesContent":["// Copyright 2023 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, waitFor } from '@testing-library/react';\nimport userEvent from '@testing-library/user-event';\nimport { PanelDefinition } from '@perses-dev/core';\nimport { renderWithContext } from '../../test';\nimport { Panel, PanelProps } from './Panel';\n\ndescribe('Panel', () => {\n const createTestPanel = (): PanelDefinition => ({\n kind: 'Panel',\n spec: {\n display: {\n name: 'Fake Panel Title',\n description: 'This is a fake panel',\n },\n plugin: {\n kind: 'TimeSeriesChart',\n spec: {},\n },\n },\n });\n\n // Helper to render the panel with some context set\n const renderPanel = (definition?: PanelDefinition, editHandlers?: PanelProps['editHandlers']) => {\n definition ??= createTestPanel();\n\n renderWithContext(<Panel definition={definition} editHandlers={editHandlers} />);\n };\n\n // Helper to get the panel once rendered\n const getPanel = () => screen.getByRole('region', { name: 'Fake Panel Title' });\n\n it('should render panel', async () => {\n renderPanel();\n\n const panel = getPanel();\n expect(panel).toBeInTheDocument();\n\n // Should diplay header with panel's title\n const header = screen.getByRole('banner');\n expect(header).toHaveTextContent('Fake Panel Title');\n\n // Should display chart's content from the fake panel plugin\n const content = screen.getByRole('figure');\n await waitFor(() => {\n expect(content).toHaveTextContent('TimeSeriesChart panel');\n });\n expect(content);\n });\n\n it('shows panel description', async () => {\n renderPanel();\n\n const panel = getPanel();\n\n // Description button should not be visible until hover on panel\n const missingButton = screen.queryByRole('button', { name: /description/i });\n expect(missingButton).not.toBeInTheDocument();\n userEvent.hover(panel);\n const descriptionButton = screen.getByRole('button', { name: /description/i });\n expect(descriptionButton).toBeInTheDocument();\n\n // Can hover to see panel description in tooltip\n userEvent.hover(descriptionButton);\n const tooltip = await screen.findByRole('tooltip');\n expect(tooltip).toHaveTextContent('This is a fake panel');\n });\n\n it('does not show description when panel does not have one', () => {\n // Render a panel without a description set\n const withoutDescription = createTestPanel();\n withoutDescription.spec.display.description = undefined;\n renderPanel(withoutDescription);\n\n const panel = getPanel();\n userEvent.hover(panel);\n const descriptionButton = screen.queryByRole('button', { name: /description/i });\n expect(descriptionButton).not.toBeInTheDocument();\n });\n\n it('does not show description in edit mode', () => {\n renderPanel(undefined, { onEditPanelClick: jest.fn(), onDeletePanelClick: jest.fn() });\n\n const panel = getPanel();\n userEvent.hover(panel);\n const descriptionButton = screen.queryByRole('button', { name: /description/i });\n expect(descriptionButton).not.toBeInTheDocument();\n });\n\n it('can trigger panel actions in edit mode', () => {\n const onEditPanelClick = jest.fn();\n const onDeletePanelClick = jest.fn();\n renderPanel(undefined, { onEditPanelClick, onDeletePanelClick });\n\n const panel = getPanel();\n userEvent.hover(panel);\n\n const editButton = screen.getByRole('button', { name: /edit/i });\n userEvent.click(editButton);\n\n const deleteButton = screen.getByRole('button', { name: /delete/i });\n userEvent.click(deleteButton);\n\n expect(onEditPanelClick).toHaveBeenCalledTimes(1);\n expect(onDeletePanelClick).toHaveBeenCalledTimes(1);\n });\n});\n"],"names":["screen","waitFor","userEvent","renderWithContext","Panel","describe","createTestPanel","kind","spec","display","name","description","plugin","renderPanel","definition","editHandlers","getPanel","getByRole","it","panel","expect","toBeInTheDocument","header","toHaveTextContent","content","missingButton","queryByRole","not","hover","descriptionButton","tooltip","findByRole","withoutDescription","undefined","onEditPanelClick","jest","fn","onDeletePanelClick","editButton","click","deleteButton","toHaveBeenCalledTimes"],"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,MAAM,EAAEC,OAAO,QAAQ,wBAAwB,CAAC;AACzD,OAAOC,SAAS,MAAM,6BAA6B,CAAC;AAEpD,SAASC,iBAAiB,QAAQ,YAAY,CAAC;AAC/C,SAASC,KAAK,QAAoB,SAAS,CAAC;AAE5CC,QAAQ,CAAC,OAAO,EAAE,IAAM;IACtB,MAAMC,eAAe,GAAG,IAAwB,CAAA;YAC9CC,IAAI,EAAE,OAAO;YACbC,IAAI,EAAE;gBACJC,OAAO,EAAE;oBACPC,IAAI,EAAE,kBAAkB;oBACxBC,WAAW,EAAE,sBAAsB;iBACpC;gBACDC,MAAM,EAAE;oBACNL,IAAI,EAAE,iBAAiB;oBACvBC,IAAI,EAAE,EAAE;iBACT;aACF;SACF,CAAA,AAAC,AAAC;IAEH,mDAAmD;IACnD,MAAMK,WAAW,GAAG,CAACC,UAA4B,EAAEC,YAAyC,GAAK;QAC/FD,UAAU,aAAVA,UAAU,cAAVA,UAAU,GAAVA,UAAU,GAAKR,eAAe,EAAE,CAAC;QAEjCH,iBAAiB,eAAC,KAACC,KAAK;YAACU,UAAU,EAAEA,UAAU;YAAEC,YAAY,EAAEA,Y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B;SAAE,CAAC,AAAC;QACjFU,MAAM,CAACS,iBAAiB,CAAC,CAACF,GAAG,CAACN,iBAAiB,EAAE,CAAC;IACpD,CAAC,CAAC,CAAC;IAEHH,EAAE,CAAC,wCAAwC,EAAE,IAAM;QACjD,MAAMgB,gBAAgB,GAAGC,IAAI,CAACC,EAAE,EAAE,AAAC;QACnC,MAAMC,kBAAkB,GAAGF,IAAI,CAACC,EAAE,EAAE,AAAC;QACrCvB,WAAW,CAACoB,SAAS,EAAE;YAAEC,gBAAgB;YAAEG,kBAAkB;SAAE,CAAC,CAAC;QAEjE,MAAMlB,KAAK,GAAGH,QAAQ,EAAE,AAAC;QACzBd,SAAS,CAAC0B,KAAK,CAACT,KAAK,CAAC,CAAC;QAEvB,MAAMmB,UAAU,GAAGtC,MAAM,CAACiB,SAAS,CAAC,QAAQ,EAAE;YAAEP,IAAI,SAAS;SAAE,CAAC,AAAC;QACjER,SAAS,CAACqC,KAAK,CAACD,UAAU,CAAC,CAAC;QAE5B,MAAME,YAAY,GAAGxC,MAAM,CAACiB,SAAS,CAAC,QAAQ,EAAE;YAAEP,IAAI,WAAW;SAAE,CAAC,AAAC;QACrER,SAAS,CAACqC,KAAK,CAACC,YAAY,CAAC,CAAC;QAE9BpB,MAAM,CAACc,gBAAgB,CAAC,CAACO,qBAAqB,CAAC,CAAC,CAAC,CAAC;QAClDrB,MAAM,CAACiB,kBAAkB,CAAC,CAACI,qBAAqB,CAAC,CAAC,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Panel/PanelContent.tsx"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Panel/PanelContent.tsx"],"sourcesContent":["// Copyright 2023 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;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,SAAS,QAAoB,2BAA2B,CAAC;AAClE,SAASC,QAAQ,QAAQ,eAAe,CAAC;AAOzC;;;CAGC,GACD,OAAO,SAASC,YAAY,CAACC,KAAwB,EAAE;IACrD,MAAM,EAAEC,eAAe,CAAA,EAAEC,iBAAiB,CAAA,EAAE,GAAGC,MAAM,EAAE,GAAGH,KAAK,AAAC;IAChE,MAAM,EAAEI,IAAI,EAAEC,MAAM,CAAA,EAAEC,SAAS,CAAA,EAAE,GAAGT,SAAS,CAAC,OAAO,EAAEI,eAAe,EAAE;QAAEM,gBAAgB,EAAE,IAAI;KAAE,CAAC,AAAC;IACpG,MAAMC,cAAc,GAAGH,MAAM,aAANA,MAAM,WAAgB,GAAtBA,KAAAA,CAAsB,GAAtBA,MAAM,CAAEG,cAAc,AAAC;IAE9C,IAAIF,SAAS,EAAE;QACb,qBAAO,KAACR,QAAQ;YAACW,OAAO,EAAC,aAAa;YAACC,KAAK,EAAER,iBAAiB,aAAjBA,iBAAiB,WAAO,GAAxBA,KAAAA,CAAwB,GAAxBA,iBAAiB,CAAEQ,KAAK;YAAEC,MAAM,EAAET,iBAAiB,aAAjBA,iBAAiB,WAAQ,GAAzBA,KAAAA,CAAyB,GAAzBA,iBAAiB,CAAES,MAAM;UAAI,CAAC;IAChH,CAAC;IAED,IAAIH,cAAc,KAAKI,SAAS,EAAE;QAChC,MAAM,IAAIC,KAAK,CAAC,CAAC,mDAAmD,EAAEZ,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5F,CAAC;IAED,qBAAO,KAACO,cAAc;QAAE,GAAGL,MAAM;QAAED,iBAAiB,EAAEA,iBAAiB;MAAI,CAAC;AAC9E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PanelHeader.d.ts","sourceRoot":"","sources":["../../../src/components/Panel/PanelHeader.tsx"],"names":[],"mappings":";AAaA,OAAO,EAA6C,eAAe,EAAU,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"PanelHeader.d.ts","sourceRoot":"","sources":["../../../src/components/Panel/PanelHeader.tsx"],"names":[],"mappings":";AAaA,OAAO,EAA6C,eAAe,EAAU,MAAM,eAAe,CAAC;AAQnG,aAAK,YAAY,GAAG,UAAU,GAAG,QAAQ,GAAG,OAAO,GAAG,mBAAmB,CAAC;AAE1E,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,eAAe,EAAE,YAAY,CAAC;IAC3E,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE;QACb,gBAAgB,EAAE,MAAM,IAAI,CAAC;QAC7B,kBAAkB,EAAE,MAAM,IAAI,CAAC;KAChC,CAAC;IACF,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,WAAW,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,EAAE,gBAAgB,eAmG7G"}
|