@perses-dev/dashboards 0.0.0-snapshot-scatter-chart-embed-8efdfab → 0.0.0-snapshot-scatterplot-fix-imports-95e1b59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/AddGroupButton/AddGroupButton.js +1 -1
- package/dist/cjs/components/AddPanelButton/AddPanelButton.js +2 -2
- package/dist/cjs/components/Dashboard/Dashboard.js +1 -1
- package/dist/cjs/components/DashboardStickyToolbar/DashboardStickyToolbar.js +2 -2
- package/dist/cjs/components/DashboardToolbar/DashboardToolbar.js +5 -5
- package/dist/cjs/components/Datasources/DatasourceEditor.js +2 -3
- package/dist/cjs/components/Datasources/EditDatasourcesButton.js +10 -4
- package/dist/cjs/components/DeletePanelDialog/DeletePanelDialog.js +4 -4
- package/dist/cjs/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +1 -1
- package/dist/cjs/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js +1 -1
- package/dist/cjs/components/DownloadButton/DownloadButton.js +3 -4
- package/dist/cjs/components/EditButton/EditButton.js +1 -1
- package/dist/cjs/components/EditJsonButton/EditJsonButton.js +3 -4
- package/dist/cjs/components/EditJsonDialog/EditJsonDialog.js +14 -7
- package/dist/cjs/components/EmptyDashboard/EmptyDashboard.js +3 -3
- package/dist/cjs/components/GridLayout/GridContainer.js +1 -1
- package/dist/cjs/components/GridLayout/GridItemContent.js +6 -7
- package/dist/cjs/components/GridLayout/GridLayout.js +4 -4
- package/dist/cjs/components/GridLayout/GridTitle.js +5 -6
- package/dist/cjs/components/Panel/Panel.js +2 -2
- package/dist/cjs/components/Panel/PanelContent.js +2 -2
- package/dist/cjs/components/Panel/PanelHeader.js +2 -2
- package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +18 -15
- package/dist/cjs/components/PanelDrawer/PanelPreview.js +2 -3
- package/dist/cjs/components/PanelDrawer/usePanelEditor.js +2 -2
- package/dist/cjs/components/PanelGroupDialog/PanelGroupEditorForm.js +1 -1
- package/dist/cjs/components/QuerySummaryTable/QuerySummaryTable.js +2 -2
- package/dist/cjs/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +4 -4
- package/dist/cjs/components/SaveDashboardButton/SaveDashboardButton.js +7 -7
- package/dist/cjs/components/Variables/BuiltinVariableAccordions.js +7 -6
- package/dist/cjs/components/Variables/EditVariablesButton.js +2 -2
- package/dist/cjs/components/Variables/TemplateVariable.js +20 -11
- package/dist/cjs/components/Variables/VariableEditor.js +13 -14
- package/dist/cjs/components/Variables/VariableList.js +1 -1
- package/dist/cjs/components/index.js +0 -2
- package/dist/cjs/constants/styles.js +4 -4
- package/dist/cjs/constants/user-interface-text.js +3 -5
- package/dist/cjs/context/DashboardProvider/DashboardProvider.js +15 -10
- package/dist/cjs/context/DashboardProvider/common.js +3 -3
- package/dist/cjs/context/DashboardProvider/dashboard-provider-api.js +40 -40
- package/dist/cjs/context/DashboardProvider/delete-panel-group-slice.js +1 -1
- package/dist/cjs/context/DashboardProvider/delete-panel-slice.js +3 -3
- package/dist/cjs/context/DashboardProvider/duplicate-panel-slice.js +1 -1
- package/dist/cjs/context/DashboardProvider/panel-editor-slice.js +4 -6
- package/dist/cjs/context/DashboardProvider/panel-group-slice.js +6 -6
- package/dist/cjs/context/DatasourceStoreProvider.js +15 -9
- package/dist/cjs/context/TemplateVariableProvider/TemplateVariableProvider.js +81 -77
- package/dist/cjs/context/TemplateVariableProvider/query-params.js +7 -7
- package/dist/cjs/context/TemplateVariableProvider/utils.js +3 -3
- package/dist/cjs/context/useDashboard.js +21 -6
- package/dist/cjs/test/dashboard-provider.js +3 -3
- package/dist/cjs/test/datasource-provider.js +4 -4
- package/dist/cjs/test/render.js +1 -1
- package/dist/cjs/utils/index.js +0 -1
- package/dist/cjs/utils/panelUtils.js +5 -5
- package/dist/cjs/views/ViewDashboard/DashboardApp.js +5 -5
- package/dist/cjs/views/ViewDashboard/ViewDashboard.js +3 -3
- package/dist/components/AddGroupButton/AddGroupButton.d.ts +1 -2
- package/dist/components/AddGroupButton/AddGroupButton.d.ts.map +1 -1
- package/dist/components/AddGroupButton/AddGroupButton.js +1 -1
- package/dist/components/AddGroupButton/AddGroupButton.js.map +1 -1
- package/dist/components/AddPanelButton/AddPanelButton.d.ts +1 -2
- package/dist/components/AddPanelButton/AddPanelButton.d.ts.map +1 -1
- package/dist/components/AddPanelButton/AddPanelButton.js +2 -2
- package/dist/components/AddPanelButton/AddPanelButton.js.map +1 -1
- package/dist/components/Dashboard/Dashboard.d.ts +2 -3
- package/dist/components/Dashboard/Dashboard.d.ts.map +1 -1
- package/dist/components/Dashboard/Dashboard.js +1 -1
- package/dist/components/Dashboard/Dashboard.js.map +1 -1
- package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.d.ts +1 -2
- package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.d.ts.map +1 -1
- package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js +1 -1
- package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js.map +1 -1
- package/dist/components/DashboardToolbar/DashboardToolbar.d.ts +1 -1
- package/dist/components/DashboardToolbar/DashboardToolbar.d.ts.map +1 -1
- package/dist/components/DashboardToolbar/DashboardToolbar.js +4 -4
- package/dist/components/DashboardToolbar/DashboardToolbar.js.map +1 -1
- package/dist/components/Datasources/DatasourceEditor.d.ts +1 -2
- package/dist/components/Datasources/DatasourceEditor.d.ts.map +1 -1
- package/dist/components/Datasources/DatasourceEditor.js +2 -3
- package/dist/components/Datasources/DatasourceEditor.js.map +1 -1
- package/dist/components/Datasources/EditDatasourcesButton.d.ts +1 -2
- package/dist/components/Datasources/EditDatasourcesButton.d.ts.map +1 -1
- package/dist/components/Datasources/EditDatasourcesButton.js +10 -4
- package/dist/components/Datasources/EditDatasourcesButton.js.map +1 -1
- package/dist/components/DeletePanelDialog/DeletePanelDialog.d.ts +1 -2
- package/dist/components/DeletePanelDialog/DeletePanelDialog.d.ts.map +1 -1
- package/dist/components/DeletePanelDialog/DeletePanelDialog.js +4 -4
- package/dist/components/DeletePanelDialog/DeletePanelDialog.js.map +1 -1
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.d.ts +1 -2
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.d.ts.map +1 -1
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +1 -1
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js.map +1 -1
- package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.d.ts +1 -2
- package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.d.ts.map +1 -1
- package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js +1 -1
- package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js.map +1 -1
- package/dist/components/DownloadButton/DownloadButton.d.ts +1 -2
- package/dist/components/DownloadButton/DownloadButton.d.ts.map +1 -1
- package/dist/components/DownloadButton/DownloadButton.js +3 -4
- package/dist/components/DownloadButton/DownloadButton.js.map +1 -1
- package/dist/components/EditButton/EditButton.d.ts +1 -2
- package/dist/components/EditButton/EditButton.d.ts.map +1 -1
- package/dist/components/EditButton/EditButton.js +1 -1
- package/dist/components/EditButton/EditButton.js.map +1 -1
- package/dist/components/EditJsonButton/EditJsonButton.d.ts +1 -2
- package/dist/components/EditJsonButton/EditJsonButton.d.ts.map +1 -1
- package/dist/components/EditJsonButton/EditJsonButton.js +3 -4
- package/dist/components/EditJsonButton/EditJsonButton.js.map +1 -1
- package/dist/components/EditJsonDialog/EditJsonDialog.d.ts +1 -2
- package/dist/components/EditJsonDialog/EditJsonDialog.d.ts.map +1 -1
- package/dist/components/EditJsonDialog/EditJsonDialog.js +14 -7
- package/dist/components/EditJsonDialog/EditJsonDialog.js.map +1 -1
- package/dist/components/EmptyDashboard/EmptyDashboard.d.ts +1 -1
- package/dist/components/EmptyDashboard/EmptyDashboard.d.ts.map +1 -1
- package/dist/components/EmptyDashboard/EmptyDashboard.js +3 -3
- package/dist/components/EmptyDashboard/EmptyDashboard.js.map +1 -1
- package/dist/components/GridLayout/GridContainer.d.ts +1 -1
- package/dist/components/GridLayout/GridContainer.d.ts.map +1 -1
- package/dist/components/GridLayout/GridContainer.js +1 -1
- package/dist/components/GridLayout/GridContainer.js.map +1 -1
- package/dist/components/GridLayout/GridItemContent.d.ts +1 -2
- package/dist/components/GridLayout/GridItemContent.d.ts.map +1 -1
- package/dist/components/GridLayout/GridItemContent.js +6 -7
- package/dist/components/GridLayout/GridItemContent.js.map +1 -1
- package/dist/components/GridLayout/GridLayout.d.ts +1 -2
- package/dist/components/GridLayout/GridLayout.d.ts.map +1 -1
- package/dist/components/GridLayout/GridLayout.js +4 -4
- package/dist/components/GridLayout/GridLayout.js.map +1 -1
- package/dist/components/GridLayout/GridTitle.d.ts +1 -2
- package/dist/components/GridLayout/GridTitle.d.ts.map +1 -1
- package/dist/components/GridLayout/GridTitle.js +5 -6
- package/dist/components/GridLayout/GridTitle.js.map +1 -1
- package/dist/components/Panel/Panel.d.ts +2 -2
- package/dist/components/Panel/Panel.d.ts.map +1 -1
- package/dist/components/Panel/Panel.js +2 -2
- package/dist/components/Panel/Panel.js.map +1 -1
- package/dist/components/Panel/PanelContent.d.ts +1 -2
- package/dist/components/Panel/PanelContent.d.ts.map +1 -1
- package/dist/components/Panel/PanelContent.js +2 -2
- package/dist/components/Panel/PanelContent.js.map +1 -1
- package/dist/components/Panel/PanelHeader.d.ts +2 -2
- package/dist/components/Panel/PanelHeader.d.ts.map +1 -1
- package/dist/components/Panel/PanelHeader.js +2 -2
- package/dist/components/Panel/PanelHeader.js.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.d.ts +1 -2
- package/dist/components/PanelDrawer/PanelDrawer.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.d.ts +1 -2
- package/dist/components/PanelDrawer/PanelEditorForm.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.js +18 -15
- package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -1
- package/dist/components/PanelDrawer/PanelPreview.d.ts +1 -2
- package/dist/components/PanelDrawer/PanelPreview.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelPreview.js +2 -3
- package/dist/components/PanelDrawer/PanelPreview.js.map +1 -1
- package/dist/components/PanelDrawer/usePanelEditor.js +2 -2
- package/dist/components/PanelDrawer/usePanelEditor.js.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts +1 -2
- package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.js.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.d.ts +1 -2
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.d.ts.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.js +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.js.map +1 -1
- package/dist/components/QuerySummaryTable/QuerySummaryTable.d.ts +1 -2
- package/dist/components/QuerySummaryTable/QuerySummaryTable.d.ts.map +1 -1
- package/dist/components/QuerySummaryTable/QuerySummaryTable.js +2 -2
- package/dist/components/QuerySummaryTable/QuerySummaryTable.js.map +1 -1
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.d.ts +1 -2
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.d.ts.map +1 -1
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +4 -4
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js.map +1 -1
- package/dist/components/SaveDashboardButton/SaveDashboardButton.d.ts +1 -2
- package/dist/components/SaveDashboardButton/SaveDashboardButton.d.ts.map +1 -1
- package/dist/components/SaveDashboardButton/SaveDashboardButton.js +7 -7
- package/dist/components/SaveDashboardButton/SaveDashboardButton.js.map +1 -1
- package/dist/components/Variables/BuiltinVariableAccordions.d.ts +2 -3
- package/dist/components/Variables/BuiltinVariableAccordions.d.ts.map +1 -1
- package/dist/components/Variables/BuiltinVariableAccordions.js +7 -6
- package/dist/components/Variables/BuiltinVariableAccordions.js.map +1 -1
- package/dist/components/Variables/EditVariablesButton.d.ts +1 -2
- package/dist/components/Variables/EditVariablesButton.d.ts.map +1 -1
- package/dist/components/Variables/EditVariablesButton.js +2 -2
- package/dist/components/Variables/EditVariablesButton.js.map +1 -1
- package/dist/components/Variables/TemplateVariable.d.ts +2 -3
- package/dist/components/Variables/TemplateVariable.d.ts.map +1 -1
- package/dist/components/Variables/TemplateVariable.js +20 -11
- package/dist/components/Variables/TemplateVariable.js.map +1 -1
- package/dist/components/Variables/VariableEditor.d.ts +2 -3
- package/dist/components/Variables/VariableEditor.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditor.js +13 -14
- package/dist/components/Variables/VariableEditor.js.map +1 -1
- package/dist/components/Variables/VariableList.d.ts +2 -3
- package/dist/components/Variables/VariableList.d.ts.map +1 -1
- package/dist/components/Variables/VariableList.js +1 -1
- package/dist/components/Variables/VariableList.js.map +1 -1
- package/dist/components/index.d.ts +0 -2
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +0 -2
- package/dist/components/index.js.map +1 -1
- package/dist/constants/user-interface-text.d.ts +0 -2
- package/dist/constants/user-interface-text.d.ts.map +1 -1
- package/dist/constants/user-interface-text.js +0 -2
- package/dist/constants/user-interface-text.js.map +1 -1
- package/dist/context/DashboardProvider/DashboardProvider.d.ts +6 -4
- package/dist/context/DashboardProvider/DashboardProvider.d.ts.map +1 -1
- package/dist/context/DashboardProvider/DashboardProvider.js +12 -7
- package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -1
- package/dist/context/DashboardProvider/common.d.ts +3 -3
- package/dist/context/DashboardProvider/common.d.ts.map +1 -1
- package/dist/context/DashboardProvider/common.js.map +1 -1
- package/dist/context/DashboardProvider/dashboard-provider-api.d.ts +1 -1
- package/dist/context/DashboardProvider/dashboard-provider-api.js +15 -15
- package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -1
- package/dist/context/DashboardProvider/delete-panel-group-slice.js +1 -1
- package/dist/context/DashboardProvider/delete-panel-group-slice.js.map +1 -1
- package/dist/context/DashboardProvider/delete-panel-slice.js +3 -3
- package/dist/context/DashboardProvider/delete-panel-slice.js.map +1 -1
- package/dist/context/DashboardProvider/discard-changes-dialog-slice.js.map +1 -1
- package/dist/context/DashboardProvider/duplicate-panel-slice.js +1 -1
- package/dist/context/DashboardProvider/duplicate-panel-slice.js.map +1 -1
- package/dist/context/DashboardProvider/edit-json-dialog-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-editor-slice.js +4 -6
- package/dist/context/DashboardProvider/panel-editor-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-group-editor-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-group-slice.d.ts +2 -2
- package/dist/context/DashboardProvider/panel-group-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/panel-group-slice.js +2 -2
- package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -1
- package/dist/context/DashboardProvider/save-changes-dialog-slice.js.map +1 -1
- package/dist/context/DatasourceStoreProvider.d.ts +5 -5
- package/dist/context/DatasourceStoreProvider.d.ts.map +1 -1
- package/dist/context/DatasourceStoreProvider.js +15 -9
- package/dist/context/DatasourceStoreProvider.js.map +1 -1
- package/dist/context/TemplateVariableProvider/TemplateVariableProvider.d.ts +6 -6
- package/dist/context/TemplateVariableProvider/TemplateVariableProvider.d.ts.map +1 -1
- package/dist/context/TemplateVariableProvider/TemplateVariableProvider.js +70 -66
- package/dist/context/TemplateVariableProvider/TemplateVariableProvider.js.map +1 -1
- package/dist/context/TemplateVariableProvider/hydrationUtils.d.ts.map +1 -1
- package/dist/context/TemplateVariableProvider/hydrationUtils.js.map +1 -1
- package/dist/context/TemplateVariableProvider/query-params.js.map +1 -1
- package/dist/context/TemplateVariableProvider/utils.js.map +1 -1
- package/dist/context/useDashboard.d.ts +3 -3
- package/dist/context/useDashboard.d.ts.map +1 -1
- package/dist/context/useDashboard.js +21 -6
- package/dist/context/useDashboard.js.map +1 -1
- package/dist/stories/decorators/WithDashboard.js.map +1 -1
- package/dist/stories/decorators/WithDatasourceStore.js.map +1 -1
- package/dist/stories/decorators/WithTemplateVariables.js.map +1 -1
- package/dist/test/dashboard-provider.js.map +1 -1
- package/dist/test/datasource-provider.js.map +1 -1
- package/dist/test/render.js +1 -1
- package/dist/test/render.js.map +1 -1
- package/dist/test/setup-tests.js.map +1 -1
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +0 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/panelUtils.d.ts +1 -1
- package/dist/utils/panelUtils.d.ts.map +1 -1
- package/dist/utils/panelUtils.js +2 -2
- package/dist/utils/panelUtils.js.map +1 -1
- package/dist/validation/panel.d.ts +1 -1
- package/dist/validation/panel.d.ts.map +1 -1
- package/dist/validation/panel.js.map +1 -1
- package/dist/views/ViewDashboard/DashboardApp.d.ts +3 -3
- package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -1
- package/dist/views/ViewDashboard/DashboardApp.js +5 -5
- package/dist/views/ViewDashboard/DashboardApp.js.map +1 -1
- package/dist/views/ViewDashboard/ViewDashboard.d.ts +1 -2
- package/dist/views/ViewDashboard/ViewDashboard.d.ts.map +1 -1
- package/dist/views/ViewDashboard/ViewDashboard.js +3 -3
- package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -1
- package/package.json +6 -6
- package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +0 -210
- package/dist/cjs/components/TimeRangeControls/index.js +0 -30
- package/dist/cjs/components/ToolbarIconButton/ToolbarIconButton.js +0 -40
- package/dist/cjs/components/ToolbarIconButton/index.js +0 -30
- package/dist/cjs/utils/time.js +0 -29
- package/dist/components/TimeRangeControls/TimeRangeControls.d.ts +0 -14
- package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +0 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.js +0 -186
- package/dist/components/TimeRangeControls/TimeRangeControls.js.map +0 -1
- package/dist/components/TimeRangeControls/index.d.ts +0 -2
- package/dist/components/TimeRangeControls/index.d.ts.map +0 -1
- package/dist/components/TimeRangeControls/index.js +0 -15
- package/dist/components/TimeRangeControls/index.js.map +0 -1
- package/dist/components/ToolbarIconButton/ToolbarIconButton.d.ts +0 -6
- package/dist/components/ToolbarIconButton/ToolbarIconButton.d.ts.map +0 -1
- package/dist/components/ToolbarIconButton/ToolbarIconButton.js +0 -32
- package/dist/components/ToolbarIconButton/ToolbarIconButton.js.map +0 -1
- package/dist/components/ToolbarIconButton/index.d.ts +0 -2
- package/dist/components/ToolbarIconButton/index.d.ts.map +0 -1
- package/dist/components/ToolbarIconButton/index.js +0 -15
- package/dist/components/ToolbarIconButton/index.js.map +0 -1
- package/dist/utils/time.d.ts +0 -5
- package/dist/utils/time.d.ts.map +0 -1
- package/dist/utils/time.js +0 -23
- package/dist/utils/time.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/views/ViewDashboard/ViewDashboard.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, BoxProps } from '@mui/material';\nimport { BuiltinVariableDefinition, DEFAULT_DASHBOARD_DURATION, DEFAULT_REFRESH_INTERVAL } from '@perses-dev/core';\nimport { ErrorBoundary, ErrorAlert, combineSx } from '@perses-dev/components';\nimport {\n TimeRangeProviderWithQueryParams,\n useInitialRefreshInterval,\n useInitialTimeRange,\n usePluginBuiltinVariableDefinitions,\n} from '@perses-dev/plugin-system';\nimport { useMemo } from 'react';\nimport {\n DashboardProvider,\n DatasourceStoreProviderProps,\n DatasourceStoreProvider,\n TemplateVariableProviderProps,\n TemplateVariableProviderWithQueryParams,\n} from '../../context';\nimport { DashboardApp, DashboardAppProps } from './DashboardApp';\n\nexport interface ViewDashboardProps extends Omit<BoxProps, 'children'>, DashboardAppProps {\n datasourceApi: DatasourceStoreProviderProps['datasourceApi'];\n externalVariableDefinitions?: TemplateVariableProviderProps['externalVariableDefinitions'];\n isEditing?: boolean;\n isCreating?: boolean;\n}\n\n/**\n * The View for displaying a Dashboard, along with the UI for selecting variable values.\n */\nexport function ViewDashboard(props: ViewDashboardProps) {\n const {\n dashboardResource,\n datasourceApi,\n externalVariableDefinitions,\n dashboardTitleComponent,\n emptyDashboardProps,\n onSave,\n onDiscard,\n initialVariableIsSticky,\n isReadonly,\n isEditing,\n isCreating,\n sx,\n ...others\n } = props;\n const { spec } = dashboardResource;\n const dashboardDuration = spec.duration ?? DEFAULT_DASHBOARD_DURATION;\n const dashboardRefreshInterval = spec.refreshInterval ?? DEFAULT_REFRESH_INTERVAL;\n const initialTimeRange = useInitialTimeRange(dashboardDuration);\n const initialRefreshInterval = useInitialRefreshInterval(dashboardRefreshInterval);\n const { data } = usePluginBuiltinVariableDefinitions();\n\n const builtinVariables = useMemo(() => {\n const result = [\n {\n kind: 'BuiltinVariable',\n spec: {\n name: '__dashboard',\n value: () => dashboardResource.metadata.name,\n source: 'Dashboard',\n display: {\n name: '__dashboard',\n description: 'The name of the current dashboard',\n hidden: true,\n },\n },\n } as BuiltinVariableDefinition,\n {\n kind: 'BuiltinVariable',\n spec: {\n name: '__project',\n value: () => dashboardResource.metadata.project,\n source: 'Dashboard',\n display: {\n name: '__project',\n description: 'The name of the current dashboard project',\n hidden: true,\n },\n },\n } as BuiltinVariableDefinition,\n ];\n if (data) {\n data.forEach((def: BuiltinVariableDefinition) => result.push(def));\n }\n return result;\n }, [dashboardResource.metadata.name, dashboardResource.metadata.project, data]);\n\n return (\n <DatasourceStoreProvider dashboardResource={dashboardResource} datasourceApi={datasourceApi}>\n <DashboardProvider initialState={{ dashboardResource, isEditMode: !!isEditing }}>\n <TimeRangeProviderWithQueryParams\n initialTimeRange={initialTimeRange}\n initialRefreshInterval={initialRefreshInterval}\n >\n <TemplateVariableProviderWithQueryParams\n initialVariableDefinitions={spec.variables}\n externalVariableDefinitions={externalVariableDefinitions}\n builtinVariables={builtinVariables}\n >\n <Box\n sx={combineSx(\n {\n display: 'flex',\n width: '100%',\n height: '100%',\n position: 'relative',\n overflow: 'hidden',\n },\n sx\n )}\n {...others}\n >\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <DashboardApp\n dashboardResource={dashboardResource}\n dashboardTitleComponent={dashboardTitleComponent}\n emptyDashboardProps={emptyDashboardProps}\n onSave={onSave}\n onDiscard={onDiscard}\n initialVariableIsSticky={initialVariableIsSticky}\n isReadonly={isReadonly}\n isCreating={isCreating}\n />\n </ErrorBoundary>\n </Box>\n </TemplateVariableProviderWithQueryParams>\n </TimeRangeProviderWithQueryParams>\n </DashboardProvider>\n </DatasourceStoreProvider>\n );\n}\n"],"names":["Box","DEFAULT_DASHBOARD_DURATION","DEFAULT_REFRESH_INTERVAL","ErrorBoundary","ErrorAlert","combineSx","TimeRangeProviderWithQueryParams","useInitialRefreshInterval","useInitialTimeRange","usePluginBuiltinVariableDefinitions","useMemo","DashboardProvider","DatasourceStoreProvider","TemplateVariableProviderWithQueryParams","DashboardApp","ViewDashboard","props","dashboardResource","datasourceApi","externalVariableDefinitions","dashboardTitleComponent","emptyDashboardProps","onSave","onDiscard","initialVariableIsSticky","isReadonly","isEditing","isCreating","sx","others","spec","dashboardDuration","duration","dashboardRefreshInterval","refreshInterval","initialTimeRange","initialRefreshInterval","data","builtinVariables","result","kind","name","value","metadata","source","display","description","hidden","project","forEach","def","push","initialState","isEditMode","initialVariableDefinitions","variables","width","height","position","overflow","FallbackComponent"],"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,GAAG,QAAkB,gBAAgB;AAC9C,SAAoCC,0BAA0B,EAAEC,wBAAwB,QAAQ,mBAAmB;AACnH,SAASC,aAAa,EAAEC,UAAU,EAAEC,SAAS,QAAQ,yBAAyB;AAC9E,SACEC,gCAAgC,EAChCC,yBAAyB,EACzBC,mBAAmB,EACnBC,mCAAmC,QAC9B,4BAA4B;AACnC,SAASC,OAAO,QAAQ,QAAQ;AAChC,SACEC,iBAAiB,EAEjBC,uBAAuB,EAEvBC,uCAAuC,QAClC,gBAAgB;AACvB,SAASC,YAAY,QAA2B,iBAAiB;AASjE;;CAEC,GACD,OAAO,SAASC,cAAcC,KAAyB;IACrD,MAAM,EACJC,
|
|
1
|
+
{"version":3,"sources":["../../../src/views/ViewDashboard/ViewDashboard.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, BoxProps } from '@mui/material';\nimport { BuiltinVariableDefinition, DEFAULT_DASHBOARD_DURATION, DEFAULT_REFRESH_INTERVAL } from '@perses-dev/core';\nimport { ErrorBoundary, ErrorAlert, combineSx } from '@perses-dev/components';\nimport {\n TimeRangeProviderWithQueryParams,\n useInitialRefreshInterval,\n useInitialTimeRange,\n usePluginBuiltinVariableDefinitions,\n} from '@perses-dev/plugin-system';\nimport { useMemo } from 'react';\nimport {\n DashboardProvider,\n DatasourceStoreProviderProps,\n DatasourceStoreProvider,\n TemplateVariableProviderProps,\n TemplateVariableProviderWithQueryParams,\n} from '../../context';\nimport { DashboardApp, DashboardAppProps } from './DashboardApp';\n\nexport interface ViewDashboardProps extends Omit<BoxProps, 'children'>, DashboardAppProps {\n datasourceApi: DatasourceStoreProviderProps['datasourceApi'];\n externalVariableDefinitions?: TemplateVariableProviderProps['externalVariableDefinitions'];\n isEditing?: boolean;\n isCreating?: boolean;\n}\n\n/**\n * The View for displaying a Dashboard, along with the UI for selecting variable values.\n */\nexport function ViewDashboard(props: ViewDashboardProps) {\n const {\n dashboardResource,\n datasourceApi,\n externalVariableDefinitions,\n dashboardTitleComponent,\n emptyDashboardProps,\n onSave,\n onDiscard,\n initialVariableIsSticky,\n isReadonly,\n isEditing,\n isCreating,\n sx,\n ...others\n } = props;\n const { spec } = dashboardResource;\n const dashboardDuration = spec.duration ?? DEFAULT_DASHBOARD_DURATION;\n const dashboardRefreshInterval = spec.refreshInterval ?? DEFAULT_REFRESH_INTERVAL;\n const initialTimeRange = useInitialTimeRange(dashboardDuration);\n const initialRefreshInterval = useInitialRefreshInterval(dashboardRefreshInterval);\n const { data } = usePluginBuiltinVariableDefinitions();\n\n const builtinVariables = useMemo(() => {\n const result = [\n {\n kind: 'BuiltinVariable',\n spec: {\n name: '__dashboard',\n value: () => dashboardResource.metadata.name,\n source: 'Dashboard',\n display: {\n name: '__dashboard',\n description: 'The name of the current dashboard',\n hidden: true,\n },\n },\n } as BuiltinVariableDefinition,\n {\n kind: 'BuiltinVariable',\n spec: {\n name: '__project',\n value: () => dashboardResource.metadata.project,\n source: 'Dashboard',\n display: {\n name: '__project',\n description: 'The name of the current dashboard project',\n hidden: true,\n },\n },\n } as BuiltinVariableDefinition,\n ];\n if (data) {\n data.forEach((def: BuiltinVariableDefinition) => result.push(def));\n }\n return result;\n }, [dashboardResource.metadata.name, dashboardResource.metadata.project, data]);\n\n return (\n <DatasourceStoreProvider dashboardResource={dashboardResource} datasourceApi={datasourceApi}>\n <DashboardProvider initialState={{ dashboardResource, isEditMode: !!isEditing }}>\n <TimeRangeProviderWithQueryParams\n initialTimeRange={initialTimeRange}\n initialRefreshInterval={initialRefreshInterval}\n >\n <TemplateVariableProviderWithQueryParams\n initialVariableDefinitions={spec.variables}\n externalVariableDefinitions={externalVariableDefinitions}\n builtinVariables={builtinVariables}\n >\n <Box\n sx={combineSx(\n {\n display: 'flex',\n width: '100%',\n height: '100%',\n position: 'relative',\n overflow: 'hidden',\n },\n sx\n )}\n {...others}\n >\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <DashboardApp\n dashboardResource={dashboardResource}\n dashboardTitleComponent={dashboardTitleComponent}\n emptyDashboardProps={emptyDashboardProps}\n onSave={onSave}\n onDiscard={onDiscard}\n initialVariableIsSticky={initialVariableIsSticky}\n isReadonly={isReadonly}\n isCreating={isCreating}\n />\n </ErrorBoundary>\n </Box>\n </TemplateVariableProviderWithQueryParams>\n </TimeRangeProviderWithQueryParams>\n </DashboardProvider>\n </DatasourceStoreProvider>\n );\n}\n"],"names":["Box","DEFAULT_DASHBOARD_DURATION","DEFAULT_REFRESH_INTERVAL","ErrorBoundary","ErrorAlert","combineSx","TimeRangeProviderWithQueryParams","useInitialRefreshInterval","useInitialTimeRange","usePluginBuiltinVariableDefinitions","useMemo","DashboardProvider","DatasourceStoreProvider","TemplateVariableProviderWithQueryParams","DashboardApp","ViewDashboard","props","dashboardResource","datasourceApi","externalVariableDefinitions","dashboardTitleComponent","emptyDashboardProps","onSave","onDiscard","initialVariableIsSticky","isReadonly","isEditing","isCreating","sx","others","spec","dashboardDuration","duration","dashboardRefreshInterval","refreshInterval","initialTimeRange","initialRefreshInterval","data","builtinVariables","result","kind","name","value","metadata","source","display","description","hidden","project","forEach","def","push","initialState","isEditMode","initialVariableDef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1
1
|
{
|
|
2
2
|
"name": "@perses-dev/dashboards",
|
|
3
|
-
"version": "0.0.0-snapshot-
|
|
3
|
+
"version": "0.0.0-snapshot-scatterplot-fix-imports-95e1b59",
|
|
4
4
|
"description": "The dashboards feature in Perses",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/perses/perses/blob/main/README.md",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"lint:fix": "eslint --fix src --ext .ts,.tsx"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@perses-dev/components": "0.0.0-snapshot-
|
|
33
|
-
"@perses-dev/core": "0.0.0-snapshot-
|
|
34
|
-
"@perses-dev/plugin-system": "0.0.0-snapshot-
|
|
32
|
+
"@perses-dev/components": "0.0.0-snapshot-scatterplot-fix-imports-95e1b59",
|
|
33
|
+
"@perses-dev/core": "0.0.0-snapshot-scatterplot-fix-imports-95e1b59",
|
|
34
|
+
"@perses-dev/plugin-system": "0.0.0-snapshot-scatterplot-fix-imports-95e1b59",
|
|
35
35
|
"@types/react-grid-layout": "^1.3.2",
|
|
36
36
|
"date-fns": "^2.28.0",
|
|
37
37
|
"immer": "^9.0.15",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"zustand": "^4.3.3"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@perses-dev/internal-utils": "0.0.0-snapshot-
|
|
49
|
-
"@perses-dev/storybook": "0.0.0-snapshot-
|
|
48
|
+
"@perses-dev/internal-utils": "0.0.0-snapshot-scatterplot-fix-imports-95e1b59",
|
|
49
|
+
"@perses-dev/storybook": "0.0.0-snapshot-scatterplot-fix-imports-95e1b59",
|
|
50
50
|
"history": "^5.3.0",
|
|
51
51
|
"intersection-observer": "^0.12.2"
|
|
52
52
|
},
|
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
// Copyright 2023 The Perses Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
"use strict";
|
|
14
|
-
Object.defineProperty(exports, "__esModule", {
|
|
15
|
-
value: true
|
|
16
|
-
});
|
|
17
|
-
function _export(target, all) {
|
|
18
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: all[name]
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
_export(exports, {
|
|
24
|
-
DEFAULT_TIME_RANGE_OPTIONS: function() {
|
|
25
|
-
return DEFAULT_TIME_RANGE_OPTIONS;
|
|
26
|
-
},
|
|
27
|
-
DEFAULT_REFRESH_INTERVAL_OPTIONS: function() {
|
|
28
|
-
return DEFAULT_REFRESH_INTERVAL_OPTIONS;
|
|
29
|
-
},
|
|
30
|
-
TimeRangeControls: function() {
|
|
31
|
-
return TimeRangeControls;
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
const _jsxruntime = require("react/jsx-runtime");
|
|
35
|
-
const _Refresh = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/Refresh"));
|
|
36
|
-
const _material = require("@mui/material");
|
|
37
|
-
const _components = require("@perses-dev/components");
|
|
38
|
-
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
39
|
-
const _core = require("@perses-dev/core");
|
|
40
|
-
const _react = require("react");
|
|
41
|
-
const _constants = require("../../constants");
|
|
42
|
-
const _context = require("../../context");
|
|
43
|
-
const _ToolbarIconButton = require("../ToolbarIconButton");
|
|
44
|
-
const _useDashboard = require("../../context/useDashboard");
|
|
45
|
-
function _interop_require_default(obj) {
|
|
46
|
-
return obj && obj.__esModule ? obj : {
|
|
47
|
-
default: obj
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
const DEFAULT_TIME_RANGE_OPTIONS = [
|
|
51
|
-
{
|
|
52
|
-
value: {
|
|
53
|
-
pastDuration: '5m'
|
|
54
|
-
},
|
|
55
|
-
display: 'Last 5 minutes'
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
value: {
|
|
59
|
-
pastDuration: '15m'
|
|
60
|
-
},
|
|
61
|
-
display: 'Last 15 minutes'
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
value: {
|
|
65
|
-
pastDuration: '30m'
|
|
66
|
-
},
|
|
67
|
-
display: 'Last 30 minutes'
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
value: {
|
|
71
|
-
pastDuration: '1h'
|
|
72
|
-
},
|
|
73
|
-
display: 'Last 1 hour'
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
value: {
|
|
77
|
-
pastDuration: '6h'
|
|
78
|
-
},
|
|
79
|
-
display: 'Last 6 hours'
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
value: {
|
|
83
|
-
pastDuration: '12h'
|
|
84
|
-
},
|
|
85
|
-
display: 'Last 12 hours'
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
value: {
|
|
89
|
-
pastDuration: '24h'
|
|
90
|
-
},
|
|
91
|
-
display: 'Last 1 day'
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
value: {
|
|
95
|
-
pastDuration: '7d'
|
|
96
|
-
},
|
|
97
|
-
display: 'Last 7 days'
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
value: {
|
|
101
|
-
pastDuration: '14d'
|
|
102
|
-
},
|
|
103
|
-
display: 'Last 14 days'
|
|
104
|
-
}
|
|
105
|
-
];
|
|
106
|
-
const DEFAULT_REFRESH_INTERVAL_OPTIONS = [
|
|
107
|
-
{
|
|
108
|
-
value: {
|
|
109
|
-
pastDuration: '0s'
|
|
110
|
-
},
|
|
111
|
-
display: 'Off'
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
value: {
|
|
115
|
-
pastDuration: '5s'
|
|
116
|
-
},
|
|
117
|
-
display: '5s'
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
value: {
|
|
121
|
-
pastDuration: '10s'
|
|
122
|
-
},
|
|
123
|
-
display: '10s'
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
value: {
|
|
127
|
-
pastDuration: '15s'
|
|
128
|
-
},
|
|
129
|
-
display: '15s'
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
value: {
|
|
133
|
-
pastDuration: '30s'
|
|
134
|
-
},
|
|
135
|
-
display: '30s'
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
value: {
|
|
139
|
-
pastDuration: '60s'
|
|
140
|
-
},
|
|
141
|
-
display: '1m'
|
|
142
|
-
}
|
|
143
|
-
];
|
|
144
|
-
const DEFAULT_HEIGHT = '34px';
|
|
145
|
-
function TimeRangeControls({ heightPx , showTimeRangeSelector =true , showRefreshButton =true , showRefreshInterval =true , timePresets =DEFAULT_TIME_RANGE_OPTIONS }) {
|
|
146
|
-
const { timeRange , setTimeRange , refresh , refreshInterval , setRefreshInterval } = (0, _pluginsystem.useTimeRange)();
|
|
147
|
-
// TODO: Remove this since it couples to the dashboard context
|
|
148
|
-
const dashboardDuration = (0, _context.useDashboardDuration)();
|
|
149
|
-
const { dashboard , setDashboard } = (0, _useDashboard.useDashboard)();
|
|
150
|
-
// Convert height to a string, then use the string for styling
|
|
151
|
-
const height = heightPx === undefined ? DEFAULT_HEIGHT : `${heightPx}px`;
|
|
152
|
-
// add time shortcut if one does not match duration from dashboard JSON
|
|
153
|
-
if (!timePresets.some((option)=>option.value.pastDuration === dashboardDuration)) {
|
|
154
|
-
if ((0, _core.isDurationString)(dashboardDuration)) {
|
|
155
|
-
timePresets.push({
|
|
156
|
-
value: {
|
|
157
|
-
pastDuration: dashboardDuration
|
|
158
|
-
},
|
|
159
|
-
display: `Last ${dashboardDuration}`
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
// set the new refresh interval both in the dashboard context & as query param
|
|
164
|
-
const handleRefreshIntervalChange = (0, _react.useCallback)((duration)=>{
|
|
165
|
-
setDashboard({
|
|
166
|
-
...dashboard,
|
|
167
|
-
spec: {
|
|
168
|
-
...dashboard.spec,
|
|
169
|
-
refreshInterval: duration
|
|
170
|
-
}
|
|
171
|
-
});
|
|
172
|
-
setRefreshInterval(duration);
|
|
173
|
-
}, [
|
|
174
|
-
dashboard,
|
|
175
|
-
setDashboard,
|
|
176
|
-
setRefreshInterval
|
|
177
|
-
]);
|
|
178
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
179
|
-
direction: "row",
|
|
180
|
-
spacing: 1,
|
|
181
|
-
children: [
|
|
182
|
-
showTimeRangeSelector && /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.DateTimeRangePicker, {
|
|
183
|
-
timeOptions: timePresets,
|
|
184
|
-
value: timeRange,
|
|
185
|
-
onChange: setTimeRange,
|
|
186
|
-
height: height
|
|
187
|
-
}),
|
|
188
|
-
showRefreshButton && /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.InfoTooltip, {
|
|
189
|
-
description: _constants.TOOLTIP_TEXT.refreshDashboard,
|
|
190
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_ToolbarIconButton.ToolbarIconButton, {
|
|
191
|
-
"aria-label": _constants.TOOLTIP_TEXT.refreshDashboard,
|
|
192
|
-
onClick: refresh,
|
|
193
|
-
sx: {
|
|
194
|
-
height
|
|
195
|
-
},
|
|
196
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Refresh.default, {})
|
|
197
|
-
})
|
|
198
|
-
}),
|
|
199
|
-
showRefreshInterval && /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.InfoTooltip, {
|
|
200
|
-
description: _constants.TOOLTIP_TEXT.refreshDashboardInterval,
|
|
201
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.RefreshIntervalPicker, {
|
|
202
|
-
timeOptions: DEFAULT_REFRESH_INTERVAL_OPTIONS,
|
|
203
|
-
value: refreshInterval,
|
|
204
|
-
onChange: handleRefreshIntervalChange,
|
|
205
|
-
height: height
|
|
206
|
-
})
|
|
207
|
-
})
|
|
208
|
-
]
|
|
209
|
-
});
|
|
210
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// Copyright 2023 The Perses Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
"use strict";
|
|
14
|
-
Object.defineProperty(exports, "__esModule", {
|
|
15
|
-
value: true
|
|
16
|
-
});
|
|
17
|
-
_export_star(require("./TimeRangeControls"), exports);
|
|
18
|
-
function _export_star(from, to) {
|
|
19
|
-
Object.keys(from).forEach(function(k) {
|
|
20
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
21
|
-
Object.defineProperty(to, k, {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function() {
|
|
24
|
-
return from[k];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
return from;
|
|
30
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
// Copyright 2023 The Perses Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
"use strict";
|
|
14
|
-
Object.defineProperty(exports, "__esModule", {
|
|
15
|
-
value: true
|
|
16
|
-
});
|
|
17
|
-
Object.defineProperty(exports, "ToolbarIconButton", {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
get: function() {
|
|
20
|
-
return ToolbarIconButton;
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
const _jsxruntime = require("react/jsx-runtime");
|
|
24
|
-
const _react = require("react");
|
|
25
|
-
const _material = require("@mui/material");
|
|
26
|
-
function IconButton(props, ref) {
|
|
27
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsx)(StyledIconButton, {
|
|
28
|
-
ref: ref,
|
|
29
|
-
variant: "outlined",
|
|
30
|
-
color: "secondary",
|
|
31
|
-
...props
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
const StyledIconButton = (0, _material.styled)(_material.Button)(({ theme })=>({
|
|
35
|
-
// Using a button with some adjusted styles because it is easier to inherit
|
|
36
|
-
// styling and variants from themes than with an IconButton.
|
|
37
|
-
padding: theme.spacing(0.5),
|
|
38
|
-
minWidth: 'auto'
|
|
39
|
-
}));
|
|
40
|
-
const ToolbarIconButton = /*#__PURE__*/ (0, _react.forwardRef)(IconButton);
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// Copyright 2023 The Perses Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
"use strict";
|
|
14
|
-
Object.defineProperty(exports, "__esModule", {
|
|
15
|
-
value: true
|
|
16
|
-
});
|
|
17
|
-
_export_star(require("./ToolbarIconButton"), exports);
|
|
18
|
-
function _export_star(from, to) {
|
|
19
|
-
Object.keys(from).forEach(function(k) {
|
|
20
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
21
|
-
Object.defineProperty(to, k, {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function() {
|
|
24
|
-
return from[k];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
return from;
|
|
30
|
-
}
|
package/dist/cjs/utils/time.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
// Copyright 2023 The Perses Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
"use strict";
|
|
14
|
-
Object.defineProperty(exports, "__esModule", {
|
|
15
|
-
value: true
|
|
16
|
-
});
|
|
17
|
-
Object.defineProperty(exports, "useSuggestedStepMs", {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
get: function() {
|
|
20
|
-
return useSuggestedStepMs;
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
const _core = require("@perses-dev/core");
|
|
24
|
-
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
25
|
-
function useSuggestedStepMs(width) {
|
|
26
|
-
const { absoluteTimeRange } = (0, _pluginsystem.useTimeRange)();
|
|
27
|
-
if (width === undefined) return 0;
|
|
28
|
-
return (0, _core.getSuggestedStepMs)(absoluteTimeRange, width);
|
|
29
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { TimeOption } from '@perses-dev/components';
|
|
3
|
-
export declare const DEFAULT_TIME_RANGE_OPTIONS: TimeOption[];
|
|
4
|
-
export declare const DEFAULT_REFRESH_INTERVAL_OPTIONS: TimeOption[];
|
|
5
|
-
interface TimeRangeControlsProps {
|
|
6
|
-
heightPx?: number;
|
|
7
|
-
showTimeRangeSelector?: boolean;
|
|
8
|
-
showRefreshButton?: boolean;
|
|
9
|
-
showRefreshInterval?: boolean;
|
|
10
|
-
timePresets?: TimeOption[];
|
|
11
|
-
}
|
|
12
|
-
export declare function TimeRangeControls({ heightPx, showTimeRangeSelector, showRefreshButton, showRefreshInterval, timePresets, }: TimeRangeControlsProps): JSX.Element;
|
|
13
|
-
export {};
|
|
14
|
-
//# sourceMappingURL=TimeRangeControls.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TimeRangeControls.d.ts","sourceRoot":"","sources":["../../../src/components/TimeRangeControls/TimeRangeControls.tsx"],"names":[],"mappings":";AAeA,OAAO,EAA2D,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAS7G,eAAO,MAAM,0BAA0B,EAAE,UAAU,EAUlD,CAAC;AAEF,eAAO,MAAM,gCAAgC,EAAE,UAAU,EAOxD,CAAC;AAIF,UAAU,sBAAsB;IAE9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;CAC5B;AAED,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,EACR,qBAA4B,EAC5B,iBAAwB,EACxB,mBAA0B,EAC1B,WAAwC,GACzC,EAAE,sBAAsB,eA0DxB"}
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
// Copyright 2023 The Perses Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
-
import RefreshIcon from 'mdi-material-ui/Refresh';
|
|
15
|
-
import { Stack } from '@mui/material';
|
|
16
|
-
import { DateTimeRangePicker, RefreshIntervalPicker, InfoTooltip } from '@perses-dev/components';
|
|
17
|
-
import { useTimeRange } from '@perses-dev/plugin-system';
|
|
18
|
-
import { isDurationString } from '@perses-dev/core';
|
|
19
|
-
import { useCallback } from 'react';
|
|
20
|
-
import { TOOLTIP_TEXT } from '../../constants';
|
|
21
|
-
import { useDashboardDuration } from '../../context';
|
|
22
|
-
import { ToolbarIconButton } from '../ToolbarIconButton';
|
|
23
|
-
import { useDashboard } from '../../context/useDashboard';
|
|
24
|
-
export const DEFAULT_TIME_RANGE_OPTIONS = [
|
|
25
|
-
{
|
|
26
|
-
value: {
|
|
27
|
-
pastDuration: '5m'
|
|
28
|
-
},
|
|
29
|
-
display: 'Last 5 minutes'
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
value: {
|
|
33
|
-
pastDuration: '15m'
|
|
34
|
-
},
|
|
35
|
-
display: 'Last 15 minutes'
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
value: {
|
|
39
|
-
pastDuration: '30m'
|
|
40
|
-
},
|
|
41
|
-
display: 'Last 30 minutes'
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
value: {
|
|
45
|
-
pastDuration: '1h'
|
|
46
|
-
},
|
|
47
|
-
display: 'Last 1 hour'
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
value: {
|
|
51
|
-
pastDuration: '6h'
|
|
52
|
-
},
|
|
53
|
-
display: 'Last 6 hours'
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
value: {
|
|
57
|
-
pastDuration: '12h'
|
|
58
|
-
},
|
|
59
|
-
display: 'Last 12 hours'
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
value: {
|
|
63
|
-
pastDuration: '24h'
|
|
64
|
-
},
|
|
65
|
-
display: 'Last 1 day'
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
value: {
|
|
69
|
-
pastDuration: '7d'
|
|
70
|
-
},
|
|
71
|
-
display: 'Last 7 days'
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
value: {
|
|
75
|
-
pastDuration: '14d'
|
|
76
|
-
},
|
|
77
|
-
display: 'Last 14 days'
|
|
78
|
-
}
|
|
79
|
-
];
|
|
80
|
-
export const DEFAULT_REFRESH_INTERVAL_OPTIONS = [
|
|
81
|
-
{
|
|
82
|
-
value: {
|
|
83
|
-
pastDuration: '0s'
|
|
84
|
-
},
|
|
85
|
-
display: 'Off'
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
value: {
|
|
89
|
-
pastDuration: '5s'
|
|
90
|
-
},
|
|
91
|
-
display: '5s'
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
value: {
|
|
95
|
-
pastDuration: '10s'
|
|
96
|
-
},
|
|
97
|
-
display: '10s'
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
value: {
|
|
101
|
-
pastDuration: '15s'
|
|
102
|
-
},
|
|
103
|
-
display: '15s'
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
value: {
|
|
107
|
-
pastDuration: '30s'
|
|
108
|
-
},
|
|
109
|
-
display: '30s'
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
value: {
|
|
113
|
-
pastDuration: '60s'
|
|
114
|
-
},
|
|
115
|
-
display: '1m'
|
|
116
|
-
}
|
|
117
|
-
];
|
|
118
|
-
const DEFAULT_HEIGHT = '34px';
|
|
119
|
-
export function TimeRangeControls({ heightPx , showTimeRangeSelector =true , showRefreshButton =true , showRefreshInterval =true , timePresets =DEFAULT_TIME_RANGE_OPTIONS }) {
|
|
120
|
-
const { timeRange , setTimeRange , refresh , refreshInterval , setRefreshInterval } = useTimeRange();
|
|
121
|
-
// TODO: Remove this since it couples to the dashboard context
|
|
122
|
-
const dashboardDuration = useDashboardDuration();
|
|
123
|
-
const { dashboard , setDashboard } = useDashboard();
|
|
124
|
-
// Convert height to a string, then use the string for styling
|
|
125
|
-
const height = heightPx === undefined ? DEFAULT_HEIGHT : `${heightPx}px`;
|
|
126
|
-
// add time shortcut if one does not match duration from dashboard JSON
|
|
127
|
-
if (!timePresets.some((option)=>option.value.pastDuration === dashboardDuration)) {
|
|
128
|
-
if (isDurationString(dashboardDuration)) {
|
|
129
|
-
timePresets.push({
|
|
130
|
-
value: {
|
|
131
|
-
pastDuration: dashboardDuration
|
|
132
|
-
},
|
|
133
|
-
display: `Last ${dashboardDuration}`
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
// set the new refresh interval both in the dashboard context & as query param
|
|
138
|
-
const handleRefreshIntervalChange = useCallback((duration)=>{
|
|
139
|
-
setDashboard({
|
|
140
|
-
...dashboard,
|
|
141
|
-
spec: {
|
|
142
|
-
...dashboard.spec,
|
|
143
|
-
refreshInterval: duration
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
setRefreshInterval(duration);
|
|
147
|
-
}, [
|
|
148
|
-
dashboard,
|
|
149
|
-
setDashboard,
|
|
150
|
-
setRefreshInterval
|
|
151
|
-
]);
|
|
152
|
-
return /*#__PURE__*/ _jsxs(Stack, {
|
|
153
|
-
direction: "row",
|
|
154
|
-
spacing: 1,
|
|
155
|
-
children: [
|
|
156
|
-
showTimeRangeSelector && /*#__PURE__*/ _jsx(DateTimeRangePicker, {
|
|
157
|
-
timeOptions: timePresets,
|
|
158
|
-
value: timeRange,
|
|
159
|
-
onChange: setTimeRange,
|
|
160
|
-
height: height
|
|
161
|
-
}),
|
|
162
|
-
showRefreshButton && /*#__PURE__*/ _jsx(InfoTooltip, {
|
|
163
|
-
description: TOOLTIP_TEXT.refreshDashboard,
|
|
164
|
-
children: /*#__PURE__*/ _jsx(ToolbarIconButton, {
|
|
165
|
-
"aria-label": TOOLTIP_TEXT.refreshDashboard,
|
|
166
|
-
onClick: refresh,
|
|
167
|
-
sx: {
|
|
168
|
-
height
|
|
169
|
-
},
|
|
170
|
-
children: /*#__PURE__*/ _jsx(RefreshIcon, {})
|
|
171
|
-
})
|
|
172
|
-
}),
|
|
173
|
-
showRefreshInterval && /*#__PURE__*/ _jsx(InfoTooltip, {
|
|
174
|
-
description: TOOLTIP_TEXT.refreshDashboardInterval,
|
|
175
|
-
children: /*#__PURE__*/ _jsx(RefreshIntervalPicker, {
|
|
176
|
-
timeOptions: DEFAULT_REFRESH_INTERVAL_OPTIONS,
|
|
177
|
-
value: refreshInterval,
|
|
178
|
-
onChange: handleRefreshIntervalChange,
|
|
179
|
-
height: height
|
|
180
|
-
})
|
|
181
|
-
})
|
|
182
|
-
]
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
//# sourceMappingURL=TimeRangeControls.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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, RefreshIntervalPicker, InfoTooltip, TimeOption } from '@perses-dev/components';\nimport { useTimeRange } from '@perses-dev/plugin-system';\nimport { isDurationString, DurationString } from '@perses-dev/core';\nimport { useCallback } from 'react';\nimport { TOOLTIP_TEXT } from '../../constants';\nimport { useDashboardDuration } from '../../context';\nimport { ToolbarIconButton } from '../ToolbarIconButton';\nimport { useDashboard } from '../../context/useDashboard';\n\nexport const DEFAULT_TIME_RANGE_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\nexport const DEFAULT_REFRESH_INTERVAL_OPTIONS: TimeOption[] = [\n { value: { pastDuration: '0s' }, display: 'Off' },\n { value: { pastDuration: '5s' }, display: '5s' },\n { value: { pastDuration: '10s' }, display: '10s' },\n { value: { pastDuration: '15s' }, display: '15s' },\n { value: { pastDuration: '30s' }, display: '30s' },\n { value: { pastDuration: '60s' }, display: '1m' },\n];\n\nconst DEFAULT_HEIGHT = '34px';\n\ninterface TimeRangeControlsProps {\n // The controls look best at heights >= 28 pixels\n heightPx?: number;\n showTimeRangeSelector?: boolean;\n showRefreshButton?: boolean;\n showRefreshInterval?: boolean;\n timePresets?: TimeOption[];\n}\n\nexport function TimeRangeControls({\n heightPx,\n showTimeRangeSelector = true,\n showRefreshButton = true,\n showRefreshInterval = true,\n timePresets = DEFAULT_TIME_RANGE_OPTIONS,\n}: TimeRangeControlsProps) {\n const { timeRange, setTimeRange, refresh, refreshInterval, setRefreshInterval } = useTimeRange();\n // TODO: Remove this since it couples to the dashboard context\n const dashboardDuration = useDashboardDuration();\n const { dashboard, setDashboard } = useDashboard();\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 (!timePresets.some((option) => option.value.pastDuration === dashboardDuration)) {\n if (isDurationString(dashboardDuration)) {\n timePresets.push({\n value: { pastDuration: dashboardDuration },\n display: `Last ${dashboardDuration}`,\n });\n }\n }\n\n // set the new refresh interval both in the dashboard context & as query param\n const handleRefreshIntervalChange = useCallback(\n (duration: DurationString) => {\n setDashboard({\n ...dashboard,\n spec: {\n ...dashboard.spec,\n refreshInterval: duration,\n },\n });\n setRefreshInterval(duration);\n },\n [dashboard, setDashboard, setRefreshInterval]\n );\n\n return (\n <Stack direction=\"row\" spacing={1}>\n {showTimeRangeSelector && (\n <DateTimeRangePicker timeOptions={timePresets} value={timeRange} onChange={setTimeRange} height={height} />\n )}\n {showRefreshButton && (\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 {showRefreshInterval && (\n <InfoTooltip description={TOOLTIP_TEXT.refreshDashboardInterval}>\n <RefreshIntervalPicker\n timeOptions={DEFAULT_REFRESH_INTERVAL_OPTIONS}\n value={refreshInterval}\n onChange={handleRefreshIntervalChange}\n height={height}\n />\n </InfoTooltip>\n )}\n </Stack>\n );\n}\n"],"names":["RefreshIcon","Stack","DateTimeRangePicker","RefreshIntervalPicker","InfoTooltip","useTimeRange","isDurationString","useCallback","TOOLTIP_TEXT","useDashboardDuration","ToolbarIconButton","useDashboard","DEFAULT_TIME_RANGE_OPTIONS","value","pastDuration","display","DEFAULT_REFRESH_INTERVAL_OPTIONS","DEFAULT_HEIGHT","TimeRangeControls","heightPx","showTimeRangeSelector","showRefreshButton","showRefreshInterval","timePresets","timeRange","setTimeRange","refresh","refreshInterval","setRefreshInterval","dashboardDuration","dashboard","setDashboard","height","undefined","some","option","push","handleRefreshIntervalChange","duration","spec","direction","spacing","timeOptions","onChange","description","refreshDashboard","aria-label","onClick","sx","refreshDashboardInterval"],"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,OAAOA,iBAAiB,0BAA0B;AAClD,SAASC,KAAK,QAAQ,gBAAgB;AACtC,SAASC,mBAAmB,EAAEC,qBAAqB,EAAEC,WAAW,QAAoB,yBAAyB;AAC7G,SAASC,YAAY,QAAQ,4BAA4B;AACzD,SAASC,gBAAgB,QAAwB,mBAAmB;AACpE,SAASC,WAA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}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/TimeRangeControls/index.ts"],"names":[],"mappings":"AAaA,cAAc,qBAAqB,CAAC"}
|