@perses-dev/dashboards 0.43.0-rc2 → 0.44.0-rc0
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/DashboardToolbar/DashboardToolbar.js +3 -3
- package/dist/cjs/components/Datasources/DatasourceEditor.js +1 -1
- package/dist/cjs/components/Datasources/EditDatasourcesButton.js +3 -3
- 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 +2 -2
- package/dist/cjs/components/EditButton/EditButton.js +1 -1
- package/dist/cjs/components/EditJsonButton/EditJsonButton.js +2 -2
- package/dist/cjs/components/EditJsonDialog/EditJsonDialog.js +7 -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 +5 -5
- package/dist/cjs/components/GridLayout/GridLayout.js +4 -4
- package/dist/cjs/components/GridLayout/GridTitle.js +5 -5
- package/dist/cjs/components/Panel/Panel.js +3 -2
- package/dist/cjs/components/Panel/PanelContent.js +4 -3
- 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 +1 -1
- 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/TimeRangeControls/TimeRangeControls.js +6 -6
- package/dist/cjs/components/ToolbarIconButton/ToolbarIconButton.js +1 -1
- 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/constants/styles.js +4 -4
- package/dist/cjs/constants/user-interface-text.js +3 -3
- package/dist/cjs/context/DashboardProvider/DashboardProvider.js +10 -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 +8 -8
- 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 +3 -3
- 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/panelUtils.js +5 -5
- package/dist/cjs/utils/time.js +1 -1
- 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.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 +3 -3
- 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 +1 -1
- 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 +3 -3
- 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 +2 -2
- 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 +2 -2
- 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 +7 -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 +5 -5
- 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 -5
- 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 +3 -2
- package/dist/components/Panel/Panel.js.map +1 -1
- package/dist/components/Panel/PanelContent.d.ts +3 -3
- package/dist/components/Panel/PanelContent.d.ts.map +1 -1
- package/dist/components/Panel/PanelContent.js +4 -3
- 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 +1 -1
- 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/TimeRangeControls/TimeRangeControls.d.ts +1 -2
- package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.js +3 -3
- package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
- package/dist/components/ToolbarIconButton/ToolbarIconButton.d.ts +2 -2
- package/dist/components/ToolbarIconButton/ToolbarIconButton.d.ts.map +1 -1
- package/dist/components/ToolbarIconButton/ToolbarIconButton.js +1 -1
- package/dist/components/ToolbarIconButton/ToolbarIconButton.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/context/DashboardProvider/DashboardProvider.d.ts +1 -1
- package/dist/context/DashboardProvider/DashboardProvider.d.ts.map +1 -1
- package/dist/context/DashboardProvider/DashboardProvider.js +7 -7
- package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -1
- package/dist/context/DashboardProvider/common.d.ts +2 -2
- 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.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 +3 -3
- package/dist/context/DatasourceStoreProvider.d.ts.map +1 -1
- package/dist/context/DatasourceStoreProvider.js +8 -8
- 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.js +3 -3
- 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/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/utils/time.js +1 -1
- package/dist/utils/time.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 +1 -1
- 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
|
@@ -32,7 +32,7 @@ function _interop_require_default(obj) {
|
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
const AddGroupButton = ()=>{
|
|
35
|
-
const { openAddPanelGroup
|
|
35
|
+
const { openAddPanelGroup } = (0, _context.useDashboardActions)();
|
|
36
36
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.InfoTooltip, {
|
|
37
37
|
description: _constants.TOOLTIP_TEXT.addGroup,
|
|
38
38
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Button, {
|
|
@@ -31,8 +31,8 @@ function _interop_require_default(obj) {
|
|
|
31
31
|
default: obj
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
|
-
const AddPanelButton = ({ variant ='text'
|
|
35
|
-
const { openAddPanel
|
|
34
|
+
const AddPanelButton = ({ variant = 'text', color = 'primary', label = 'Panel', fullWidth })=>{
|
|
35
|
+
const { openAddPanel } = (0, _context.useDashboardActions)();
|
|
36
36
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.InfoTooltip, {
|
|
37
37
|
description: _constants.TOOLTIP_TEXT.addPanel,
|
|
38
38
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Button, {
|
|
@@ -26,7 +26,7 @@ const _components = require("@perses-dev/components");
|
|
|
26
26
|
const _context = require("../../context");
|
|
27
27
|
const _GridLayout = require("../GridLayout");
|
|
28
28
|
const _EmptyDashboard = require("../EmptyDashboard");
|
|
29
|
-
function Dashboard({ emptyDashboardProps
|
|
29
|
+
function Dashboard({ emptyDashboardProps, panelOptions, ...boxProps }) {
|
|
30
30
|
const panelGroupIds = (0, _context.usePanelGroupIds)();
|
|
31
31
|
const isEmpty = !panelGroupIds.length;
|
|
32
32
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
|
|
@@ -35,8 +35,8 @@ const _EditJsonButton = require("../EditJsonButton");
|
|
|
35
35
|
const _SaveDashboardButton = require("../SaveDashboardButton");
|
|
36
36
|
const _DashboardStickyToolbar = require("../DashboardStickyToolbar");
|
|
37
37
|
const DashboardToolbar = (props)=>{
|
|
38
|
-
const { dashboardName
|
|
39
|
-
const { isEditMode
|
|
38
|
+
const { dashboardName, dashboardTitleComponent, initialVariableIsSticky, isReadonly, onEditButtonClick, onCancelButtonClick, onSave } = props;
|
|
39
|
+
const { isEditMode } = (0, _context.useEditMode)();
|
|
40
40
|
const isBiggerThanSm = (0, _material.useMediaQuery)((0, _material.useTheme)().breakpoints.up('sm'));
|
|
41
41
|
const isBiggerThanMd = (0, _material.useMediaQuery)((0, _material.useTheme)().breakpoints.up('md'));
|
|
42
42
|
const dashboardTitle = dashboardTitleComponent ? dashboardTitleComponent : /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
@@ -122,7 +122,7 @@ const DashboardToolbar = (props)=>{
|
|
|
122
122
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_DashboardStickyToolbar.DashboardStickyToolbar, {
|
|
123
123
|
initialVariableIsSticky: initialVariableIsSticky,
|
|
124
124
|
sx: {
|
|
125
|
-
backgroundColor: ({ palette
|
|
125
|
+
backgroundColor: ({ palette })=>palette.background.default
|
|
126
126
|
}
|
|
127
127
|
})
|
|
128
128
|
})
|
|
@@ -46,7 +46,7 @@ function DatasourceEditor(props) {
|
|
|
46
46
|
spec: {}
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
|
-
const { openDiscardChangesConfirmationDialog
|
|
49
|
+
const { openDiscardChangesConfirmationDialog, closeDiscardChangesConfirmationDialog } = (0, _context.useDiscardChangesConfirmationDialog)();
|
|
50
50
|
const handleCancel = ()=>{
|
|
51
51
|
if (JSON.stringify(props.datasources) !== JSON.stringify(datasources)) {
|
|
52
52
|
openDiscardChangesConfirmationDialog({
|
|
@@ -36,10 +36,10 @@ function _interop_require_default(obj) {
|
|
|
36
36
|
}
|
|
37
37
|
function EditDatasourcesButton() {
|
|
38
38
|
const [isDatasourceEditorOpen, setIsDatasourceEditorOpen] = (0, _react.useState)(false);
|
|
39
|
-
const { getLocalDatasources
|
|
39
|
+
const { getLocalDatasources, setLocalDatasources, getSavedDatasources, setSavedDatasources } = (0, _pluginsystem.useDatasourceStore)();
|
|
40
40
|
const localDatasources = getLocalDatasources();
|
|
41
41
|
const savedDatasources = getSavedDatasources();
|
|
42
|
-
const { dashboard
|
|
42
|
+
const { dashboard, setDashboard } = (0, _context.useDashboard)();
|
|
43
43
|
const openDatasourceEditor = ()=>{
|
|
44
44
|
setIsDatasourceEditorOpen(true);
|
|
45
45
|
};
|
|
@@ -49,7 +49,7 @@ function EditDatasourcesButton() {
|
|
|
49
49
|
const handleChangeDatasources = (datasources)=>{
|
|
50
50
|
// Calculates the new list of datasources that are allowed to be used.
|
|
51
51
|
const newSavedDatasources = Object.keys(datasources).filter((key)=>{
|
|
52
|
-
var _datasources_key,
|
|
52
|
+
var _datasources_key_plugin, _datasources_key, _savedDatasources_key_plugin, _savedDatasources_key, _datasources_key_plugin_spec, _datasources_key_plugin1, _datasources_key1, _savedDatasources_key_plugin_spec, _savedDatasources_key_plugin1, _savedDatasources_key1;
|
|
53
53
|
var _datasources_key_plugin_spec1;
|
|
54
54
|
// Datasources are allowed to be used if a) they are direct, or b) they are proxied, and their
|
|
55
55
|
// proxy is the same as what we have saved.
|
|
@@ -24,7 +24,7 @@ const _jsxruntime = require("react/jsx-runtime");
|
|
|
24
24
|
const _components = require("@perses-dev/components");
|
|
25
25
|
const _context = require("../../context");
|
|
26
26
|
const DeletePanelDialog = ()=>{
|
|
27
|
-
const { deletePanelDialog
|
|
27
|
+
const { deletePanelDialog, closeDeletePanelDialog } = (0, _context.useDeletePanelDialog)();
|
|
28
28
|
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_components.Dialog, {
|
|
29
29
|
open: deletePanelDialog !== undefined,
|
|
30
30
|
children: [
|
|
@@ -38,11 +38,11 @@ const DeletePanelDialog = ()=>{
|
|
|
38
38
|
]
|
|
39
39
|
});
|
|
40
40
|
};
|
|
41
|
-
const DeletePanelForm = ({ deletePanelDialog
|
|
42
|
-
const { deletePanel
|
|
41
|
+
const DeletePanelForm = ({ deletePanelDialog })=>{
|
|
42
|
+
const { deletePanel, closeDeletePanelDialog } = (0, _context.useDeletePanelDialog)();
|
|
43
43
|
const handleDelete = (e)=>{
|
|
44
44
|
e.preventDefault();
|
|
45
|
-
const { panelGroupItemId
|
|
45
|
+
const { panelGroupItemId } = deletePanelDialog;
|
|
46
46
|
deletePanel(panelGroupItemId);
|
|
47
47
|
closeDeletePanelDialog();
|
|
48
48
|
};
|
|
@@ -30,7 +30,7 @@ function _interop_require_default(obj) {
|
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
const DeletePanelGroupDialog = ()=>{
|
|
33
|
-
const { deletePanelGroupDialog
|
|
33
|
+
const { deletePanelGroupDialog, closeDeletePanelGroupDialog, deletePanelGroup } = (0, _context.useDeletePanelGroupDialog)();
|
|
34
34
|
const panelGroupId = deletePanelGroupDialog === null || deletePanelGroupDialog === void 0 ? void 0 : deletePanelGroupDialog.panelGroupId;
|
|
35
35
|
const handleDelete = (e)=>{
|
|
36
36
|
e.preventDefault();
|
package/dist/cjs/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js
CHANGED
|
@@ -24,7 +24,7 @@ const _jsxruntime = require("react/jsx-runtime");
|
|
|
24
24
|
const _components = require("@perses-dev/components");
|
|
25
25
|
const _context = require("../../context");
|
|
26
26
|
const DashboardDiscardChangesConfirmationDialog = ()=>{
|
|
27
|
-
const { discardChangesConfirmationDialog: dialog
|
|
27
|
+
const { discardChangesConfirmationDialog: dialog } = (0, _context.useDiscardChangesConfirmationDialog)();
|
|
28
28
|
if (dialog === undefined) {
|
|
29
29
|
return null;
|
|
30
30
|
}
|
|
@@ -32,8 +32,8 @@ function _interop_require_default(obj) {
|
|
|
32
32
|
default: obj
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
|
-
function DownloadButton({ heightPx
|
|
36
|
-
const { dashboard
|
|
35
|
+
function DownloadButton({ heightPx }) {
|
|
36
|
+
const { dashboard } = (0, _context.useDashboard)();
|
|
37
37
|
const hiddenLinkRef = (0, _react.useRef)(null);
|
|
38
38
|
const height = heightPx === undefined ? undefined : `${heightPx}px`;
|
|
39
39
|
const onDownloadButtonClick = ()=>{
|
|
@@ -28,7 +28,7 @@ function _interop_require_default(obj) {
|
|
|
28
28
|
default: obj
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
-
const EditButton = ({ label ='Edit'
|
|
31
|
+
const EditButton = ({ label = 'Edit', onClick })=>{
|
|
32
32
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Button, {
|
|
33
33
|
onClick: onClick,
|
|
34
34
|
startIcon: /*#__PURE__*/ (0, _jsxruntime.jsx)(_PencilOutline.default, {}),
|
|
@@ -32,8 +32,8 @@ function _interop_require_default(obj) {
|
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
const EditJsonButton = (props)=>{
|
|
35
|
-
const { isReadonly
|
|
36
|
-
const { openEditJsonDialog
|
|
35
|
+
const { isReadonly } = props;
|
|
36
|
+
const { openEditJsonDialog } = (0, _context.useEditJsonDialog)();
|
|
37
37
|
const info = isReadonly ? _constants.TOOLTIP_TEXT.viewJson : _constants.TOOLTIP_TEXT.editJson;
|
|
38
38
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.InfoTooltip, {
|
|
39
39
|
description: info,
|
|
@@ -28,8 +28,8 @@ const _pluginsystem = require("@perses-dev/plugin-system");
|
|
|
28
28
|
const _DashboardProvider = require("../../context/DashboardProvider");
|
|
29
29
|
const _useDashboard = require("../../context/useDashboard");
|
|
30
30
|
const EditJsonDialog = (props)=>{
|
|
31
|
-
const { isReadonly
|
|
32
|
-
const { editJsonDialog
|
|
31
|
+
const { isReadonly, disableMetadataEdition } = props;
|
|
32
|
+
const { editJsonDialog, closeEditJsonDialog } = (0, _DashboardProvider.useEditJsonDialog)();
|
|
33
33
|
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_components.Dialog, {
|
|
34
34
|
open: !!(editJsonDialog === null || editJsonDialog === void 0 ? void 0 : editJsonDialog.isOpen),
|
|
35
35
|
scroll: "paper",
|
|
@@ -51,11 +51,11 @@ const EditJsonDialog = (props)=>{
|
|
|
51
51
|
});
|
|
52
52
|
};
|
|
53
53
|
const EditJsonDialogForm = (props)=>{
|
|
54
|
-
const { isReadonly
|
|
55
|
-
const { closeEditJsonDialog
|
|
56
|
-
const { setTimeRange
|
|
57
|
-
const { dashboard
|
|
58
|
-
const { setLocalDatasources
|
|
54
|
+
const { isReadonly, disableMetadataEdition } = props;
|
|
55
|
+
const { closeEditJsonDialog } = (0, _DashboardProvider.useEditJsonDialog)();
|
|
56
|
+
const { setTimeRange, setRefreshInterval } = (0, _pluginsystem.useTimeRange)();
|
|
57
|
+
const { dashboard, setDashboard } = (0, _useDashboard.useDashboard)();
|
|
58
|
+
const { setLocalDatasources } = (0, _pluginsystem.useDatasourceStore)();
|
|
59
59
|
const [draftDashboard, setDraftDashboard] = (0, _react.useState)(dashboard);
|
|
60
60
|
const handleApply = (e)=>{
|
|
61
61
|
e.preventDefault();
|
|
@@ -38,7 +38,7 @@ const COMMON_BUTTON_PROPS = {
|
|
|
38
38
|
variant: 'outlined',
|
|
39
39
|
color: 'secondary'
|
|
40
40
|
};
|
|
41
|
-
const EmptyDashboardActions = ({ actions
|
|
41
|
+
const EmptyDashboardActions = ({ actions, isEditMode, onEditButtonClick })=>{
|
|
42
42
|
if (actions && typeof actions !== 'boolean') {
|
|
43
43
|
// Custom actions
|
|
44
44
|
return actions;
|
|
@@ -76,8 +76,8 @@ const EmptyDashboardActions = ({ actions , isEditMode , onEditButtonClick })=>{
|
|
|
76
76
|
}
|
|
77
77
|
return null;
|
|
78
78
|
};
|
|
79
|
-
const EmptyDashboard = ({ title =DEFAULT_TITLE
|
|
80
|
-
const { isEditMode
|
|
79
|
+
const EmptyDashboard = ({ title = DEFAULT_TITLE, image, description, additionalText, actions, onEditButtonClick })=>{
|
|
80
|
+
const { isEditMode } = (0, _context.useEditMode)();
|
|
81
81
|
const defaultDescription = isEditMode ? DEFAULT_DESCRIPTION.edit : DEFAULT_DESCRIPTION.view;
|
|
82
82
|
const actionsContent = /*#__PURE__*/ (0, _jsxruntime.jsx)(EmptyDashboardActions, {
|
|
83
83
|
actions: actions,
|
|
@@ -50,7 +50,7 @@ function GridContainer(props) {
|
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
52
|
* These are the classes needed by react-grid-layout from their CSS stylesheet.
|
|
53
|
-
*/ const ReactGridLayoutContainer = (0, _material.styled)('section')(({ theme
|
|
53
|
+
*/ const ReactGridLayoutContainer = (0, _material.styled)('section')(({ theme })=>({
|
|
54
54
|
'& .react-grid-layout': {
|
|
55
55
|
position: 'relative',
|
|
56
56
|
transition: 'height 200ms ease'
|
|
@@ -28,12 +28,12 @@ const _context = require("../../context");
|
|
|
28
28
|
const _utils = require("../../utils");
|
|
29
29
|
const _Panel = require("../Panel/Panel");
|
|
30
30
|
function GridItemContent(props) {
|
|
31
|
-
const { panelGroupItemId
|
|
31
|
+
const { panelGroupItemId, width } = props;
|
|
32
32
|
const panelDefinition = (0, _context.usePanel)(panelGroupItemId);
|
|
33
|
-
const { spec: { queries
|
|
34
|
-
const { isEditMode
|
|
35
|
-
const { openEditPanel
|
|
36
|
-
const { ref
|
|
33
|
+
const { spec: { queries } } = panelDefinition;
|
|
34
|
+
const { isEditMode } = (0, _context.useEditMode)();
|
|
35
|
+
const { openEditPanel, openDeletePanelDialog, duplicatePanel } = (0, _context.usePanelActions)(panelGroupItemId);
|
|
36
|
+
const { ref, inView } = (0, _reactintersectionobserver.useInView)({
|
|
37
37
|
threshold: 0.2,
|
|
38
38
|
initialInView: false,
|
|
39
39
|
triggerOnce: true
|
|
@@ -33,13 +33,13 @@ const _GridContainer = require("./GridContainer");
|
|
|
33
33
|
const DEFAULT_MARGIN = 10;
|
|
34
34
|
const ResponsiveGridLayout = (0, _reactgridlayout.WidthProvider)(_reactgridlayout.Responsive);
|
|
35
35
|
function GridLayout(props) {
|
|
36
|
-
const { panelGroupId
|
|
36
|
+
const { panelGroupId/*...others */ } = props;
|
|
37
37
|
const theme = (0, _material.useTheme)();
|
|
38
38
|
const groupDefinition = (0, _context.usePanelGroup)(panelGroupId);
|
|
39
|
-
const { updatePanelGroupLayouts
|
|
39
|
+
const { updatePanelGroupLayouts } = (0, _context.usePanelGroupActions)(panelGroupId);
|
|
40
40
|
var _ref;
|
|
41
41
|
const [isOpen, setIsOpen] = (0, _react.useState)((_ref = !groupDefinition.isCollapsed) !== null && _ref !== void 0 ? _ref : true);
|
|
42
|
-
const { isEditMode
|
|
42
|
+
const { isEditMode } = (0, _context.useEditMode)();
|
|
43
43
|
const [gridColWidth, setGridColWidth] = (0, _react.useState)(0);
|
|
44
44
|
const handleLayoutChange = (currentLayout, allLayouts)=>{
|
|
45
45
|
// Using the value from `allLayouts` instead of `currentLayout` because of
|
|
@@ -103,7 +103,7 @@ function GridLayout(props) {
|
|
|
103
103
|
},
|
|
104
104
|
onLayoutChange: handleLayoutChange,
|
|
105
105
|
onWidthChange: handleWidthChange,
|
|
106
|
-
children: groupDefinition.itemLayouts.map(({ i
|
|
106
|
+
children: groupDefinition.itemLayouts.map(({ i, w })=>/*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
107
107
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.ErrorBoundary, {
|
|
108
108
|
FallbackComponent: _components.ErrorAlert,
|
|
109
109
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_GridItemContent.GridItemContent, {
|
|
@@ -39,11 +39,11 @@ function _interop_require_default(obj) {
|
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
function GridTitle(props) {
|
|
42
|
-
const { panelGroupId
|
|
42
|
+
const { panelGroupId, title: rawTitle, collapse } = props;
|
|
43
43
|
const title = (0, _pluginsystem.useReplaceVariablesInString)(rawTitle);
|
|
44
|
-
const { openAddPanel
|
|
45
|
-
const { openDeletePanelGroupDialog
|
|
46
|
-
const { isEditMode
|
|
44
|
+
const { openAddPanel, openEditPanelGroup, moveUp, moveDown } = (0, _context.usePanelGroupActions)(panelGroupId);
|
|
45
|
+
const { openDeletePanelGroupDialog } = (0, _context.useDeletePanelGroupDialog)();
|
|
46
|
+
const { isEditMode } = (0, _context.useEditMode)();
|
|
47
47
|
const text = /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
48
48
|
variant: "h2",
|
|
49
49
|
children: title
|
|
@@ -56,7 +56,7 @@ function GridTitle(props) {
|
|
|
56
56
|
alignItems: 'center',
|
|
57
57
|
padding: (theme)=>theme.spacing(1),
|
|
58
58
|
cursor: collapse ? 'pointer' : 'auto',
|
|
59
|
-
backgroundColor: ({ palette
|
|
59
|
+
backgroundColor: ({ palette })=>palette.background.paper
|
|
60
60
|
},
|
|
61
61
|
"data-testid": "panel-group-header",
|
|
62
62
|
children: collapse ? /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
@@ -34,12 +34,12 @@ function _interop_require_default(obj) {
|
|
|
34
34
|
}
|
|
35
35
|
const Panel = /*#__PURE__*/ (0, _react.memo)(function Panel(props) {
|
|
36
36
|
var _panelOptions_extra;
|
|
37
|
-
const { definition
|
|
37
|
+
const { definition, editHandlers, onMouseEnter, onMouseLeave, sx, panelOptions, panelGroupItemId, ...others } = props;
|
|
38
38
|
// Make sure we have an ID we can use for aria attributes
|
|
39
39
|
const generatedPanelId = (0, _components.useId)('Panel');
|
|
40
40
|
const headerId = `${generatedPanelId}-header`;
|
|
41
41
|
const [contentElement, setContentElement] = (0, _react.useState)(null);
|
|
42
|
-
const { width
|
|
42
|
+
const { width, height } = (0, _useresizeobserver.default)({
|
|
43
43
|
ref: contentElement
|
|
44
44
|
});
|
|
45
45
|
const contentDimensions = (0, _react.useMemo)(()=>{
|
|
@@ -108,6 +108,7 @@ const Panel = /*#__PURE__*/ (0, _react.memo)(function Panel(props) {
|
|
|
108
108
|
definition.spec
|
|
109
109
|
],
|
|
110
110
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_PanelContent.PanelContent, {
|
|
111
|
+
definition: definition,
|
|
111
112
|
panelPluginKind: definition.spec.plugin.kind,
|
|
112
113
|
spec: definition.spec.plugin.spec,
|
|
113
114
|
contentDimensions: contentDimensions
|
|
@@ -24,8 +24,8 @@ const _jsxruntime = require("react/jsx-runtime");
|
|
|
24
24
|
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
25
25
|
const _material = require("@mui/material");
|
|
26
26
|
function PanelContent(props) {
|
|
27
|
-
const { panelPluginKind
|
|
28
|
-
const { data: plugin
|
|
27
|
+
const { panelPluginKind, contentDimensions, definition, ...others } = props;
|
|
28
|
+
const { data: plugin, isLoading } = (0, _pluginsystem.usePlugin)('Panel', panelPluginKind, {
|
|
29
29
|
useErrorBoundary: true
|
|
30
30
|
});
|
|
31
31
|
const PanelComponent = plugin === null || plugin === void 0 ? void 0 : plugin.PanelComponent;
|
|
@@ -42,6 +42,7 @@ function PanelContent(props) {
|
|
|
42
42
|
}
|
|
43
43
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(PanelComponent, {
|
|
44
44
|
...others,
|
|
45
|
-
contentDimensions: contentDimensions
|
|
45
|
+
contentDimensions: contentDimensions,
|
|
46
|
+
definition: definition
|
|
46
47
|
});
|
|
47
48
|
}
|
|
@@ -35,7 +35,7 @@ function _interop_require_default(obj) {
|
|
|
35
35
|
default: obj
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
|
-
function PanelHeader({ id
|
|
38
|
+
function PanelHeader({ id, title: rawTitle, description: rawDescription, editHandlers, sx, extra, ...rest }) {
|
|
39
39
|
const titleElementId = `${id}-title`;
|
|
40
40
|
const descriptionTooltipId = `${id}-description`;
|
|
41
41
|
const title = (0, _pluginsystem.useReplaceVariablesInString)(rawTitle);
|
|
@@ -169,7 +169,7 @@ function PanelHeader({ id , title: rawTitle , description: rawDescription , edit
|
|
|
169
169
|
...rest
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
|
-
const HeaderIconButton = (0, _material.styled)(_material.IconButton)(({ theme
|
|
172
|
+
const HeaderIconButton = (0, _material.styled)(_material.IconButton)(({ theme })=>({
|
|
173
173
|
borderRadius: theme.shape.borderRadius,
|
|
174
174
|
padding: '4px'
|
|
175
175
|
}));
|
|
@@ -40,11 +40,11 @@ const _validation = require("../../validation");
|
|
|
40
40
|
const _PanelPreview = require("./PanelPreview");
|
|
41
41
|
const _usePanelEditor = require("./usePanelEditor");
|
|
42
42
|
function PanelEditorForm(props) {
|
|
43
|
-
const { initialValues: { panelDefinition: initialPanelDef
|
|
43
|
+
const { initialValues: { panelDefinition: initialPanelDef, groupId: initialGroupId }, initialAction, onSave, onClose } = props;
|
|
44
44
|
const panelGroups = (0, _context.useListPanelGroups)();
|
|
45
45
|
const [groupId, setGroupId] = (0, _react.useState)(initialGroupId);
|
|
46
|
-
const { panelDefinition
|
|
47
|
-
const { plugin
|
|
46
|
+
const { panelDefinition, setName, setDescription, setQueries, setPlugin, setPanelDefinition } = (0, _usePanelEditor.usePanelEditor)(initialPanelDef);
|
|
47
|
+
const { plugin } = panelDefinition.spec;
|
|
48
48
|
const [isDiscardDialogOpened, setDiscardDialogOpened] = (0, _react.useState)(false);
|
|
49
49
|
// Use common plugin editor logic even though we've split the inputs up in this form
|
|
50
50
|
const pluginEditor = (0, _pluginsystem.usePluginEditor)({
|
|
@@ -98,14 +98,13 @@ function PanelEditorForm(props) {
|
|
|
98
98
|
}
|
|
99
99
|
const handlePanelDefinitionChange = (nextPanelDefStr)=>{
|
|
100
100
|
const nextPanelDef = JSON.parse(nextPanelDefStr);
|
|
101
|
-
const { kind: pluginKind
|
|
101
|
+
const { kind: pluginKind, spec: pluginSpec } = nextPanelDef.spec.plugin;
|
|
102
102
|
// if panel plugin kind and spec are modified, then need to save current spec
|
|
103
103
|
if (panelDefinition.spec.plugin.kind !== pluginKind && JSON.stringify(panelDefinition.spec.plugin.spec) !== JSON.stringify(pluginSpec)) {
|
|
104
104
|
pluginEditor.rememberCurrentSpecState();
|
|
105
105
|
}
|
|
106
106
|
setPanelDefinition(nextPanelDef);
|
|
107
107
|
};
|
|
108
|
-
var _panelGroup_title, _pluginEditor_error_message;
|
|
109
108
|
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_reacthookform.FormProvider, {
|
|
110
109
|
...form,
|
|
111
110
|
children: [
|
|
@@ -161,9 +160,9 @@ function PanelEditorForm(props) {
|
|
|
161
160
|
xs: 8,
|
|
162
161
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
163
162
|
name: "name",
|
|
164
|
-
render: ({ field
|
|
163
|
+
render: ({ field, fieldState })=>{
|
|
165
164
|
var _fieldState_error;
|
|
166
|
-
/*#__PURE__*/
|
|
165
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
167
166
|
...field,
|
|
168
167
|
required: true,
|
|
169
168
|
fullWidth: true,
|
|
@@ -183,9 +182,9 @@ function PanelEditorForm(props) {
|
|
|
183
182
|
xs: 4,
|
|
184
183
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
185
184
|
name: "groupId",
|
|
186
|
-
render: ({ field
|
|
185
|
+
render: ({ field, fieldState })=>{
|
|
187
186
|
var _fieldState_error;
|
|
188
|
-
/*#__PURE__*/
|
|
187
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
189
188
|
select: true,
|
|
190
189
|
...field,
|
|
191
190
|
required: true,
|
|
@@ -197,10 +196,13 @@ function PanelEditorForm(props) {
|
|
|
197
196
|
field.onChange(event);
|
|
198
197
|
setGroupId(+event.target.value);
|
|
199
198
|
},
|
|
200
|
-
children: panelGroups.map((panelGroup, index)=>/*#__PURE__*/
|
|
199
|
+
children: panelGroups.map((panelGroup, index)=>/*#__PURE__*/ {
|
|
200
|
+
var _panelGroup_title;
|
|
201
|
+
return (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
201
202
|
value: panelGroup.id,
|
|
202
203
|
children: (_panelGroup_title = panelGroup.title) !== null && _panelGroup_title !== void 0 ? _panelGroup_title : `Group ${index + 1}`
|
|
203
|
-
}, panelGroup.id)
|
|
204
|
+
}, panelGroup.id);
|
|
205
|
+
})
|
|
204
206
|
});
|
|
205
207
|
}
|
|
206
208
|
})
|
|
@@ -210,9 +212,9 @@ function PanelEditorForm(props) {
|
|
|
210
212
|
xs: 8,
|
|
211
213
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
212
214
|
name: "description",
|
|
213
|
-
render: ({ field
|
|
215
|
+
render: ({ field, fieldState })=>{
|
|
214
216
|
var _fieldState_error;
|
|
215
|
-
/*#__PURE__*/
|
|
217
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
216
218
|
...field,
|
|
217
219
|
fullWidth: true,
|
|
218
220
|
label: "Description",
|
|
@@ -231,9 +233,10 @@ function PanelEditorForm(props) {
|
|
|
231
233
|
xs: 4,
|
|
232
234
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
233
235
|
name: "type",
|
|
234
|
-
render: ({ field
|
|
236
|
+
render: ({ field, fieldState })=>/*#__PURE__*/ {
|
|
235
237
|
var _pluginEditor_error, _fieldState_error;
|
|
236
|
-
|
|
238
|
+
var _pluginEditor_error_message;
|
|
239
|
+
return (0, _jsxruntime.jsx)(_pluginsystem.PluginKindSelect, {
|
|
237
240
|
...field,
|
|
238
241
|
pluginType: "Panel",
|
|
239
242
|
required: true,
|
|
@@ -28,7 +28,7 @@ const _Panel = require("../Panel");
|
|
|
28
28
|
const _utils = require("../../utils");
|
|
29
29
|
const PANEL_PREVIEW_HEIGHT = 300;
|
|
30
30
|
const PANEL_PREVIEW_DEFAULT_WIDTH = 840;
|
|
31
|
-
function PanelPreview({ panelDefinition
|
|
31
|
+
function PanelPreview({ panelDefinition }) {
|
|
32
32
|
const boxRef = (0, _react.useRef)(null);
|
|
33
33
|
let width = PANEL_PREVIEW_DEFAULT_WIDTH;
|
|
34
34
|
if (boxRef.current !== null) {
|
|
@@ -22,7 +22,7 @@ Object.defineProperty(exports, "usePanelEditor", {
|
|
|
22
22
|
});
|
|
23
23
|
const _react = require("react");
|
|
24
24
|
const usePanelEditor = (panelDefinition)=>{
|
|
25
|
-
const { display
|
|
25
|
+
const { display, plugin: pluginDefinition, queries: initialQueries } = panelDefinition.spec;
|
|
26
26
|
const [name, setName] = (0, _react.useState)(display.name);
|
|
27
27
|
const [description, setDescription] = (0, _react.useState)(display.description);
|
|
28
28
|
const [plugin, setPlugin] = (0, _react.useState)(pluginDefinition);
|
|
@@ -47,7 +47,7 @@ const usePanelEditor = (panelDefinition)=>{
|
|
|
47
47
|
]);
|
|
48
48
|
// reset panel definition
|
|
49
49
|
const setPanelDefinition = (0, _react.useCallback)((panelDefinition)=>{
|
|
50
|
-
const { display
|
|
50
|
+
const { display, plugin, queries } = panelDefinition.spec;
|
|
51
51
|
setName(display.name);
|
|
52
52
|
setDescription(display.description);
|
|
53
53
|
setPlugin(plugin);
|
|
@@ -32,7 +32,7 @@ const _jsxruntime = require("react/jsx-runtime");
|
|
|
32
32
|
const _react = require("react");
|
|
33
33
|
const _material = require("@mui/material");
|
|
34
34
|
function PanelGroupEditorForm(props) {
|
|
35
|
-
const { initialValues
|
|
35
|
+
const { initialValues, onSubmit } = props;
|
|
36
36
|
const [title, setTitle] = (0, _react.useState)(initialValues.title);
|
|
37
37
|
const [isCollapsed, setIsCollapsed] = (0, _react.useState)(initialValues.isCollapsed);
|
|
38
38
|
const handleCollapsedChange = (e)=>{
|
|
@@ -26,11 +26,11 @@ const _reactquery = require("@tanstack/react-query");
|
|
|
26
26
|
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
27
27
|
const TABLE_MAX_WIDTH = 1000;
|
|
28
28
|
function QuerySummaryTable(props) {
|
|
29
|
-
const { showTotalQueries =true
|
|
29
|
+
const { showTotalQueries = true } = props;
|
|
30
30
|
const datasourceClient = (0, _pluginsystem.useDatasourceClient)({
|
|
31
31
|
kind: 'PrometheusDatasource'
|
|
32
32
|
});
|
|
33
|
-
const { absoluteTimeRange
|
|
33
|
+
const { absoluteTimeRange } = (0, _pluginsystem.useTimeRange)();
|
|
34
34
|
// for displaying a summary of recent query results
|
|
35
35
|
const queryClient = (0, _reactquery.useQueryClient)();
|
|
36
36
|
const queries = queryClient.getQueryCache().findAll();
|
|
@@ -28,17 +28,17 @@ const _core = require("@perses-dev/core");
|
|
|
28
28
|
const _components = require("@perses-dev/components");
|
|
29
29
|
const _context = require("../../context");
|
|
30
30
|
const SaveChangesConfirmationDialog = ()=>{
|
|
31
|
-
const { saveChangesConfirmationDialog: dialog
|
|
31
|
+
const { saveChangesConfirmationDialog: dialog } = (0, _context.useSaveChangesConfirmationDialog)();
|
|
32
32
|
var _dialog_isSavedDurationModified;
|
|
33
33
|
const isSavedDurationModified = (_dialog_isSavedDurationModified = dialog === null || dialog === void 0 ? void 0 : dialog.isSavedDurationModified) !== null && _dialog_isSavedDurationModified !== void 0 ? _dialog_isSavedDurationModified : true;
|
|
34
34
|
var _dialog_isSavedVariableModified;
|
|
35
35
|
const isSavedVariableModified = (_dialog_isSavedVariableModified = dialog === null || dialog === void 0 ? void 0 : dialog.isSavedVariableModified) !== null && _dialog_isSavedVariableModified !== void 0 ? _dialog_isSavedVariableModified : true;
|
|
36
36
|
const [saveDefaultTimeRange, setSaveDefaultTimeRange] = (0, _react.useState)(isSavedDurationModified);
|
|
37
37
|
const [saveDefaultVariables, setSaveDefaultVariables] = (0, _react.useState)(isSavedVariableModified);
|
|
38
|
-
const { getSavedVariablesStatus
|
|
39
|
-
const { modifiedVariableNames
|
|
38
|
+
const { getSavedVariablesStatus } = (0, _context.useTemplateVariableActions)();
|
|
39
|
+
const { modifiedVariableNames } = getSavedVariablesStatus();
|
|
40
40
|
const isOpen = dialog !== undefined;
|
|
41
|
-
const { timeRange
|
|
41
|
+
const { timeRange } = (0, _pluginsystem.useTimeRange)();
|
|
42
42
|
const currentTimeRangeText = (0, _core.isRelativeTimeRange)(timeRange) ? `(Last ${timeRange.pastDuration})` : '(Absolute time ranges can not be saved)';
|
|
43
43
|
const saveTimeRangeText = `Save current time range as new default ${currentTimeRangeText}`;
|
|
44
44
|
const saveVariablesText = `Save current variable values as new default (${modifiedVariableNames.length > 0 ? modifiedVariableNames.join(', ') : 'No modified variables'})`;
|
|
@@ -26,14 +26,14 @@ const _material = require("@mui/material");
|
|
|
26
26
|
const _core = require("@perses-dev/core");
|
|
27
27
|
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
28
28
|
const _context = require("../../context");
|
|
29
|
-
const SaveDashboardButton = ({ onSave
|
|
29
|
+
const SaveDashboardButton = ({ onSave, isDisabled, variant = 'contained' })=>{
|
|
30
30
|
const [isSavingDashboard, setSavingDashboard] = (0, _react.useState)(false);
|
|
31
|
-
const { dashboard
|
|
32
|
-
const { getSavedVariablesStatus
|
|
33
|
-
const { isSavedVariableModified
|
|
34
|
-
const { timeRange
|
|
35
|
-
const { setEditMode
|
|
36
|
-
const { openSaveChangesConfirmationDialog
|
|
31
|
+
const { dashboard, setDashboard } = (0, _context.useDashboard)();
|
|
32
|
+
const { getSavedVariablesStatus, setVariableDefaultValues } = (0, _context.useTemplateVariableActions)();
|
|
33
|
+
const { isSavedVariableModified } = getSavedVariablesStatus();
|
|
34
|
+
const { timeRange } = (0, _pluginsystem.useTimeRange)();
|
|
35
|
+
const { setEditMode } = (0, _context.useEditMode)();
|
|
36
|
+
const { openSaveChangesConfirmationDialog, closeSaveChangesConfirmationDialog } = (0, _context.useSaveChangesConfirmationDialog)();
|
|
37
37
|
const onSaveButtonClick = ()=>{
|
|
38
38
|
const isSavedDurationModified = (0, _core.isRelativeTimeRange)(timeRange) && dashboard.spec.duration !== timeRange.pastDuration;
|
|
39
39
|
// Save dashboard
|
|
@@ -21,12 +21,12 @@ function _export(target, all) {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
|
-
DEFAULT_TIME_RANGE_OPTIONS: function() {
|
|
25
|
-
return DEFAULT_TIME_RANGE_OPTIONS;
|
|
26
|
-
},
|
|
27
24
|
DEFAULT_REFRESH_INTERVAL_OPTIONS: function() {
|
|
28
25
|
return DEFAULT_REFRESH_INTERVAL_OPTIONS;
|
|
29
26
|
},
|
|
27
|
+
DEFAULT_TIME_RANGE_OPTIONS: function() {
|
|
28
|
+
return DEFAULT_TIME_RANGE_OPTIONS;
|
|
29
|
+
},
|
|
30
30
|
TimeRangeControls: function() {
|
|
31
31
|
return TimeRangeControls;
|
|
32
32
|
}
|
|
@@ -142,11 +142,11 @@ const DEFAULT_REFRESH_INTERVAL_OPTIONS = [
|
|
|
142
142
|
}
|
|
143
143
|
];
|
|
144
144
|
const DEFAULT_HEIGHT = '34px';
|
|
145
|
-
function TimeRangeControls({ heightPx
|
|
146
|
-
const { timeRange
|
|
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
147
|
// TODO: Remove this since it couples to the dashboard context
|
|
148
148
|
const dashboardDuration = (0, _context.useDashboardDuration)();
|
|
149
|
-
const { dashboard
|
|
149
|
+
const { dashboard, setDashboard } = (0, _useDashboard.useDashboard)();
|
|
150
150
|
// Convert height to a string, then use the string for styling
|
|
151
151
|
const height = heightPx === undefined ? DEFAULT_HEIGHT : `${heightPx}px`;
|
|
152
152
|
// add time shortcut if one does not match duration from dashboard JSON
|
|
@@ -31,7 +31,7 @@ function IconButton(props, ref) {
|
|
|
31
31
|
...props
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
|
-
const StyledIconButton = (0, _material.styled)(_material.Button)(({ theme
|
|
34
|
+
const StyledIconButton = (0, _material.styled)(_material.Button)(({ theme })=>({
|
|
35
35
|
// Using a button with some adjusted styles because it is easier to inherit
|
|
36
36
|
// styling and variants from themes than with an IconButton.
|
|
37
37
|
padding: theme.spacing(0.5),
|