@perses-dev/dashboards 0.0.0-snapshot-time-range-height-80d08fc
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/LICENSE +201 -0
- package/dist/cjs/components/Dashboard/Dashboard.js +37 -0
- package/dist/cjs/components/Dashboard/index.js +28 -0
- package/dist/cjs/components/DashboardToolbar/DashboardToolbar.js +176 -0
- package/dist/cjs/components/DashboardToolbar/index.js +28 -0
- package/dist/cjs/components/DeletePanelDialog/DeletePanelDialog.js +92 -0
- package/dist/cjs/components/DeletePanelDialog/index.js +28 -0
- package/dist/cjs/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +88 -0
- package/dist/cjs/components/DeletePanelGroupDialog/index.js +28 -0
- package/dist/cjs/components/DownloadButton/DownloadButton.js +109 -0
- package/dist/cjs/components/DownloadButton/index.js +28 -0
- package/dist/cjs/components/GridLayout/GridContainer.js +219 -0
- package/dist/cjs/components/GridLayout/GridItemContent.js +41 -0
- package/dist/cjs/components/GridLayout/GridLayout.js +104 -0
- package/dist/cjs/components/GridLayout/GridTitle.js +100 -0
- package/dist/cjs/components/GridLayout/index.js +29 -0
- package/dist/cjs/components/Panel/Panel.js +123 -0
- package/dist/cjs/components/Panel/Panel.test.js +129 -0
- package/dist/cjs/components/Panel/PanelContent.js +44 -0
- package/dist/cjs/components/Panel/PanelHeader.js +120 -0
- package/dist/cjs/components/Panel/index.js +28 -0
- package/dist/cjs/components/PanelDrawer/PanelDrawer.js +98 -0
- package/dist/cjs/components/PanelDrawer/PanelDrawer.test.js +131 -0
- package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +202 -0
- package/dist/cjs/components/PanelDrawer/PanelPreview.js +47 -0
- package/dist/cjs/components/PanelDrawer/index.js +28 -0
- package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.js +101 -0
- package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.test.js +87 -0
- package/dist/cjs/components/PanelGroupDialog/PanelGroupEditorForm.js +92 -0
- package/dist/cjs/components/PanelGroupDialog/index.js +28 -0
- package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +136 -0
- package/dist/cjs/components/TimeRangeControls/TimeRangeControls.test.js +95 -0
- package/dist/cjs/components/TimeRangeControls/index.js +28 -0
- package/dist/cjs/components/UnsavedChangesConfirmationDialog/UnsavedChangesConfirmationDialog.js +67 -0
- package/dist/cjs/components/UnsavedChangesConfirmationDialog/index.js +28 -0
- package/dist/cjs/components/Variables/Variable.js +194 -0
- package/dist/cjs/components/Variables/VariableEditor.js +276 -0
- package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +459 -0
- package/dist/cjs/components/Variables/VariableEditorForm/index.js +28 -0
- package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +89 -0
- package/dist/cjs/components/Variables/VariableList.js +150 -0
- package/dist/cjs/components/Variables/index.js +30 -0
- package/dist/cjs/components/Variables/variable-model.js +117 -0
- package/dist/cjs/components/Variables/variable-model.test.js +106 -0
- package/dist/cjs/components/index.js +39 -0
- package/dist/cjs/context/DashboardProvider/DashboardProvider.js +95 -0
- package/dist/cjs/context/DashboardProvider/common.js +28 -0
- package/dist/cjs/context/DashboardProvider/dashboard-provider-api.js +191 -0
- package/dist/cjs/context/DashboardProvider/delete-panel-group-slice.js +70 -0
- package/dist/cjs/context/DashboardProvider/delete-panel-slice.js +85 -0
- package/dist/cjs/context/DashboardProvider/index.js +29 -0
- package/dist/cjs/context/DashboardProvider/panel-editor-slice.js +205 -0
- package/dist/cjs/context/DashboardProvider/panel-group-editor-slice.js +85 -0
- package/dist/cjs/context/DashboardProvider/panel-group-slice.js +113 -0
- package/dist/cjs/context/DashboardProvider/panel-slice.js +25 -0
- package/dist/cjs/context/DatasourceStoreProvider.js +170 -0
- package/dist/cjs/context/TemplateVariableProvider/TemplateVariableProvider.js +228 -0
- package/dist/cjs/context/TemplateVariableProvider/index.js +28 -0
- package/dist/cjs/context/TemplateVariableProvider/query-params.js +81 -0
- package/dist/cjs/context/TemplateVariableProvider/query-params.test.js +82 -0
- package/dist/cjs/context/index.js +31 -0
- package/dist/cjs/context/useDashboard.js +94 -0
- package/dist/cjs/index.js +30 -0
- package/dist/cjs/test/dashboard-provider.js +51 -0
- package/dist/cjs/test/index.js +30 -0
- package/dist/cjs/test/plugin-registry.js +42 -0
- package/dist/cjs/test/render.js +62 -0
- package/dist/cjs/test/setup-tests.js +23 -0
- package/dist/cjs/test/testDashboard.js +293 -0
- package/dist/cjs/utils/functions.js +23 -0
- package/dist/cjs/views/ViewDashboard/DashboardApp.js +96 -0
- package/dist/cjs/views/ViewDashboard/ViewDashboard.js +68 -0
- package/dist/cjs/views/ViewDashboard/index.js +28 -0
- package/dist/cjs/views/ViewDashboard/tests/panelGroups.test.js +110 -0
- package/dist/cjs/views/index.js +28 -0
- package/dist/components/Dashboard/Dashboard.d.ts +8 -0
- package/dist/components/Dashboard/Dashboard.d.ts.map +1 -0
- package/dist/components/Dashboard/Dashboard.js +33 -0
- package/dist/components/Dashboard/Dashboard.js.map +1 -0
- package/dist/components/Dashboard/index.d.ts +2 -0
- package/dist/components/Dashboard/index.d.ts.map +1 -0
- package/dist/components/Dashboard/index.js +15 -0
- package/dist/components/Dashboard/index.js.map +1 -0
- package/dist/components/DashboardToolbar/DashboardToolbar.d.ts +11 -0
- package/dist/components/DashboardToolbar/DashboardToolbar.d.ts.map +1 -0
- package/dist/components/DashboardToolbar/DashboardToolbar.js +165 -0
- package/dist/components/DashboardToolbar/DashboardToolbar.js.map +1 -0
- package/dist/components/DashboardToolbar/index.d.ts +2 -0
- package/dist/components/DashboardToolbar/index.d.ts.map +1 -0
- package/dist/components/DashboardToolbar/index.js +15 -0
- package/dist/components/DashboardToolbar/index.js.map +1 -0
- package/dist/components/DeletePanelDialog/DeletePanelDialog.d.ts +3 -0
- package/dist/components/DeletePanelDialog/DeletePanelDialog.d.ts.map +1 -0
- package/dist/components/DeletePanelDialog/DeletePanelDialog.js +81 -0
- package/dist/components/DeletePanelDialog/DeletePanelDialog.js.map +1 -0
- package/dist/components/DeletePanelDialog/index.d.ts +2 -0
- package/dist/components/DeletePanelDialog/index.d.ts.map +1 -0
- package/dist/components/DeletePanelDialog/index.js +15 -0
- package/dist/components/DeletePanelDialog/index.js.map +1 -0
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.d.ts +3 -0
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.d.ts.map +1 -0
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +77 -0
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js.map +1 -0
- package/dist/components/DeletePanelGroupDialog/index.d.ts +2 -0
- package/dist/components/DeletePanelGroupDialog/index.d.ts.map +1 -0
- package/dist/components/DeletePanelGroupDialog/index.js +15 -0
- package/dist/components/DeletePanelGroupDialog/index.js.map +1 -0
- package/dist/components/DownloadButton/DownloadButton.d.ts +3 -0
- package/dist/components/DownloadButton/DownloadButton.d.ts.map +1 -0
- package/dist/components/DownloadButton/DownloadButton.js +60 -0
- package/dist/components/DownloadButton/DownloadButton.js.map +1 -0
- package/dist/components/DownloadButton/index.d.ts +2 -0
- package/dist/components/DownloadButton/index.d.ts.map +1 -0
- package/dist/components/DownloadButton/index.js +15 -0
- package/dist/components/DownloadButton/index.js.map +1 -0
- package/dist/components/GridLayout/GridContainer.d.ts +6 -0
- package/dist/components/GridLayout/GridContainer.d.ts.map +1 -0
- package/dist/components/GridLayout/GridContainer.js +213 -0
- package/dist/components/GridLayout/GridContainer.js.map +1 -0
- package/dist/components/GridLayout/GridItemContent.d.ts +10 -0
- package/dist/components/GridLayout/GridItemContent.d.ts.map +1 -0
- package/dist/components/GridLayout/GridItemContent.js +37 -0
- package/dist/components/GridLayout/GridItemContent.js.map +1 -0
- package/dist/components/GridLayout/GridLayout.d.ts +10 -0
- package/dist/components/GridLayout/GridLayout.d.ts.map +1 -0
- package/dist/components/GridLayout/GridLayout.js +100 -0
- package/dist/components/GridLayout/GridLayout.js.map +1 -0
- package/dist/components/GridLayout/GridTitle.d.ts +16 -0
- package/dist/components/GridLayout/GridTitle.d.ts.map +1 -0
- package/dist/components/GridLayout/GridTitle.js +92 -0
- package/dist/components/GridLayout/GridTitle.js.map +1 -0
- package/dist/components/GridLayout/index.d.ts +3 -0
- package/dist/components/GridLayout/index.d.ts.map +1 -0
- package/dist/components/GridLayout/index.js +16 -0
- package/dist/components/GridLayout/index.js.map +1 -0
- package/dist/components/Panel/Panel.d.ts +13 -0
- package/dist/components/Panel/Panel.d.ts.map +1 -0
- package/dist/components/Panel/Panel.js +114 -0
- package/dist/components/Panel/Panel.js.map +1 -0
- package/dist/components/Panel/Panel.test.d.ts +2 -0
- package/dist/components/Panel/Panel.test.d.ts.map +1 -0
- package/dist/components/Panel/Panel.test.js +122 -0
- package/dist/components/Panel/Panel.test.js.map +1 -0
- package/dist/components/Panel/PanelContent.d.ts +12 -0
- package/dist/components/Panel/PanelContent.d.ts.map +1 -0
- package/dist/components/Panel/PanelContent.js +41 -0
- package/dist/components/Panel/PanelContent.js.map +1 -0
- package/dist/components/Panel/PanelHeader.d.ts +16 -0
- package/dist/components/Panel/PanelHeader.d.ts.map +1 -0
- package/dist/components/Panel/PanelHeader.js +109 -0
- package/dist/components/Panel/PanelHeader.js.map +1 -0
- package/dist/components/Panel/index.d.ts +2 -0
- package/dist/components/Panel/index.d.ts.map +1 -0
- package/dist/components/Panel/index.js +15 -0
- package/dist/components/Panel/index.js.map +1 -0
- package/dist/components/PanelDrawer/PanelDrawer.d.ts +6 -0
- package/dist/components/PanelDrawer/PanelDrawer.d.ts.map +1 -0
- package/dist/components/PanelDrawer/PanelDrawer.js +94 -0
- package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -0
- package/dist/components/PanelDrawer/PanelDrawer.test.d.ts +2 -0
- package/dist/components/PanelDrawer/PanelDrawer.test.d.ts.map +1 -0
- package/dist/components/PanelDrawer/PanelDrawer.test.js +124 -0
- package/dist/components/PanelDrawer/PanelDrawer.test.js.map +1 -0
- package/dist/components/PanelDrawer/PanelEditorForm.d.ts +12 -0
- package/dist/components/PanelDrawer/PanelEditorForm.d.ts.map +1 -0
- package/dist/components/PanelDrawer/PanelEditorForm.js +192 -0
- package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -0
- package/dist/components/PanelDrawer/PanelPreview.d.ts +4 -0
- package/dist/components/PanelDrawer/PanelPreview.d.ts.map +1 -0
- package/dist/components/PanelDrawer/PanelPreview.js +41 -0
- package/dist/components/PanelDrawer/PanelPreview.js.map +1 -0
- package/dist/components/PanelDrawer/index.d.ts +2 -0
- package/dist/components/PanelDrawer/index.d.ts.map +1 -0
- package/dist/components/PanelDrawer/index.js +15 -0
- package/dist/components/PanelDrawer/index.js.map +1 -0
- package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts +6 -0
- package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts.map +1 -0
- package/dist/components/PanelGroupDialog/PanelGroupDialog.js +92 -0
- package/dist/components/PanelGroupDialog/PanelGroupDialog.js.map +1 -0
- package/dist/components/PanelGroupDialog/PanelGroupDialog.test.d.ts +2 -0
- package/dist/components/PanelGroupDialog/PanelGroupDialog.test.d.ts.map +1 -0
- package/dist/components/PanelGroupDialog/PanelGroupDialog.test.js +80 -0
- package/dist/components/PanelGroupDialog/PanelGroupDialog.test.js.map +1 -0
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.d.ts +12 -0
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.d.ts.map +1 -0
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.js +82 -0
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.js.map +1 -0
- package/dist/components/PanelGroupDialog/index.d.ts +2 -0
- package/dist/components/PanelGroupDialog/index.d.ts.map +1 -0
- package/dist/components/PanelGroupDialog/index.js +15 -0
- package/dist/components/PanelGroupDialog/index.js.map +1 -0
- package/dist/components/TimeRangeControls/TimeRangeControls.d.ts +9 -0
- package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -0
- package/dist/components/TimeRangeControls/TimeRangeControls.js +119 -0
- package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -0
- package/dist/components/TimeRangeControls/TimeRangeControls.test.d.ts +2 -0
- package/dist/components/TimeRangeControls/TimeRangeControls.test.d.ts.map +1 -0
- package/dist/components/TimeRangeControls/TimeRangeControls.test.js +88 -0
- package/dist/components/TimeRangeControls/TimeRangeControls.test.js.map +1 -0
- package/dist/components/TimeRangeControls/index.d.ts +2 -0
- package/dist/components/TimeRangeControls/index.d.ts.map +1 -0
- package/dist/components/TimeRangeControls/index.js +15 -0
- package/dist/components/TimeRangeControls/index.js.map +1 -0
- package/dist/components/UnsavedChangesConfirmationDialog/UnsavedChangesConfirmationDialog.d.ts +8 -0
- package/dist/components/UnsavedChangesConfirmationDialog/UnsavedChangesConfirmationDialog.d.ts.map +1 -0
- package/dist/components/UnsavedChangesConfirmationDialog/UnsavedChangesConfirmationDialog.js +56 -0
- package/dist/components/UnsavedChangesConfirmationDialog/UnsavedChangesConfirmationDialog.js.map +1 -0
- package/dist/components/UnsavedChangesConfirmationDialog/index.d.ts +2 -0
- package/dist/components/UnsavedChangesConfirmationDialog/index.d.ts.map +1 -0
- package/dist/components/UnsavedChangesConfirmationDialog/index.js +15 -0
- package/dist/components/UnsavedChangesConfirmationDialog/index.js.map +1 -0
- package/dist/components/Variables/Variable.d.ts +8 -0
- package/dist/components/Variables/Variable.d.ts.map +1 -0
- package/dist/components/Variables/Variable.js +188 -0
- package/dist/components/Variables/Variable.js.map +1 -0
- package/dist/components/Variables/VariableEditor.d.ts +8 -0
- package/dist/components/Variables/VariableEditor.d.ts.map +1 -0
- package/dist/components/Variables/VariableEditor.js +265 -0
- package/dist/components/Variables/VariableEditor.js.map +1 -0
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts +8 -0
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -0
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +409 -0
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -0
- package/dist/components/Variables/VariableEditorForm/index.d.ts +2 -0
- package/dist/components/Variables/VariableEditorForm/index.d.ts.map +1 -0
- package/dist/components/Variables/VariableEditorForm/index.js +15 -0
- package/dist/components/Variables/VariableEditorForm/index.js.map +1 -0
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts +22 -0
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts.map +1 -0
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +77 -0
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -0
- package/dist/components/Variables/VariableList.d.ts +9 -0
- package/dist/components/Variables/VariableList.d.ts.map +1 -0
- package/dist/components/Variables/VariableList.js +100 -0
- package/dist/components/Variables/VariableList.js.map +1 -0
- package/dist/components/Variables/index.d.ts +4 -0
- package/dist/components/Variables/index.d.ts.map +1 -0
- package/dist/components/Variables/index.js +17 -0
- package/dist/components/Variables/index.js.map +1 -0
- package/dist/components/Variables/variable-model.d.ts +16 -0
- package/dist/components/Variables/variable-model.d.ts.map +1 -0
- package/dist/components/Variables/variable-model.js +105 -0
- package/dist/components/Variables/variable-model.js.map +1 -0
- package/dist/components/Variables/variable-model.test.d.ts +2 -0
- package/dist/components/Variables/variable-model.test.d.ts.map +1 -0
- package/dist/components/Variables/variable-model.test.js +104 -0
- package/dist/components/Variables/variable-model.test.js.map +1 -0
- package/dist/components/index.d.ts +13 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +26 -0
- package/dist/components/index.js.map +1 -0
- package/dist/context/DashboardProvider/DashboardProvider.d.ts +28 -0
- package/dist/context/DashboardProvider/DashboardProvider.d.ts.map +1 -0
- package/dist/context/DashboardProvider/DashboardProvider.js +77 -0
- package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -0
- package/dist/context/DashboardProvider/common.d.ts +12 -0
- package/dist/context/DashboardProvider/common.d.ts.map +1 -0
- package/dist/context/DashboardProvider/common.js +24 -0
- package/dist/context/DashboardProvider/common.js.map +1 -0
- package/dist/context/DashboardProvider/dashboard-provider-api.d.ts +74 -0
- package/dist/context/DashboardProvider/dashboard-provider-api.d.ts.map +1 -0
- package/dist/context/DashboardProvider/dashboard-provider-api.js +190 -0
- package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -0
- package/dist/context/DashboardProvider/delete-panel-group-slice.d.ts +23 -0
- package/dist/context/DashboardProvider/delete-panel-group-slice.d.ts.map +1 -0
- package/dist/context/DashboardProvider/delete-panel-group-slice.js +64 -0
- package/dist/context/DashboardProvider/delete-panel-group-slice.js.map +1 -0
- package/dist/context/DashboardProvider/delete-panel-slice.d.ts +36 -0
- package/dist/context/DashboardProvider/delete-panel-slice.d.ts.map +1 -0
- package/dist/context/DashboardProvider/delete-panel-slice.js +81 -0
- package/dist/context/DashboardProvider/delete-panel-slice.js.map +1 -0
- package/dist/context/DashboardProvider/index.d.ts +7 -0
- package/dist/context/DashboardProvider/index.d.ts.map +1 -0
- package/dist/context/DashboardProvider/index.js +16 -0
- package/dist/context/DashboardProvider/index.js.map +1 -0
- package/dist/context/DashboardProvider/panel-editor-slice.d.ts +56 -0
- package/dist/context/DashboardProvider/panel-editor-slice.d.ts.map +1 -0
- package/dist/context/DashboardProvider/panel-editor-slice.js +201 -0
- package/dist/context/DashboardProvider/panel-editor-slice.js.map +1 -0
- package/dist/context/DashboardProvider/panel-group-editor-slice.d.ts +33 -0
- package/dist/context/DashboardProvider/panel-group-editor-slice.d.ts.map +1 -0
- package/dist/context/DashboardProvider/panel-group-editor-slice.js +79 -0
- package/dist/context/DashboardProvider/panel-group-editor-slice.js.map +1 -0
- package/dist/context/DashboardProvider/panel-group-slice.d.ts +59 -0
- package/dist/context/DashboardProvider/panel-group-slice.d.ts.map +1 -0
- package/dist/context/DashboardProvider/panel-group-slice.js +105 -0
- package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -0
- package/dist/context/DashboardProvider/panel-slice.d.ts +14 -0
- package/dist/context/DashboardProvider/panel-slice.d.ts.map +1 -0
- package/dist/context/DashboardProvider/panel-slice.js +21 -0
- package/dist/context/DashboardProvider/panel-slice.js.map +1 -0
- package/dist/context/DatasourceStoreProvider.d.ts +24 -0
- package/dist/context/DatasourceStoreProvider.d.ts.map +1 -0
- package/dist/context/DatasourceStoreProvider.js +166 -0
- package/dist/context/DatasourceStoreProvider.js.map +1 -0
- package/dist/context/TemplateVariableProvider/TemplateVariableProvider.d.ts +30 -0
- package/dist/context/TemplateVariableProvider/TemplateVariableProvider.d.ts.map +1 -0
- package/dist/context/TemplateVariableProvider/TemplateVariableProvider.js +212 -0
- package/dist/context/TemplateVariableProvider/TemplateVariableProvider.js.map +1 -0
- package/dist/context/TemplateVariableProvider/index.d.ts +2 -0
- package/dist/context/TemplateVariableProvider/index.d.ts.map +1 -0
- package/dist/context/TemplateVariableProvider/index.js +15 -0
- package/dist/context/TemplateVariableProvider/index.js.map +1 -0
- package/dist/context/TemplateVariableProvider/query-params.d.ts +12 -0
- package/dist/context/TemplateVariableProvider/query-params.d.ts.map +1 -0
- package/dist/context/TemplateVariableProvider/query-params.js +66 -0
- package/dist/context/TemplateVariableProvider/query-params.js.map +1 -0
- package/dist/context/TemplateVariableProvider/query-params.test.d.ts +2 -0
- package/dist/context/TemplateVariableProvider/query-params.test.d.ts.map +1 -0
- package/dist/context/TemplateVariableProvider/query-params.test.js +80 -0
- package/dist/context/TemplateVariableProvider/query-params.test.js.map +1 -0
- package/dist/context/index.d.ts +5 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/index.js +18 -0
- package/dist/context/index.js.map +1 -0
- package/dist/context/useDashboard.d.ts +6 -0
- package/dist/context/useDashboard.d.ts.map +1 -0
- package/dist/context/useDashboard.js +88 -0
- package/dist/context/useDashboard.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/test/dashboard-provider.d.ts +19 -0
- package/dist/test/dashboard-provider.d.ts.map +1 -0
- package/dist/test/dashboard-provider.js +40 -0
- package/dist/test/dashboard-provider.js.map +1 -0
- package/dist/test/index.d.ts +4 -0
- package/dist/test/index.d.ts.map +1 -0
- package/dist/test/index.js +17 -0
- package/dist/test/index.js.map +1 -0
- package/dist/test/plugin-registry.d.ts +3 -0
- package/dist/test/plugin-registry.d.ts.map +1 -0
- package/dist/test/plugin-registry.js +37 -0
- package/dist/test/plugin-registry.js.map +1 -0
- package/dist/test/render.d.ts +8 -0
- package/dist/test/render.d.ts.map +1 -0
- package/dist/test/render.js +58 -0
- package/dist/test/render.js.map +1 -0
- package/dist/test/setup-tests.d.ts +2 -0
- package/dist/test/setup-tests.d.ts.map +1 -0
- package/dist/test/setup-tests.js +22 -0
- package/dist/test/setup-tests.js.map +1 -0
- package/dist/test/testDashboard.d.ts +4 -0
- package/dist/test/testDashboard.d.ts.map +1 -0
- package/dist/test/testDashboard.js +287 -0
- package/dist/test/testDashboard.js.map +1 -0
- package/dist/utils/functions.d.ts +2 -0
- package/dist/utils/functions.d.ts.map +1 -0
- package/dist/utils/functions.js +17 -0
- package/dist/utils/functions.js.map +1 -0
- package/dist/views/ViewDashboard/DashboardApp.d.ts +10 -0
- package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -0
- package/dist/views/ViewDashboard/DashboardApp.js +90 -0
- package/dist/views/ViewDashboard/DashboardApp.js.map +1 -0
- package/dist/views/ViewDashboard/ViewDashboard.d.ts +16 -0
- package/dist/views/ViewDashboard/ViewDashboard.d.ts.map +1 -0
- package/dist/views/ViewDashboard/ViewDashboard.js +64 -0
- package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -0
- package/dist/views/ViewDashboard/index.d.ts +2 -0
- package/dist/views/ViewDashboard/index.d.ts.map +1 -0
- package/dist/views/ViewDashboard/index.js +15 -0
- package/dist/views/ViewDashboard/index.js.map +1 -0
- package/dist/views/ViewDashboard/tests/panelGroups.test.d.ts +2 -0
- package/dist/views/ViewDashboard/tests/panelGroups.test.d.ts.map +1 -0
- package/dist/views/ViewDashboard/tests/panelGroups.test.js +103 -0
- package/dist/views/ViewDashboard/tests/panelGroups.test.js.map +1 -0
- package/dist/views/index.d.ts +2 -0
- package/dist/views/index.d.ts.map +1 -0
- package/dist/views/index.js +15 -0
- package/dist/views/index.js.map +1 -0
- package/package.json +57 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
// Copyright 2022 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 _jsxRuntime = require("react/jsx-runtime");
|
|
18
|
+
const _react = require("@testing-library/react");
|
|
19
|
+
const _userEvent = /*#__PURE__*/ _interopRequireDefault(require("@testing-library/user-event"));
|
|
20
|
+
const _testUtils = require("react-dom/test-utils");
|
|
21
|
+
const _test = require("../../test");
|
|
22
|
+
const _dashboardProvider = require("../../context/DashboardProvider");
|
|
23
|
+
const _panelDrawer = require("./PanelDrawer");
|
|
24
|
+
function _interopRequireDefault(obj) {
|
|
25
|
+
return obj && obj.__esModule ? obj : {
|
|
26
|
+
default: obj
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
describe('Panel Drawer', ()=>{
|
|
30
|
+
const renderPanelDrawer = ()=>{
|
|
31
|
+
const { store , DashboardProviderSpy } = (0, _test.createDashboardProviderSpy)();
|
|
32
|
+
(0, _test.renderWithContext)(/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_dashboardProvider.DashboardProvider, {
|
|
33
|
+
initialState: {
|
|
34
|
+
dashboardResource: (0, _test.getTestDashboard)(),
|
|
35
|
+
isEditMode: true
|
|
36
|
+
},
|
|
37
|
+
children: [
|
|
38
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(DashboardProviderSpy, {}),
|
|
39
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_panelDrawer.PanelDrawer, {})
|
|
40
|
+
]
|
|
41
|
+
}));
|
|
42
|
+
const { value: storeApi } = store;
|
|
43
|
+
if (storeApi === undefined) {
|
|
44
|
+
throw new Error('Expected dashboard store to be set after initial render');
|
|
45
|
+
}
|
|
46
|
+
return storeApi;
|
|
47
|
+
};
|
|
48
|
+
it('should add new panel', async ()=>{
|
|
49
|
+
const storeApi = renderPanelDrawer();
|
|
50
|
+
// Open the drawer for a new panel
|
|
51
|
+
(0, _testUtils.act)(()=>storeApi.getState().openAddPanel());
|
|
52
|
+
const nameInput = await _react.screen.findByLabelText(/Name/);
|
|
53
|
+
_userEvent.default.type(nameInput, 'New Panel');
|
|
54
|
+
_userEvent.default.click(_react.screen.getByText('Add'));
|
|
55
|
+
// TODO: Assert drawer is closed?
|
|
56
|
+
const panels = storeApi.getState().panels;
|
|
57
|
+
expect(panels).toMatchObject({
|
|
58
|
+
// Should have the new panel in the store
|
|
59
|
+
NewPanel: {
|
|
60
|
+
kind: 'Panel',
|
|
61
|
+
spec: {
|
|
62
|
+
display: {
|
|
63
|
+
name: 'New Panel'
|
|
64
|
+
},
|
|
65
|
+
plugin: {
|
|
66
|
+
kind: '',
|
|
67
|
+
spec: {}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
it('should add panel with duplicate panel name', async ()=>{
|
|
74
|
+
const storeApi = renderPanelDrawer();
|
|
75
|
+
(0, _testUtils.act)(()=>storeApi.getState().openAddPanel());
|
|
76
|
+
const nameInput = await _react.screen.findByLabelText(/Name/);
|
|
77
|
+
_userEvent.default.type(nameInput, 'cpu');
|
|
78
|
+
_userEvent.default.click(_react.screen.getByText('Add'));
|
|
79
|
+
const panels = storeApi.getState().panels;
|
|
80
|
+
expect(panels).toMatchObject({
|
|
81
|
+
// make sure we don't have duplicate panel key by appending "-1"
|
|
82
|
+
'cpu-1': {
|
|
83
|
+
kind: 'Panel',
|
|
84
|
+
spec: {
|
|
85
|
+
display: {
|
|
86
|
+
name: 'cpu'
|
|
87
|
+
},
|
|
88
|
+
plugin: {
|
|
89
|
+
kind: '',
|
|
90
|
+
spec: {}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
it('should edit an existing panel', async ()=>{
|
|
97
|
+
const storeApi = renderPanelDrawer();
|
|
98
|
+
// Open the drawer for an existing panel
|
|
99
|
+
const group = Object.values(storeApi.getState().panelGroups).find((group)=>group.title === 'CPU Stats');
|
|
100
|
+
if (group === undefined) {
|
|
101
|
+
throw new Error('Test group not found');
|
|
102
|
+
}
|
|
103
|
+
const layout = Object.entries(group.itemPanelKeys).find(([, panelKey])=>panelKey === 'cpu');
|
|
104
|
+
if (layout === undefined) {
|
|
105
|
+
throw new Error('Test panel not found');
|
|
106
|
+
}
|
|
107
|
+
(0, _testUtils.act)(()=>storeApi.getState().openEditPanel({
|
|
108
|
+
panelGroupId: group.id,
|
|
109
|
+
panelGroupItemLayoutId: layout[0]
|
|
110
|
+
}));
|
|
111
|
+
const nameInput = await _react.screen.findByLabelText(/Name/);
|
|
112
|
+
_userEvent.default.clear(nameInput);
|
|
113
|
+
_userEvent.default.type(nameInput, 'cpu usage');
|
|
114
|
+
_userEvent.default.click(_react.screen.getByText('Apply'));
|
|
115
|
+
const panels = storeApi.getState().panels;
|
|
116
|
+
expect(panels).toMatchObject({
|
|
117
|
+
cpu: {
|
|
118
|
+
kind: 'Panel',
|
|
119
|
+
spec: {
|
|
120
|
+
display: {
|
|
121
|
+
name: 'cpu usage'
|
|
122
|
+
},
|
|
123
|
+
plugin: {
|
|
124
|
+
kind: 'TimeSeriesChart',
|
|
125
|
+
spec: {}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
});
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
// Copyright 2022 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
function _export(target, all) {
|
|
18
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: all[name]
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
_export(exports, {
|
|
24
|
+
PanelEditorForm: ()=>PanelEditorForm,
|
|
25
|
+
panelEditorFormId: ()=>panelEditorFormId
|
|
26
|
+
});
|
|
27
|
+
const _jsxRuntime = require("react/jsx-runtime");
|
|
28
|
+
const _react = require("react");
|
|
29
|
+
const _material = require("@mui/material");
|
|
30
|
+
const _components = require("@perses-dev/components");
|
|
31
|
+
const _pluginSystem = require("@perses-dev/plugin-system");
|
|
32
|
+
const _context = require("../../context");
|
|
33
|
+
const _panelPreview = require("./PanelPreview");
|
|
34
|
+
function PanelEditorForm(props) {
|
|
35
|
+
var ref;
|
|
36
|
+
const { initialValues , onSubmit } = props;
|
|
37
|
+
const panelGroups = (0, _context.useListPanelGroups)();
|
|
38
|
+
const [name, setName] = (0, _react.useState)(initialValues.name);
|
|
39
|
+
const [description, setDescription] = (0, _react.useState)(initialValues.description);
|
|
40
|
+
const [groupId, setGroupId] = (0, _react.useState)(initialValues.groupId);
|
|
41
|
+
const [kind, setKind] = (0, _react.useState)(initialValues.kind);
|
|
42
|
+
const [spec, setSpec] = (0, _react.useState)(initialValues.spec);
|
|
43
|
+
// Use common plugin editor logic even though we've split the inputs up in this form
|
|
44
|
+
const pluginEditor = (0, _pluginSystem.usePluginEditor)({
|
|
45
|
+
pluginType: 'Panel',
|
|
46
|
+
value: {
|
|
47
|
+
kind,
|
|
48
|
+
spec
|
|
49
|
+
},
|
|
50
|
+
onChange: (plugin)=>{
|
|
51
|
+
setKind(plugin.kind);
|
|
52
|
+
setSpec(plugin.spec);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
// Ignore string values (which would be an "empty" value from the Select) since we don't allow them to unset it
|
|
56
|
+
const handleGroupChange = (e)=>{
|
|
57
|
+
const { value } = e.target;
|
|
58
|
+
if (typeof value === 'string') {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
setGroupId(value);
|
|
62
|
+
};
|
|
63
|
+
const handleSubmit = (e)=>{
|
|
64
|
+
e.preventDefault();
|
|
65
|
+
const values = {
|
|
66
|
+
name,
|
|
67
|
+
description,
|
|
68
|
+
groupId,
|
|
69
|
+
kind,
|
|
70
|
+
spec
|
|
71
|
+
};
|
|
72
|
+
onSubmit(values);
|
|
73
|
+
};
|
|
74
|
+
var _title, ref1;
|
|
75
|
+
return(// Grid maxHeight allows user to scroll inside Drawer to see all content
|
|
76
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Box, {
|
|
77
|
+
component: "form",
|
|
78
|
+
id: panelEditorFormId,
|
|
79
|
+
onSubmit: handleSubmit,
|
|
80
|
+
sx: {
|
|
81
|
+
flex: 1,
|
|
82
|
+
overflowY: 'scroll',
|
|
83
|
+
padding: (theme)=>theme.spacing(2)
|
|
84
|
+
},
|
|
85
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Grid, {
|
|
86
|
+
container: true,
|
|
87
|
+
spacing: 2,
|
|
88
|
+
children: [
|
|
89
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Grid, {
|
|
90
|
+
item: true,
|
|
91
|
+
xs: 8,
|
|
92
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.TextField, {
|
|
93
|
+
required: true,
|
|
94
|
+
fullWidth: true,
|
|
95
|
+
label: "Name",
|
|
96
|
+
value: name,
|
|
97
|
+
variant: "outlined",
|
|
98
|
+
onChange: (e)=>setName(e.target.value)
|
|
99
|
+
})
|
|
100
|
+
}),
|
|
101
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Grid, {
|
|
102
|
+
item: true,
|
|
103
|
+
xs: 4,
|
|
104
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.FormControl, {
|
|
105
|
+
fullWidth: true,
|
|
106
|
+
children: [
|
|
107
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.InputLabel, {
|
|
108
|
+
id: "select-group",
|
|
109
|
+
children: "Group"
|
|
110
|
+
}),
|
|
111
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Select, {
|
|
112
|
+
required: true,
|
|
113
|
+
labelId: "select-group",
|
|
114
|
+
label: "Group",
|
|
115
|
+
value: groupId,
|
|
116
|
+
onChange: handleGroupChange,
|
|
117
|
+
children: panelGroups.map((panelGroup, index)=>/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.MenuItem, {
|
|
118
|
+
value: panelGroup.id,
|
|
119
|
+
children: (_title = panelGroup.title) !== null && _title !== void 0 ? _title : `Group ${index + 1}`
|
|
120
|
+
}, panelGroup.id))
|
|
121
|
+
})
|
|
122
|
+
]
|
|
123
|
+
})
|
|
124
|
+
}),
|
|
125
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Grid, {
|
|
126
|
+
item: true,
|
|
127
|
+
xs: 8,
|
|
128
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.TextField, {
|
|
129
|
+
fullWidth: true,
|
|
130
|
+
label: "Description",
|
|
131
|
+
value: description,
|
|
132
|
+
variant: "outlined",
|
|
133
|
+
onChange: (e)=>setDescription(e.target.value)
|
|
134
|
+
})
|
|
135
|
+
}),
|
|
136
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Grid, {
|
|
137
|
+
item: true,
|
|
138
|
+
xs: 4,
|
|
139
|
+
children: [
|
|
140
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.FormControl, {
|
|
141
|
+
fullWidth: true,
|
|
142
|
+
disabled: pluginEditor.isLoading,
|
|
143
|
+
error: pluginEditor.error !== null,
|
|
144
|
+
children: [
|
|
145
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.InputLabel, {
|
|
146
|
+
id: "panel-type-label",
|
|
147
|
+
children: "Type"
|
|
148
|
+
}),
|
|
149
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_pluginSystem.PluginKindSelect, {
|
|
150
|
+
pluginType: "Panel",
|
|
151
|
+
required: true,
|
|
152
|
+
labelId: "panel-type-label",
|
|
153
|
+
label: "Type",
|
|
154
|
+
value: pluginEditor.pendingKind ? pluginEditor.pendingKind : kind,
|
|
155
|
+
onChange: pluginEditor.onKindChange
|
|
156
|
+
})
|
|
157
|
+
]
|
|
158
|
+
}),
|
|
159
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.FormHelperText, {
|
|
160
|
+
children: (ref1 = (ref = pluginEditor.error) === null || ref === void 0 ? void 0 : ref.message) !== null && ref1 !== void 0 ? ref1 : ''
|
|
161
|
+
})
|
|
162
|
+
]
|
|
163
|
+
}),
|
|
164
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Grid, {
|
|
165
|
+
item: true,
|
|
166
|
+
xs: 12,
|
|
167
|
+
children: [
|
|
168
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Typography, {
|
|
169
|
+
variant: "h4",
|
|
170
|
+
marginBottom: 1,
|
|
171
|
+
children: "Preview"
|
|
172
|
+
}),
|
|
173
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_components.ErrorBoundary, {
|
|
174
|
+
FallbackComponent: _components.ErrorAlert,
|
|
175
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_panelPreview.PanelPreview, {
|
|
176
|
+
kind: kind,
|
|
177
|
+
name: name,
|
|
178
|
+
description: description,
|
|
179
|
+
spec: spec,
|
|
180
|
+
groupId: groupId
|
|
181
|
+
})
|
|
182
|
+
})
|
|
183
|
+
]
|
|
184
|
+
}),
|
|
185
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Grid, {
|
|
186
|
+
item: true,
|
|
187
|
+
xs: 12,
|
|
188
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components.ErrorBoundary, {
|
|
189
|
+
FallbackComponent: _components.ErrorAlert,
|
|
190
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pluginSystem.PluginSpecEditor, {
|
|
191
|
+
pluginType: "Panel",
|
|
192
|
+
pluginKind: kind,
|
|
193
|
+
value: spec,
|
|
194
|
+
onChange: pluginEditor.onSpecChange
|
|
195
|
+
})
|
|
196
|
+
})
|
|
197
|
+
})
|
|
198
|
+
]
|
|
199
|
+
})
|
|
200
|
+
}));
|
|
201
|
+
}
|
|
202
|
+
const panelEditorFormId = 'panel-editor-form';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Copyright 2022 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "PanelPreview", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: ()=>PanelPreview
|
|
20
|
+
});
|
|
21
|
+
const _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
+
const _material = require("@mui/material");
|
|
23
|
+
const _panel = require("../Panel");
|
|
24
|
+
function PanelPreview({ name , description , kind , spec }) {
|
|
25
|
+
const definition = {
|
|
26
|
+
kind: 'Panel',
|
|
27
|
+
spec: {
|
|
28
|
+
display: {
|
|
29
|
+
name,
|
|
30
|
+
description: description === '' ? undefined : description
|
|
31
|
+
},
|
|
32
|
+
plugin: {
|
|
33
|
+
kind,
|
|
34
|
+
spec
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
if (kind === '') {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Box, {
|
|
42
|
+
height: 300,
|
|
43
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_panel.Panel, {
|
|
44
|
+
definition: definition
|
|
45
|
+
})
|
|
46
|
+
});
|
|
47
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Copyright 2022 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
|
+
_exportStar(require("./PanelDrawer"), exports);
|
|
18
|
+
function _exportStar(from, to) {
|
|
19
|
+
Object.keys(from).forEach(function(k) {
|
|
20
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function() {
|
|
23
|
+
return from[k];
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
return from;
|
|
28
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
// Copyright 2022 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "PanelGroupDialog", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: ()=>PanelGroupDialog
|
|
20
|
+
});
|
|
21
|
+
const _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
+
const _material = require("@mui/material");
|
|
23
|
+
const _close = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/Close"));
|
|
24
|
+
const _react = require("react");
|
|
25
|
+
const _context = require("../../context");
|
|
26
|
+
const _panelGroupEditorForm = require("./PanelGroupEditorForm");
|
|
27
|
+
function _interopRequireDefault(obj) {
|
|
28
|
+
return obj && obj.__esModule ? obj : {
|
|
29
|
+
default: obj
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function PanelGroupDialog() {
|
|
33
|
+
const panelGroupEditor = (0, _context.usePanelGroupEditor)();
|
|
34
|
+
// When the user clicks close, start closing but don't call the store yet to keep values stable during animtation
|
|
35
|
+
const [isClosing, setIsClosing] = (0, _react.useState)(false);
|
|
36
|
+
const handleClose = ()=>setIsClosing(true);
|
|
37
|
+
// Don't call close on the store until the Dialog has completely transitioned out
|
|
38
|
+
const handleExited = ()=>{
|
|
39
|
+
panelGroupEditor === null || panelGroupEditor === void 0 ? void 0 : panelGroupEditor.close();
|
|
40
|
+
setIsClosing(false);
|
|
41
|
+
};
|
|
42
|
+
// Dialog is open if we have a model and we're not transitioning out
|
|
43
|
+
const isOpen = panelGroupEditor !== undefined && isClosing === false;
|
|
44
|
+
const handleSubmit = (values)=>{
|
|
45
|
+
// This shouldn't happen since we don't render the submit button until we have a model, but check to make TS happy
|
|
46
|
+
if (panelGroupEditor === undefined) {
|
|
47
|
+
throw new Error('Cannot apply changes');
|
|
48
|
+
}
|
|
49
|
+
panelGroupEditor.applyChanges(values);
|
|
50
|
+
handleClose();
|
|
51
|
+
};
|
|
52
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Dialog, {
|
|
53
|
+
open: isOpen,
|
|
54
|
+
TransitionProps: {
|
|
55
|
+
onExited: handleExited
|
|
56
|
+
},
|
|
57
|
+
children: panelGroupEditor !== undefined && /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
58
|
+
children: [
|
|
59
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.DialogTitle, {
|
|
60
|
+
children: [
|
|
61
|
+
panelGroupEditor.mode,
|
|
62
|
+
" Panel Group"
|
|
63
|
+
]
|
|
64
|
+
}),
|
|
65
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
66
|
+
"aria-label": "Close",
|
|
67
|
+
onClick: panelGroupEditor.close,
|
|
68
|
+
sx: (theme)=>({
|
|
69
|
+
position: 'absolute',
|
|
70
|
+
top: theme.spacing(0.5),
|
|
71
|
+
right: theme.spacing(0.5)
|
|
72
|
+
}),
|
|
73
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_close.default, {})
|
|
74
|
+
}),
|
|
75
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.DialogContent, {
|
|
76
|
+
sx: {
|
|
77
|
+
width: '500px'
|
|
78
|
+
},
|
|
79
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_panelGroupEditorForm.PanelGroupEditorForm, {
|
|
80
|
+
initialValues: panelGroupEditor.initialValues,
|
|
81
|
+
onSubmit: handleSubmit
|
|
82
|
+
})
|
|
83
|
+
}),
|
|
84
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.DialogActions, {
|
|
85
|
+
children: [
|
|
86
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Button, {
|
|
87
|
+
variant: "contained",
|
|
88
|
+
type: "submit",
|
|
89
|
+
form: _panelGroupEditorForm.panelGroupEditorFormId,
|
|
90
|
+
children: panelGroupEditor.mode === 'Edit' ? 'Apply' : 'Add'
|
|
91
|
+
}),
|
|
92
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Button, {
|
|
93
|
+
onClick: panelGroupEditor.close,
|
|
94
|
+
children: "Cancel"
|
|
95
|
+
})
|
|
96
|
+
]
|
|
97
|
+
})
|
|
98
|
+
]
|
|
99
|
+
})
|
|
100
|
+
});
|
|
101
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// Copyright 2022 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 _jsxRuntime = require("react/jsx-runtime");
|
|
18
|
+
const _react = require("@testing-library/react");
|
|
19
|
+
const _userEvent = /*#__PURE__*/ _interopRequireDefault(require("@testing-library/user-event"));
|
|
20
|
+
const _testUtils = require("react-dom/test-utils");
|
|
21
|
+
const _context = require("../../context");
|
|
22
|
+
const _test = require("../../test");
|
|
23
|
+
const _panelGroupDialog = require("./PanelGroupDialog");
|
|
24
|
+
function _interopRequireDefault(obj) {
|
|
25
|
+
return obj && obj.__esModule ? obj : {
|
|
26
|
+
default: obj
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
describe('Add Panel Group', ()=>{
|
|
30
|
+
const renderDialog = ()=>{
|
|
31
|
+
const { store , DashboardProviderSpy } = (0, _test.createDashboardProviderSpy)();
|
|
32
|
+
(0, _test.renderWithContext)(/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_context.DashboardProvider, {
|
|
33
|
+
initialState: {
|
|
34
|
+
dashboardResource: (0, _test.getTestDashboard)(),
|
|
35
|
+
isEditMode: true
|
|
36
|
+
},
|
|
37
|
+
children: [
|
|
38
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(DashboardProviderSpy, {}),
|
|
39
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_panelGroupDialog.PanelGroupDialog, {})
|
|
40
|
+
]
|
|
41
|
+
}));
|
|
42
|
+
const { value: storeApi } = store;
|
|
43
|
+
if (storeApi === undefined) {
|
|
44
|
+
throw new Error('Expected dashboard store to be set after initial render');
|
|
45
|
+
}
|
|
46
|
+
return storeApi;
|
|
47
|
+
};
|
|
48
|
+
it('should add new panel group', async ()=>{
|
|
49
|
+
const storeApi = renderDialog();
|
|
50
|
+
// Open the dialog for a new panel group
|
|
51
|
+
(0, _testUtils.act)(()=>storeApi.getState().openAddPanelGroup());
|
|
52
|
+
const nameInput = await _react.screen.findByLabelText(/Name/);
|
|
53
|
+
_userEvent.default.type(nameInput, 'New Panel Group');
|
|
54
|
+
_userEvent.default.click(_react.screen.getByText('Add'));
|
|
55
|
+
// TODO: Figure out how to test this without coupling to the store state
|
|
56
|
+
const panelGroups = Object.values(storeApi.getState().panelGroups);
|
|
57
|
+
expect(panelGroups).toContainEqual({
|
|
58
|
+
id: expect.any(Number),
|
|
59
|
+
title: 'New Panel Group',
|
|
60
|
+
isCollapsed: false,
|
|
61
|
+
itemLayouts: expect.any(Array),
|
|
62
|
+
itemPanelKeys: expect.any(Object)
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
it('should edit existing panel group', async ()=>{
|
|
66
|
+
const storeApi = renderDialog();
|
|
67
|
+
// Open the dialog for an existing panel group
|
|
68
|
+
const group = Object.values(storeApi.getState().panelGroups).find((group)=>group.title === 'CPU Stats');
|
|
69
|
+
if (group === undefined) {
|
|
70
|
+
throw new Error('Missing test group');
|
|
71
|
+
}
|
|
72
|
+
(0, _testUtils.act)(()=>storeApi.getState().openEditPanelGroup(group.id));
|
|
73
|
+
const nameInput = await _react.screen.findByLabelText(/Name/);
|
|
74
|
+
_userEvent.default.clear(nameInput);
|
|
75
|
+
_userEvent.default.type(nameInput, 'New Name');
|
|
76
|
+
_userEvent.default.click(_react.screen.getByText('Apply'));
|
|
77
|
+
// TODO: Figure out how to test this without coupling to the store state
|
|
78
|
+
const panelGroups = storeApi.getState().panelGroups;
|
|
79
|
+
expect(panelGroups).toMatchObject({
|
|
80
|
+
[group.id]: {
|
|
81
|
+
id: group.id,
|
|
82
|
+
title: 'New Name',
|
|
83
|
+
isCollapsed: false
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
});
|