@perses-dev/dashboards 0.23.1 → 0.25.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/AddPanelButton/AddPanelButton.js +9 -2
- package/dist/cjs/components/Dashboard/Dashboard.js +23 -6
- package/dist/cjs/components/DashboardToolbar/DashboardToolbar.js +8 -17
- package/dist/cjs/components/EditButton/EditButton.js +41 -0
- package/dist/cjs/components/EditButton/index.js +28 -0
- package/dist/cjs/components/EditJsonButton/EditJsonButton.js +42 -0
- package/dist/cjs/components/EditJsonButton/index.js +28 -0
- package/dist/cjs/components/EditJsonDialog/EditJsonDialog.js +86 -0
- package/dist/cjs/components/EditJsonDialog/index.js +28 -0
- package/dist/cjs/components/EmptyDashboard/EmptyDashboard.js +127 -0
- package/dist/cjs/components/EmptyDashboard/index.js +28 -0
- package/dist/cjs/components/QuerySummaryTable/QuerySummaryTable.js +185 -0
- package/dist/cjs/components/QuerySummaryTable/index.js +28 -0
- package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +7 -3
- package/dist/cjs/components/ToolbarIconButton/ToolbarIconButton.js +6 -3
- package/dist/cjs/components/Variables/EditVariablesButton.js +9 -2
- package/dist/cjs/components/index.js +4 -0
- package/dist/cjs/constants/user-interface-text.js +1 -0
- package/dist/cjs/context/DashboardProvider/DashboardProvider.js +12 -6
- package/dist/cjs/context/DashboardProvider/dashboard-provider-api.js +10 -1
- package/dist/cjs/context/DashboardProvider/edit-json-dialog-slice.js +36 -0
- package/dist/cjs/context/DatasourceStoreProvider.js +9 -3
- package/dist/cjs/stories/decorators/WithDashboard.js +60 -0
- package/dist/cjs/stories/decorators/WithPluginRegistry.js +91 -0
- package/dist/cjs/stories/decorators/WithQueryClient.js +29 -0
- package/dist/cjs/stories/decorators/WithQueryParams.js +29 -0
- package/dist/cjs/stories/decorators/WithTemplateVariables.js +27 -0
- package/dist/cjs/stories/decorators/index.js +32 -0
- package/dist/cjs/views/ViewDashboard/DashboardApp.js +11 -4
- package/dist/cjs/views/ViewDashboard/ViewDashboard.js +2 -1
- package/dist/components/AddPanelButton/AddPanelButton.d.ts +16 -1
- package/dist/components/AddPanelButton/AddPanelButton.d.ts.map +1 -1
- package/dist/components/AddPanelButton/AddPanelButton.js +9 -2
- package/dist/components/AddPanelButton/AddPanelButton.js.map +1 -1
- package/dist/components/Dashboard/Dashboard.d.ts +10 -2
- package/dist/components/Dashboard/Dashboard.d.ts.map +1 -1
- package/dist/components/Dashboard/Dashboard.js +24 -7
- package/dist/components/Dashboard/Dashboard.js.map +1 -1
- package/dist/components/DashboardToolbar/DashboardToolbar.d.ts.map +1 -1
- package/dist/components/DashboardToolbar/DashboardToolbar.js +8 -12
- package/dist/components/DashboardToolbar/DashboardToolbar.js.map +1 -1
- package/dist/components/EditButton/EditButton.d.ts +13 -0
- package/dist/components/EditButton/EditButton.d.ts.map +1 -0
- package/dist/components/EditButton/EditButton.js +30 -0
- package/dist/components/EditButton/EditButton.js.map +1 -0
- package/dist/components/EditButton/index.d.ts +2 -0
- package/dist/components/EditButton/index.d.ts.map +1 -0
- package/dist/components/EditButton/index.js +15 -0
- package/dist/components/EditButton/index.js.map +1 -0
- package/dist/components/EditJsonButton/EditJsonButton.d.ts +3 -0
- package/dist/components/EditJsonButton/EditJsonButton.d.ts.map +1 -0
- package/dist/components/EditJsonButton/EditJsonButton.js +31 -0
- package/dist/components/EditJsonButton/EditJsonButton.js.map +1 -0
- package/dist/components/EditJsonButton/index.d.ts +2 -0
- package/dist/components/EditJsonButton/index.d.ts.map +1 -0
- package/dist/components/EditJsonButton/index.js +15 -0
- package/dist/components/EditJsonButton/index.js.map +1 -0
- package/dist/components/EditJsonDialog/EditJsonDialog.d.ts +3 -0
- package/dist/components/EditJsonDialog/EditJsonDialog.d.ts.map +1 -0
- package/dist/components/EditJsonDialog/EditJsonDialog.js +80 -0
- package/dist/components/EditJsonDialog/EditJsonDialog.js.map +1 -0
- package/dist/components/EditJsonDialog/index.d.ts +2 -0
- package/dist/components/EditJsonDialog/index.d.ts.map +1 -0
- package/dist/components/EditJsonDialog/index.js +15 -0
- package/dist/components/EditJsonDialog/index.js.map +1 -0
- package/dist/components/EmptyDashboard/EmptyDashboard.d.ts +33 -0
- package/dist/components/EmptyDashboard/EmptyDashboard.d.ts.map +1 -0
- package/dist/components/EmptyDashboard/EmptyDashboard.js +123 -0
- package/dist/components/EmptyDashboard/EmptyDashboard.js.map +1 -0
- package/dist/components/EmptyDashboard/index.d.ts +2 -0
- package/dist/components/EmptyDashboard/index.d.ts.map +1 -0
- package/dist/components/EmptyDashboard/index.js +15 -0
- package/dist/components/EmptyDashboard/index.js.map +1 -0
- package/dist/components/QuerySummaryTable/QuerySummaryTable.d.ts +11 -0
- package/dist/components/QuerySummaryTable/QuerySummaryTable.d.ts.map +1 -0
- package/dist/components/QuerySummaryTable/QuerySummaryTable.js +179 -0
- package/dist/components/QuerySummaryTable/QuerySummaryTable.js.map +1 -0
- package/dist/components/QuerySummaryTable/index.d.ts +2 -0
- package/dist/components/QuerySummaryTable/index.d.ts.map +1 -0
- package/dist/components/QuerySummaryTable/index.js +15 -0
- package/dist/components/QuerySummaryTable/index.js.map +1 -0
- package/dist/components/TimeRangeControls/TimeRangeControls.d.ts +2 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.js +8 -4
- package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
- package/dist/components/ToolbarIconButton/ToolbarIconButton.d.ts +1 -1
- package/dist/components/ToolbarIconButton/ToolbarIconButton.d.ts.map +1 -1
- package/dist/components/ToolbarIconButton/ToolbarIconButton.js +6 -3
- package/dist/components/ToolbarIconButton/ToolbarIconButton.js.map +1 -1
- package/dist/components/Variables/EditVariablesButton.d.ts +16 -1
- package/dist/components/Variables/EditVariablesButton.d.ts.map +1 -1
- package/dist/components/Variables/EditVariablesButton.js +9 -2
- package/dist/components/Variables/EditVariablesButton.js.map +1 -1
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +4 -0
- package/dist/components/index.js.map +1 -1
- package/dist/constants/user-interface-text.d.ts +1 -0
- package/dist/constants/user-interface-text.d.ts.map +1 -1
- package/dist/constants/user-interface-text.js +1 -0
- package/dist/constants/user-interface-text.js.map +1 -1
- package/dist/context/DashboardProvider/DashboardProvider.d.ts +2 -1
- package/dist/context/DashboardProvider/DashboardProvider.d.ts.map +1 -1
- package/dist/context/DashboardProvider/DashboardProvider.js +12 -6
- package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -1
- package/dist/context/DashboardProvider/dashboard-provider-api.d.ts +8 -0
- package/dist/context/DashboardProvider/dashboard-provider-api.d.ts.map +1 -1
- package/dist/context/DashboardProvider/dashboard-provider-api.js +10 -0
- package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -1
- package/dist/context/DashboardProvider/edit-json-dialog-slice.d.ts +12 -0
- package/dist/context/DashboardProvider/edit-json-dialog-slice.d.ts.map +1 -0
- package/dist/context/DashboardProvider/edit-json-dialog-slice.js +30 -0
- package/dist/context/DashboardProvider/edit-json-dialog-slice.js.map +1 -0
- package/dist/context/DatasourceStoreProvider.d.ts +2 -0
- package/dist/context/DatasourceStoreProvider.d.ts.map +1 -1
- package/dist/context/DatasourceStoreProvider.js +9 -3
- package/dist/context/DatasourceStoreProvider.js.map +1 -1
- package/dist/stories/decorators/WithDashboard.js +48 -0
- package/dist/stories/decorators/WithDashboard.js.map +1 -0
- package/dist/stories/decorators/WithPluginRegistry.js +46 -0
- package/dist/stories/decorators/WithPluginRegistry.js.map +1 -0
- package/dist/stories/decorators/WithQueryClient.js +23 -0
- package/dist/stories/decorators/WithQueryClient.js.map +1 -0
- package/dist/stories/decorators/WithQueryParams.js +23 -0
- package/dist/stories/decorators/WithQueryParams.js.map +1 -0
- package/dist/stories/decorators/WithTemplateVariables.js +21 -0
- package/dist/stories/decorators/WithTemplateVariables.js.map +1 -0
- package/dist/stories/decorators/index.js +19 -0
- package/dist/stories/decorators/index.js.map +1 -0
- package/dist/views/ViewDashboard/DashboardApp.d.ts +2 -0
- package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -1
- package/dist/views/ViewDashboard/DashboardApp.js +12 -5
- package/dist/views/ViewDashboard/DashboardApp.js.map +1 -1
- package/dist/views/ViewDashboard/ViewDashboard.d.ts +2 -8
- package/dist/views/ViewDashboard/ViewDashboard.d.ts.map +1 -1
- package/dist/views/ViewDashboard/ViewDashboard.js +2 -1
- package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -1
- package/package.json +6 -5
- package/dist/cjs/components/Panel/Panel.test.js +0 -137
- package/dist/cjs/components/PanelDrawer/PanelDrawer.test.js +0 -131
- package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.test.js +0 -87
- package/dist/cjs/components/TimeRangeControls/TimeRangeControls.test.js +0 -95
- package/dist/cjs/components/Variables/variable-model.test.js +0 -106
- package/dist/cjs/context/TemplateVariableProvider/query-params.test.js +0 -82
- package/dist/cjs/utils/panelUtils.test.js +0 -195
- package/dist/cjs/views/ViewDashboard/tests/panelGroups.test.js +0 -110
- package/dist/components/Panel/Panel.test.d.ts +0 -2
- package/dist/components/Panel/Panel.test.d.ts.map +0 -1
- package/dist/components/Panel/Panel.test.js +0 -130
- package/dist/components/Panel/Panel.test.js.map +0 -1
- package/dist/components/PanelDrawer/PanelDrawer.test.d.ts +0 -2
- package/dist/components/PanelDrawer/PanelDrawer.test.d.ts.map +0 -1
- package/dist/components/PanelDrawer/PanelDrawer.test.js +0 -124
- package/dist/components/PanelDrawer/PanelDrawer.test.js.map +0 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.test.d.ts +0 -2
- package/dist/components/PanelGroupDialog/PanelGroupDialog.test.d.ts.map +0 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.test.js +0 -80
- package/dist/components/PanelGroupDialog/PanelGroupDialog.test.js.map +0 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.test.d.ts +0 -2
- package/dist/components/TimeRangeControls/TimeRangeControls.test.d.ts.map +0 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.test.js +0 -88
- package/dist/components/TimeRangeControls/TimeRangeControls.test.js.map +0 -1
- package/dist/components/Variables/variable-model.test.d.ts +0 -2
- package/dist/components/Variables/variable-model.test.d.ts.map +0 -1
- package/dist/components/Variables/variable-model.test.js +0 -104
- package/dist/components/Variables/variable-model.test.js.map +0 -1
- package/dist/context/TemplateVariableProvider/query-params.test.d.ts +0 -2
- package/dist/context/TemplateVariableProvider/query-params.test.d.ts.map +0 -1
- package/dist/context/TemplateVariableProvider/query-params.test.js +0 -80
- package/dist/context/TemplateVariableProvider/query-params.test.js.map +0 -1
- package/dist/utils/panelUtils.test.d.ts +0 -2
- package/dist/utils/panelUtils.test.d.ts.map +0 -1
- package/dist/utils/panelUtils.test.js +0 -193
- package/dist/utils/panelUtils.test.js.map +0 -1
- package/dist/views/ViewDashboard/tests/panelGroups.test.d.ts +0 -2
- package/dist/views/ViewDashboard/tests/panelGroups.test.d.ts.map +0 -1
- package/dist/views/ViewDashboard/tests/panelGroups.test.js +0 -103
- package/dist/views/ViewDashboard/tests/panelGroups.test.js.map +0 -1
|
@@ -10,8 +10,9 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
14
|
import RefreshIcon from 'mdi-material-ui/Refresh';
|
|
15
|
+
import { Stack } from '@mui/material';
|
|
15
16
|
import { DateTimeRangePicker, InfoTooltip } from '@perses-dev/components';
|
|
16
17
|
import { useTimeRange } from '@perses-dev/plugin-system';
|
|
17
18
|
import { isDurationString } from '@perses-dev/core';
|
|
@@ -75,8 +76,9 @@ export const TIME_OPTIONS = [
|
|
|
75
76
|
}
|
|
76
77
|
];
|
|
77
78
|
const DEFAULT_HEIGHT = '34px';
|
|
78
|
-
export function TimeRangeControls({ heightPx }) {
|
|
79
|
+
export function TimeRangeControls({ heightPx , showRefresh =true }) {
|
|
79
80
|
const { timeRange , setTimeRange , refresh } = useTimeRange();
|
|
81
|
+
// TODO: Remove this since it couples to the dashboard context
|
|
80
82
|
const defaultTimeRange = useDefaultTimeRange();
|
|
81
83
|
// Convert height to a string, then use the string for styling
|
|
82
84
|
const height = heightPx === undefined ? DEFAULT_HEIGHT : `${heightPx}px`;
|
|
@@ -91,7 +93,9 @@ export function TimeRangeControls({ heightPx }) {
|
|
|
91
93
|
});
|
|
92
94
|
}
|
|
93
95
|
}
|
|
94
|
-
return /*#__PURE__*/ _jsxs(
|
|
96
|
+
return /*#__PURE__*/ _jsxs(Stack, {
|
|
97
|
+
direction: "row",
|
|
98
|
+
spacing: 1,
|
|
95
99
|
children: [
|
|
96
100
|
/*#__PURE__*/ _jsx(DateTimeRangePicker, {
|
|
97
101
|
timeOptions: TIME_OPTIONS,
|
|
@@ -99,7 +103,7 @@ export function TimeRangeControls({ heightPx }) {
|
|
|
99
103
|
onChange: setTimeRange,
|
|
100
104
|
height: height
|
|
101
105
|
}),
|
|
102
|
-
/*#__PURE__*/ _jsx(InfoTooltip, {
|
|
106
|
+
showRefresh && /*#__PURE__*/ _jsx(InfoTooltip, {
|
|
103
107
|
description: TOOLTIP_TEXT.refreshDashboard,
|
|
104
108
|
children: /*#__PURE__*/ _jsx(ToolbarIconButton, {
|
|
105
109
|
"aria-label": TOOLTIP_TEXT.refreshDashboard,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/TimeRangeControls/TimeRangeControls.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 RefreshIcon from 'mdi-material-ui/Refresh';\nimport { DateTimeRangePicker, InfoTooltip, TimeOption } from '@perses-dev/components';\nimport { useTimeRange } from '@perses-dev/plugin-system';\nimport { isDurationString } from '@perses-dev/core';\nimport { TOOLTIP_TEXT } from '../../constants';\nimport { useDefaultTimeRange } from '../../context';\nimport { ToolbarIconButton } from '../ToolbarIconButton';\n\nexport const TIME_OPTIONS: TimeOption[] = [\n { value: { pastDuration: '5m' }, display: 'Last 5 minutes' },\n { value: { pastDuration: '15m' }, display: 'Last 15 minutes' },\n { value: { pastDuration: '30m' }, display: 'Last 30 minutes' },\n { value: { pastDuration: '1h' }, display: 'Last 1 hour' },\n { value: { pastDuration: '6h' }, display: 'Last 6 hours' },\n { value: { pastDuration: '12h' }, display: 'Last 12 hours' },\n { value: { pastDuration: '24h' }, display: 'Last 1 day' },\n { value: { pastDuration: '7d' }, display: 'Last 7 days' },\n { value: { pastDuration: '14d' }, display: 'Last 14 days' },\n];\n\nconst DEFAULT_HEIGHT = '34px';\n\ninterface TimeRangeControlsProps {\n // The controls look best at heights >= 28 pixels\n heightPx?: number;\n}\n\nexport function TimeRangeControls({ heightPx }: TimeRangeControlsProps) {\n const { timeRange, setTimeRange, refresh } = useTimeRange();\n const defaultTimeRange = useDefaultTimeRange();\n\n // Convert height to a string, then use the string for styling\n const height = heightPx === undefined ? DEFAULT_HEIGHT : `${heightPx}px`;\n\n // add time shortcut if one does not match duration from dashboard JSON\n if (!TIME_OPTIONS.some((option) => option.value.pastDuration === defaultTimeRange.pastDuration)) {\n if (isDurationString(defaultTimeRange.pastDuration)) {\n TIME_OPTIONS.push({\n value: { pastDuration: defaultTimeRange.pastDuration },\n display: `Last ${defaultTimeRange.pastDuration}`,\n });\n }\n }\n\n return (\n
|
|
1
|
+
{"version":3,"sources":["../../../src/components/TimeRangeControls/TimeRangeControls.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 RefreshIcon from 'mdi-material-ui/Refresh';\nimport { Stack } from '@mui/material';\nimport { DateTimeRangePicker, InfoTooltip, TimeOption } from '@perses-dev/components';\nimport { useTimeRange } from '@perses-dev/plugin-system';\nimport { isDurationString } from '@perses-dev/core';\nimport { TOOLTIP_TEXT } from '../../constants';\nimport { useDefaultTimeRange } from '../../context';\nimport { ToolbarIconButton } from '../ToolbarIconButton';\n\nexport const TIME_OPTIONS: TimeOption[] = [\n { value: { pastDuration: '5m' }, display: 'Last 5 minutes' },\n { value: { pastDuration: '15m' }, display: 'Last 15 minutes' },\n { value: { pastDuration: '30m' }, display: 'Last 30 minutes' },\n { value: { pastDuration: '1h' }, display: 'Last 1 hour' },\n { value: { pastDuration: '6h' }, display: 'Last 6 hours' },\n { value: { pastDuration: '12h' }, display: 'Last 12 hours' },\n { value: { pastDuration: '24h' }, display: 'Last 1 day' },\n { value: { pastDuration: '7d' }, display: 'Last 7 days' },\n { value: { pastDuration: '14d' }, display: 'Last 14 days' },\n];\n\nconst DEFAULT_HEIGHT = '34px';\n\ninterface TimeRangeControlsProps {\n // The controls look best at heights >= 28 pixels\n heightPx?: number;\n\n // Whether to show the refresh button or not\n showRefresh?: boolean;\n}\n\nexport function TimeRangeControls({ heightPx, showRefresh = true }: TimeRangeControlsProps) {\n const { timeRange, setTimeRange, refresh } = useTimeRange();\n // TODO: Remove this since it couples to the dashboard context\n const defaultTimeRange = useDefaultTimeRange();\n\n // Convert height to a string, then use the string for styling\n const height = heightPx === undefined ? DEFAULT_HEIGHT : `${heightPx}px`;\n\n // add time shortcut if one does not match duration from dashboard JSON\n if (!TIME_OPTIONS.some((option) => option.value.pastDuration === defaultTimeRange.pastDuration)) {\n if (isDurationString(defaultTimeRange.pastDuration)) {\n TIME_OPTIONS.push({\n value: { pastDuration: defaultTimeRange.pastDuration },\n display: `Last ${defaultTimeRange.pastDuration}`,\n });\n }\n }\n\n return (\n <Stack direction=\"row\" spacing={1}>\n <DateTimeRangePicker timeOptions={TIME_OPTIONS} value={timeRange} onChange={setTimeRange} height={height} />\n {showRefresh && (\n <InfoTooltip description={TOOLTIP_TEXT.refreshDashboard}>\n <ToolbarIconButton aria-label={TOOLTIP_TEXT.refreshDashboard} onClick={refresh} sx={{ height }}>\n <RefreshIcon />\n </ToolbarIconButton>\n </InfoTooltip>\n )}\n </Stack>\n );\n}\n"],"names":["RefreshIcon","Stack","DateTimeRangePicker","InfoTooltip","useTimeRange","isDurationString","TOOLTIP_TEXT","useDefaultTimeRange","ToolbarIconButton","TIME_OPTIONS","value","pastDuration","display","DEFAULT_HEIGHT","TimeRangeControls","heightPx","showRefresh","timeRange","setTimeRange","refresh","defaultTimeRange","height","undefined","some","option","push","direction","spacing","timeOptions","onChange","description","refreshDashboard","aria-label","onClick","sx"],"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,OAAOA,WAAW,MAAM,yBAAyB,CAAC;AAClD,SAASC,KAAK,QAAQ,eAAe,CAAC;AACtC,SAASC,mBAAmB,EAAEC,WAAW,QAAoB,wBAAwB,CAAC;AACtF,SAASC,YAAY,QAAQ,2BAA2B,CAAC;AACzD,SAASC,gBAAgB,QAA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barIconButtonProps = ButtonProps;
|
|
4
|
-
export declare
|
|
4
|
+
export declare const ToolbarIconButton: import("react").ForwardRefExoticComponent<Pick<ToolbarIconButtonProps, "onChange" | "placeholder" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "slot" | "spellCheck" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "value" | "autoFocus" | "form" | "size" | "name" | keyof import("@mui/material/OverridableComponent").CommonProps | "action" | "centerRipple" | "disabled" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "sx" | "TouchRippleProps" | "touchRippleRef" | "key" | "href" | "type" | "disableElevation" | "disableFocusRipple" | "endIcon" | "fullWidth" | "startIcon" | "variant" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
5
5
|
export {};
|
|
6
6
|
//# sourceMappingURL=ToolbarIconButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolbarIconButton.d.ts","sourceRoot":"","sources":["../../../src/components/ToolbarIconButton/ToolbarIconButton.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"ToolbarIconButton.d.ts","sourceRoot":"","sources":["../../../src/components/ToolbarIconButton/ToolbarIconButton.tsx"],"names":[],"mappings":";AAcA,OAAO,EAAkB,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5D,aAAK,sBAAsB,GAAG,WAAW,CAAC;AAa1C,eAAO,MAAM,iBAAiB,gmKAAyB,CAAC"}
|
|
@@ -11,19 +11,22 @@
|
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import { forwardRef } from 'react';
|
|
14
15
|
import { Button, styled } from '@mui/material';
|
|
15
|
-
|
|
16
|
-
return /*#__PURE__*/ _jsx(
|
|
16
|
+
function IconButton(props, ref) {
|
|
17
|
+
return /*#__PURE__*/ _jsx(StyledIconButton, {
|
|
18
|
+
ref: ref,
|
|
17
19
|
variant: "outlined",
|
|
18
20
|
color: "secondary",
|
|
19
21
|
...props
|
|
20
22
|
});
|
|
21
23
|
}
|
|
22
|
-
const
|
|
24
|
+
const StyledIconButton = styled(Button)(({ theme })=>({
|
|
23
25
|
// Using a button with some adjusted styles because it is easier to inherit
|
|
24
26
|
// styling and variants from themes than with an IconButton.
|
|
25
27
|
padding: theme.spacing(0.5),
|
|
26
28
|
minWidth: 'auto'
|
|
27
29
|
}));
|
|
30
|
+
export const ToolbarIconButton = /*#__PURE__*/ forwardRef(IconButton);
|
|
28
31
|
|
|
29
32
|
//# sourceMappingURL=ToolbarIconButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/ToolbarIconButton/ToolbarIconButton.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 { Button, styled, ButtonProps } from '@mui/material';\n\ntype ToolbarIconButtonProps = ButtonProps;\n\
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ToolbarIconButton/ToolbarIconButton.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 { ForwardedRef, forwardRef } from 'react';\nimport { Button, styled, ButtonProps } from '@mui/material';\n\ntype ToolbarIconButtonProps = ButtonProps;\n\nfunction IconButton(props: ToolbarIconButtonProps, ref: ForwardedRef<HTMLButtonElement>) {\n return <StyledIconButton ref={ref} variant=\"outlined\" color=\"secondary\" {...props} />;\n}\n\nconst StyledIconButton = styled(Button)(({ theme }) => ({\n // Using a button with some adjusted styles because it is easier to inherit\n // styling and variants from themes than with an IconButton.\n padding: theme.spacing(0.5),\n minWidth: 'auto',\n}));\n\nexport const ToolbarIconButton = forwardRef(IconButton);\n"],"names":["forwardRef","Button","styled","IconButton","props","ref","StyledIconButton","variant","color","theme","padding","spacing","minWidth","ToolbarIconButton"],"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,SAAuBA,UAAU,QAAQ,OAAO,CAAC;AACjD,SAASC,MAAM,EAAEC,MAAM,QAAqB,eAAe,CAAC;AAI5D,SAASC,UAAU,CAACC,KAA6B,EAAEC,GAAoC,EAAE;IACvF,qBAAO,KAACC,gBAAgB;QAACD,GAAG,EAAEA,GAAG;QAAEE,OAAO,EAAC,UAAU;QAACC,KAAK,EAAC,WAAW;QAAE,GAAGJ,KAAK;MAAI,CAAC;AACxF,CAAC;AAED,MAAME,gBAAgB,GAAGJ,MAAM,CAACD,MAAM,CAAC,CAAC,CAAC,EAAEQ,KAAK,CAAA,EAAE,GAAM,CAAA;QACtD,2EAA2E;QAC3E,4DAA4D;QAC5DC,OAAO,EAAED,KAAK,CAACE,OAAO,CAAC,GAAG,CAAC;QAC3BC,QAAQ,EAAE,MAAM;KACjB,CAAA,AAAC,CAAC,AAAC;AAEJ,OAAO,MAAMC,iBAAiB,iBAAGb,UAAU,CAACG,UAAU,CAAC,CAAC"}
|
|
@@ -1,3 +1,18 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
2
|
+
import { ButtonProps } from '@mui/material';
|
|
3
|
+
export interface EditVariablesButtonProps extends Pick<ButtonProps, 'fullWidth'> {
|
|
4
|
+
/**
|
|
5
|
+
* The variant to use to display the button.
|
|
6
|
+
*/
|
|
7
|
+
variant?: 'text' | 'outlined';
|
|
8
|
+
/**
|
|
9
|
+
* The color to use to display the button.
|
|
10
|
+
*/
|
|
11
|
+
color?: 'primary' | 'secondary';
|
|
12
|
+
/**
|
|
13
|
+
* The label used inside the button.
|
|
14
|
+
*/
|
|
15
|
+
label?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function EditVariablesButton({ variant, label, color, fullWidth, }: EditVariablesButtonProps): JSX.Element;
|
|
3
18
|
//# sourceMappingURL=EditVariablesButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditVariablesButton.d.ts","sourceRoot":"","sources":["../../../src/components/Variables/EditVariablesButton.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"EditVariablesButton.d.ts","sourceRoot":"","sources":["../../../src/components/Variables/EditVariablesButton.tsx"],"names":[],"mappings":";AAcA,OAAO,EAAU,WAAW,EAAE,MAAM,eAAe,CAAC;AASpD,MAAM,WAAW,wBAAyB,SAAQ,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC;IAC9E;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IAE9B;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC;IAEhC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,mBAAmB,CAAC,EAClC,OAAgB,EAChB,KAAmB,EACnB,KAAiB,EACjB,SAAS,GACV,EAAE,wBAAwB,eA6C1B"}
|
|
@@ -18,7 +18,7 @@ import { Drawer, InfoTooltip } from '@perses-dev/components';
|
|
|
18
18
|
import { TOOLTIP_TEXT } from '../../constants';
|
|
19
19
|
import { useTemplateVariableDefinitions, useTemplateVariableActions } from '../../context';
|
|
20
20
|
import { VariableEditor } from './VariableEditor';
|
|
21
|
-
export function EditVariablesButton() {
|
|
21
|
+
export function EditVariablesButton({ variant ='text' , label ='Variables' , color ='primary' , fullWidth }) {
|
|
22
22
|
const [isVariableEditorOpen, setIsVariableEditorOpen] = useState(false);
|
|
23
23
|
const variableDefinitions = useTemplateVariableDefinitions();
|
|
24
24
|
const { setVariableDefinitions } = useTemplateVariableActions();
|
|
@@ -36,7 +36,14 @@ export function EditVariablesButton() {
|
|
|
36
36
|
startIcon: /*#__PURE__*/ _jsx(PencilIcon, {}),
|
|
37
37
|
onClick: openVariableEditor,
|
|
38
38
|
"aria-label": TOOLTIP_TEXT.editVariables,
|
|
39
|
-
|
|
39
|
+
variant: variant,
|
|
40
|
+
color: color,
|
|
41
|
+
fullWidth: fullWidth,
|
|
42
|
+
sx: {
|
|
43
|
+
whiteSpace: 'nowrap',
|
|
44
|
+
minWidth: 'auto'
|
|
45
|
+
},
|
|
46
|
+
children: label
|
|
40
47
|
})
|
|
41
48
|
}),
|
|
42
49
|
/*#__PURE__*/ _jsx(Drawer, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Variables/EditVariablesButton.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 } from 'react';\nimport { Button } from '@mui/material';\nimport PencilIcon from 'mdi-material-ui/PencilOutline';\nimport { Drawer, InfoTooltip } from '@perses-dev/components';\nimport { VariableDefinition } from '@perses-dev/core';\n\nimport { TOOLTIP_TEXT } from '../../constants';\nimport { useTemplateVariableDefinitions, useTemplateVariableActions } from '../../context';\nimport { VariableEditor } from './VariableEditor';\n\nexport function EditVariablesButton() {\n const [isVariableEditorOpen, setIsVariableEditorOpen] = useState(false);\n const variableDefinitions: VariableDefinition[] = useTemplateVariableDefinitions();\n const { setVariableDefinitions } = useTemplateVariableActions();\n\n const openVariableEditor = () => {\n setIsVariableEditorOpen(true);\n };\n\n const closeVariableEditor = () => {\n setIsVariableEditorOpen(false);\n };\n\n return (\n <>\n <InfoTooltip description={TOOLTIP_TEXT.editVariables}>\n <Button
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Variables/EditVariablesButton.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 } from 'react';\nimport { Button, ButtonProps } from '@mui/material';\nimport PencilIcon from 'mdi-material-ui/PencilOutline';\nimport { Drawer, InfoTooltip } from '@perses-dev/components';\nimport { VariableDefinition } from '@perses-dev/core';\n\nimport { TOOLTIP_TEXT } from '../../constants';\nimport { useTemplateVariableDefinitions, useTemplateVariableActions } from '../../context';\nimport { VariableEditor } from './VariableEditor';\n\nexport interface EditVariablesButtonProps extends Pick<ButtonProps, 'fullWidth'> {\n /**\n * The variant to use to display the button.\n */\n variant?: 'text' | 'outlined';\n\n /**\n * The color to use to display the button.\n */\n color?: 'primary' | 'secondary';\n\n /**\n * The label used inside the button.\n */\n label?: string;\n}\n\nexport function EditVariablesButton({\n variant = 'text',\n label = 'Variables',\n color = 'primary',\n fullWidth,\n}: EditVariablesButtonProps) {\n const [isVariableEditorOpen, setIsVariableEditorOpen] = useState(false);\n const variableDefinitions: VariableDefinition[] = useTemplateVariableDefinitions();\n const { setVariableDefinitions } = useTemplateVariableActions();\n\n const openVariableEditor = () => {\n setIsVariableEditorOpen(true);\n };\n\n const closeVariableEditor = () => {\n setIsVariableEditorOpen(false);\n };\n\n return (\n <>\n <InfoTooltip description={TOOLTIP_TEXT.editVariables}>\n <Button\n startIcon={<PencilIcon />}\n onClick={openVariableEditor}\n aria-label={TOOLTIP_TEXT.editVariables}\n variant={variant}\n color={color}\n fullWidth={fullWidth}\n sx={{ whiteSpace: 'nowrap', minWidth: 'auto' }}\n >\n {label}\n </Button>\n </InfoTooltip>\n <Drawer\n isOpen={isVariableEditorOpen}\n onClose={closeVariableEditor}\n PaperProps={{ sx: { width: '50%' } }}\n data-testid=\"variable-editor\"\n >\n <VariableEditor\n variableDefinitions={variableDefinitions}\n onCancel={closeVariableEditor}\n onChange={(variables: VariableDefinition[]) => {\n setVariableDefinitions(variables);\n setIsVariableEditorOpen(false);\n }}\n />\n </Drawer>\n </>\n );\n}\n"],"names":["useState","Button","PencilIcon","Drawer","InfoTooltip","TOOLTIP_TEXT","useTemplateVariableDefinitions","useTemplateVariableActions","VariableEditor","EditVariablesButton","variant","label","color","fullWidth","isVariableEditorOpen","setIsVariableEditorOpen","variableDefinitions","setVariableDefinitions","openVariableEditor","closeVariableEditor","description","editVariables","startIcon","onClick","aria-label","sx","whiteSpace","minWidth","isOpen","onClose","Pa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EL,kBAAkB;oBAC3BM,YAAU,EAAEnB,YAAY,CAACgB,aAAa;oBACtCX,OAAO,EAAEA,OAAO;oBAChBE,KAAK,EAAEA,KAAK;oBACZC,SAAS,EAAEA,SAAS;oBACpBY,EAAE,EAAE;wBAAEC,UAAU,EAAE,QAAQ;wBAAEC,QAAQ,EAAE,MAAM;qBAAE;8BAE7ChB,KAAK;kBACC;cACG;0BACd,KAACR,MAAM;gBACLyB,MAAM,EAAEd,oBAAoB;gBAC5Be,OAAO,EAAEV,mBAAmB;gBAC5BW,UAAU,EAAE;oBAAEL,EAAE,EAAE;wBAAEM,KAAK,EAAE,KAAK;qBAAE;iBAAE;gBACpCC,aAAW,EAAC,iBAAiB;0BAE7B,cAAA,KAACxB,cAAc;oBACbQ,mBAAmB,EAAEA,mBAAmB;oBACxCiB,QAAQ,EAAEd,mBAAmB;oBAC7Be,QAAQ,EAAE,CAACC,SAA+B,GAAK;wBAC7ClB,sBAAsB,CAACkB,SAAS,CAAC,CAAC;wBAClCpB,uBAAuB,CAAC,KAAK,CAAC,CAAC;oBACjC,CAAC;kBACD;cACK;;MACR,CACH;AACJ,CAAC"}
|
|
@@ -6,10 +6,14 @@ export * from './DeletePanelDialog';
|
|
|
6
6
|
export * from './DeletePanelGroupDialog';
|
|
7
7
|
export * from './DiscardChangesConfirmationDialog';
|
|
8
8
|
export * from './DownloadButton';
|
|
9
|
+
export * from './EditJsonButton';
|
|
10
|
+
export * from './EditJsonDialog';
|
|
11
|
+
export * from './EmptyDashboard';
|
|
9
12
|
export * from './GridLayout';
|
|
10
13
|
export * from './Panel';
|
|
11
14
|
export * from './PanelDrawer';
|
|
12
15
|
export * from './PanelGroupDialog';
|
|
16
|
+
export * from './QuerySummaryTable';
|
|
13
17
|
export * from './TimeRangeControls';
|
|
14
18
|
export * from './ToolbarIconButton';
|
|
15
19
|
export * from './Variables';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAaA,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oCAAoC,CAAC;AACnD,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAaA,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oCAAoC,CAAC;AACnD,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC"}
|
package/dist/components/index.js
CHANGED
|
@@ -18,10 +18,14 @@ export * from './DeletePanelDialog';
|
|
|
18
18
|
export * from './DeletePanelGroupDialog';
|
|
19
19
|
export * from './DiscardChangesConfirmationDialog';
|
|
20
20
|
export * from './DownloadButton';
|
|
21
|
+
export * from './EditJsonButton';
|
|
22
|
+
export * from './EditJsonDialog';
|
|
23
|
+
export * from './EmptyDashboard';
|
|
21
24
|
export * from './GridLayout';
|
|
22
25
|
export * from './Panel';
|
|
23
26
|
export * from './PanelDrawer';
|
|
24
27
|
export * from './PanelGroupDialog';
|
|
28
|
+
export * from './QuerySummaryTable';
|
|
25
29
|
export * from './TimeRangeControls';
|
|
26
30
|
export * from './ToolbarIconButton';
|
|
27
31
|
export * from './Variables';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/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 './AddGroupButton';\nexport * from './AddPanelButton';\nexport * from './Dashboard';\nexport * from './DashboardToolbar';\nexport * from './DeletePanelDialog';\nexport * from './DeletePanelGroupDialog';\nexport * from './DiscardChangesConfirmationDialog';\nexport * from './DownloadButton';\nexport * from './GridLayout';\nexport * from './Panel';\nexport * from './PanelDrawer';\nexport * from './PanelGroupDialog';\nexport * from './TimeRangeControls';\nexport * from './ToolbarIconButton';\nexport * from './Variables';\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;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oCAAoC,CAAC;AACnD,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../../src/components/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 './AddGroupButton';\nexport * from './AddPanelButton';\nexport * from './Dashboard';\nexport * from './DashboardToolbar';\nexport * from './DeletePanelDialog';\nexport * from './DeletePanelGroupDialog';\nexport * from './DiscardChangesConfirmationDialog';\nexport * from './DownloadButton';\nexport * from './EditJsonButton';\nexport * from './EditJsonDialog';\nexport * from './EmptyDashboard';\nexport * from './GridLayout';\nexport * from './Panel';\nexport * from './PanelDrawer';\nexport * from './PanelGroupDialog';\nexport * from './QuerySummaryTable';\nexport * from './TimeRangeControls';\nexport * from './ToolbarIconButton';\nexport * from './Variables';\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;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oCAAoC,CAAC;AACnD,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-interface-text.d.ts","sourceRoot":"","sources":["../../src/constants/user-interface-text.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,YAAY
|
|
1
|
+
{"version":3,"file":"user-interface-text.d.ts","sourceRoot":"","sources":["../../src/constants/user-interface-text.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;CAsBxB,CAAC;AAEF,eAAO,MAAM,eAAe;iCAEG,MAAM;6BACV,MAAM;2BACR,MAAM;+BACF,MAAM;6BACR,MAAM;2BAER,MAAM;gCACD,MAAM;6BACT,MAAM;2BACR,MAAM;CAC9B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/constants/user-interface-text.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 const TOOLTIP_TEXT = {\n // Toolbar buttons\n addPanel: 'Add panel',\n addGroup: 'Add panel group',\n downloadDashboard: 'Download JSON',\n editVariables: 'Edit variables',\n refreshDashboard: 'Refresh dashboard',\n // Group buttons\n addPanelToGroup: 'Add panel to group',\n deleteGroup: 'Delete group',\n editGroup: 'Edit group',\n moveGroupDown: 'Move group down',\n moveGroupUp: 'Move group up',\n // Panel buttons\n editPanel: 'Edit',\n duplicatePanel: 'Duplicate',\n deletePanel: 'Delete',\n movePanel: 'Move',\n // Variable editor buttons\n refreshVariableValues: 'Refresh values',\n copyVariableValues: 'Copy values to clipboard',\n};\n\nexport const ARIA_LABEL_TEXT = {\n // Group buttons\n addPanelToGroup: (groupName: string) => `add panel to group ${groupName}`,\n deleteGroup: (groupName: string) => `delete group ${groupName}`,\n editGroup: (groupName: string) => `edit group ${groupName}`,\n moveGroupDown: (groupName: string) => `move group ${groupName} down`,\n moveGroupUp: (groupName: string) => `move group ${groupName} up`,\n // Panel buttons\n editPanel: (panelName: string) => `edit panel ${panelName}`,\n duplicatePanel: (panelName: string) => `duplicate panel ${panelName}`,\n deletePanel: (panelName: string) => `delete panel ${panelName}`,\n movePanel: (panelName: string) => `move panel ${panelName}`,\n};\n"],"names":["TOOLTIP_TEXT","addPanel","addGroup","downloadDashboard","editVariables","refreshDashboard","addPanelToGroup","deleteGroup","editGroup","moveGroupDown","moveGroupUp","editPanel","duplicatePanel","deletePanel","movePanel","refreshVariableValues","copyVariableValues","ARIA_LABEL_TEXT","groupName","panelName"],"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,OAAO,MAAMA,YAAY,GAAG;IAC1B,kBAAkB;IAClBC,QAAQ,EAAE,WAAW;IACrBC,QAAQ,EAAE,iBAAiB;IAC3BC,iBAAiB,EAAE,eAAe;IAClCC,aAAa,EAAE,gBAAgB;IAC/BC,gBAAgB,EAAE,mBAAmB;IACrC,gBAAgB;IAChBC,eAAe,EAAE,oBAAoB;IACrCC,WAAW,EAAE,cAAc;IAC3BC,SAAS,EAAE,YAAY;IACvBC,aAAa,EAAE,iBAAiB;IAChCC,WAAW,EAAE,eAAe;IAC5B,gBAAgB;IAChBC,SAAS,EAAE,MAAM;IACjBC,cAAc,EAAE,WAAW;IAC3BC,WAAW,EAAE,QAAQ;IACrBC,SAAS,EAAE,MAAM;IACjB,0BAA0B;IAC1BC,qBAAqB,EAAE,gBAAgB;IACvCC,kBAAkB,EAAE,0BAA0B;CAC/C,CAAC;AAEF,OAAO,MAAMC,eAAe,GAAG;IAC7B,gBAAgB;IAChBX,eAAe,EAAE,CAACY,SAAiB,GAAK,CAAC,mBAAmB,EAAEA,SAAS,CAAC,CAAC;IACzEX,WAAW,EAAE,CAACW,SAAiB,GAAK,CAAC,aAAa,EAAEA,SAAS,CAAC,CAAC;IAC/DV,SAAS,EAAE,CAACU,SAAiB,GAAK,CAAC,WAAW,EAAEA,SAAS,CAAC,CAAC;IAC3DT,aAAa,EAAE,CAACS,SAAiB,GAAK,CAAC,WAAW,EAAEA,SAAS,CAAC,KAAK,CAAC;IACpER,WAAW,EAAE,CAACQ,SAAiB,GAAK,CAAC,WAAW,EAAEA,SAAS,CAAC,GAAG,CAAC;IAChE,gBAAgB;IAChBP,SAAS,EAAE,CAACQ,SAAiB,GAAK,CAAC,WAAW,EAAEA,SAAS,CAAC,CAAC;IAC3DP,cAAc,EAAE,CAACO,SAAiB,GAAK,CAAC,gBAAgB,EAAEA,SAAS,CAAC,CAAC;IACrEN,WAAW,EAAE,CAACM,SAAiB,GAAK,CAAC,aAAa,EAAEA,SAAS,CAAC,CAAC;IAC/DL,SAAS,EAAE,CAACK,SAAiB,GAAK,CAAC,WAAW,EAAEA,SAAS,CAAC,CAAC;CAC5D,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../../src/constants/user-interface-text.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 const TOOLTIP_TEXT = {\n // Toolbar buttons\n addPanel: 'Add panel',\n addGroup: 'Add panel group',\n downloadDashboard: 'Download JSON',\n editJson: 'Edit JSON',\n editVariables: 'Edit variables',\n refreshDashboard: 'Refresh dashboard',\n // Group buttons\n addPanelToGroup: 'Add panel to group',\n deleteGroup: 'Delete group',\n editGroup: 'Edit group',\n moveGroupDown: 'Move group down',\n moveGroupUp: 'Move group up',\n // Panel buttons\n editPanel: 'Edit',\n duplicatePanel: 'Duplicate',\n deletePanel: 'Delete',\n movePanel: 'Move',\n // Variable editor buttons\n refreshVariableValues: 'Refresh values',\n copyVariableValues: 'Copy values to clipboard',\n};\n\nexport const ARIA_LABEL_TEXT = {\n // Group buttons\n addPanelToGroup: (groupName: string) => `add panel to group ${groupName}`,\n deleteGroup: (groupName: string) => `delete group ${groupName}`,\n editGroup: (groupName: string) => `edit group ${groupName}`,\n moveGroupDown: (groupName: string) => `move group ${groupName} down`,\n moveGroupUp: (groupName: string) => `move group ${groupName} up`,\n // Panel buttons\n editPanel: (panelName: string) => `edit panel ${panelName}`,\n duplicatePanel: (panelName: string) => `duplicate panel ${panelName}`,\n deletePanel: (panelName: string) => `delete panel ${panelName}`,\n movePanel: (panelName: string) => `move panel ${panelName}`,\n};\n"],"names":["TOOLTIP_TEXT","addPanel","addGroup","downloadDashboard","editJson","editVariables","refreshDashboard","addPanelToGroup","deleteGroup","editGroup","moveGroupDown","moveGroupUp","editPanel","duplicatePanel","deletePanel","movePanel","refreshVariableValues","copyVariableValues","ARIA_LABEL_TEXT","groupName","panelName"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CA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cAAc,EAAE,CAACO,SAAiB,GAAK,CAAC,gBAAgB,EAAEA,SAAS,CAAC,CAAC;IACrEN,WAAW,EAAE,CAACM,SAAiB,GAAK,CAAC,aAAa,EAAEA,SAAS,CAAC,CAAC;IAC/DL,SAAS,EAAE,CAACK,SAAiB,GAAK,CAAC,WAAW,EAAEA,SAAS,CAAC,CAAC;CAC5D,CAAC"}
|
|
@@ -9,7 +9,8 @@ import { DeletePanelGroupSlice } from './delete-panel-group-slice';
|
|
|
9
9
|
import { DeletePanelSlice } from './delete-panel-slice';
|
|
10
10
|
import { DiscardChangesConfirmationDialogSlice } from './discard-changes-dialog-slice';
|
|
11
11
|
import { DuplicatePanelSlice } from './duplicate-panel-slice';
|
|
12
|
-
|
|
12
|
+
import { EditJsonDialogSlice } from './edit-json-dialog-slice';
|
|
13
|
+
export interface DashboardStoreState extends PanelGroupSlice, PanelSlice, PanelGroupEditorSlice, DeletePanelGroupSlice, PanelEditorSlice, DeletePanelSlice, DiscardChangesConfirmationDialogSlice, DuplicatePanelSlice, EditJsonDialogSlice {
|
|
13
14
|
isEditMode: boolean;
|
|
14
15
|
setEditMode: (isEditMode: boolean) => void;
|
|
15
16
|
defaultTimeRange: RelativeTimeRange;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardProvider.d.ts","sourceRoot":"","sources":["../../../src/context/DashboardProvider/DashboardProvider.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAIxC,OAAO,EAAiB,SAAS,EAAgD,MAAM,OAAO,CAAC;AAC/F,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAElG,OAAO,EAA+B,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAChG,OAAO,EAAsD,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC1G,OAAO,EAA0B,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAChF,OAAO,EAAoB,UAAU,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAA+B,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAChG,OAAO,EAA0B,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAChF,OAAO,EAAmC,qCAAqC,EAAE,MAAM,gCAAgC,CAAC;AACxH,OAAO,EAA6B,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"DashboardProvider.d.ts","sourceRoot":"","sources":["../../../src/context/DashboardProvider/DashboardProvider.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAIxC,OAAO,EAAiB,SAAS,EAAgD,MAAM,OAAO,CAAC;AAC/F,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAElG,OAAO,EAA+B,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAChG,OAAO,EAAsD,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC1G,OAAO,EAA0B,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAChF,OAAO,EAAoB,UAAU,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAA+B,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAChG,OAAO,EAA0B,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAChF,OAAO,EAAmC,qCAAqC,EAAE,MAAM,gCAAgC,CAAC;AACxH,OAAO,EAA6B,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACzF,OAAO,EAA6B,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE1F,MAAM,WAAW,mBACf,SAAQ,eAAe,EACrB,UAAU,EACV,qBAAqB,EACrB,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,EAChB,qCAAqC,EACrC,mBAAmB,EACnB,mBAAmB;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3C,gBAAgB,EAAE,iBAAiB,CAAC;IACpC,YAAY,EAAE,CAAC,SAAS,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACrD,QAAQ,EAAE,eAAe,CAAC;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,sBAAsB;IACrC,YAAY,EAAE,mBAAmB,CAAC;IAClC,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,eAAO,MAAM,gBAAgB,oEAAsE,CAAC;AAEpG,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,CAAC,KAM/E;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,eAsB9D"}
|
|
@@ -25,6 +25,7 @@ import { createDeletePanelGroupSlice } from './delete-panel-group-slice';
|
|
|
25
25
|
import { createDeletePanelSlice } from './delete-panel-slice';
|
|
26
26
|
import { createDiscardChangesDialogSlice } from './discard-changes-dialog-slice';
|
|
27
27
|
import { createDuplicatePanelSlice } from './duplicate-panel-slice';
|
|
28
|
+
import { createEditJsonDialogSlice } from './edit-json-dialog-slice';
|
|
28
29
|
export const DashboardContext = /*#__PURE__*/ createContext(undefined);
|
|
29
30
|
export function useDashboardStore(selector) {
|
|
30
31
|
const store = useContext(DashboardContext);
|
|
@@ -65,18 +66,23 @@ export function DashboardProvider(props) {
|
|
|
65
66
|
}
|
|
66
67
|
function initStore(props) {
|
|
67
68
|
const { initialState: { dashboardResource , isEditMode } , } = props;
|
|
68
|
-
const { spec: { display ,
|
|
69
|
+
const { spec: { display , duration } , metadata , } = dashboardResource;
|
|
70
|
+
let { spec: { layouts , panels } , } = dashboardResource;
|
|
71
|
+
// Set fallbacks in case the frontend is used with a non-Perses backend
|
|
72
|
+
layouts = layouts !== null && layouts !== void 0 ? layouts : [];
|
|
73
|
+
panels = panels !== null && panels !== void 0 ? panels : {};
|
|
69
74
|
const store = createStore()(immer(devtools((...args)=>{
|
|
70
75
|
const [set] = args;
|
|
71
76
|
return {
|
|
72
|
-
...createPanelGroupSlice(layouts)(...args),
|
|
73
|
-
...createPanelSlice(panels)(...args),
|
|
77
|
+
/* Groups */ ...createPanelGroupSlice(layouts)(...args),
|
|
74
78
|
...createPanelGroupEditorSlice(...args),
|
|
75
79
|
...createDeletePanelGroupSlice(...args),
|
|
80
|
+
/* Panels */ ...createPanelSlice(panels)(...args),
|
|
76
81
|
...createPanelEditorSlice()(...args),
|
|
77
82
|
...createDeletePanelSlice()(...args),
|
|
78
|
-
...createDiscardChangesDialogSlice(...args),
|
|
79
83
|
...createDuplicatePanelSlice()(...args),
|
|
84
|
+
/* General */ ...createDiscardChangesDialogSlice(...args),
|
|
85
|
+
...createEditJsonDialogSlice(...args),
|
|
80
86
|
metadata,
|
|
81
87
|
display,
|
|
82
88
|
defaultTimeRange: {
|
|
@@ -86,12 +92,12 @@ function initStore(props) {
|
|
|
86
92
|
setEditMode: (isEditMode)=>set({
|
|
87
93
|
isEditMode
|
|
88
94
|
}),
|
|
89
|
-
setDashboard: ({ metadata , spec: { display , panels , layouts } })=>{
|
|
95
|
+
setDashboard: ({ metadata , spec: { display , panels ={} , layouts =[] } })=>{
|
|
90
96
|
set((state)=>{
|
|
91
97
|
state.metadata = metadata;
|
|
92
98
|
state.display = display;
|
|
93
|
-
const { panelGroups , panelGroupOrder } = convertLayoutsToPanelGroups(layouts);
|
|
94
99
|
state.panels = panels;
|
|
100
|
+
const { panelGroups , panelGroupOrder } = convertLayoutsToPanelGroups(layouts);
|
|
95
101
|
state.panelGroups = panelGroups;
|
|
96
102
|
state.panelGroupOrder = panelGroupOrder;
|
|
97
103
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/context/DashboardProvider/DashboardProvider.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 { createStore, useStore } from 'zustand';\nimport type { StoreApi } from 'zustand';\nimport { devtools } from 'zustand/middleware';\nimport { immer } from 'zustand/middleware/immer';\nimport { shallow } from 'zustand/shallow';\nimport { createContext, ReactNode, useCallback, useContext, useEffect, useState } from 'react';\nimport { DashboardResource, Display, ProjectMetadata, RelativeTimeRange } from '@perses-dev/core';\nimport { usePlugin, usePluginRegistry } from '@perses-dev/plugin-system';\nimport { createPanelGroupEditorSlice, PanelGroupEditorSlice } from './panel-group-editor-slice';\nimport { convertLayoutsToPanelGroups, createPanelGroupSlice, PanelGroupSlice } from './panel-group-slice';\nimport { createPanelEditorSlice, PanelEditorSlice } from './panel-editor-slice';\nimport { createPanelSlice, PanelSlice } from './panel-slice';\nimport { createDeletePanelGroupSlice, DeletePanelGroupSlice } from './delete-panel-group-slice';\nimport { createDeletePanelSlice, DeletePanelSlice } from './delete-panel-slice';\nimport { createDiscardChangesDialogSlice, DiscardChangesConfirmationDialogSlice } from './discard-changes-dialog-slice';\nimport { createDuplicatePanelSlice, DuplicatePanelSlice } from './duplicate-panel-slice';\n\nexport interface DashboardStoreState\n extends PanelGroupSlice,\n PanelSlice,\n PanelGroupEditorSlice,\n DeletePanelGroupSlice,\n PanelEditorSlice,\n DeletePanelSlice,\n DiscardChangesConfirmationDialogSlice,\n DuplicatePanelSlice {\n isEditMode: boolean;\n setEditMode: (isEditMode: boolean) => void;\n defaultTimeRange: RelativeTimeRange;\n setDashboard: (dashboard: DashboardResource) => void;\n metadata: ProjectMetadata;\n display?: Display;\n}\n\nexport interface DashboardStoreProps {\n dashboardResource: DashboardResource;\n isEditMode?: boolean;\n}\n\nexport interface DashboardProviderProps {\n initialState: DashboardStoreProps;\n children?: ReactNode;\n}\n\nexport const DashboardContext = createContext<StoreApi<DashboardStoreState> | undefined>(undefined);\n\nexport function useDashboardStore<T>(selector: (state: DashboardStoreState) => T) {\n const store = useContext(DashboardContext);\n if (store === undefined) {\n throw new Error('No DashboardContext found. Did you forget a Provider?');\n }\n return useStore(store, selector, shallow);\n}\n\nexport function DashboardProvider(props: DashboardProviderProps) {\n const createDashboardStore = useCallback(initStore, [props]);\n\n // load plugin to retrieve initial spec if default panel kind is defined\n const { defaultPluginKinds } = usePluginRegistry();\n const defaultPanelKind = defaultPluginKinds?.['Panel'] ?? '';\n const { data: plugin } = usePlugin('Panel', defaultPanelKind);\n\n const [store] = useState(createDashboardStore(props)); // prevent calling createDashboardStore every time it rerenders\n\n useEffect(() => {\n if (plugin === undefined) return;\n const spec = plugin.createInitialOptions();\n // set default panel kind and spec for add panel editor\n store.setState({ initialValues: { kind: defaultPanelKind, spec } });\n }, [plugin, store, defaultPanelKind]);\n\n return (\n <DashboardContext.Provider value={store as StoreApi<DashboardStoreState>}>\n {props.children}\n </DashboardContext.Provider>\n );\n}\n\nfunction initStore(props: DashboardProviderProps) {\n const {\n initialState: { dashboardResource, isEditMode },\n } = props;\n\n const {\n spec: { display, layouts, panels, duration },\n metadata,\n } = dashboardResource;\n const store = createStore<DashboardStoreState>()(\n immer(\n devtools((...args) => {\n const [set] = args;\n return {\n ...createPanelGroupSlice(layouts)(...args),\n ...createPanelSlice(panels)(...args),\n ...createPanelGroupEditorSlice(...args),\n ...createDeletePanelGroupSlice(...args),\n ...createPanelEditorSlice()(...args),\n ...createDeletePanelSlice()(...args),\n ...createDiscardChangesDialogSlice(...args),\n ...createDuplicatePanelSlice()(...args),\n metadata,\n display,\n defaultTimeRange: { pastDuration: duration },\n isEditMode: !!isEditMode,\n setEditMode: (isEditMode: boolean) => set({ isEditMode }),\n setDashboard: ({ metadata, spec: { display, panels, layouts } }) => {\n set((state) => {\n state.metadata = metadata;\n state.display = display;\n const { panelGroups, panelGroupOrder } = convertLayoutsToPanelGroups(layouts);\n state.panels = panels;\n state.panelGroups = panelGroups;\n state.panelGroupOrder = panelGroupOrder;\n });\n },\n };\n })\n )\n );\n\n return store;\n}\n"],"names":["createStore","useStore","devtools","immer","shallow","createContext","useCallback","useContext","useEffect","useState","usePlugin","usePluginRegistry","createPanelGroupEditorSlice","convertLayoutsToPanelGroups","createPanelGroupSlice","createPanelEditorSlice","createPanelSlice","createDeletePanelGroupSlice","createDeletePanelSlice","createDiscardChangesDialogSlice","createDuplicatePanelSlice","DashboardContext","undefined","useDashboardStore","selector","store","Error","DashboardProvider","props","createDashboardStore","initStore","defaultPluginKinds","defaultPanelKind","data","plugin","spec","createInitialOptions","setState","initialValues","kind","Provider","value","children","initialState","dashboardResource","isEditMode","display","layouts","panels","duration","metadata","args","set","defaultTimeRange","pastDuration","setEditMode","setDashboard","state","panelGroups","panelGroupOrder"],"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,WAAW,EAAEC,QAAQ,QAAQ,SAAS,CAAC;AAEhD,SAASC,QAAQ,QAAQ,oBAAoB,CAAC;AAC9C,SAASC,KAAK,QAAQ,0BAA0B,CAAC;AACjD,SAASC,OAAO,QAAQ,iBAAiB,CAAC;AAC1C,SAASC,aAAa,EAAaC,WAAW,EAAEC,UAAU,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO,CAAC;AAE/F,SAASC,SAAS,EAAEC,iBAAiB,QAAQ,2BAA2B,CAAC;AACz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AI,CAAC;YACvC,GAAGlC,2BAA2B,IAAIkC,IAAI,CAAC;YACvC,GAAGpC,sBAAsB,EAAE,IAAIoC,IAAI,CAAC;YACpC,GAAGjC,sBAAsB,EAAE,IAAIiC,IAAI,CAAC;YACpC,GAAGhC,+BAA+B,IAAIgC,IAAI,CAAC;YAC3C,GAAG/B,yBAAyB,EAAE,IAAI+B,IAAI,CAAC;YACvCD,QAAQ;YACRJ,OAAO;YACPO,gBAAgB,EAAE;gBAAEC,YAAY,EAAEL,QAAQ;aAAE;YAC5CJ,UAAU,EAAE,CAAC,CAACA,UAAU;YACxBU,WAAW,EAAE,CAACV,UAAmB,GAAKO,GAAG,CAAC;oBAAEP,UAAU;iBAAE,CAAC;YACzDW,YAAY,EAAE,CAAC,EAAEN,QAAQ,CAAA,EAAEf,IAAI,EAAE,EAAEW,OAAO,CAAA,EAAEE,MAAM,CAAA,EAAED,OAAO,CAAA,EAAE,CAAA,EAAE,GAAK;gBAClEK,GAAG,CAAC,CAACK,KAAK,GAAK;oBACbA,KAAK,CAACP,QAAQ,GAAGA,QAAQ,CAAC;oBAC1BO,KAAK,CAACX,OAAO,GAAGA,OAAO,CAAC;oBACxB,MAAM,EAAEY,WAAW,CAAA,EAAEC,eAAe,CAAA,EAAE,GAAG9C,2BAA2B,CAACkC,OAAO,CAAC,AAAC;oBAC9EU,KAAK,CAACT,MAAM,GAAGA,MAAM,CAAC;oBACtBS,KAAK,CAACC,WAAW,GAAGA,WAAW,CAAC;oBAChCD,KAAK,CAACE,eAAe,GAAGA,eAAe,CAAC;gBAC1C,CAAC,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC,CAAC,CACH,CACF,AAAC;IAEF,OAAOlC,KAAK,CAAC;AACf,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../src/context/DashboardProvider/DashboardProvider.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 { createStore, useStore } from 'zustand';\nimport type { StoreApi } from 'zustand';\nimport { devtools } from 'zustand/middleware';\nimport { immer } from 'zustand/middleware/immer';\nimport { shallow } from 'zustand/shallow';\nimport { createContext, ReactNode, useCallback, useContext, useEffect, useState } from 'react';\nimport { DashboardResource, Display, ProjectMetadata, RelativeTimeRange } from '@perses-dev/core';\nimport { usePlugin, usePluginRegistry } from '@perses-dev/plugin-system';\nimport { createPanelGroupEditorSlice, PanelGroupEditorSlice } from './panel-group-editor-slice';\nimport { convertLayoutsToPanelGroups, createPanelGroupSlice, PanelGroupSlice } from './panel-group-slice';\nimport { createPanelEditorSlice, PanelEditorSlice } from './panel-editor-slice';\nimport { createPanelSlice, PanelSlice } from './panel-slice';\nimport { createDeletePanelGroupSlice, DeletePanelGroupSlice } from './delete-panel-group-slice';\nimport { createDeletePanelSlice, DeletePanelSlice } from './delete-panel-slice';\nimport { createDiscardChangesDialogSlice, DiscardChangesConfirmationDialogSlice } from './discard-changes-dialog-slice';\nimport { createDuplicatePanelSlice, DuplicatePanelSlice } from './duplicate-panel-slice';\nimport { createEditJsonDialogSlice, EditJsonDialogSlice } from './edit-json-dialog-slice';\n\nexport interface DashboardStoreState\n extends PanelGroupSlice,\n PanelSlice,\n PanelGroupEditorSlice,\n DeletePanelGroupSlice,\n PanelEditorSlice,\n DeletePanelSlice,\n DiscardChangesConfirmationDialogSlice,\n DuplicatePanelSlice,\n EditJsonDialogSlice {\n isEditMode: boolean;\n setEditMode: (isEditMode: boolean) => void;\n defaultTimeRange: RelativeTimeRange;\n setDashboard: (dashboard: DashboardResource) => void;\n metadata: ProjectMetadata;\n display?: Display;\n}\n\nexport interface DashboardStoreProps {\n dashboardResource: DashboardResource;\n isEditMode?: boolean;\n}\n\nexport interface DashboardProviderProps {\n initialState: DashboardStoreProps;\n children?: ReactNode;\n}\n\nexport const DashboardContext = createContext<StoreApi<DashboardStoreState> | undefined>(undefined);\n\nexport function useDashboardStore<T>(selector: (state: DashboardStoreState) => T) {\n const store = useContext(DashboardContext);\n if (store === undefined) {\n throw new Error('No DashboardContext found. Did you forget a Provider?');\n }\n return useStore(store, selector, shallow);\n}\n\nexport function DashboardProvider(props: DashboardProviderProps) {\n const createDashboardStore = useCallback(initStore, [props]);\n\n // load plugin to retrieve initial spec if default panel kind is defined\n const { defaultPluginKinds } = usePluginRegistry();\n const defaultPanelKind = defaultPluginKinds?.['Panel'] ?? '';\n const { data: plugin } = usePlugin('Panel', defaultPanelKind);\n\n const [store] = useState(createDashboardStore(props)); // prevent calling createDashboardStore every time it rerenders\n\n useEffect(() => {\n if (plugin === undefined) return;\n const spec = plugin.createInitialOptions();\n // set default panel kind and spec for add panel editor\n store.setState({ initialValues: { kind: defaultPanelKind, spec } });\n }, [plugin, store, defaultPanelKind]);\n\n return (\n <DashboardContext.Provider value={store as StoreApi<DashboardStoreState>}>\n {props.children}\n </DashboardContext.Provider>\n );\n}\n\nfunction initStore(props: DashboardProviderProps) {\n const {\n initialState: { dashboardResource, isEditMode },\n } = props;\n\n const {\n spec: { display, duration },\n metadata,\n } = dashboardResource;\n\n let {\n spec: { layouts, panels },\n } = dashboardResource;\n\n // Set fallbacks in case the frontend is used with a non-Perses backend\n layouts = layouts ?? [];\n panels = panels ?? {};\n\n const store = createStore<DashboardStoreState>()(\n immer(\n devtools((...args) => {\n const [set] = args;\n return {\n /* Groups */\n ...createPanelGroupSlice(layouts)(...args),\n ...createPanelGroupEditorSlice(...args),\n ...createDeletePanelGroupSlice(...args),\n /* Panels */\n ...createPanelSlice(panels)(...args),\n ...createPanelEditorSlice()(...args),\n ...createDeletePanelSlice()(...args),\n ...createDuplicatePanelSlice()(...args),\n /* General */\n ...createDiscardChangesDialogSlice(...args),\n ...createEditJsonDialogSlice(...args),\n metadata,\n display,\n defaultTimeRange: { pastDuration: duration },\n isEditMode: !!isEditMode,\n setEditMode: (isEditMode: boolean) => set({ isEditMode }),\n setDashboard: ({ metadata, spec: { display, panels = {}, layouts = [] } }) => {\n set((state) => {\n state.metadata = metadata;\n state.display = display;\n state.panels = panels;\n const { panelGroups, panelGroupOrder } = convertLayoutsToPanelGroups(layouts);\n state.panelGroups = panelGroups;\n state.panelGroupOrder = panelGroupOrder;\n });\n },\n };\n })\n )\n );\n\n return store;\n}\n"],"names":["createStore","useStore","devtools","immer","shallow","createContext","useCallback","useContext","useEffect","useState","usePlugin","usePluginRegistry","createPanelGroupEditorSlice","convertLayoutsToPanelGroups","createPanelGroupSlice","createPanelEditorSlice","createPanelSlice","createDeletePanelGroupSlice","createDeletePanelSlice","createDiscardChangesDialogSlice","createDuplicatePanelSlice","createEditJsonDialogSlice","DashboardContext","undefined","useDashboardStore","selector","store","Error","DashboardProvider","props","createDashboardStore","initStore","defaultPluginKinds","defaultPanelKind","data","plugin","spec","createInitialOptions","setState","initialValues","kind","Provider","value","children","initialState","dashboardResource","isEditMode","display","duration","metadata","layouts","panels","args","set","defaultTimeRange","pastDuration","setEditMode","setDashboard","state","panelGroups","panelGroupOrder"],"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,WAAW,EAAEC,QAAQ,QAAQ,SAAS,CAAC;AAEhD,SAASC,QAAQ,QAAQ,oBAAoB,CAAC;AAC9C,SAASC,KAAK,QAAQ,0BAA0B,CAAC;AACjD,SAASC,OAAO,QAAQ,iBAAiB,CAAC;AAC1C,SAASC,aAAa,EAAaC,WAAW,EAAEC,UAAU,EAAEC,SAAS,EAAEC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B,MAAM,EAAEQ,WAAW,CAAA,EAAEC,eAAe,CAAA,EAAE,GAAG/C,2BAA2B,CAACqC,OAAO,CAAC,AAAC;oBAC9EQ,KAAK,CAACC,WAAW,GAAGA,WAAW,CAAC;oBAChCD,KAAK,CAACE,eAAe,GAAGA,eAAe,CAAC;gBAC1C,CAAC,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC,CAAC,CACH,CACF,AAAC;IAEF,OAAOlC,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -77,4 +77,12 @@ export declare function useDiscardChangesConfirmationDialog(): {
|
|
|
77
77
|
openDiscardChangesConfirmationDialog: (discardChangesConfirmationDialog: import("./discard-changes-dialog-slice").DiscardChangesConfirmationDialogState) => void;
|
|
78
78
|
closeDiscardChangesConfirmationDialog: () => void;
|
|
79
79
|
};
|
|
80
|
+
/**
|
|
81
|
+
* Gets the state for the edit JSON dialog.
|
|
82
|
+
*/
|
|
83
|
+
export declare function useEditJsonDialog(): {
|
|
84
|
+
editJsonDialog: import("./edit-json-dialog-slice").EditJsonDialogState | undefined;
|
|
85
|
+
openEditJsonDialog: () => void;
|
|
86
|
+
closeEditJsonDialog: () => void;
|
|
87
|
+
};
|
|
80
88
|
//# sourceMappingURL=dashboard-provider-api.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dashboard-provider-api.d.ts","sourceRoot":"","sources":["../../../src/context/DashboardProvider/dashboard-provider-api.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAG3F,wBAAgB,WAAW;;;EAE1B;AAOD;;GAEG;AACH,wBAAgB,mBAAmB;;;;EAOlC;AAGD;;GAEG;AACH,wBAAgB,gBAAgB,aAE/B;AAGD;;GAEG;AACH,wBAAgB,kBAAkB,yDAYjC;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,YAAY,EAAE,YAAY,sDAMvD;AAaD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,YAAY;;;;;;2CAWpB,oBAAoB,EAAE;EAGhE;AA4BD;;GAEG;AACH,wBAAgB,mBAAmB,sEAElC;AAaD;;GAEG;AACH,wBAAgB,yBAAyB;;;;;EASxC;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,sFAiB1D;AAQD;;GAEG;AACH,wBAAgB,eAAe,CAAC,gBAAgB,EAAE,gBAAgB;;;;EAOjE;AAGD;;GAEG;AACH,wBAAgB,cAAc,gEAE7B;AAQD;;GAEG;AACH,wBAAgB,oBAAoB;;;;EAGnC;AAGD,wBAAgB,mBAAmB,iDAElC;AAWD,wBAAgB,mCAAmC;;;;EAElD"}
|
|
1
|
+
{"version":3,"file":"dashboard-provider-api.d.ts","sourceRoot":"","sources":["../../../src/context/DashboardProvider/dashboard-provider-api.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAG3F,wBAAgB,WAAW;;;EAE1B;AAOD;;GAEG;AACH,wBAAgB,mBAAmB;;;;EAOlC;AAGD;;GAEG;AACH,wBAAgB,gBAAgB,aAE/B;AAGD;;GAEG;AACH,wBAAgB,kBAAkB,yDAYjC;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,YAAY,EAAE,YAAY,sDAMvD;AAaD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,YAAY;;;;;;2CAWpB,oBAAoB,EAAE;EAGhE;AA4BD;;GAEG;AACH,wBAAgB,mBAAmB,sEAElC;AAaD;;GAEG;AACH,wBAAgB,yBAAyB;;;;;EASxC;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,sFAiB1D;AAQD;;GAEG;AACH,wBAAgB,eAAe,CAAC,gBAAgB,EAAE,gBAAgB;;;;EAOjE;AAGD;;GAEG;AACH,wBAAgB,cAAc,gEAE7B;AAQD;;GAEG;AACH,wBAAgB,oBAAoB;;;;EAGnC;AAGD,wBAAgB,mBAAmB,iDAElC;AAWD,wBAAgB,mCAAmC;;;;EAElD;AAOD;;GAEG;AACH,wBAAgB,iBAAiB;;;;EAEhC"}
|
|
@@ -196,5 +196,15 @@ const selectDiscardChangesConfirmationDialog = ({ discardChangesConfirmationDial
|
|
|
196
196
|
export function useDiscardChangesConfirmationDialog() {
|
|
197
197
|
return useDashboardStore(selectDiscardChangesConfirmationDialog);
|
|
198
198
|
}
|
|
199
|
+
const selectEditJsonDialog = ({ editJsonDialog , openEditJsonDialog , closeEditJsonDialog })=>({
|
|
200
|
+
editJsonDialog,
|
|
201
|
+
openEditJsonDialog,
|
|
202
|
+
closeEditJsonDialog
|
|
203
|
+
});
|
|
204
|
+
/**
|
|
205
|
+
* Gets the state for the edit JSON dialog.
|
|
206
|
+
*/ export function useEditJsonDialog() {
|
|
207
|
+
return useDashboardStore(selectEditJsonDialog);
|
|
208
|
+
}
|
|
199
209
|
|
|
200
210
|
//# sourceMappingURL=dashboard-provider-api.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/context/DashboardProvider/dashboard-provider-api.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\nimport { useCallback, useMemo } from 'react';\nimport { DashboardStoreState, useDashboardStore } from './DashboardProvider';\nimport { PanelGroupItemId, PanelGroupId, PanelGroupItemLayout } from './panel-group-slice';\n\nconst selectEditMode = ({ isEditMode, setEditMode }: DashboardStoreState) => ({ isEditMode, setEditMode });\nexport function useEditMode() {\n return useDashboardStore(selectEditMode);\n}\n\nconst selectDashboardActions = ({ setDashboard, openAddPanelGroup, openAddPanel }: DashboardStoreState) => ({\n setDashboard,\n openAddPanelGroup,\n openAddPanel,\n});\n/**\n * Returns actions that can be performed on the current dashboard.\n */\nexport function useDashboardActions() {\n const { setDashboard, openAddPanelGroup, openAddPanel } = useDashboardStore(selectDashboardActions);\n return {\n setDashboard,\n openAddPanelGroup: () => openAddPanelGroup(),\n openAddPanel: () => openAddPanel(),\n };\n}\n\nconst selectPanelGroupOrder = (state: DashboardStoreState) => state.panelGroupOrder;\n/**\n * Returns an array of PanelGroupIds in the order they appear in the dashboard.\n */\nexport function usePanelGroupIds() {\n return useDashboardStore(selectPanelGroupOrder);\n}\n\nconst selectPanelGroups = (state: DashboardStoreState) => state.panelGroups;\n/**\n * Returns an array of PanelGroupDefinitions in the order they appear in the dashboard.\n */\nexport function useListPanelGroups() {\n const panelGroupIds = usePanelGroupIds();\n const panelGroups = useDashboardStore(selectPanelGroups);\n return useMemo(() => {\n return panelGroupIds.map((id) => {\n const group = panelGroups[id];\n if (group === undefined) {\n throw new Error(`Invalid panel group Id found ${id}`);\n }\n return group;\n });\n }, [panelGroupIds, panelGroups]);\n}\n\n/**\n * Gets a specific panel group by its id. Throws if the panel group does not exist.\n */\nexport function usePanelGroup(panelGroupId: PanelGroupId) {\n const panelGroup = useDashboardStore(useCallback((state) => state.panelGroups[panelGroupId], [panelGroupId]));\n if (panelGroup === undefined) {\n throw new Error(`Panel group with Id ${panelGroupId} was not found`);\n }\n return panelGroup;\n}\n\nconst selectPanelGroupActions = ({\n openEditPanelGroup,\n deletePanelGroup,\n openAddPanel,\n updatePanelGroupLayouts,\n}: DashboardStoreState) => ({\n openEditPanelGroup,\n deletePanelGroup,\n openAddPanel,\n updatePanelGroupLayouts,\n});\n/**\n * Returns actions that can be performed on the given panel group.\n */\nexport function usePanelGroupActions(panelGroupId: PanelGroupId) {\n const { moveUp, moveDown } = useMovePanelGroup(panelGroupId);\n const { openEditPanelGroup, deletePanelGroup, openAddPanel, updatePanelGroupLayouts } =\n useDashboardStore(selectPanelGroupActions);\n\n return {\n openEditPanelGroup: () => openEditPanelGroup(panelGroupId),\n deletePanelGroup: () => deletePanelGroup(panelGroupId),\n openAddPanel: () => openAddPanel(panelGroupId),\n moveUp,\n moveDown,\n updatePanelGroupLayouts: (itemLayouts: PanelGroupItemLayout[]) =>\n updatePanelGroupLayouts(panelGroupId, itemLayouts),\n };\n}\n\nconst selectSwapPanelGroups = (state: DashboardStoreState) => state.swapPanelGroups;\nconst selectPanelGroupsLength = (state: DashboardStoreState) => state.panelGroupOrder.length;\n/**\n * Returns functions for moving a panel group up or down. A function will be undefined if the panel group can't be\n * moved in that direction.\n */\nfunction useMovePanelGroup(panelGroupId: PanelGroupId) {\n const currentIndex = useDashboardStore(\n useCallback((store) => store.panelGroupOrder.findIndex((id) => id === panelGroupId), [panelGroupId])\n );\n const panelGroupsLength = useDashboardStore(selectPanelGroupsLength);\n const swapPanelGroups = useDashboardStore(selectSwapPanelGroups);\n\n if (currentIndex < 0) {\n throw new Error(`Could not find panel group with Id ${panelGroupId} in order array`);\n }\n\n const moveUp = () => swapPanelGroups(currentIndex, currentIndex - 1);\n const moveDown = () => swapPanelGroups(currentIndex, currentIndex + 1);\n return {\n moveUp: currentIndex > 0 ? moveUp : undefined,\n moveDown: currentIndex < panelGroupsLength - 1 ? moveDown : undefined,\n };\n}\n\nconst selectPanelGroupEditor = (state: DashboardStoreState) => state.panelGroupEditor;\n/**\n * Gets the Panel Group editor state.\n */\nexport function usePanelGroupEditor() {\n return useDashboardStore(selectPanelGroupEditor);\n}\n\nconst selectDeletePanelGroupDialog = ({\n deletePanelGroupDialog,\n openDeletePanelGroupDialog,\n closeDeletePanelGroupDialog,\n deletePanelGroup,\n}: DashboardStoreState) => ({\n deletePanelGroupDialog,\n openDeletePanelGroupDialog,\n closeDeletePanelGroupDialog,\n deletePanelGroup,\n});\n/**\n * Gets the Delete Panel Group dialog state.\n */\nexport function useDeletePanelGroupDialog() {\n const { deletePanelGroupDialog, openDeletePanelGroupDialog, closeDeletePanelGroupDialog, deletePanelGroup } =\n useDashboardStore(selectDeletePanelGroupDialog);\n return {\n deletePanelGroupDialog,\n deletePanelGroup,\n openDeletePanelGroupDialog,\n closeDeletePanelGroupDialog: () => closeDeletePanelGroupDialog(),\n };\n}\n\n/**\n * Gets an individual panel in the store. Throws if the panel can't be found.\n */\nexport function usePanel(panelGroupItemId: PanelGroupItemId) {\n const { panelGroupId, panelGroupItemLayoutId: panelGroupLayoutId } = panelGroupItemId;\n const panel = useDashboardStore(\n useCallback(\n (store) => {\n const panelKey = store.panelGroups[panelGroupId]?.itemPanelKeys[panelGroupLayoutId];\n if (panelKey === undefined) return;\n return store.panels[panelKey];\n },\n [panelGroupId, panelGroupLayoutId]\n )\n );\n\n if (panel === undefined) {\n throw new Error(`Could not find panel for Id ${panelGroupItemId}`);\n }\n return panel;\n}\n\nconst selectPanelActions = ({ openEditPanel, openDeletePanelDialog, duplicatePanel }: DashboardStoreState) => ({\n openEditPanel,\n openDeletePanelDialog,\n duplicatePanel,\n});\n\n/**\n * Returns actions that can be performed on the given Panel.\n */\nexport function usePanelActions(panelGroupItemId: PanelGroupItemId) {\n const { openEditPanel, openDeletePanelDialog, duplicatePanel } = useDashboardStore(selectPanelActions);\n return {\n openEditPanel: () => openEditPanel(panelGroupItemId),\n openDeletePanelDialog: () => openDeletePanelDialog(panelGroupItemId),\n duplicatePanel: () => duplicatePanel(panelGroupItemId),\n };\n}\n\nconst selectPanelEditor = (state: DashboardStoreState) => state.panelEditor;\n/**\n * Gets the state for the Panel Editor.\n */\nexport function usePanelEditor() {\n return useDashboardStore(selectPanelEditor);\n}\n\nconst selectDeletePanelDialog = ({ deletePanelDialog, deletePanel, closeDeletePanelDialog }: DashboardStoreState) => ({\n deletePanelDialog,\n deletePanel,\n closeDeletePanelDialog,\n});\n\n/**\n * Gets the state for the Delete Panel dialog.\n */\nexport function useDeletePanelDialog() {\n // TODO: Refactor similar to other dialogs/editors so these are on the editor state itself\n return useDashboardStore(selectDeletePanelDialog);\n}\n\nconst selectDefaultTimeRange = (state: DashboardStoreState) => state.defaultTimeRange;\nexport function useDefaultTimeRange() {\n return useDashboardStore(selectDefaultTimeRange);\n}\n\nconst selectDiscardChangesConfirmationDialog = ({\n discardChangesConfirmationDialog,\n openDiscardChangesConfirmationDialog,\n closeDiscardChangesConfirmationDialog,\n}: DashboardStoreState) => ({\n discardChangesConfirmationDialog,\n openDiscardChangesConfirmationDialog,\n closeDiscardChangesConfirmationDialog,\n});\nexport function useDiscardChangesConfirmationDialog() {\n return useDashboardStore(selectDiscardChangesConfirmationDialog);\n}\n"],"names":["useCallback","useMemo","useDashboardStore","selectEditMode","isEditMode","setEditMode","useEditMode","selectDashboardActions","setDashboard","openAddPanelGroup","openAddPanel","useDashboardActions","selectPanelGroupOrder","state","panelGroupOrder","usePanelGroupIds","selectPanelGroups","panelGroups","useListPanelGroups","panelGroupIds","map","id","group","undefined","Error","usePanelGroup","panelGroupId","panelGroup","selectPanelGroupActions","openEditPanelGroup","deletePanelGroup","updatePanelGroupLayouts","usePanelGroupActions","moveUp","moveDown","useMovePanelGroup","itemLayouts","selectSwapPanelGroups","swapPanelGroups","selectPanelGroupsLength","length","currentIndex","store","findIndex","panelGroupsLength","selectPanelGroupEditor","panelGroupEditor","usePanelGroupEditor","selectDeletePanelGroupDialog","deletePanelGroupDialog","openDeletePanelGroupDialog","closeDeletePanelGroupDialog","useDeletePanelGroupDialog","usePanel","panelGroupItemId","panelGroupItemLayoutId","panelGroupLayoutId","panel","panelKey","itemPanelKeys","panels","selectPanelActions","openEditPanel","openDeletePanelDialog","duplicatePanel","usePanelActions","selectPanelEditor","panelEditor","usePanelEditor","selectDeletePanelDialog","deletePanelDialog","deletePanel","closeDeletePanelDialog","useDeletePanelDialog","selectDefaultTimeRange","defaultTimeRange","useDefaultTimeRange","selectDiscardChangesConfirmationDialog","discardChangesConfirmationDialog","openDiscardChangesConfirmationDialog","closeDiscardChangesConfirmationDialog","useDiscardChangesConfirmationDialog"],"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,SAASA,WAAW,EAAEC,OAAO,QAAQ,OAAO,CAAC;AAC7C,SAA8BC,iBAAiB,QAAQ,qBAAqB,CAAC;AAG7E,MAAMC,cAAc,GAAG,CAAC,EAAEC,UAAU,CAAA,EAAEC,WAAW,CAAA,EAAuB,GAAM,CAAA;QAAED,UAAU;QAAEC,WAAW;KAAE,CAAA,AAAC,AAAC;AAC3G,OAAO,SAASC,WAAW,GAAG;IAC5B,OAAOJ,iBAAiB,CAACC,cAAc,CAAC,CAAC;AAC3C,CAAC;AAED,MAAMI,sBAAsB,GAAG,CAAC,EAAEC,YAAY,CAAA,EAAEC,iBAAiB,CAAA,EAAEC,YAAY,CAAA,EAAuB,GAAM,CAAA;QAC1GF,YAAY;QACZC,iBAAiB;QACjBC,YAAY;KACb,CAAA,AAAC,AAAC;AACH;;CAEC,GACD,OAAO,SAASC,mBAAmB,GAAG;IACpC,MAAM,EAAEH,YAAY,CAAA,EAAEC,iBAAiB,CAAA,EAAEC,YAAY,CAAA,EAAE,GAAGR,iBAAiB,CAACK,sBAAsB,CAAC,AAAC;IACpG,OAAO;QACLC,YAAY;QACZC,iBAAiB,EAAE,IAAMA,iBAAiB,EAAE;QAC5CC,YAAY,EAAE,IAAMA,YAAY,EAAE;KACnC,CAAC;AACJ,CAAC;AAED,MAAME,qBAAqB,GAAG,CAACC,KAA0B,GAAKA,KAAK,CAACC,eAAe,AAAC;AACpF;;CAEC,GACD,OAAO,SAASC,gBAAgB,GAAG;IACjC,OAAOb,iBAAiB,CAACU,qBAAqB,CAAC,CAAC;AAClD,CAAC;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,EAAE,IAAMA,cAAc,CAACV,gBAAgB,CAAC;KACvD,CAAC;AACJ,CAAC;AAED,MAAMY,iBAAiB,GAAG,CAACrD,KAA0B,GAAKA,KAAK,CAACsD,WAAW,AAAC;AAC5E;;CAEC,GACD,OAAO,SAASC,cAAc,GAAG;IAC/B,OAAOlE,iBAAiB,CAACgE,iBAAiB,CAAC,CAAC;AAC9C,CAAC;AAED,MAAMG,uBAAuB,GAAG,CAAC,EAAEC,iBAAiB,CAAA,EAAEC,WAAW,CAAA,EAAEC,sBAAsB,CAAA,EAAuB,GAAM,CAAA;QACpHF,iBAAiB;QACjBC,WAAW;QACXC,sBAAsB;KACvB,CAAA,AAAC,AAAC;AAEH;;CAEC,GACD,OAAO,SAASC,oBAAoB,GAAG;IACrC,0FAA0F;IAC1F,OAAOvE,iBAAiB,CAACmE,uBAAuB,CAAC,CAAC;AACpD,CAAC;AAED,MAAMK,sBAAsB,GAAG,CAAC7D,KAA0B,GAAKA,KAAK,CAAC8D,gBAAgB,AAAC;AACtF,OAAO,SAASC,mBAAmB,GAAG;IACpC,OAAO1E,iBAAiB,CAACwE,sBAAsB,CAAC,CAAC;AACnD,CAAC;AAED,MAAMG,sCAAsC,GAAG,CAAC,EAC9CC,gCAAgC,CAAA,EAChCC,oCAAoC,CAAA,EACpCC,qCAAqC,CAAA,EACjB,GAAM,CAAA;QAC1BF,gCAAgC;QAChCC,oCAAoC;QACpCC,qCAAqC;KACtC,CAAA,AAAC,AAAC;AACH,OAAO,SAASC,mCAAmC,GAAG;IACpD,OAAO/E,iBAAiB,CAAC2E,sCAAsC,CAAC,CAAC;AACnE,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../src/context/DashboardProvider/dashboard-provider-api.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\nimport { useCallback, useMemo } from 'react';\nimport { DashboardStoreState, useDashboardStore } from './DashboardProvider';\nimport { PanelGroupItemId, PanelGroupId, PanelGroupItemLayout } from './panel-group-slice';\n\nconst selectEditMode = ({ isEditMode, setEditMode }: DashboardStoreState) => ({ isEditMode, setEditMode });\nexport function useEditMode() {\n return useDashboardStore(selectEditMode);\n}\n\nconst selectDashboardActions = ({ setDashboard, openAddPanelGroup, openAddPanel }: DashboardStoreState) => ({\n setDashboard,\n openAddPanelGroup,\n openAddPanel,\n});\n/**\n * Returns actions that can be performed on the current dashboard.\n */\nexport function useDashboardActions() {\n const { setDashboard, openAddPanelGroup, openAddPanel } = useDashboardStore(selectDashboardActions);\n return {\n setDashboard,\n openAddPanelGroup: () => openAddPanelGroup(),\n openAddPanel: () => openAddPanel(),\n };\n}\n\nconst selectPanelGroupOrder = (state: DashboardStoreState) => state.panelGroupOrder;\n/**\n * Returns an array of PanelGroupIds in the order they appear in the dashboard.\n */\nexport function usePanelGroupIds() {\n return useDashboardStore(selectPanelGroupOrder);\n}\n\nconst selectPanelGroups = (state: DashboardStoreState) => state.panelGroups;\n/**\n * Returns an array of PanelGroupDefinitions in the order they appear in the dashboard.\n */\nexport function useListPanelGroups() {\n const panelGroupIds = usePanelGroupIds();\n const panelGroups = useDashboardStore(selectPanelGroups);\n return useMemo(() => {\n return panelGroupIds.map((id) => {\n const group = panelGroups[id];\n if (group === undefined) {\n throw new Error(`Invalid panel group Id found ${id}`);\n }\n return group;\n });\n }, [panelGroupIds, panelGroups]);\n}\n\n/**\n * Gets a specific panel group by its id. Throws if the panel group does not exist.\n */\nexport function usePanelGroup(panelGroupId: PanelGroupId) {\n const panelGroup = useDashboardStore(useCallback((state) => state.panelGroups[panelGroupId], [panelGroupId]));\n if (panelGroup === undefined) {\n throw new Error(`Panel group with Id ${panelGroupId} was not found`);\n }\n return panelGroup;\n}\n\nconst selectPanelGroupActions = ({\n openEditPanelGroup,\n deletePanelGroup,\n openAddPanel,\n updatePanelGroupLayouts,\n}: DashboardStoreState) => ({\n openEditPanelGroup,\n deletePanelGroup,\n openAddPanel,\n updatePanelGroupLayouts,\n});\n/**\n * Returns actions that can be performed on the given panel group.\n */\nexport function usePanelGroupActions(panelGroupId: PanelGroupId) {\n const { moveUp, moveDown } = useMovePanelGroup(panelGroupId);\n const { openEditPanelGroup, deletePanelGroup, openAddPanel, updatePanelGroupLayouts } =\n useDashboardStore(selectPanelGroupActions);\n\n return {\n openEditPanelGroup: () => openEditPanelGroup(panelGroupId),\n deletePanelGroup: () => deletePanelGroup(panelGroupId),\n openAddPanel: () => openAddPanel(panelGroupId),\n moveUp,\n moveDown,\n updatePanelGroupLayouts: (itemLayouts: PanelGroupItemLayout[]) =>\n updatePanelGroupLayouts(panelGroupId, itemLayouts),\n };\n}\n\nconst selectSwapPanelGroups = (state: DashboardStoreState) => state.swapPanelGroups;\nconst selectPanelGroupsLength = (state: DashboardStoreState) => state.panelGroupOrder.length;\n/**\n * Returns functions for moving a panel group up or down. A function will be undefined if the panel group can't be\n * moved in that direction.\n */\nfunction useMovePanelGroup(panelGroupId: PanelGroupId) {\n const currentIndex = useDashboardStore(\n useCallback((store) => store.panelGroupOrder.findIndex((id) => id === panelGroupId), [panelGroupId])\n );\n const panelGroupsLength = useDashboardStore(selectPanelGroupsLength);\n const swapPanelGroups = useDashboardStore(selectSwapPanelGroups);\n\n if (currentIndex < 0) {\n throw new Error(`Could not find panel group with Id ${panelGroupId} in order array`);\n }\n\n const moveUp = () => swapPanelGroups(currentIndex, currentIndex - 1);\n const moveDown = () => swapPanelGroups(currentIndex, currentIndex + 1);\n return {\n moveUp: currentIndex > 0 ? moveUp : undefined,\n moveDown: currentIndex < panelGroupsLength - 1 ? moveDown : undefined,\n };\n}\n\nconst selectPanelGroupEditor = (state: DashboardStoreState) => state.panelGroupEditor;\n/**\n * Gets the Panel Group editor state.\n */\nexport function usePanelGroupEditor() {\n return useDashboardStore(selectPanelGroupEditor);\n}\n\nconst selectDeletePanelGroupDialog = ({\n deletePanelGroupDialog,\n openDeletePanelGroupDialog,\n closeDeletePanelGroupDialog,\n deletePanelGroup,\n}: DashboardStoreState) => ({\n deletePanelGroupDialog,\n openDeletePanelGroupDialog,\n closeDeletePanelGroupDialog,\n deletePanelGroup,\n});\n/**\n * Gets the Delete Panel Group dialog state.\n */\nexport function useDeletePanelGroupDialog() {\n const { deletePanelGroupDialog, openDeletePanelGroupDialog, closeDeletePanelGroupDialog, deletePanelGroup } =\n useDashboardStore(selectDeletePanelGroupDialog);\n return {\n deletePanelGroupDialog,\n deletePanelGroup,\n openDeletePanelGroupDialog,\n closeDeletePanelGroupDialog: () => closeDeletePanelGroupDialog(),\n };\n}\n\n/**\n * Gets an individual panel in the store. Throws if the panel can't be found.\n */\nexport function usePanel(panelGroupItemId: PanelGroupItemId) {\n const { panelGroupId, panelGroupItemLayoutId: panelGroupLayoutId } = panelGroupItemId;\n const panel = useDashboardStore(\n useCallback(\n (store) => {\n const panelKey = store.panelGroups[panelGroupId]?.itemPanelKeys[panelGroupLayoutId];\n if (panelKey === undefined) return;\n return store.panels[panelKey];\n },\n [panelGroupId, panelGroupLayoutId]\n )\n );\n\n if (panel === undefined) {\n throw new Error(`Could not find panel for Id ${panelGroupItemId}`);\n }\n return panel;\n}\n\nconst selectPanelActions = ({ openEditPanel, openDeletePanelDialog, duplicatePanel }: DashboardStoreState) => ({\n openEditPanel,\n openDeletePanelDialog,\n duplicatePanel,\n});\n\n/**\n * Returns actions that can be performed on the given Panel.\n */\nexport function usePanelActions(panelGroupItemId: PanelGroupItemId) {\n const { openEditPanel, openDeletePanelDialog, duplicatePanel } = useDashboardStore(selectPanelActions);\n return {\n openEditPanel: () => openEditPanel(panelGroupItemId),\n openDeletePanelDialog: () => openDeletePanelDialog(panelGroupItemId),\n duplicatePanel: () => duplicatePanel(panelGroupItemId),\n };\n}\n\nconst selectPanelEditor = (state: DashboardStoreState) => state.panelEditor;\n/**\n * Gets the state for the Panel Editor.\n */\nexport function usePanelEditor() {\n return useDashboardStore(selectPanelEditor);\n}\n\nconst selectDeletePanelDialog = ({ deletePanelDialog, deletePanel, closeDeletePanelDialog }: DashboardStoreState) => ({\n deletePanelDialog,\n deletePanel,\n closeDeletePanelDialog,\n});\n\n/**\n * Gets the state for the Delete Panel dialog.\n */\nexport function useDeletePanelDialog() {\n // TODO: Refactor similar to other dialogs/editors so these are on the editor state itself\n return useDashboardStore(selectDeletePanelDialog);\n}\n\nconst selectDefaultTimeRange = (state: DashboardStoreState) => state.defaultTimeRange;\nexport function useDefaultTimeRange() {\n return useDashboardStore(selectDefaultTimeRange);\n}\n\nconst selectDiscardChangesConfirmationDialog = ({\n discardChangesConfirmationDialog,\n openDiscardChangesConfirmationDialog,\n closeDiscardChangesConfirmationDialog,\n}: DashboardStoreState) => ({\n discardChangesConfirmationDialog,\n openDiscardChangesConfirmationDialog,\n closeDiscardChangesConfirmationDialog,\n});\nexport function useDiscardChangesConfirmationDialog() {\n return useDashboardStore(selectDiscardChangesConfirmationDialog);\n}\n\nconst selectEditJsonDialog = ({ editJsonDialog, openEditJsonDialog, closeEditJsonDialog }: DashboardStoreState) => ({\n editJsonDialog,\n openEditJsonDialog,\n closeEditJsonDialog,\n});\n/**\n * Gets the state for the edit JSON dialog.\n */\nexport function useEditJsonDialog() {\n return useDashboardStore(selectEditJsonDialog);\n}\n"],"names":["useCallback","useMemo","useDashboardStore","selectEditMode","isEditMode","setEditMode","useEditMode","selectDashboardActions","setDashboard","openAddPanelGroup","openAddPanel","useDashboardActions","selectPanelGroupOrder","state","panelGroupOrder","usePanelGroupIds","selectPanelGroups","panelGroups","useListPanelGroups","panelGroupIds","map","id","group","undefined","Error","usePanelGroup","panelGroupId","panelGroup","selectPanelGroupActions","openEditPanelGroup","deletePanelGroup","updatePanelGroupLayouts","usePanelGroupActions","moveUp","moveDown","useMovePanelGroup","itemLayouts","selectSwapPanelGroups","swapPanelGroups","selectPanelGroupsLength","length","currentIndex","store","findIndex","panelGroupsLength","selectPanelGroupEditor","panelGroupEditor","usePanelGroupEditor","selectDeletePanelGroupDialog","deletePanelGroupDialog","openDeletePanelGroupDialog","closeDeletePanelGroupDialog","useDeletePanelGroupDialog","usePanel","panelGroupItemId","panelGroupItemLayoutId","panelGroupLayoutId","panel","panelKey","itemPanelKeys","panels","selectPanelActions","openEditPanel","openDeletePanelDialog","duplicatePanel","usePanelActions","selectPanelEditor","panelEditor","usePanelEditor","selectDeletePanelDialog","deletePanelDialog","deletePanel","closeDeletePanelDialog","useDeletePanelDialog","selectDefaultTimeRange","defaultTimeRange","useDefaultTimeRange","selectDiscardChangesConfirmationDialog","discardChangesConfirmationDialog","openDiscardChangesConfirmationDialog","closeDiscardChangesConfirmationDialog","useDiscardChangesConfirmationDialog","selectEditJsonDialog","editJsonDialog","openEditJsonDialog","closeEditJsonDialog","useEditJsonDialog"],"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,SAASA,WAAW,EAAEC,OAAO,QAAQ,OAAO,CAAC;AAC7C,SAA8BC,iBAAiB,QAAQ,qBAAqB,CAAC;AAG7E,MAAMC,cAAc,GAAG,CAAC,EAAEC,UAAU,CAAA,EAAEC,WAAW,CAAA,EAAuB,GAAM,CAAA;QAAED,UAAU;QAAEC,WAAW;KAAE,CAAA,AAAC,AAAC;AAC3G,OAAO,SAASC,WAAW,GAAG;IAC5B,OAAOJ,iBAAiB,CAACC,cAAc,CAAC,CAAC;AAC3C,CAAC;AAED,MAAMI,sBAAsB,GAAG,CAAC,EAAEC,YAAY,CAAA,EAAEC,iBAAiB,CAAA,EAAEC,YA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