@perses-dev/dashboards 0.21.1 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/AddGroupButton/AddGroupButton.js +43 -0
- package/dist/cjs/components/AddGroupButton/index.js +28 -0
- package/dist/cjs/components/AddPanelButton/AddPanelButton.js +43 -0
- package/dist/cjs/components/AddPanelButton/index.js +28 -0
- package/dist/cjs/components/Dashboard/Dashboard.js +1 -1
- package/dist/cjs/components/Dashboard/index.js +1 -1
- package/dist/cjs/components/DashboardToolbar/DashboardToolbar.js +50 -22
- package/dist/cjs/components/DashboardToolbar/index.js +1 -1
- package/dist/cjs/components/DeletePanelDialog/DeletePanelDialog.js +9 -31
- package/dist/cjs/components/DeletePanelDialog/index.js +1 -1
- package/dist/cjs/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +2 -1
- package/dist/cjs/components/DeletePanelGroupDialog/index.js +1 -1
- package/dist/cjs/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js +2 -1
- package/dist/cjs/components/DiscardChangesConfirmationDialog/index.js +1 -1
- package/dist/cjs/components/DownloadButton/DownloadButton.js +17 -53
- package/dist/cjs/components/DownloadButton/index.js +1 -1
- package/dist/cjs/components/GridLayout/GridContainer.js +2 -1
- package/dist/cjs/components/GridLayout/GridItemContent.js +3 -2
- package/dist/cjs/components/GridLayout/GridLayout.js +6 -8
- package/dist/cjs/components/GridLayout/GridTitle.js +14 -11
- package/dist/cjs/components/GridLayout/index.js +1 -1
- package/dist/cjs/components/Panel/Panel.js +6 -6
- package/dist/cjs/components/Panel/Panel.test.js +11 -3
- package/dist/cjs/components/Panel/PanelContent.js +3 -2
- package/dist/cjs/components/Panel/PanelHeader.js +26 -8
- package/dist/cjs/components/Panel/index.js +1 -1
- package/dist/cjs/components/PanelDrawer/PanelDrawer.js +2 -1
- package/dist/cjs/components/PanelDrawer/PanelDrawer.test.js +1 -1
- package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +1 -1
- package/dist/cjs/components/PanelDrawer/PanelPreview.js +1 -1
- package/dist/cjs/components/PanelDrawer/index.js +1 -1
- package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.js +4 -1
- package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.test.js +1 -1
- package/dist/cjs/components/PanelGroupDialog/PanelGroupEditorForm.js +1 -1
- package/dist/cjs/components/PanelGroupDialog/index.js +1 -1
- package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +14 -16
- package/dist/cjs/components/TimeRangeControls/TimeRangeControls.test.js +3 -3
- package/dist/cjs/components/TimeRangeControls/index.js +1 -1
- package/dist/cjs/components/ToolbarIconButton/ToolbarIconButton.js +35 -0
- package/dist/cjs/components/ToolbarIconButton/index.js +28 -0
- package/dist/cjs/components/Variables/EditVariablesButton.js +75 -0
- package/dist/cjs/components/Variables/Variable.js +1 -1
- package/dist/cjs/components/Variables/VariableEditor.js +10 -6
- package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +6 -7
- package/dist/cjs/components/Variables/VariableEditorForm/index.js +1 -1
- package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +1 -1
- package/dist/cjs/components/Variables/VariableList.js +45 -111
- package/dist/cjs/components/Variables/index.js +4 -2
- package/dist/cjs/components/Variables/variable-model.js +1 -1
- package/dist/cjs/components/Variables/variable-model.test.js +1 -1
- package/dist/cjs/components/index.js +5 -2
- package/dist/cjs/{utils/functions.js → constants/grid-layout-config.js} +14 -6
- package/dist/cjs/constants/index.js +29 -0
- package/dist/cjs/constants/user-interface-text.js +61 -0
- package/dist/cjs/context/DashboardProvider/DashboardProvider.js +28 -3
- package/dist/cjs/context/DashboardProvider/common.js +1 -1
- package/dist/cjs/context/DashboardProvider/dashboard-provider-api.js +7 -5
- package/dist/cjs/context/DashboardProvider/delete-panel-group-slice.js +1 -1
- package/dist/cjs/context/DashboardProvider/delete-panel-slice.js +1 -1
- package/dist/cjs/context/DashboardProvider/discard-changes-dialog-slice.js +1 -1
- package/dist/cjs/context/DashboardProvider/duplicate-panel-slice.js +62 -0
- package/dist/cjs/context/DashboardProvider/index.js +1 -1
- package/dist/cjs/context/DashboardProvider/panel-editor-slice.js +9 -38
- package/dist/cjs/context/DashboardProvider/panel-group-editor-slice.js +1 -1
- package/dist/cjs/context/DashboardProvider/panel-group-slice.js +1 -1
- package/dist/cjs/context/DashboardProvider/panel-slice.js +1 -1
- package/dist/cjs/context/DatasourceStoreProvider.js +1 -1
- package/dist/cjs/context/TemplateVariableProvider/TemplateVariableProvider.js +8 -8
- package/dist/cjs/context/TemplateVariableProvider/index.js +1 -1
- package/dist/cjs/context/TemplateVariableProvider/query-params.js +1 -1
- package/dist/cjs/context/TemplateVariableProvider/query-params.test.js +1 -1
- package/dist/cjs/context/index.js +1 -1
- package/dist/cjs/context/useDashboard.js +5 -3
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/test/dashboard-provider.js +1 -1
- package/dist/cjs/test/index.js +1 -1
- package/dist/cjs/test/plugin-registry.js +1 -1
- package/dist/cjs/test/render.js +1 -1
- package/dist/cjs/test/setup-tests.js +1 -1
- package/dist/cjs/test/testDashboard.js +1 -1
- package/dist/cjs/utils/index.js +28 -0
- package/dist/cjs/utils/panelUtils.js +168 -0
- package/dist/cjs/utils/panelUtils.test.js +195 -0
- package/dist/cjs/views/ViewDashboard/DashboardApp.js +5 -2
- package/dist/cjs/views/ViewDashboard/ViewDashboard.js +5 -3
- package/dist/cjs/views/ViewDashboard/index.js +1 -1
- package/dist/cjs/views/ViewDashboard/tests/panelGroups.test.js +1 -1
- package/dist/cjs/views/index.js +1 -1
- package/dist/components/AddGroupButton/AddGroupButton.d.ts +3 -0
- package/dist/components/AddGroupButton/AddGroupButton.d.ts.map +1 -0
- package/dist/components/AddGroupButton/AddGroupButton.js +32 -0
- package/dist/components/AddGroupButton/AddGroupButton.js.map +1 -0
- package/dist/components/AddGroupButton/index.d.ts +2 -0
- package/dist/components/AddGroupButton/index.d.ts.map +1 -0
- package/dist/{utils/functions.js → components/AddGroupButton/index.js} +3 -5
- package/dist/components/AddGroupButton/index.js.map +1 -0
- package/dist/components/AddPanelButton/AddPanelButton.d.ts +3 -0
- package/dist/components/AddPanelButton/AddPanelButton.d.ts.map +1 -0
- package/dist/components/AddPanelButton/AddPanelButton.js +32 -0
- package/dist/components/AddPanelButton/AddPanelButton.js.map +1 -0
- package/dist/components/AddPanelButton/index.d.ts +2 -0
- package/dist/components/AddPanelButton/index.d.ts.map +1 -0
- package/dist/components/AddPanelButton/index.js +15 -0
- package/dist/components/AddPanelButton/index.js.map +1 -0
- package/dist/components/Dashboard/Dashboard.js +1 -1
- package/dist/components/Dashboard/Dashboard.js.map +1 -1
- package/dist/components/Dashboard/index.js +1 -1
- package/dist/components/Dashboard/index.js.map +1 -1
- package/dist/components/DashboardToolbar/DashboardToolbar.d.ts.map +1 -1
- package/dist/components/DashboardToolbar/DashboardToolbar.js +51 -23
- package/dist/components/DashboardToolbar/DashboardToolbar.js.map +1 -1
- package/dist/components/DashboardToolbar/index.js +1 -1
- package/dist/components/DashboardToolbar/index.js.map +1 -1
- package/dist/components/DeletePanelDialog/DeletePanelDialog.d.ts.map +1 -1
- package/dist/components/DeletePanelDialog/DeletePanelDialog.js +8 -25
- package/dist/components/DeletePanelDialog/DeletePanelDialog.js.map +1 -1
- package/dist/components/DeletePanelDialog/index.js +1 -1
- package/dist/components/DeletePanelDialog/index.js.map +1 -1
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +2 -1
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js.map +1 -1
- package/dist/components/DeletePanelGroupDialog/index.js +1 -1
- package/dist/components/DeletePanelGroupDialog/index.js.map +1 -1
- package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js +2 -1
- package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js.map +1 -1
- package/dist/components/DiscardChangesConfirmationDialog/index.js +1 -1
- package/dist/components/DiscardChangesConfirmationDialog/index.js.map +1 -1
- package/dist/components/DownloadButton/DownloadButton.d.ts +5 -1
- package/dist/components/DownloadButton/DownloadButton.d.ts.map +1 -1
- package/dist/components/DownloadButton/DownloadButton.js +18 -15
- package/dist/components/DownloadButton/DownloadButton.js.map +1 -1
- package/dist/components/DownloadButton/index.js +1 -1
- package/dist/components/DownloadButton/index.js.map +1 -1
- package/dist/components/GridLayout/GridContainer.d.ts.map +1 -1
- package/dist/components/GridLayout/GridContainer.js +2 -1
- package/dist/components/GridLayout/GridContainer.js.map +1 -1
- package/dist/components/GridLayout/GridItemContent.d.ts.map +1 -1
- package/dist/components/GridLayout/GridItemContent.js +3 -2
- package/dist/components/GridLayout/GridItemContent.js.map +1 -1
- package/dist/components/GridLayout/GridLayout.d.ts.map +1 -1
- package/dist/components/GridLayout/GridLayout.js +6 -8
- package/dist/components/GridLayout/GridLayout.js.map +1 -1
- package/dist/components/GridLayout/GridTitle.d.ts.map +1 -1
- package/dist/components/GridLayout/GridTitle.js +14 -11
- package/dist/components/GridLayout/GridTitle.js.map +1 -1
- package/dist/components/GridLayout/index.js +1 -1
- package/dist/components/GridLayout/index.js.map +1 -1
- package/dist/components/Panel/Panel.js +7 -7
- package/dist/components/Panel/Panel.js.map +1 -1
- package/dist/components/Panel/Panel.test.js +11 -3
- package/dist/components/Panel/Panel.test.js.map +1 -1
- package/dist/components/Panel/PanelContent.d.ts.map +1 -1
- package/dist/components/Panel/PanelContent.js +3 -2
- package/dist/components/Panel/PanelContent.js.map +1 -1
- package/dist/components/Panel/PanelHeader.d.ts +1 -0
- package/dist/components/Panel/PanelHeader.d.ts.map +1 -1
- package/dist/components/Panel/PanelHeader.js +26 -8
- package/dist/components/Panel/PanelHeader.js.map +1 -1
- package/dist/components/Panel/index.js +1 -1
- package/dist/components/Panel/index.js.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.js +2 -1
- package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.test.js +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.test.js.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.js +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -1
- package/dist/components/PanelDrawer/PanelPreview.js +1 -1
- package/dist/components/PanelDrawer/PanelPreview.js.map +1 -1
- package/dist/components/PanelDrawer/index.js +1 -1
- package/dist/components/PanelDrawer/index.js.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.js +4 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.js.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.test.js +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.test.js.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.js +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.js.map +1 -1
- package/dist/components/PanelGroupDialog/index.js +1 -1
- package/dist/components/PanelGroupDialog/index.js.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.js +15 -17
- package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.test.js +3 -3
- package/dist/components/TimeRangeControls/TimeRangeControls.test.js.map +1 -1
- package/dist/components/TimeRangeControls/index.js +1 -1
- package/dist/components/TimeRangeControls/index.js.map +1 -1
- package/dist/components/ToolbarIconButton/ToolbarIconButton.d.ts +6 -0
- package/dist/components/ToolbarIconButton/ToolbarIconButton.d.ts.map +1 -0
- package/dist/components/ToolbarIconButton/ToolbarIconButton.js +29 -0
- package/dist/components/ToolbarIconButton/ToolbarIconButton.js.map +1 -0
- package/dist/components/ToolbarIconButton/index.d.ts +2 -0
- package/dist/components/ToolbarIconButton/index.d.ts.map +1 -0
- package/dist/components/ToolbarIconButton/index.js +15 -0
- package/dist/components/ToolbarIconButton/index.js.map +1 -0
- package/dist/components/Variables/EditVariablesButton.d.ts +3 -0
- package/dist/components/Variables/EditVariablesButton.d.ts.map +1 -0
- package/dist/components/Variables/EditVariablesButton.js +64 -0
- package/dist/components/Variables/EditVariablesButton.js.map +1 -0
- package/dist/components/Variables/Variable.js +1 -1
- package/dist/components/Variables/Variable.js.map +1 -1
- package/dist/components/Variables/VariableEditor.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditor.js +10 -6
- package/dist/components/Variables/VariableEditor.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +8 -9
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/index.js +1 -1
- package/dist/components/Variables/VariableEditorForm/index.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +1 -1
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -1
- package/dist/components/Variables/VariableList.d.ts.map +1 -1
- package/dist/components/Variables/VariableList.js +47 -74
- package/dist/components/Variables/VariableList.js.map +1 -1
- package/dist/components/Variables/index.d.ts +3 -1
- package/dist/components/Variables/index.d.ts.map +1 -1
- package/dist/components/Variables/index.js +4 -2
- package/dist/components/Variables/index.js.map +1 -1
- package/dist/components/Variables/variable-model.js +1 -1
- package/dist/components/Variables/variable-model.js.map +1 -1
- package/dist/components/Variables/variable-model.test.js +1 -1
- package/dist/components/Variables/variable-model.test.js.map +1 -1
- package/dist/components/index.d.ts +4 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +5 -2
- package/dist/components/index.js.map +1 -1
- package/dist/constants/grid-layout-config.d.ts +6 -0
- package/dist/constants/grid-layout-config.d.ts.map +1 -0
- package/dist/constants/grid-layout-config.js +19 -0
- package/dist/constants/grid-layout-config.js.map +1 -0
- package/dist/constants/index.d.ts +3 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/constants/index.js +16 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/constants/user-interface-text.d.ts +30 -0
- package/dist/constants/user-interface-text.d.ts.map +1 -0
- package/dist/constants/user-interface-text.js +49 -0
- package/dist/constants/user-interface-text.js.map +1 -0
- 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 +29 -4
- package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -1
- package/dist/context/DashboardProvider/common.js +1 -1
- package/dist/context/DashboardProvider/common.js.map +1 -1
- package/dist/context/DashboardProvider/dashboard-provider-api.d.ts +1 -0
- package/dist/context/DashboardProvider/dashboard-provider-api.d.ts.map +1 -1
- package/dist/context/DashboardProvider/dashboard-provider-api.js +7 -5
- package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -1
- package/dist/context/DashboardProvider/delete-panel-group-slice.js +1 -1
- package/dist/context/DashboardProvider/delete-panel-group-slice.js.map +1 -1
- package/dist/context/DashboardProvider/delete-panel-slice.js +1 -1
- package/dist/context/DashboardProvider/delete-panel-slice.js.map +1 -1
- package/dist/context/DashboardProvider/discard-changes-dialog-slice.js +1 -1
- package/dist/context/DashboardProvider/discard-changes-dialog-slice.js.map +1 -1
- package/dist/context/DashboardProvider/duplicate-panel-slice.d.ts +19 -0
- package/dist/context/DashboardProvider/duplicate-panel-slice.d.ts.map +1 -0
- package/dist/context/DashboardProvider/duplicate-panel-slice.js +58 -0
- package/dist/context/DashboardProvider/duplicate-panel-slice.js.map +1 -0
- package/dist/context/DashboardProvider/index.d.ts +1 -1
- package/dist/context/DashboardProvider/index.d.ts.map +1 -1
- package/dist/context/DashboardProvider/index.js +1 -1
- package/dist/context/DashboardProvider/index.js.map +1 -1
- package/dist/context/DashboardProvider/panel-editor-slice.d.ts +4 -0
- package/dist/context/DashboardProvider/panel-editor-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/panel-editor-slice.js +7 -36
- package/dist/context/DashboardProvider/panel-editor-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-group-editor-slice.js +1 -1
- package/dist/context/DashboardProvider/panel-group-editor-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-group-slice.js +1 -1
- package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-slice.js +1 -1
- package/dist/context/DashboardProvider/panel-slice.js.map +1 -1
- package/dist/context/DatasourceStoreProvider.js +1 -1
- package/dist/context/DatasourceStoreProvider.js.map +1 -1
- package/dist/context/TemplateVariableProvider/TemplateVariableProvider.js +8 -8
- package/dist/context/TemplateVariableProvider/TemplateVariableProvider.js.map +1 -1
- package/dist/context/TemplateVariableProvider/index.js +1 -1
- package/dist/context/TemplateVariableProvider/index.js.map +1 -1
- package/dist/context/TemplateVariableProvider/query-params.js +1 -1
- package/dist/context/TemplateVariableProvider/query-params.js.map +1 -1
- package/dist/context/TemplateVariableProvider/query-params.test.js +1 -1
- package/dist/context/TemplateVariableProvider/query-params.test.js.map +1 -1
- package/dist/context/index.js +1 -1
- package/dist/context/index.js.map +1 -1
- package/dist/context/useDashboard.d.ts.map +1 -1
- package/dist/context/useDashboard.js +5 -3
- package/dist/context/useDashboard.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/test/dashboard-provider.js +1 -1
- package/dist/test/dashboard-provider.js.map +1 -1
- package/dist/test/index.js +1 -1
- package/dist/test/index.js.map +1 -1
- package/dist/test/plugin-registry.js +1 -1
- package/dist/test/plugin-registry.js.map +1 -1
- package/dist/test/render.js +1 -1
- package/dist/test/render.js.map +1 -1
- package/dist/test/setup-tests.js +1 -1
- package/dist/test/setup-tests.js.map +1 -1
- package/dist/test/testDashboard.js +1 -1
- package/dist/test/testDashboard.js.map +1 -1
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +15 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/panelUtils.d.ts +27 -0
- package/dist/utils/panelUtils.d.ts.map +1 -0
- package/dist/utils/panelUtils.js +174 -0
- package/dist/utils/panelUtils.js.map +1 -0
- package/dist/utils/panelUtils.test.d.ts +2 -0
- package/dist/utils/panelUtils.test.d.ts.map +1 -0
- package/dist/utils/panelUtils.test.js +193 -0
- package/dist/utils/panelUtils.test.js.map +1 -0
- package/dist/views/ViewDashboard/DashboardApp.d.ts +1 -0
- package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -1
- package/dist/views/ViewDashboard/DashboardApp.js +5 -2
- package/dist/views/ViewDashboard/DashboardApp.js.map +1 -1
- package/dist/views/ViewDashboard/ViewDashboard.d.ts +2 -0
- package/dist/views/ViewDashboard/ViewDashboard.d.ts.map +1 -1
- package/dist/views/ViewDashboard/ViewDashboard.js +5 -3
- package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -1
- package/dist/views/ViewDashboard/index.js +1 -1
- package/dist/views/ViewDashboard/index.js.map +1 -1
- package/dist/views/ViewDashboard/tests/panelGroups.test.js +1 -1
- package/dist/views/ViewDashboard/tests/panelGroups.test.js.map +1 -1
- package/dist/views/index.js +1 -1
- package/dist/views/index.js.map +1 -1
- package/package.json +4 -4
- package/dist/utils/functions.d.ts +0 -2
- package/dist/utils/functions.d.ts.map +0 -1
- package/dist/utils/functions.js.map +0 -1
|
@@ -0,0 +1,195 @@
|
|
|
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
|
+
const _panelUtils = require("./panelUtils");
|
|
18
|
+
describe('insertPanelInLayout', ()=>{
|
|
19
|
+
describe('inserts the panel to the right when space is available', ()=>{
|
|
20
|
+
test('with a single panel in that row', ()=>{
|
|
21
|
+
const newLayout = {
|
|
22
|
+
i: 'abc',
|
|
23
|
+
w: 10,
|
|
24
|
+
h: 8
|
|
25
|
+
};
|
|
26
|
+
const referenceLayout = {
|
|
27
|
+
i: 'one',
|
|
28
|
+
x: 0,
|
|
29
|
+
y: 0,
|
|
30
|
+
w: 6,
|
|
31
|
+
h: 6
|
|
32
|
+
};
|
|
33
|
+
const layouts = [
|
|
34
|
+
referenceLayout
|
|
35
|
+
];
|
|
36
|
+
expect((0, _panelUtils.insertPanelInLayout)(newLayout, referenceLayout, layouts)).toEqual([
|
|
37
|
+
referenceLayout,
|
|
38
|
+
{
|
|
39
|
+
x: 6,
|
|
40
|
+
y: 0,
|
|
41
|
+
...newLayout
|
|
42
|
+
}
|
|
43
|
+
]);
|
|
44
|
+
});
|
|
45
|
+
test('with multiple panels in that row with space between them', ()=>{
|
|
46
|
+
const newLayout = {
|
|
47
|
+
i: 'abc',
|
|
48
|
+
w: 10,
|
|
49
|
+
h: 8
|
|
50
|
+
};
|
|
51
|
+
const referenceLayout = {
|
|
52
|
+
i: 'one',
|
|
53
|
+
x: 0,
|
|
54
|
+
y: 0,
|
|
55
|
+
w: 3,
|
|
56
|
+
h: 4
|
|
57
|
+
};
|
|
58
|
+
const otherPanelInRow = {
|
|
59
|
+
i: 'two',
|
|
60
|
+
x: 20,
|
|
61
|
+
y: 0,
|
|
62
|
+
w: 4,
|
|
63
|
+
h: 4
|
|
64
|
+
};
|
|
65
|
+
const layouts = [
|
|
66
|
+
referenceLayout,
|
|
67
|
+
otherPanelInRow
|
|
68
|
+
];
|
|
69
|
+
expect((0, _panelUtils.insertPanelInLayout)(newLayout, referenceLayout, layouts)).toEqual([
|
|
70
|
+
referenceLayout,
|
|
71
|
+
{
|
|
72
|
+
x: 3,
|
|
73
|
+
y: 0,
|
|
74
|
+
...newLayout
|
|
75
|
+
},
|
|
76
|
+
otherPanelInRow
|
|
77
|
+
]);
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
describe('inserts the panel below when space is not available to the right', ()=>{
|
|
81
|
+
test('with a single panel in the initial layout', ()=>{
|
|
82
|
+
const newLayout = {
|
|
83
|
+
i: 'abc',
|
|
84
|
+
w: 10,
|
|
85
|
+
h: 8
|
|
86
|
+
};
|
|
87
|
+
const referenceLayout = {
|
|
88
|
+
i: 'one',
|
|
89
|
+
x: 1,
|
|
90
|
+
y: 0,
|
|
91
|
+
w: 18,
|
|
92
|
+
h: 4
|
|
93
|
+
};
|
|
94
|
+
const layouts = [
|
|
95
|
+
referenceLayout
|
|
96
|
+
];
|
|
97
|
+
expect((0, _panelUtils.insertPanelInLayout)(newLayout, referenceLayout, layouts)).toEqual([
|
|
98
|
+
referenceLayout,
|
|
99
|
+
{
|
|
100
|
+
x: 1,
|
|
101
|
+
y: 4,
|
|
102
|
+
...newLayout
|
|
103
|
+
}
|
|
104
|
+
]);
|
|
105
|
+
});
|
|
106
|
+
test('with a single panel in the same row and additional panels below', ()=>{
|
|
107
|
+
const newLayout = {
|
|
108
|
+
i: 'abc',
|
|
109
|
+
w: 10,
|
|
110
|
+
h: 8
|
|
111
|
+
};
|
|
112
|
+
const referenceLayout = {
|
|
113
|
+
i: 'one',
|
|
114
|
+
x: 0,
|
|
115
|
+
y: 0,
|
|
116
|
+
w: 18,
|
|
117
|
+
h: 4
|
|
118
|
+
};
|
|
119
|
+
const nextRowItem = {
|
|
120
|
+
i: 'two',
|
|
121
|
+
x: 0,
|
|
122
|
+
y: 4,
|
|
123
|
+
w: 6,
|
|
124
|
+
h: 6
|
|
125
|
+
};
|
|
126
|
+
const layouts = [
|
|
127
|
+
referenceLayout,
|
|
128
|
+
nextRowItem
|
|
129
|
+
];
|
|
130
|
+
expect((0, _panelUtils.insertPanelInLayout)(newLayout, referenceLayout, layouts)).toEqual([
|
|
131
|
+
referenceLayout,
|
|
132
|
+
{
|
|
133
|
+
x: 0,
|
|
134
|
+
y: 4,
|
|
135
|
+
...newLayout
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
...nextRowItem,
|
|
139
|
+
y: nextRowItem.y + newLayout.h
|
|
140
|
+
}
|
|
141
|
+
]);
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
describe('getValidPanelKey', ()=>{
|
|
146
|
+
test('removes whitespace', ()=>{
|
|
147
|
+
expect((0, _panelUtils.getValidPanelKey)('my panel name', {})).toBe('mypanelname');
|
|
148
|
+
});
|
|
149
|
+
test('does not include a counter if the key is not in use', ()=>{
|
|
150
|
+
const mockPanelDefs = {
|
|
151
|
+
alreadyInUse: {
|
|
152
|
+
kind: 'Panel',
|
|
153
|
+
spec: {}
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
expect((0, _panelUtils.getValidPanelKey)('newPanelName', mockPanelDefs)).toBe('newPanelName');
|
|
157
|
+
});
|
|
158
|
+
test('includes a counter if the key is already in use', ()=>{
|
|
159
|
+
const mockPanelDefs = {
|
|
160
|
+
alreadyInUse: {
|
|
161
|
+
kind: 'Panel',
|
|
162
|
+
spec: {}
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
expect((0, _panelUtils.getValidPanelKey)('alreadyInUse', mockPanelDefs)).toBe('alreadyInUse-1');
|
|
166
|
+
});
|
|
167
|
+
test('includes an incremented counter if the key is already in use multiple times', ()=>{
|
|
168
|
+
const mockPanelDefs = {
|
|
169
|
+
popularKey: {
|
|
170
|
+
kind: 'Panel',
|
|
171
|
+
spec: {}
|
|
172
|
+
},
|
|
173
|
+
'popularKey-1': {
|
|
174
|
+
kind: 'Panel',
|
|
175
|
+
spec: {}
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
expect((0, _panelUtils.getValidPanelKey)('popularKey', mockPanelDefs)).toBe('popularKey-2');
|
|
179
|
+
expect((0, _panelUtils.getValidPanelKey)('popularKey-1', mockPanelDefs)).toBe('popularKey-2');
|
|
180
|
+
});
|
|
181
|
+
test('does not duplicate counters when they are out of order', ()=>{
|
|
182
|
+
const mockPanelDefs = {
|
|
183
|
+
outoforder: {
|
|
184
|
+
kind: 'Panel',
|
|
185
|
+
spec: {}
|
|
186
|
+
},
|
|
187
|
+
'outoforder-2': {
|
|
188
|
+
kind: 'Panel',
|
|
189
|
+
spec: {}
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
expect((0, _panelUtils.getValidPanelKey)('outoforder', mockPanelDefs)).toBe('outoforder-3');
|
|
193
|
+
expect((0, _panelUtils.getValidPanelKey)('outoforder-2', mockPanelDefs)).toBe('outoforder-3');
|
|
194
|
+
});
|
|
195
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2023 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -25,7 +25,7 @@ const _components = require("@perses-dev/components");
|
|
|
25
25
|
const _components1 = require("../../components");
|
|
26
26
|
const _context = require("../../context");
|
|
27
27
|
const DashboardApp = (props)=>{
|
|
28
|
-
const { dashboardResource , dashboardTitleComponent , onSave , initialVariableIsSticky , isReadonly } = props;
|
|
28
|
+
const { dashboardResource , dashboardTitleComponent , onSave , onDiscard , initialVariableIsSticky , isReadonly } = props;
|
|
29
29
|
const { setEditMode } = (0, _context.useEditMode)();
|
|
30
30
|
const { dashboard , setDashboard } = (0, _context.useDashboard)();
|
|
31
31
|
const [originalDashboard, setOriginalDashboard] = (0, _react.useState)(undefined);
|
|
@@ -37,6 +37,9 @@ const DashboardApp = (props)=>{
|
|
|
37
37
|
}
|
|
38
38
|
setEditMode(false);
|
|
39
39
|
closeDiscardChangesConfirmationDialog();
|
|
40
|
+
if (onDiscard) {
|
|
41
|
+
onDiscard(dashboard);
|
|
42
|
+
}
|
|
40
43
|
};
|
|
41
44
|
const onEditButtonClick = ()=>{
|
|
42
45
|
setEditMode(true);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2023 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -25,7 +25,7 @@ const _pluginSystem = require("@perses-dev/plugin-system");
|
|
|
25
25
|
const _context = require("../../context");
|
|
26
26
|
const _dashboardApp = require("./DashboardApp");
|
|
27
27
|
function ViewDashboard(props) {
|
|
28
|
-
const { dashboardResource , datasourceApi , dashboardTitleComponent , onSave , initialVariableIsSticky , isReadonly , sx , ...others } = props;
|
|
28
|
+
const { dashboardResource , datasourceApi , dashboardTitleComponent , onSave , onDiscard , initialVariableIsSticky , isReadonly , isEditing , sx , ...others } = props;
|
|
29
29
|
const { spec } = dashboardResource;
|
|
30
30
|
var _duration;
|
|
31
31
|
const dashboardDuration = (_duration = spec.duration) !== null && _duration !== void 0 ? _duration : '1h';
|
|
@@ -35,7 +35,8 @@ function ViewDashboard(props) {
|
|
|
35
35
|
datasourceApi: datasourceApi,
|
|
36
36
|
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_context.DashboardProvider, {
|
|
37
37
|
initialState: {
|
|
38
|
-
dashboardResource
|
|
38
|
+
dashboardResource,
|
|
39
|
+
isEditMode: !!isEditing
|
|
39
40
|
},
|
|
40
41
|
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pluginSystem.TimeRangeProvider, {
|
|
41
42
|
initialTimeRange: initialTimeRange,
|
|
@@ -57,6 +58,7 @@ function ViewDashboard(props) {
|
|
|
57
58
|
dashboardResource: dashboardResource,
|
|
58
59
|
dashboardTitleComponent: dashboardTitleComponent,
|
|
59
60
|
onSave: onSave,
|
|
61
|
+
onDiscard: onDiscard,
|
|
60
62
|
initialVariableIsSticky: initialVariableIsSticky,
|
|
61
63
|
isReadonly: isReadonly
|
|
62
64
|
})
|
package/dist/cjs/views/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AddGroupButton.d.ts","sourceRoot":"","sources":["../../../src/components/AddGroupButton/AddGroupButton.tsx"],"names":[],"mappings":";AAmBA,eAAO,MAAM,cAAc,mBAU1B,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
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 } from "react/jsx-runtime";
|
|
14
|
+
import { Button } from '@mui/material';
|
|
15
|
+
import AddGroupIcon from 'mdi-material-ui/PlusBoxOutline';
|
|
16
|
+
import { InfoTooltip } from '@perses-dev/components';
|
|
17
|
+
import { TOOLTIP_TEXT } from '../../constants';
|
|
18
|
+
import { useDashboardActions } from '../../context';
|
|
19
|
+
export const AddGroupButton = ()=>{
|
|
20
|
+
const { openAddPanelGroup } = useDashboardActions();
|
|
21
|
+
return /*#__PURE__*/ _jsx(InfoTooltip, {
|
|
22
|
+
description: TOOLTIP_TEXT.addGroup,
|
|
23
|
+
children: /*#__PURE__*/ _jsx(Button, {
|
|
24
|
+
startIcon: /*#__PURE__*/ _jsx(AddGroupIcon, {}),
|
|
25
|
+
onClick: openAddPanelGroup,
|
|
26
|
+
"aria-label": TOOLTIP_TEXT.addGroup,
|
|
27
|
+
children: "Panel Group"
|
|
28
|
+
})
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=AddGroupButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/AddGroupButton/AddGroupButton.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Button } from '@mui/material';\nimport AddGroupIcon from 'mdi-material-ui/PlusBoxOutline';\nimport { InfoTooltip } from '@perses-dev/components';\nimport { TOOLTIP_TEXT } from '../../constants';\nimport { useDashboardActions } from '../../context';\n\nexport const AddGroupButton = () => {\n const { openAddPanelGroup } = useDashboardActions();\n\n return (\n <InfoTooltip description={TOOLTIP_TEXT.addGroup}>\n <Button startIcon={<AddGroupIcon />} onClick={openAddPanelGroup} aria-label={TOOLTIP_TEXT.addGroup}>\n Panel Group\n </Button>\n </InfoTooltip>\n );\n};\n"],"names":["Button","AddGroupIcon","InfoTooltip","TOOLTIP_TEXT","useDashboardActions","AddGroupButton","openAddPanelGroup","description","addGroup","startIcon","onClick","aria-label"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC;AAAA,SAASA,MAAM,QAAQ,eAAe,CAAC;AACvC,OAAOC,YAAY,MAAM,gCAAgC,CAAC;AAC1D,SAASC,WAAW,QAAQ,wBAAwB,CAAC;AACrD,SAASC,YAAY,QAAQ,iBAAiB,CAAC;AAC/C,SAASC,mBAAmB,QAAQ,eAAe,CAAC;AAEpD,OAAO,MAAMC,cAAc,GAAG,IAAM;IAClC,MAAM,EAAEC,iBAAiB,CAAA,EAAE,GAAGF,mBAAmB,EAAE,AAAC;IAEpD,qBACE,KAACF,WAAW;QAACK,WAAW,EAAEJ,YAAY,CAACK,QAAQ;kBAC7C,cAAA,KAACR,MAAM;YAACS,SAAS,gBAAE,KAACR,YAAY,KAAG;YAAES,OAAO,EAAEJ,iBAAiB;YAAEK,YAAU,EAAER,YAAY,CAACK,QAAQ;sBAAE,aAEpG;UAAS;MACG,CACd;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/AddGroupButton/index.ts"],"names":[],"mappings":"AAaA,cAAc,kBAAkB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2023 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -10,8 +10,6 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
-
export
|
|
14
|
-
return str.replace(/\s+/g, '');
|
|
15
|
-
};
|
|
13
|
+
export * from './AddGroupButton';
|
|
16
14
|
|
|
17
|
-
//# sourceMappingURL=
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/AddGroupButton/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './AddGroupButton';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AddPanelButton.d.ts","sourceRoot":"","sources":["../../../src/components/AddPanelButton/AddPanelButton.tsx"],"names":[],"mappings":";AAmBA,eAAO,MAAM,cAAc,mBAU1B,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
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 } from "react/jsx-runtime";
|
|
14
|
+
import { Button } from '@mui/material';
|
|
15
|
+
import AddPanelIcon from 'mdi-material-ui/ChartBoxPlusOutline';
|
|
16
|
+
import { InfoTooltip } from '@perses-dev/components';
|
|
17
|
+
import { TOOLTIP_TEXT } from '../../constants';
|
|
18
|
+
import { useDashboardActions } from '../../context';
|
|
19
|
+
export const AddPanelButton = ()=>{
|
|
20
|
+
const { openAddPanel } = useDashboardActions();
|
|
21
|
+
return /*#__PURE__*/ _jsx(InfoTooltip, {
|
|
22
|
+
description: TOOLTIP_TEXT.addPanel,
|
|
23
|
+
children: /*#__PURE__*/ _jsx(Button, {
|
|
24
|
+
startIcon: /*#__PURE__*/ _jsx(AddPanelIcon, {}),
|
|
25
|
+
onClick: openAddPanel,
|
|
26
|
+
"aria-label": TOOLTIP_TEXT.addPanel,
|
|
27
|
+
children: "Panel"
|
|
28
|
+
})
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=AddPanelButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/AddPanelButton/AddPanelButton.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Button } from '@mui/material';\nimport AddPanelIcon from 'mdi-material-ui/ChartBoxPlusOutline';\nimport { InfoTooltip } from '@perses-dev/components';\nimport { TOOLTIP_TEXT } from '../../constants';\nimport { useDashboardActions } from '../../context';\n\nexport const AddPanelButton = () => {\n const { openAddPanel } = useDashboardActions();\n\n return (\n <InfoTooltip description={TOOLTIP_TEXT.addPanel}>\n <Button startIcon={<AddPanelIcon />} onClick={openAddPanel} aria-label={TOOLTIP_TEXT.addPanel}>\n Panel\n </Button>\n </InfoTooltip>\n );\n};\n"],"names":["Button","AddPanelIcon","InfoTooltip","TOOLTIP_TEXT","useDashboardActions","AddPanelButton","openAddPanel","description","addPanel","startIcon","onClick","aria-label"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC;AAAA,SAASA,MAAM,QAAQ,eAAe,CAAC;AACvC,OAAOC,YAAY,MAAM,qCAAqC,CAAC;AAC/D,SAASC,WAAW,QAAQ,wBAAwB,CAAC;AACrD,SAASC,YAAY,QAAQ,iBAAiB,CAAC;AAC/C,SAASC,mBAAmB,QAAQ,eAAe,CAAC;AAEpD,OAAO,MAAMC,cAAc,GAAG,IAAM;IAClC,MAAM,EAAEC,YAAY,CAAA,EAAE,GAAGF,mBAAmB,EAAE,AAAC;IAE/C,qBACE,KAACF,WAAW;QAACK,WAAW,EAAEJ,YAAY,CAACK,QAAQ;kBAC7C,cAAA,KAACR,MAAM;YAACS,SAAS,gBAAE,KAACR,YAAY,KAAG;YAAES,OAAO,EAAEJ,YAAY;YAAEK,YAAU,EAAER,YAAY,CAACK,QAAQ;sBAAE,OAE/F;UAAS;MACG,CACd;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/AddPanelButton/index.ts"],"names":[],"mappings":"AAaA,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
export * from './AddPanelButton';
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/AddPanelButton/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './AddPanelButton';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Dashboard/Dashboard.tsx"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Dashboard/Dashboard.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 { ErrorBoundary, ErrorAlert } from '@perses-dev/components';\nimport { usePanelGroupIds } from '../../context';\nimport { GridLayout } from '../GridLayout';\n\nexport type DashboardProps = BoxProps;\n\n/**\n * Renders a Dashboard for the provided Dashboard spec.\n */\nexport function Dashboard(props: DashboardProps) {\n const panelGroupIds = usePanelGroupIds();\n return (\n <Box {...props}>\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n {panelGroupIds.map((panelGroupId) => (\n <GridLayout key={panelGroupId} panelGroupId={panelGroupId} />\n ))}\n </ErrorBoundary>\n </Box>\n );\n}\n"],"names":["Box","ErrorBoundary","ErrorAlert","usePanelGroupIds","GridLayout","Dashboard","props","panelGroupIds","FallbackComponent","map","panelGroupId"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC;AAAA,SAASA,GAAG,QAAkB,eAAe,CAAC;AAC9C,SAASC,aAAa,EAAEC,UAAU,QAAQ,wBAAwB,CAAC;AACnE,SAASC,gBAAgB,QAAQ,eAAe,CAAC;AACjD,SAASC,UAAU,QAAQ,eAAe,CAAC;AAI3C;;CAEC,GACD,OAAO,SAASC,SAAS,CAACC,KAAqB,EAAE;IAC/C,MAAMC,aAAa,GAAGJ,gBAAgB,EAAE,AAAC;IACzC,qBACE,KAACH,GAAG;QAAE,GAAGM,KAAK;kBACZ,cAAA,KAACL,aAAa;YAACO,iBAAiB,EAAEN,UAAU;sBACzCK,aAAa,CAACE,GAAG,CAAC,CAACC,YAAY,iBAC9B,KAACN,UAAU;oBAAoBM,YAAY,EAAEA,YAAY;mBAAxCA,YAAY,CAAgC,AAC9D,CAAC;UACY;MACZ,CACN;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Dashboard/index.ts"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Dashboard/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './Dashboard';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardToolbar.d.ts","sourceRoot":"","sources":["../../../src/components/DashboardToolbar/DashboardToolbar.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"DashboardToolbar.d.ts","sourceRoot":"","sources":["../../../src/components/DashboardToolbar/DashboardToolbar.tsx"],"names":[],"mappings":";AAiBA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAQrD,MAAM,WAAW,qBAAqB;IACpC,aAAa,EAAE,MAAM,CAAC;IACtB,uBAAuB,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IACtC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,UAAU,EAAE,OAAO,CAAC;IACpB,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAC9B,mBAAmB,EAAE,MAAM,IAAI,CAAC;IAChC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAC;CACpE;AAED,eAAO,MAAM,gBAAgB,UAAW,qBAAqB,gBA4I5D,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2023 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -11,23 +11,23 @@
|
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
|
+
import { useState } from 'react';
|
|
14
15
|
import { Typography, Stack, Button, Box, useTheme, useMediaQuery, Alert } from '@mui/material';
|
|
15
16
|
import PencilIcon from 'mdi-material-ui/PencilOutline';
|
|
16
|
-
import AddPanelGroupIcon from 'mdi-material-ui/PlusBoxOutline';
|
|
17
|
-
import AddPanelIcon from 'mdi-material-ui/ChartBoxPlusOutline';
|
|
18
17
|
import { ErrorBoundary, ErrorAlert } from '@perses-dev/components';
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import { TimeRangeControls } from '../TimeRangeControls';
|
|
18
|
+
import { useDashboard, useEditMode } from '../../context';
|
|
19
|
+
import { AddPanelButton } from '../AddPanelButton';
|
|
20
|
+
import { AddGroupButton } from '../AddGroupButton';
|
|
23
21
|
import { DownloadButton } from '../DownloadButton';
|
|
22
|
+
import { TimeRangeControls } from '../TimeRangeControls';
|
|
23
|
+
import { TemplateVariableList, EditVariablesButton } from '../Variables';
|
|
24
24
|
export const DashboardToolbar = (props)=>{
|
|
25
25
|
const { dashboardName , dashboardTitleComponent , initialVariableIsSticky , isReadonly , onEditButtonClick , onCancelButtonClick , onSave , } = props;
|
|
26
|
+
const dashboard = useDashboard();
|
|
26
27
|
const { isEditMode , setEditMode } = useEditMode();
|
|
28
|
+
const isBiggerThanMd = useMediaQuery(useTheme().breakpoints.up('md'));
|
|
29
|
+
const isBiggerThanSm = useMediaQuery(useTheme().breakpoints.up('sm'));
|
|
27
30
|
const [isSavingDashboard, setSavingDashboard] = useState(false);
|
|
28
|
-
const dashboard = useDashboard();
|
|
29
|
-
const { openAddPanelGroup , openAddPanel } = useDashboardActions();
|
|
30
|
-
const isLaptopSize = useMediaQuery(useTheme().breakpoints.up('sm'));
|
|
31
31
|
const dashboardTitle = dashboardTitleComponent ? dashboardTitleComponent : /*#__PURE__*/ _jsx(Typography, {
|
|
32
32
|
variant: "h2",
|
|
33
33
|
children: dashboardName
|
|
@@ -45,9 +45,11 @@ export const DashboardToolbar = (props)=>{
|
|
|
45
45
|
setEditMode(false);
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
+
const testId = 'dashboard-toolbar';
|
|
48
49
|
return /*#__PURE__*/ _jsx(_Fragment, {
|
|
49
50
|
children: isEditMode ? /*#__PURE__*/ _jsxs(Stack, {
|
|
50
51
|
spacing: 1,
|
|
52
|
+
"data-testid": testId,
|
|
51
53
|
children: [
|
|
52
54
|
/*#__PURE__*/ _jsxs(Box, {
|
|
53
55
|
p: 2,
|
|
@@ -89,8 +91,8 @@ export const DashboardToolbar = (props)=>{
|
|
|
89
91
|
sx: {
|
|
90
92
|
display: 'flex',
|
|
91
93
|
width: '100%',
|
|
92
|
-
alignItems: '
|
|
93
|
-
padding: (theme)=>theme.spacing(
|
|
94
|
+
alignItems: 'start',
|
|
95
|
+
padding: (theme)=>theme.spacing(1, 2, 2, 2)
|
|
94
96
|
},
|
|
95
97
|
children: [
|
|
96
98
|
/*#__PURE__*/ _jsx(ErrorBoundary, {
|
|
@@ -102,6 +104,7 @@ export const DashboardToolbar = (props)=>{
|
|
|
102
104
|
}
|
|
103
105
|
})
|
|
104
106
|
}),
|
|
107
|
+
isBiggerThanMd ? // On bigger screens, make it one row
|
|
105
108
|
/*#__PURE__*/ _jsxs(Stack, {
|
|
106
109
|
direction: "row",
|
|
107
110
|
spacing: 1,
|
|
@@ -110,19 +113,42 @@ export const DashboardToolbar = (props)=>{
|
|
|
110
113
|
whiteSpace: 'nowrap'
|
|
111
114
|
},
|
|
112
115
|
children: [
|
|
113
|
-
/*#__PURE__*/ _jsx(
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
children: "Add Panel Group"
|
|
117
|
-
}),
|
|
118
|
-
/*#__PURE__*/ _jsx(Button, {
|
|
119
|
-
startIcon: /*#__PURE__*/ _jsx(AddPanelIcon, {}),
|
|
120
|
-
onClick: openAddPanel,
|
|
121
|
-
children: "Add Panel"
|
|
122
|
-
}),
|
|
116
|
+
/*#__PURE__*/ _jsx(EditVariablesButton, {}),
|
|
117
|
+
/*#__PURE__*/ _jsx(AddPanelButton, {}),
|
|
118
|
+
/*#__PURE__*/ _jsx(AddGroupButton, {}),
|
|
123
119
|
/*#__PURE__*/ _jsx(TimeRangeControls, {}),
|
|
124
120
|
/*#__PURE__*/ _jsx(DownloadButton, {})
|
|
125
121
|
]
|
|
122
|
+
}) : // On smaller screens, make it two rows
|
|
123
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
124
|
+
spacing: 1,
|
|
125
|
+
children: [
|
|
126
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
127
|
+
direction: "row",
|
|
128
|
+
spacing: 1,
|
|
129
|
+
marginLeft: "auto",
|
|
130
|
+
sx: {
|
|
131
|
+
whiteSpace: 'nowrap'
|
|
132
|
+
},
|
|
133
|
+
children: [
|
|
134
|
+
/*#__PURE__*/ _jsx(TimeRangeControls, {}),
|
|
135
|
+
/*#__PURE__*/ _jsx(DownloadButton, {})
|
|
136
|
+
]
|
|
137
|
+
}),
|
|
138
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
139
|
+
direction: "row",
|
|
140
|
+
spacing: 1,
|
|
141
|
+
marginLeft: "auto",
|
|
142
|
+
sx: {
|
|
143
|
+
whiteSpace: 'nowrap'
|
|
144
|
+
},
|
|
145
|
+
children: [
|
|
146
|
+
/*#__PURE__*/ _jsx(EditVariablesButton, {}),
|
|
147
|
+
/*#__PURE__*/ _jsx(AddPanelButton, {}),
|
|
148
|
+
/*#__PURE__*/ _jsx(AddGroupButton, {})
|
|
149
|
+
]
|
|
150
|
+
})
|
|
151
|
+
]
|
|
126
152
|
})
|
|
127
153
|
]
|
|
128
154
|
})
|
|
@@ -130,6 +156,7 @@ export const DashboardToolbar = (props)=>{
|
|
|
130
156
|
}) : /*#__PURE__*/ _jsxs(Stack, {
|
|
131
157
|
spacing: 1,
|
|
132
158
|
padding: 2,
|
|
159
|
+
"data-testid": testId,
|
|
133
160
|
children: [
|
|
134
161
|
/*#__PURE__*/ _jsxs(Box, {
|
|
135
162
|
sx: {
|
|
@@ -145,8 +172,9 @@ export const DashboardToolbar = (props)=>{
|
|
|
145
172
|
children: [
|
|
146
173
|
/*#__PURE__*/ _jsx(TimeRangeControls, {}),
|
|
147
174
|
/*#__PURE__*/ _jsx(DownloadButton, {}),
|
|
148
|
-
|
|
175
|
+
isBiggerThanSm && /*#__PURE__*/ _jsx(Button, {
|
|
149
176
|
variant: "outlined",
|
|
177
|
+
color: "secondary",
|
|
150
178
|
startIcon: /*#__PURE__*/ _jsx(PencilIcon, {}),
|
|
151
179
|
onClick: onEditButtonClick,
|
|
152
180
|
sx: {
|