@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,191 @@
|
|
|
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
|
+
useEditMode: ()=>useEditMode,
|
|
25
|
+
useDashboardActions: ()=>useDashboardActions,
|
|
26
|
+
usePanelGroupIds: ()=>usePanelGroupIds,
|
|
27
|
+
useListPanelGroups: ()=>useListPanelGroups,
|
|
28
|
+
usePanelGroup: ()=>usePanelGroup,
|
|
29
|
+
usePanelGroupActions: ()=>usePanelGroupActions,
|
|
30
|
+
usePanelGroupEditor: ()=>usePanelGroupEditor,
|
|
31
|
+
useDeletePanelGroupDialog: ()=>useDeletePanelGroupDialog,
|
|
32
|
+
usePanel: ()=>usePanel,
|
|
33
|
+
usePanelActions: ()=>usePanelActions,
|
|
34
|
+
usePanelEditor: ()=>usePanelEditor,
|
|
35
|
+
useDeletePanelDialog: ()=>useDeletePanelDialog,
|
|
36
|
+
useDefaultTimeRange: ()=>useDefaultTimeRange
|
|
37
|
+
});
|
|
38
|
+
const _react = require("react");
|
|
39
|
+
const _dashboardProvider = require("./DashboardProvider");
|
|
40
|
+
const selectEditMode = ({ isEditMode , setEditMode })=>({
|
|
41
|
+
isEditMode,
|
|
42
|
+
setEditMode
|
|
43
|
+
});
|
|
44
|
+
function useEditMode() {
|
|
45
|
+
return (0, _dashboardProvider.useDashboardStore)(selectEditMode);
|
|
46
|
+
}
|
|
47
|
+
const selectDashboardActions = ({ setDashboard , openAddPanelGroup , openAddPanel })=>({
|
|
48
|
+
setDashboard,
|
|
49
|
+
openAddPanelGroup,
|
|
50
|
+
openAddPanel
|
|
51
|
+
});
|
|
52
|
+
function useDashboardActions() {
|
|
53
|
+
const { setDashboard , openAddPanelGroup , openAddPanel } = (0, _dashboardProvider.useDashboardStore)(selectDashboardActions);
|
|
54
|
+
return {
|
|
55
|
+
setDashboard,
|
|
56
|
+
openAddPanelGroup: ()=>openAddPanelGroup(),
|
|
57
|
+
openAddPanel: ()=>openAddPanel()
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
const selectPanelGroupOrder = (state)=>state.panelGroupOrder;
|
|
61
|
+
function usePanelGroupIds() {
|
|
62
|
+
return (0, _dashboardProvider.useDashboardStore)(selectPanelGroupOrder);
|
|
63
|
+
}
|
|
64
|
+
const selectPanelGroups = (state)=>state.panelGroups;
|
|
65
|
+
function useListPanelGroups() {
|
|
66
|
+
const panelGroupIds = usePanelGroupIds();
|
|
67
|
+
const panelGroups = (0, _dashboardProvider.useDashboardStore)(selectPanelGroups);
|
|
68
|
+
return (0, _react.useMemo)(()=>{
|
|
69
|
+
return panelGroupIds.map((id)=>{
|
|
70
|
+
const group = panelGroups[id];
|
|
71
|
+
if (group === undefined) {
|
|
72
|
+
throw new Error(`Invalid panel group Id found ${id}`);
|
|
73
|
+
}
|
|
74
|
+
return group;
|
|
75
|
+
});
|
|
76
|
+
}, [
|
|
77
|
+
panelGroupIds,
|
|
78
|
+
panelGroups
|
|
79
|
+
]);
|
|
80
|
+
}
|
|
81
|
+
function usePanelGroup(panelGroupId) {
|
|
82
|
+
const panelGroup = (0, _dashboardProvider.useDashboardStore)((0, _react.useCallback)((state)=>state.panelGroups[panelGroupId], [
|
|
83
|
+
panelGroupId
|
|
84
|
+
]));
|
|
85
|
+
if (panelGroup === undefined) {
|
|
86
|
+
throw new Error(`Panel group with Id ${panelGroupId} was not found`);
|
|
87
|
+
}
|
|
88
|
+
return panelGroup;
|
|
89
|
+
}
|
|
90
|
+
const selectPanelGroupActions = ({ openEditPanelGroup , deletePanelGroup , openAddPanel , updatePanelGroupLayouts })=>({
|
|
91
|
+
openEditPanelGroup,
|
|
92
|
+
deletePanelGroup,
|
|
93
|
+
openAddPanel,
|
|
94
|
+
updatePanelGroupLayouts
|
|
95
|
+
});
|
|
96
|
+
function usePanelGroupActions(panelGroupId) {
|
|
97
|
+
const { moveUp , moveDown } = useMovePanelGroup(panelGroupId);
|
|
98
|
+
const { openEditPanelGroup , deletePanelGroup , openAddPanel , updatePanelGroupLayouts } = (0, _dashboardProvider.useDashboardStore)(selectPanelGroupActions);
|
|
99
|
+
return {
|
|
100
|
+
openEditPanelGroup: ()=>openEditPanelGroup(panelGroupId),
|
|
101
|
+
deletePanelGroup: ()=>deletePanelGroup(panelGroupId),
|
|
102
|
+
openAddPanel: ()=>openAddPanel(panelGroupId),
|
|
103
|
+
moveUp,
|
|
104
|
+
moveDown,
|
|
105
|
+
updatePanelGroupLayouts: (itemLayouts)=>updatePanelGroupLayouts(panelGroupId, itemLayouts)
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
const selectSwapPanelGroups = (state)=>state.swapPanelGroups;
|
|
109
|
+
const selectPanelGroupsLength = (state)=>state.panelGroupOrder.length;
|
|
110
|
+
/**
|
|
111
|
+
* Returns functions for moving a panel group up or down. A function will be undefined if the panel group can't be
|
|
112
|
+
* moved in that direction.
|
|
113
|
+
*/ function useMovePanelGroup(panelGroupId) {
|
|
114
|
+
const currentIndex = (0, _dashboardProvider.useDashboardStore)((0, _react.useCallback)((store)=>store.panelGroupOrder.findIndex((id)=>id === panelGroupId), [
|
|
115
|
+
panelGroupId
|
|
116
|
+
]));
|
|
117
|
+
const panelGroupsLength = (0, _dashboardProvider.useDashboardStore)(selectPanelGroupsLength);
|
|
118
|
+
const swapPanelGroups = (0, _dashboardProvider.useDashboardStore)(selectSwapPanelGroups);
|
|
119
|
+
if (currentIndex < 0) {
|
|
120
|
+
throw new Error(`Could not find panel group with Id ${panelGroupId} in order array`);
|
|
121
|
+
}
|
|
122
|
+
const moveUp = ()=>swapPanelGroups(currentIndex, currentIndex - 1);
|
|
123
|
+
const moveDown = ()=>swapPanelGroups(currentIndex, currentIndex + 1);
|
|
124
|
+
return {
|
|
125
|
+
moveUp: currentIndex > 0 ? moveUp : undefined,
|
|
126
|
+
moveDown: currentIndex < panelGroupsLength - 1 ? moveDown : undefined
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
const selectPanelGroupEditor = (state)=>state.panelGroupEditor;
|
|
130
|
+
function usePanelGroupEditor() {
|
|
131
|
+
return (0, _dashboardProvider.useDashboardStore)(selectPanelGroupEditor);
|
|
132
|
+
}
|
|
133
|
+
const selectDeletePanelGroupDialog = ({ deletePanelGroupDialog , openDeletePanelGroupDialog , closeDeletePanelGroupDialog , deletePanelGroup })=>({
|
|
134
|
+
deletePanelGroupDialog,
|
|
135
|
+
openDeletePanelGroupDialog,
|
|
136
|
+
closeDeletePanelGroupDialog,
|
|
137
|
+
deletePanelGroup
|
|
138
|
+
});
|
|
139
|
+
function useDeletePanelGroupDialog() {
|
|
140
|
+
const { deletePanelGroupDialog , openDeletePanelGroupDialog , closeDeletePanelGroupDialog , deletePanelGroup } = (0, _dashboardProvider.useDashboardStore)(selectDeletePanelGroupDialog);
|
|
141
|
+
return {
|
|
142
|
+
deletePanelGroupDialog,
|
|
143
|
+
deletePanelGroup,
|
|
144
|
+
openDeletePanelGroupDialog,
|
|
145
|
+
closeDeletePanelGroupDialog: ()=>closeDeletePanelGroupDialog()
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
function usePanel(panelGroupItemId) {
|
|
149
|
+
const { panelGroupId , panelGroupItemLayoutId: panelGroupLayoutId } = panelGroupItemId;
|
|
150
|
+
const panel = (0, _dashboardProvider.useDashboardStore)((0, _react.useCallback)((store)=>{
|
|
151
|
+
var ref;
|
|
152
|
+
const panelKey = (ref = store.panelGroups[panelGroupId]) === null || ref === void 0 ? void 0 : ref.itemPanelKeys[panelGroupLayoutId];
|
|
153
|
+
if (panelKey === undefined) return;
|
|
154
|
+
return store.panels[panelKey];
|
|
155
|
+
}, [
|
|
156
|
+
panelGroupId,
|
|
157
|
+
panelGroupLayoutId
|
|
158
|
+
]));
|
|
159
|
+
if (panel === undefined) {
|
|
160
|
+
throw new Error(`Could not find panel for Id ${panelGroupItemId}`);
|
|
161
|
+
}
|
|
162
|
+
return panel;
|
|
163
|
+
}
|
|
164
|
+
const selectPanelActions = ({ openEditPanel , openDeletePanelDialog })=>({
|
|
165
|
+
openEditPanel,
|
|
166
|
+
openDeletePanelDialog
|
|
167
|
+
});
|
|
168
|
+
function usePanelActions(panelGroupItemId) {
|
|
169
|
+
const { openEditPanel , openDeletePanelDialog } = (0, _dashboardProvider.useDashboardStore)(selectPanelActions);
|
|
170
|
+
return {
|
|
171
|
+
openEditPanel: ()=>openEditPanel(panelGroupItemId),
|
|
172
|
+
openDeletePanelDialog: ()=>openDeletePanelDialog(panelGroupItemId)
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
const selectPanelEditor = (state)=>state.panelEditor;
|
|
176
|
+
function usePanelEditor() {
|
|
177
|
+
return (0, _dashboardProvider.useDashboardStore)(selectPanelEditor);
|
|
178
|
+
}
|
|
179
|
+
const selectDeletePanelDialog = ({ deletePanelDialog , deletePanel , closeDeletePanelDialog })=>({
|
|
180
|
+
deletePanelDialog,
|
|
181
|
+
deletePanel,
|
|
182
|
+
closeDeletePanelDialog
|
|
183
|
+
});
|
|
184
|
+
function useDeletePanelDialog() {
|
|
185
|
+
// TODO: Refactor similar to other dialogs/editors so these are on the editor state itself
|
|
186
|
+
return (0, _dashboardProvider.useDashboardStore)(selectDeletePanelDialog);
|
|
187
|
+
}
|
|
188
|
+
const selectDefaultTimeRange = (state)=>state.defaultTimeRange;
|
|
189
|
+
function useDefaultTimeRange() {
|
|
190
|
+
return (0, _dashboardProvider.useDashboardStore)(selectDefaultTimeRange);
|
|
191
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
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, "createDeletePanelGroupSlice", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: ()=>createDeletePanelGroupSlice
|
|
20
|
+
});
|
|
21
|
+
const createDeletePanelGroupSlice = (set, get)=>({
|
|
22
|
+
deletePanelGroup (panelGroupId) {
|
|
23
|
+
const { panelGroups , panelGroupOrder } = get();
|
|
24
|
+
const group = panelGroups[panelGroupId];
|
|
25
|
+
const idIndex = panelGroupOrder.findIndex((id)=>id === panelGroupId);
|
|
26
|
+
if (group === undefined || idIndex === -1) {
|
|
27
|
+
throw new Error(`Panel group ${panelGroupId} not found`);
|
|
28
|
+
}
|
|
29
|
+
// Get the panel keys for all the panel items in the group we're going to delete
|
|
30
|
+
const panelKeys = Object.values(group.itemPanelKeys);
|
|
31
|
+
set((draft)=>{
|
|
32
|
+
// Delete the panel group which also deletes all its items
|
|
33
|
+
delete draft.panelGroups[panelGroupId];
|
|
34
|
+
draft.panelGroupOrder.splice(idIndex, 1);
|
|
35
|
+
// Get all remaining panel keys in use
|
|
36
|
+
const usedPanelKeys = getUsedPanelKeys(draft.panelGroups);
|
|
37
|
+
// For the panel keys of the items that were just deleted, see if they're still used and if not, also delete the
|
|
38
|
+
// panel definition
|
|
39
|
+
for (const panelKey of panelKeys){
|
|
40
|
+
if (usedPanelKeys.has(panelKey)) continue;
|
|
41
|
+
delete draft.panels[panelKey];
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
openDeletePanelGroupDialog: (panelGroupId)=>{
|
|
46
|
+
const panelGroup = get().panelGroups[panelGroupId];
|
|
47
|
+
if (panelGroup === undefined) {
|
|
48
|
+
throw new Error(`Panel group with Id ${panelGroupId} not found`);
|
|
49
|
+
}
|
|
50
|
+
set((state)=>{
|
|
51
|
+
state.deletePanelGroupDialog = {
|
|
52
|
+
panelGroupId,
|
|
53
|
+
panelGroupName: panelGroup.title
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
closeDeletePanelGroupDialog: ()=>set((state)=>{
|
|
58
|
+
state.deletePanelGroupDialog = undefined;
|
|
59
|
+
})
|
|
60
|
+
});
|
|
61
|
+
// Helper to get the panel keys of all groups, returning a set to eliminate duplicates
|
|
62
|
+
function getUsedPanelKeys(panelGroups) {
|
|
63
|
+
const usedPanelKeys = new Set();
|
|
64
|
+
for (const group of Object.values(panelGroups)){
|
|
65
|
+
for (const panelKey of Object.values(group.itemPanelKeys)){
|
|
66
|
+
usedPanelKeys.add(panelKey);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return usedPanelKeys;
|
|
70
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
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, "createDeletePanelSlice", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: ()=>createDeletePanelSlice
|
|
20
|
+
});
|
|
21
|
+
function createDeletePanelSlice() {
|
|
22
|
+
// Return the state creator function for Zustand that uses the panels provided as intitial state
|
|
23
|
+
return (set, get)=>({
|
|
24
|
+
deletePanel (panelGroupItemId) {
|
|
25
|
+
set((draft)=>{
|
|
26
|
+
const { panelGroupId , panelGroupItemLayoutId: panelGroupLayoutId } = panelGroupItemId;
|
|
27
|
+
const existingGroup = draft.panelGroups[panelGroupId];
|
|
28
|
+
if (existingGroup === undefined) {
|
|
29
|
+
throw new Error(`Missing panel group ${panelGroupId}`);
|
|
30
|
+
}
|
|
31
|
+
const existingLayoutIdx = existingGroup.itemLayouts.findIndex((layout)=>layout.i === panelGroupLayoutId);
|
|
32
|
+
const existingPanelKey = existingGroup.itemPanelKeys[panelGroupLayoutId];
|
|
33
|
+
if (existingLayoutIdx === -1 || existingPanelKey === undefined) {
|
|
34
|
+
throw new Error(`Missing panel group item ${panelGroupLayoutId}`);
|
|
35
|
+
}
|
|
36
|
+
// remove panel from panel group
|
|
37
|
+
existingGroup.itemLayouts.splice(existingLayoutIdx, 1);
|
|
38
|
+
delete existingGroup.itemPanelKeys[panelGroupLayoutId];
|
|
39
|
+
// See if panel key is still used and if not, delete it
|
|
40
|
+
if (isPanelKeyStillUsed(draft.panelGroups, existingPanelKey) === false) {
|
|
41
|
+
delete draft.panels[existingPanelKey];
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
openDeletePanelDialog (panelGroupItemId) {
|
|
46
|
+
const { panelGroupId , panelGroupItemLayoutId: panelGroupLayoutId } = panelGroupItemId;
|
|
47
|
+
const { panels , panelGroups } = get();
|
|
48
|
+
const panelGroup = panelGroups[panelGroupId];
|
|
49
|
+
if (panelGroup === undefined) {
|
|
50
|
+
throw new Error(`Panel group not found ${panelGroupId}`);
|
|
51
|
+
}
|
|
52
|
+
const panelKey = panelGroup.itemPanelKeys[panelGroupLayoutId];
|
|
53
|
+
if (panelKey === undefined) {
|
|
54
|
+
throw new Error(`Could not find Panel Group item ${panelGroupLayoutId}`);
|
|
55
|
+
}
|
|
56
|
+
const panel = panels[panelKey];
|
|
57
|
+
if (panel === undefined) {
|
|
58
|
+
throw new Error(`Could not find panel ${panelKey}`);
|
|
59
|
+
}
|
|
60
|
+
set((state)=>{
|
|
61
|
+
var _title;
|
|
62
|
+
state.deletePanelDialog = {
|
|
63
|
+
panelGroupItemId: panelGroupItemId,
|
|
64
|
+
panelName: panel.spec.display.name,
|
|
65
|
+
panelGroupName: (_title = panelGroup.title) !== null && _title !== void 0 ? _title : ''
|
|
66
|
+
};
|
|
67
|
+
});
|
|
68
|
+
},
|
|
69
|
+
closeDeletePanelDialog () {
|
|
70
|
+
set((state)=>{
|
|
71
|
+
state.deletePanelDialog = undefined;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
// Helper function to determine if a panel key is still being used somewhere in Panel Groups
|
|
77
|
+
function isPanelKeyStillUsed(panelGroups, panelKey) {
|
|
78
|
+
for (const group of Object.values(panelGroups)){
|
|
79
|
+
const found = Object.values(group.itemPanelKeys).find((key)=>key === panelKey);
|
|
80
|
+
if (found !== undefined) {
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
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("./dashboard-provider-api"), exports);
|
|
18
|
+
_exportStar(require("./DashboardProvider"), exports);
|
|
19
|
+
function _exportStar(from, to) {
|
|
20
|
+
Object.keys(from).forEach(function(k) {
|
|
21
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function() {
|
|
24
|
+
return from[k];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
return from;
|
|
29
|
+
}
|
|
@@ -0,0 +1,205 @@
|
|
|
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, "createPanelEditorSlice", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: ()=>createPanelEditorSlice
|
|
20
|
+
});
|
|
21
|
+
const _functions = require("../../utils/functions");
|
|
22
|
+
const _common = require("./common");
|
|
23
|
+
const _panelGroupSlice = require("./panel-group-slice");
|
|
24
|
+
function createPanelEditorSlice() {
|
|
25
|
+
// Return the state creator function for Zustand that uses the panels provided as intitial state
|
|
26
|
+
return (set, get)=>{
|
|
27
|
+
return {
|
|
28
|
+
panelEditor: undefined,
|
|
29
|
+
openEditPanel (panelGroupItemId) {
|
|
30
|
+
var ref;
|
|
31
|
+
const { panels , panelGroups } = get();
|
|
32
|
+
// Figure out the panel key at that location
|
|
33
|
+
const { panelGroupId , panelGroupItemLayoutId: panelGroupLayoutId } = panelGroupItemId;
|
|
34
|
+
const panelKey = (ref = panelGroups[panelGroupId]) === null || ref === void 0 ? void 0 : ref.itemPanelKeys[panelGroupLayoutId];
|
|
35
|
+
if (panelKey === undefined) {
|
|
36
|
+
throw new Error(`Could not find Panel Group item ${panelGroupItemId}`);
|
|
37
|
+
}
|
|
38
|
+
// Find the panel to edit
|
|
39
|
+
const panelToEdit = panels[panelKey];
|
|
40
|
+
if (panelToEdit === undefined) {
|
|
41
|
+
throw new Error(`Cannot find Panel with key '${panelKey}'`);
|
|
42
|
+
}
|
|
43
|
+
var _description;
|
|
44
|
+
const editorState = {
|
|
45
|
+
mode: 'Edit',
|
|
46
|
+
initialValues: {
|
|
47
|
+
name: panelToEdit.spec.display.name,
|
|
48
|
+
description: (_description = panelToEdit.spec.display.description) !== null && _description !== void 0 ? _description : '',
|
|
49
|
+
groupId: panelGroupItemId.panelGroupId,
|
|
50
|
+
kind: panelToEdit.spec.plugin.kind,
|
|
51
|
+
spec: panelToEdit.spec.plugin.spec
|
|
52
|
+
},
|
|
53
|
+
applyChanges: (next)=>{
|
|
54
|
+
const panelDefinititon = createPanelDefinitionFromEditorValues(next);
|
|
55
|
+
set((state)=>{
|
|
56
|
+
state.panels[panelKey] = panelDefinititon;
|
|
57
|
+
// If the panel didn't change groups, nothing else to do
|
|
58
|
+
if (next.groupId === panelGroupId) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
// Move panel to the new group
|
|
62
|
+
const existingGroup = state.panelGroups[panelGroupId];
|
|
63
|
+
if (existingGroup === undefined) {
|
|
64
|
+
throw new Error(`Missing panel group ${panelGroupId}`);
|
|
65
|
+
}
|
|
66
|
+
const existingLayoutIdx = existingGroup.itemLayouts.findIndex((layout)=>layout.i === panelGroupLayoutId);
|
|
67
|
+
const existingLayout = existingGroup.itemLayouts[existingLayoutIdx];
|
|
68
|
+
const existingPanelKey = existingGroup.itemPanelKeys[panelGroupLayoutId];
|
|
69
|
+
if (existingLayoutIdx === -1 || existingLayout === undefined || existingPanelKey === undefined) {
|
|
70
|
+
throw new Error(`Missing panel group item ${panelGroupLayoutId}`);
|
|
71
|
+
}
|
|
72
|
+
// Remove item from the old group
|
|
73
|
+
existingGroup.itemLayouts.splice(existingLayoutIdx, 1);
|
|
74
|
+
delete existingGroup.itemPanelKeys[panelGroupLayoutId];
|
|
75
|
+
// Add item to the end of the new group
|
|
76
|
+
const newGroup = state.panelGroups[next.groupId];
|
|
77
|
+
if (newGroup === undefined) {
|
|
78
|
+
throw new Error(`Could not find new group ${next.groupId}`);
|
|
79
|
+
}
|
|
80
|
+
newGroup.itemLayouts.push({
|
|
81
|
+
i: existingLayout.i,
|
|
82
|
+
x: 0,
|
|
83
|
+
y: getYForNewRow(newGroup),
|
|
84
|
+
w: existingLayout.w,
|
|
85
|
+
h: existingLayout.h
|
|
86
|
+
});
|
|
87
|
+
newGroup.itemPanelKeys[existingLayout.i] = existingPanelKey;
|
|
88
|
+
});
|
|
89
|
+
},
|
|
90
|
+
close: ()=>{
|
|
91
|
+
set((state)=>{
|
|
92
|
+
state.panelEditor = undefined;
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
// Open the editor with the new state
|
|
97
|
+
set((state)=>{
|
|
98
|
+
state.panelEditor = editorState;
|
|
99
|
+
});
|
|
100
|
+
},
|
|
101
|
+
openAddPanel (panelGroupId) {
|
|
102
|
+
// If a panel group isn't supplied, add to the first group or create a group if there aren't any
|
|
103
|
+
let newGroup = undefined;
|
|
104
|
+
panelGroupId !== null && panelGroupId !== void 0 ? panelGroupId : panelGroupId = get().panelGroupOrder[0];
|
|
105
|
+
if (panelGroupId === undefined) {
|
|
106
|
+
newGroup = (0, _panelGroupSlice.createEmptyPanelGroup)();
|
|
107
|
+
newGroup.title = 'Panel Group';
|
|
108
|
+
panelGroupId = newGroup.id;
|
|
109
|
+
}
|
|
110
|
+
const editorState = {
|
|
111
|
+
mode: 'Add',
|
|
112
|
+
initialValues: {
|
|
113
|
+
name: '',
|
|
114
|
+
description: '',
|
|
115
|
+
groupId: panelGroupId,
|
|
116
|
+
kind: '',
|
|
117
|
+
spec: {}
|
|
118
|
+
},
|
|
119
|
+
applyChanges: (next)=>{
|
|
120
|
+
const panelDef = createPanelDefinitionFromEditorValues(next);
|
|
121
|
+
const uniquePanelKeys = getUniquePanelKeys(get().panels);
|
|
122
|
+
let panelKey = (0, _functions.removeWhiteSpacesAndSpecialCharacters)(next.name);
|
|
123
|
+
// append count if panel key already exists
|
|
124
|
+
if (uniquePanelKeys[panelKey]) {
|
|
125
|
+
panelKey += `-${uniquePanelKeys[panelKey]}`;
|
|
126
|
+
}
|
|
127
|
+
set((state)=>{
|
|
128
|
+
// Add a panel
|
|
129
|
+
state.panels[panelKey] = panelDef;
|
|
130
|
+
// Also add a panel group item referencing the panel
|
|
131
|
+
const group = state.panelGroups[next.groupId];
|
|
132
|
+
if (group === undefined) {
|
|
133
|
+
throw new Error(`Missing panel group ${next.groupId}`);
|
|
134
|
+
}
|
|
135
|
+
const layout = {
|
|
136
|
+
i: (0, _common.generateId)().toString(),
|
|
137
|
+
x: 0,
|
|
138
|
+
y: getYForNewRow(group),
|
|
139
|
+
w: 12,
|
|
140
|
+
h: 6
|
|
141
|
+
};
|
|
142
|
+
group.itemLayouts.push(layout);
|
|
143
|
+
group.itemPanelKeys[layout.i] = panelKey;
|
|
144
|
+
});
|
|
145
|
+
},
|
|
146
|
+
close: ()=>{
|
|
147
|
+
set((state)=>{
|
|
148
|
+
state.panelEditor = undefined;
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
set((state)=>{
|
|
153
|
+
// Add the new panel group if one was created for the panel
|
|
154
|
+
if (newGroup !== undefined) {
|
|
155
|
+
(0, _panelGroupSlice.addPanelGroup)(state, newGroup);
|
|
156
|
+
}
|
|
157
|
+
// Open the editor with the new state
|
|
158
|
+
state.panelEditor = editorState;
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
// Helper to create PanelDefinitions when saving
|
|
165
|
+
function createPanelDefinitionFromEditorValues(editorValues) {
|
|
166
|
+
return {
|
|
167
|
+
kind: 'Panel',
|
|
168
|
+
spec: {
|
|
169
|
+
display: {
|
|
170
|
+
name: editorValues.name,
|
|
171
|
+
description: editorValues.description !== '' ? editorValues.description : undefined
|
|
172
|
+
},
|
|
173
|
+
plugin: {
|
|
174
|
+
kind: editorValues.kind,
|
|
175
|
+
spec: editorValues.spec
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
// Given a PanelGroup, will find the Y coordinate for adding a new row to the grid, taking into account the items present
|
|
181
|
+
function getYForNewRow(group) {
|
|
182
|
+
let newRowY = 0;
|
|
183
|
+
for (const layout of group.itemLayouts){
|
|
184
|
+
const itemMaxY = layout.y + layout.h;
|
|
185
|
+
if (itemMaxY > newRowY) {
|
|
186
|
+
newRowY = itemMaxY;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
return newRowY;
|
|
190
|
+
}
|
|
191
|
+
// Find all the unique panel keys
|
|
192
|
+
// ex: cpu, cpu-1, cpu-2 count as the same panel key since these panels have the same name
|
|
193
|
+
function getUniquePanelKeys(panels) {
|
|
194
|
+
const uniquePanelKeys = {};
|
|
195
|
+
Object.keys(panels).forEach((panelKey)=>{
|
|
196
|
+
const key = panelKey.replace(/-([0-9]+)/, '');
|
|
197
|
+
const count = uniquePanelKeys[key];
|
|
198
|
+
if (count) {
|
|
199
|
+
uniquePanelKeys[key] = count + 1;
|
|
200
|
+
} else {
|
|
201
|
+
uniquePanelKeys[key] = 1;
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
return uniquePanelKeys;
|
|
205
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
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, "createPanelGroupEditorSlice", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: ()=>createPanelGroupEditorSlice
|
|
20
|
+
});
|
|
21
|
+
const _panelGroupSlice = require("./panel-group-slice");
|
|
22
|
+
const createPanelGroupEditorSlice = (set, get)=>({
|
|
23
|
+
panelGroupEditor: undefined,
|
|
24
|
+
openAddPanelGroup: ()=>{
|
|
25
|
+
// Create the editor state
|
|
26
|
+
const editor = {
|
|
27
|
+
mode: 'Add',
|
|
28
|
+
initialValues: {
|
|
29
|
+
title: '',
|
|
30
|
+
isCollapsed: false
|
|
31
|
+
},
|
|
32
|
+
applyChanges (next) {
|
|
33
|
+
const newGroup = (0, _panelGroupSlice.createEmptyPanelGroup)();
|
|
34
|
+
newGroup.title = next.title;
|
|
35
|
+
newGroup.isCollapsed = next.isCollapsed;
|
|
36
|
+
set((draft)=>{
|
|
37
|
+
(0, _panelGroupSlice.addPanelGroup)(draft, newGroup);
|
|
38
|
+
});
|
|
39
|
+
},
|
|
40
|
+
close () {
|
|
41
|
+
set((draft)=>{
|
|
42
|
+
draft.panelGroupEditor = undefined;
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
// Open the editor
|
|
47
|
+
set((draft)=>{
|
|
48
|
+
draft.panelGroupEditor = editor;
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
openEditPanelGroup: (panelGroupId)=>{
|
|
52
|
+
const existingGroup = get().panelGroups[panelGroupId];
|
|
53
|
+
if (existingGroup === undefined) {
|
|
54
|
+
throw new Error(`Panel group with Id ${panelGroupId} does not exist`);
|
|
55
|
+
}
|
|
56
|
+
var _title;
|
|
57
|
+
// Create the editor state
|
|
58
|
+
const editor = {
|
|
59
|
+
mode: 'Edit',
|
|
60
|
+
initialValues: {
|
|
61
|
+
title: (_title = existingGroup.title) !== null && _title !== void 0 ? _title : '',
|
|
62
|
+
isCollapsed: existingGroup.isCollapsed
|
|
63
|
+
},
|
|
64
|
+
applyChanges (next) {
|
|
65
|
+
set((draft)=>{
|
|
66
|
+
const group = draft.panelGroups[panelGroupId];
|
|
67
|
+
if (group === undefined) {
|
|
68
|
+
throw new Error(`Panel group with Id ${panelGroupId} does not exist`);
|
|
69
|
+
}
|
|
70
|
+
group.title = next.title;
|
|
71
|
+
group.isCollapsed = next.isCollapsed;
|
|
72
|
+
});
|
|
73
|
+
},
|
|
74
|
+
close () {
|
|
75
|
+
set((draft)=>{
|
|
76
|
+
draft.panelGroupEditor = undefined;
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
// Open the editor
|
|
81
|
+
set((draft)=>{
|
|
82
|
+
draft.panelGroupEditor = editor;
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
});
|