@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,92 @@
|
|
|
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
|
+
PanelGroupEditorForm: ()=>PanelGroupEditorForm,
|
|
25
|
+
panelGroupEditorFormId: ()=>panelGroupEditorFormId
|
|
26
|
+
});
|
|
27
|
+
const _jsxRuntime = require("react/jsx-runtime");
|
|
28
|
+
const _react = require("react");
|
|
29
|
+
const _material = require("@mui/material");
|
|
30
|
+
function PanelGroupEditorForm(props) {
|
|
31
|
+
const { initialValues , onSubmit } = props;
|
|
32
|
+
const [title, setTitle] = (0, _react.useState)(initialValues.title);
|
|
33
|
+
const [isCollapsed, setIsCollapsed] = (0, _react.useState)(initialValues.isCollapsed);
|
|
34
|
+
const handleCollapsedChange = (e)=>{
|
|
35
|
+
const next = e.target.value;
|
|
36
|
+
setIsCollapsed(next === 'Closed');
|
|
37
|
+
};
|
|
38
|
+
const handleSubmit = (e)=>{
|
|
39
|
+
e.preventDefault();
|
|
40
|
+
onSubmit({
|
|
41
|
+
title,
|
|
42
|
+
isCollapsed
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)("form", {
|
|
46
|
+
id: panelGroupEditorFormId,
|
|
47
|
+
onSubmit: handleSubmit,
|
|
48
|
+
children: [
|
|
49
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.FormControl, {
|
|
50
|
+
fullWidth: true,
|
|
51
|
+
margin: "normal",
|
|
52
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.TextField, {
|
|
53
|
+
required: true,
|
|
54
|
+
label: "Name",
|
|
55
|
+
variant: "outlined",
|
|
56
|
+
value: title,
|
|
57
|
+
onChange: (e)=>setTitle(e.target.value)
|
|
58
|
+
})
|
|
59
|
+
}),
|
|
60
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.FormControl, {
|
|
61
|
+
fullWidth: true,
|
|
62
|
+
margin: "normal",
|
|
63
|
+
children: [
|
|
64
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.InputLabel, {
|
|
65
|
+
id: "select-collapse-state",
|
|
66
|
+
children: "Collapse State"
|
|
67
|
+
}),
|
|
68
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Select, {
|
|
69
|
+
required: true,
|
|
70
|
+
displayEmpty: true,
|
|
71
|
+
labelId: "select-collapse-state",
|
|
72
|
+
label: "Collapse State",
|
|
73
|
+
size: "small",
|
|
74
|
+
value: isCollapsed ? 'Closed' : 'Open',
|
|
75
|
+
onChange: handleCollapsedChange,
|
|
76
|
+
children: [
|
|
77
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.MenuItem, {
|
|
78
|
+
value: "Open",
|
|
79
|
+
children: "Open"
|
|
80
|
+
}),
|
|
81
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.MenuItem, {
|
|
82
|
+
value: "Closed",
|
|
83
|
+
children: "Closed"
|
|
84
|
+
})
|
|
85
|
+
]
|
|
86
|
+
})
|
|
87
|
+
]
|
|
88
|
+
})
|
|
89
|
+
]
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
const panelGroupEditorFormId = 'panel-group-editor-form';
|
|
@@ -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("./PanelGroupDialog"), 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,136 @@
|
|
|
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
|
+
TIME_OPTIONS: ()=>TIME_OPTIONS,
|
|
25
|
+
TimeRangeControls: ()=>TimeRangeControls
|
|
26
|
+
});
|
|
27
|
+
const _jsxRuntime = require("react/jsx-runtime");
|
|
28
|
+
const _refresh = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/Refresh"));
|
|
29
|
+
const _material = require("@mui/material");
|
|
30
|
+
const _components = require("@perses-dev/components");
|
|
31
|
+
const _pluginSystem = require("@perses-dev/plugin-system");
|
|
32
|
+
const _core = require("@perses-dev/core");
|
|
33
|
+
const _context = require("../../context");
|
|
34
|
+
function _interopRequireDefault(obj) {
|
|
35
|
+
return obj && obj.__esModule ? obj : {
|
|
36
|
+
default: obj
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
const TIME_OPTIONS = [
|
|
40
|
+
{
|
|
41
|
+
value: {
|
|
42
|
+
pastDuration: '5m'
|
|
43
|
+
},
|
|
44
|
+
display: 'Last 5 minutes'
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
value: {
|
|
48
|
+
pastDuration: '15m'
|
|
49
|
+
},
|
|
50
|
+
display: 'Last 15 minutes'
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
value: {
|
|
54
|
+
pastDuration: '30m'
|
|
55
|
+
},
|
|
56
|
+
display: 'Last 30 minutes'
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
value: {
|
|
60
|
+
pastDuration: '1h'
|
|
61
|
+
},
|
|
62
|
+
display: 'Last 1 hour'
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
value: {
|
|
66
|
+
pastDuration: '6h'
|
|
67
|
+
},
|
|
68
|
+
display: 'Last 6 hours'
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
value: {
|
|
72
|
+
pastDuration: '12h'
|
|
73
|
+
},
|
|
74
|
+
display: 'Last 12 hours'
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
value: {
|
|
78
|
+
pastDuration: '24h'
|
|
79
|
+
},
|
|
80
|
+
display: 'Last 1 day'
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
value: {
|
|
84
|
+
pastDuration: '7d'
|
|
85
|
+
},
|
|
86
|
+
display: 'Last 7 days'
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
value: {
|
|
90
|
+
pastDuration: '14d'
|
|
91
|
+
},
|
|
92
|
+
display: 'Last 14 days'
|
|
93
|
+
}
|
|
94
|
+
];
|
|
95
|
+
const DEFAULT_HEIGHT = '34px';
|
|
96
|
+
function TimeRangeControls({ heightPx }) {
|
|
97
|
+
const { timeRange , setTimeRange , refresh } = (0, _pluginSystem.useTimeRange)();
|
|
98
|
+
const defaultTimeRange = (0, _context.useDefaultTimeRange)();
|
|
99
|
+
// Convert height as a number to height as a string, then use this value for styling
|
|
100
|
+
const height = heightPx === undefined ? DEFAULT_HEIGHT : `${heightPx}px`;
|
|
101
|
+
// add time shortcut if one does not match duration from dashboard JSON
|
|
102
|
+
if (!TIME_OPTIONS.some((option)=>option.value.pastDuration === defaultTimeRange.pastDuration)) {
|
|
103
|
+
if ((0, _core.isDurationString)(defaultTimeRange.pastDuration)) {
|
|
104
|
+
TIME_OPTIONS.push({
|
|
105
|
+
value: {
|
|
106
|
+
pastDuration: defaultTimeRange.pastDuration
|
|
107
|
+
},
|
|
108
|
+
display: `Last ${defaultTimeRange.pastDuration}`
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
113
|
+
children: [
|
|
114
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_components.DateTimeRangePicker, {
|
|
115
|
+
timeOptions: TIME_OPTIONS,
|
|
116
|
+
value: timeRange,
|
|
117
|
+
onChange: setTimeRange,
|
|
118
|
+
height: height
|
|
119
|
+
}),
|
|
120
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(RefreshIconButton, {
|
|
121
|
+
"aria-label": "Refresh Dashboard",
|
|
122
|
+
onClick: refresh,
|
|
123
|
+
sx: {
|
|
124
|
+
height
|
|
125
|
+
},
|
|
126
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_refresh.default, {})
|
|
127
|
+
})
|
|
128
|
+
]
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
const RefreshIconButton = (0, _material.styled)(_material.IconButton)(({ theme })=>({
|
|
132
|
+
border: `1px solid ${theme.palette.grey[300]}`,
|
|
133
|
+
borderRadius: theme.shape.borderRadius,
|
|
134
|
+
padding: theme.spacing(0.5),
|
|
135
|
+
color: theme.palette.grey[900]
|
|
136
|
+
}));
|
|
@@ -0,0 +1,95 @@
|
|
|
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 _reactRouter = require("react-router");
|
|
19
|
+
const _history = require("history");
|
|
20
|
+
const _userEvent = /*#__PURE__*/ _interopRequireDefault(require("@testing-library/user-event"));
|
|
21
|
+
const _react = require("@testing-library/react");
|
|
22
|
+
const _pluginSystem = require("@perses-dev/plugin-system");
|
|
23
|
+
const _test = require("../../test");
|
|
24
|
+
const _testDashboard = /*#__PURE__*/ _interopRequireDefault(require("../../test/testDashboard"));
|
|
25
|
+
const _context = require("../../context");
|
|
26
|
+
const _timeRangeControls = require("./TimeRangeControls");
|
|
27
|
+
function _interopRequireDefault(obj) {
|
|
28
|
+
return obj && obj.__esModule ? obj : {
|
|
29
|
+
default: obj
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const history = (0, _history.createMemoryHistory)({
|
|
33
|
+
initialEntries: [
|
|
34
|
+
(0, _reactRouter.generatePath)('/home'),
|
|
35
|
+
(0, _reactRouter.generatePath)('/dashboards/:id', {
|
|
36
|
+
id: 'test'
|
|
37
|
+
})
|
|
38
|
+
]
|
|
39
|
+
});
|
|
40
|
+
describe('TimeRangeControls', ()=>{
|
|
41
|
+
let initialState;
|
|
42
|
+
const testDefaultTimeRange = {
|
|
43
|
+
pastDuration: _testDashboard.default.spec.duration
|
|
44
|
+
};
|
|
45
|
+
beforeEach(()=>{
|
|
46
|
+
initialState = {
|
|
47
|
+
dashboardResource: _testDashboard.default
|
|
48
|
+
};
|
|
49
|
+
});
|
|
50
|
+
const renderTimeRangeControls = (testURLParams)=>{
|
|
51
|
+
(0, _test.renderWithContext)(/*#__PURE__*/ (0, _jsxRuntime.jsx)(_context.DashboardProvider, {
|
|
52
|
+
initialState: initialState,
|
|
53
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pluginSystem.TimeRangeProvider, {
|
|
54
|
+
initialTimeRange: testDefaultTimeRange,
|
|
55
|
+
enabledURLParams: testURLParams,
|
|
56
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_timeRangeControls.TimeRangeControls, {})
|
|
57
|
+
})
|
|
58
|
+
}), undefined, history);
|
|
59
|
+
};
|
|
60
|
+
it('should default to dashboard duration and update selected time option when clicked', async ()=>{
|
|
61
|
+
renderTimeRangeControls(false);
|
|
62
|
+
expect(_react.screen.getByText('Last 30 minutes')).toBeInTheDocument();
|
|
63
|
+
const dateButton = _react.screen.getByRole('button', {
|
|
64
|
+
name: /last/i
|
|
65
|
+
});
|
|
66
|
+
_userEvent.default.click(dateButton);
|
|
67
|
+
const firstSelected = _react.screen.getByRole('option', {
|
|
68
|
+
name: 'Last 5 minutes'
|
|
69
|
+
});
|
|
70
|
+
_userEvent.default.click(firstSelected);
|
|
71
|
+
expect(dateButton).toHaveTextContent(/5 minutes/i);
|
|
72
|
+
});
|
|
73
|
+
it('should update URL params with correct time range values', ()=>{
|
|
74
|
+
renderTimeRangeControls(true);
|
|
75
|
+
const dateButton = _react.screen.getByRole('button', {
|
|
76
|
+
name: /last/i
|
|
77
|
+
});
|
|
78
|
+
_userEvent.default.click(dateButton);
|
|
79
|
+
const firstSelected = _react.screen.getByRole('option', {
|
|
80
|
+
name: 'Last 5 minutes'
|
|
81
|
+
});
|
|
82
|
+
_userEvent.default.click(firstSelected);
|
|
83
|
+
expect(history.location.search).toEqual('?start=5m');
|
|
84
|
+
// pick another option from TimeRangeSelector dropdown
|
|
85
|
+
const secondSelected = _react.screen.getByText('Last 12 hours');
|
|
86
|
+
_userEvent.default.click(secondSelected);
|
|
87
|
+
expect(history.location.search).toEqual('?start=12h');
|
|
88
|
+
// back button should return to previous page selected
|
|
89
|
+
(0, _react.act)(()=>{
|
|
90
|
+
history.back();
|
|
91
|
+
});
|
|
92
|
+
expect(history.location.pathname).toEqual('/home');
|
|
93
|
+
});
|
|
94
|
+
// TODO: add additional tests for absolute time selection, other inputs, form validation, etc.
|
|
95
|
+
});
|
|
@@ -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("./TimeRangeControls"), 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
|
+
}
|
package/dist/cjs/components/UnsavedChangesConfirmationDialog/UnsavedChangesConfirmationDialog.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
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, "UnsavedChangesConfirmationDialog", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: ()=>UnsavedChangesConfirmationDialog
|
|
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
|
+
function _interopRequireDefault(obj) {
|
|
25
|
+
return obj && obj.__esModule ? obj : {
|
|
26
|
+
default: obj
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
const UnsavedChangesConfirmationDialog = ({ isOpen , onSave , onClose })=>{
|
|
30
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Dialog, {
|
|
31
|
+
open: isOpen,
|
|
32
|
+
children: [
|
|
33
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.DialogTitle, {
|
|
34
|
+
children: "Unsaved Changes"
|
|
35
|
+
}),
|
|
36
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
37
|
+
"aria-label": "Close",
|
|
38
|
+
onClick: onClose,
|
|
39
|
+
sx: (theme)=>({
|
|
40
|
+
position: 'absolute',
|
|
41
|
+
top: theme.spacing(0.5),
|
|
42
|
+
right: theme.spacing(0.5)
|
|
43
|
+
}),
|
|
44
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_close.default, {})
|
|
45
|
+
}),
|
|
46
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.DialogContent, {
|
|
47
|
+
sx: {
|
|
48
|
+
width: '500px'
|
|
49
|
+
},
|
|
50
|
+
children: "You have unsaved changes in this dashboard. Would you like to save these changes?"
|
|
51
|
+
}),
|
|
52
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.DialogActions, {
|
|
53
|
+
children: [
|
|
54
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Button, {
|
|
55
|
+
variant: "contained",
|
|
56
|
+
onClick: onSave,
|
|
57
|
+
children: "Save"
|
|
58
|
+
}),
|
|
59
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Button, {
|
|
60
|
+
onClick: onClose,
|
|
61
|
+
children: "Cancel"
|
|
62
|
+
})
|
|
63
|
+
]
|
|
64
|
+
})
|
|
65
|
+
]
|
|
66
|
+
});
|
|
67
|
+
};
|
|
@@ -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("./UnsavedChangesConfirmationDialog"), 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,194 @@
|
|
|
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, "TemplateVariable", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: ()=>TemplateVariable
|
|
20
|
+
});
|
|
21
|
+
const _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
+
const _react = require("react");
|
|
23
|
+
const _material = require("@mui/material");
|
|
24
|
+
const _pluginSystem = require("@perses-dev/plugin-system");
|
|
25
|
+
const _context = require("../../context");
|
|
26
|
+
const _variableModel = require("./variable-model");
|
|
27
|
+
function TemplateVariable({ name }) {
|
|
28
|
+
var ref;
|
|
29
|
+
const ctx = (0, _context.useTemplateVariable)(name);
|
|
30
|
+
const kind = (ref = ctx.definition) === null || ref === void 0 ? void 0 : ref.kind;
|
|
31
|
+
switch(kind){
|
|
32
|
+
case 'TextVariable':
|
|
33
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(TextVariable, {
|
|
34
|
+
name: name
|
|
35
|
+
});
|
|
36
|
+
case 'ListVariable':
|
|
37
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(ListVariable, {
|
|
38
|
+
name: name
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)("div", {
|
|
42
|
+
children: [
|
|
43
|
+
"Unsupported Variable Kind: $",
|
|
44
|
+
kind
|
|
45
|
+
]
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function ListVariable({ name }) {
|
|
49
|
+
var ref, ref1, ref2, ref3;
|
|
50
|
+
const ctx = (0, _context.useTemplateVariable)(name);
|
|
51
|
+
const definition = ctx.definition;
|
|
52
|
+
const variablesOptionsQuery = (0, _variableModel.useListVariablePluginValues)(definition);
|
|
53
|
+
const { setVariableValue , setVariableLoading , setVariableOptions } = (0, _context.useTemplateVariableActions)();
|
|
54
|
+
const allowMultiple = (definition === null || definition === void 0 ? void 0 : definition.spec.allow_multiple) === true;
|
|
55
|
+
const allowAllValue = (definition === null || definition === void 0 ? void 0 : definition.spec.allow_all_value) === true;
|
|
56
|
+
var ref4;
|
|
57
|
+
const title = (ref4 = (ref = definition === null || definition === void 0 ? void 0 : definition.spec.display) === null || ref === void 0 ? void 0 : ref.name) !== null && ref4 !== void 0 ? ref4 : name;
|
|
58
|
+
(0, _react.useEffect)(()=>{
|
|
59
|
+
setVariableLoading(name, variablesOptionsQuery.isFetching);
|
|
60
|
+
if (variablesOptionsQuery.data) {
|
|
61
|
+
setVariableOptions(name, variablesOptionsQuery.data);
|
|
62
|
+
}
|
|
63
|
+
}, [
|
|
64
|
+
variablesOptionsQuery,
|
|
65
|
+
name,
|
|
66
|
+
setVariableLoading,
|
|
67
|
+
setVariableOptions
|
|
68
|
+
]);
|
|
69
|
+
let value = (ref1 = ctx.state) === null || ref1 === void 0 ? void 0 : ref1.value;
|
|
70
|
+
const options = (ref2 = ctx.state) === null || ref2 === void 0 ? void 0 : ref2.options;
|
|
71
|
+
const loading = (ref3 = ctx.state) === null || ref3 === void 0 ? void 0 : ref3.loading;
|
|
72
|
+
// Make sure value is an array if allowMultiple is true
|
|
73
|
+
if (allowMultiple && !Array.isArray(value)) {
|
|
74
|
+
value = typeof value === 'string' ? [
|
|
75
|
+
value
|
|
76
|
+
] : [];
|
|
77
|
+
}
|
|
78
|
+
const finalOptions = (0, _react.useMemo)(()=>{
|
|
79
|
+
let computedOptions = options ? [
|
|
80
|
+
...options
|
|
81
|
+
] : [];
|
|
82
|
+
// Add the all value if it's allowed
|
|
83
|
+
if (allowAllValue) {
|
|
84
|
+
computedOptions = [
|
|
85
|
+
{
|
|
86
|
+
value: _pluginSystem.DEFAULT_ALL_VALUE,
|
|
87
|
+
label: 'All'
|
|
88
|
+
},
|
|
89
|
+
...computedOptions
|
|
90
|
+
];
|
|
91
|
+
}
|
|
92
|
+
return computedOptions;
|
|
93
|
+
}, [
|
|
94
|
+
options,
|
|
95
|
+
allowAllValue
|
|
96
|
+
]);
|
|
97
|
+
const valueIsInOptions = (0, _react.useMemo)(()=>Boolean(finalOptions.find((v)=>{
|
|
98
|
+
if (allowMultiple) {
|
|
99
|
+
return value.includes(v.value);
|
|
100
|
+
}
|
|
101
|
+
return value === v.value;
|
|
102
|
+
})), [
|
|
103
|
+
finalOptions,
|
|
104
|
+
value,
|
|
105
|
+
allowMultiple
|
|
106
|
+
]);
|
|
107
|
+
let selectValue = value;
|
|
108
|
+
if (!valueIsInOptions) {
|
|
109
|
+
selectValue = allowMultiple ? [] : '';
|
|
110
|
+
}
|
|
111
|
+
(0, _react.useEffect)(()=>{
|
|
112
|
+
const firstOption = finalOptions === null || finalOptions === void 0 ? void 0 : finalOptions[0];
|
|
113
|
+
// If there is no value but there are options, set the value to the first option.
|
|
114
|
+
if (!value && firstOption) {
|
|
115
|
+
setVariableValue(name, firstOption.value);
|
|
116
|
+
}
|
|
117
|
+
}, [
|
|
118
|
+
finalOptions,
|
|
119
|
+
setVariableValue,
|
|
120
|
+
value,
|
|
121
|
+
name,
|
|
122
|
+
allowMultiple
|
|
123
|
+
]);
|
|
124
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Box, {
|
|
125
|
+
display: 'flex',
|
|
126
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.FormControl, {
|
|
127
|
+
fullWidth: true,
|
|
128
|
+
children: [
|
|
129
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.InputLabel, {
|
|
130
|
+
id: name,
|
|
131
|
+
children: title
|
|
132
|
+
}),
|
|
133
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Select, {
|
|
134
|
+
sx: {
|
|
135
|
+
minWidth: 100,
|
|
136
|
+
maxWidth: 250
|
|
137
|
+
},
|
|
138
|
+
id: name,
|
|
139
|
+
label: name,
|
|
140
|
+
value: selectValue,
|
|
141
|
+
onChange: (e)=>{
|
|
142
|
+
// Must be selected
|
|
143
|
+
if (e.target.value === null || e.target.value.length === 0) {
|
|
144
|
+
if (allowAllValue) {
|
|
145
|
+
setVariableValue(name, _pluginSystem.DEFAULT_ALL_VALUE);
|
|
146
|
+
}
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
setVariableValue(name, e.target.value);
|
|
150
|
+
},
|
|
151
|
+
multiple: allowMultiple,
|
|
152
|
+
children: [
|
|
153
|
+
loading && /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.MenuItem, {
|
|
154
|
+
value: "loading",
|
|
155
|
+
disabled: true,
|
|
156
|
+
children: "Loading"
|
|
157
|
+
}),
|
|
158
|
+
finalOptions.length === 0 && /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.MenuItem, {
|
|
159
|
+
value: "empty",
|
|
160
|
+
disabled: true,
|
|
161
|
+
children: "No options"
|
|
162
|
+
}),
|
|
163
|
+
finalOptions.map((option)=>/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.MenuItem, {
|
|
164
|
+
value: option.value,
|
|
165
|
+
children: option.label
|
|
166
|
+
}, option.value))
|
|
167
|
+
]
|
|
168
|
+
}),
|
|
169
|
+
loading && /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.LinearProgress, {})
|
|
170
|
+
]
|
|
171
|
+
})
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
function TextVariable({ name }) {
|
|
175
|
+
var ref;
|
|
176
|
+
const { state , definition } = (0, _context.useTemplateVariable)(name);
|
|
177
|
+
var ref1;
|
|
178
|
+
const [tempValue, setTempValue] = (0, _react.useState)((ref1 = state === null || state === void 0 ? void 0 : state.value) !== null && ref1 !== void 0 ? ref1 : '');
|
|
179
|
+
const { setVariableValue } = (0, _context.useTemplateVariableActions)();
|
|
180
|
+
(0, _react.useEffect)(()=>{
|
|
181
|
+
var ref;
|
|
182
|
+
setTempValue((ref = state === null || state === void 0 ? void 0 : state.value) !== null && ref !== void 0 ? ref : '');
|
|
183
|
+
}, [
|
|
184
|
+
state === null || state === void 0 ? void 0 : state.value
|
|
185
|
+
]);
|
|
186
|
+
var ref2;
|
|
187
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.TextField, {
|
|
188
|
+
value: tempValue,
|
|
189
|
+
onChange: (e)=>setTempValue(e.target.value),
|
|
190
|
+
onBlur: ()=>setVariableValue(name, tempValue),
|
|
191
|
+
placeholder: name,
|
|
192
|
+
label: (ref2 = (ref = definition === null || definition === void 0 ? void 0 : definition.spec.display) === null || ref === void 0 ? void 0 : ref.name) !== null && ref2 !== void 0 ? ref2 : name
|
|
193
|
+
});
|
|
194
|
+
}
|