@perses-dev/dashboards 0.0.0-snapshot-scatterplot-fix-imports-95e1b59 → 0.0.0-snapshot-histogram-types-78c5104
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/Dashboard/Dashboard.js +8 -1
- package/dist/cjs/components/DashboardStickyToolbar/DashboardStickyToolbar.js +2 -2
- package/dist/cjs/components/DashboardToolbar/DashboardToolbar.js +4 -4
- package/dist/cjs/components/Datasources/DatasourceEditor.js +18 -18
- package/dist/cjs/components/Datasources/EditDatasourcesButton.js +2 -5
- package/dist/cjs/components/DeletePanelDialog/DeletePanelDialog.js +2 -0
- package/dist/cjs/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +5 -4
- package/dist/cjs/components/DownloadButton/DownloadButton.js +135 -29
- package/dist/cjs/components/EditJsonDialog/EditJsonDialog.js +10 -13
- package/dist/cjs/components/EmptyDashboard/EmptyDashboard.js +2 -2
- package/dist/cjs/components/GridLayout/GridContainer.js +15 -10
- package/dist/cjs/components/GridLayout/GridItemContent.js +20 -4
- package/dist/cjs/components/GridLayout/GridLayout.js +57 -12
- package/dist/cjs/components/GridLayout/GridTitle.js +3 -3
- package/dist/cjs/{validation/panel.js → components/Panel/HeaderIconButton.js} +8 -10
- package/dist/cjs/components/Panel/Panel.js +19 -11
- package/dist/cjs/components/Panel/PanelActions.js +365 -0
- package/dist/cjs/components/Panel/PanelContent.js +59 -13
- package/dist/cjs/components/Panel/PanelHeader.js +14 -117
- package/dist/cjs/components/Panel/PanelLinks.js +136 -0
- package/dist/cjs/components/Panel/PanelPluginLoader.js +56 -0
- package/dist/cjs/components/Panel/index.js +1 -0
- package/dist/cjs/components/PanelDrawer/PanelDrawer.js +9 -6
- package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +81 -67
- package/dist/cjs/components/PanelDrawer/PanelPreview.js +7 -3
- package/dist/cjs/components/PanelDrawer/usePanelEditor.js +9 -6
- package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.js +1 -1
- package/dist/cjs/components/QuerySummaryTable/QuerySummaryTable.js +3 -5
- package/dist/cjs/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +4 -6
- package/dist/cjs/components/SaveDashboardButton/SaveDashboardButton.js +2 -2
- package/dist/cjs/components/Variables/BuiltinVariableAccordions.js +7 -14
- package/dist/cjs/components/Variables/EditVariablesButton.js +4 -4
- package/dist/cjs/components/Variables/{TemplateVariable.js → Variable.js} +52 -60
- package/dist/cjs/components/Variables/VariableEditor.js +34 -40
- package/dist/cjs/components/Variables/VariableList.js +23 -22
- package/dist/cjs/components/Variables/index.js +2 -2
- package/dist/cjs/constants/styles.js +19 -7
- package/dist/cjs/constants/user-interface-text.js +3 -1
- package/dist/cjs/context/DashboardProvider/DashboardProvider.js +10 -8
- package/dist/cjs/context/DashboardProvider/DashboardProviderWithQueryParams.js +36 -0
- package/dist/cjs/context/DashboardProvider/common.js +2 -2
- package/dist/cjs/context/DashboardProvider/dashboard-provider-api.js +25 -6
- package/dist/cjs/context/DashboardProvider/delete-panel-slice.js +1 -2
- package/dist/cjs/context/DashboardProvider/panel-editor-slice.js +7 -10
- package/dist/cjs/context/DashboardProvider/panel-group-editor-slice.js +1 -2
- package/dist/cjs/context/DashboardProvider/panel-group-slice.js +8 -3
- package/dist/cjs/context/DashboardProvider/view-panel-slice.js +79 -0
- package/dist/cjs/context/DatasourceStoreProvider.js +18 -23
- package/dist/cjs/context/{TemplateVariableProvider/TemplateVariableProvider.js → VariableProvider/VariableProvider.js} +76 -87
- package/dist/cjs/context/{TemplateVariableProvider → VariableProvider}/hydrationUtils.js +11 -14
- package/dist/cjs/{validation → context/VariableProvider}/index.js +2 -2
- package/dist/cjs/context/{TemplateVariableProvider → VariableProvider}/query-params.js +1 -1
- package/dist/cjs/context/{TemplateVariableProvider → VariableProvider}/utils.js +3 -3
- package/dist/cjs/context/index.js +2 -2
- package/dist/cjs/context/useDashboard.js +4 -4
- package/dist/cjs/test/datasource-provider.js +1 -1
- package/dist/cjs/test/plugin-registry.js +8 -3
- package/dist/cjs/test/render.js +13 -11
- package/dist/cjs/views/ViewDashboard/DashboardApp.js +6 -4
- package/dist/cjs/views/ViewDashboard/ViewDashboard.js +10 -9
- package/dist/components/AddGroupButton/AddGroupButton.d.ts +2 -1
- package/dist/components/AddGroupButton/AddGroupButton.d.ts.map +1 -1
- package/dist/components/AddGroupButton/AddGroupButton.js.map +1 -1
- package/dist/components/AddPanelButton/AddPanelButton.d.ts +2 -1
- package/dist/components/AddPanelButton/AddPanelButton.d.ts.map +1 -1
- package/dist/components/AddPanelButton/AddPanelButton.js.map +1 -1
- package/dist/components/Dashboard/Dashboard.d.ts +2 -1
- package/dist/components/Dashboard/Dashboard.d.ts.map +1 -1
- package/dist/components/Dashboard/Dashboard.js +8 -1
- package/dist/components/Dashboard/Dashboard.js.map +1 -1
- package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.d.ts +2 -1
- package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.d.ts.map +1 -1
- package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js +3 -3
- package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js.map +1 -1
- package/dist/components/DashboardToolbar/DashboardToolbar.d.ts +4 -2
- package/dist/components/DashboardToolbar/DashboardToolbar.d.ts.map +1 -1
- package/dist/components/DashboardToolbar/DashboardToolbar.js +4 -4
- package/dist/components/DashboardToolbar/DashboardToolbar.js.map +1 -1
- package/dist/components/Datasources/DatasourceEditor.d.ts +2 -1
- package/dist/components/Datasources/DatasourceEditor.d.ts.map +1 -1
- package/dist/components/Datasources/DatasourceEditor.js +19 -19
- package/dist/components/Datasources/DatasourceEditor.js.map +1 -1
- package/dist/components/Datasources/EditDatasourcesButton.d.ts +2 -1
- package/dist/components/Datasources/EditDatasourcesButton.d.ts.map +1 -1
- package/dist/components/Datasources/EditDatasourcesButton.js +2 -5
- package/dist/components/Datasources/EditDatasourcesButton.js.map +1 -1
- package/dist/components/DeletePanelDialog/DeletePanelDialog.d.ts +2 -1
- package/dist/components/DeletePanelDialog/DeletePanelDialog.d.ts.map +1 -1
- package/dist/components/DeletePanelDialog/DeletePanelDialog.js +3 -1
- package/dist/components/DeletePanelDialog/DeletePanelDialog.js.map +1 -1
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.d.ts +2 -1
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.d.ts.map +1 -1
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +6 -5
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js.map +1 -1
- package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.d.ts +2 -1
- package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.d.ts.map +1 -1
- package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js.map +1 -1
- package/dist/components/DownloadButton/DownloadButton.d.ts +2 -5
- package/dist/components/DownloadButton/DownloadButton.d.ts.map +1 -1
- package/dist/components/DownloadButton/DownloadButton.js +94 -29
- package/dist/components/DownloadButton/DownloadButton.js.map +1 -1
- package/dist/components/EditButton/EditButton.d.ts +2 -1
- package/dist/components/EditButton/EditButton.d.ts.map +1 -1
- package/dist/components/EditButton/EditButton.js.map +1 -1
- package/dist/components/EditJsonButton/EditJsonButton.d.ts +2 -1
- package/dist/components/EditJsonButton/EditJsonButton.d.ts.map +1 -1
- package/dist/components/EditJsonButton/EditJsonButton.js.map +1 -1
- package/dist/components/EditJsonDialog/EditJsonDialog.d.ts +2 -1
- package/dist/components/EditJsonDialog/EditJsonDialog.d.ts.map +1 -1
- package/dist/components/EditJsonDialog/EditJsonDialog.js +7 -10
- package/dist/components/EditJsonDialog/EditJsonDialog.js.map +1 -1
- package/dist/components/EmptyDashboard/EmptyDashboard.d.ts +3 -3
- package/dist/components/EmptyDashboard/EmptyDashboard.d.ts.map +1 -1
- package/dist/components/EmptyDashboard/EmptyDashboard.js +2 -2
- package/dist/components/EmptyDashboard/EmptyDashboard.js.map +1 -1
- package/dist/components/GridLayout/GridContainer.d.ts +5 -3
- package/dist/components/GridLayout/GridContainer.d.ts.map +1 -1
- package/dist/components/GridLayout/GridContainer.js +15 -10
- package/dist/components/GridLayout/GridContainer.js.map +1 -1
- package/dist/components/GridLayout/GridItemContent.d.ts +2 -1
- package/dist/components/GridLayout/GridItemContent.d.ts.map +1 -1
- package/dist/components/GridLayout/GridItemContent.js +22 -6
- package/dist/components/GridLayout/GridItemContent.js.map +1 -1
- package/dist/components/GridLayout/GridLayout.d.ts +4 -2
- package/dist/components/GridLayout/GridLayout.d.ts.map +1 -1
- package/dist/components/GridLayout/GridLayout.js +59 -14
- package/dist/components/GridLayout/GridLayout.js.map +1 -1
- package/dist/components/GridLayout/GridTitle.d.ts +3 -2
- package/dist/components/GridLayout/GridTitle.d.ts.map +1 -1
- package/dist/components/GridLayout/GridTitle.js +3 -3
- package/dist/components/GridLayout/GridTitle.js.map +1 -1
- package/dist/components/Panel/HeaderIconButton.d.ts +5 -0
- package/dist/components/Panel/HeaderIconButton.d.ts.map +1 -0
- package/dist/{stories/decorators/index.js → components/Panel/HeaderIconButton.js} +7 -6
- package/dist/components/Panel/HeaderIconButton.js.map +1 -0
- package/dist/components/Panel/Panel.d.ts +16 -5
- package/dist/components/Panel/Panel.d.ts.map +1 -1
- package/dist/components/Panel/Panel.js +25 -12
- package/dist/components/Panel/Panel.js.map +1 -1
- package/dist/components/Panel/PanelActions.d.ts +22 -0
- package/dist/components/Panel/PanelActions.d.ts.map +1 -0
- package/dist/components/Panel/PanelActions.js +352 -0
- package/dist/components/Panel/PanelActions.js.map +1 -0
- package/dist/components/Panel/PanelContent.d.ts +7 -5
- package/dist/components/Panel/PanelContent.d.ts.map +1 -1
- package/dist/components/Panel/PanelContent.js +61 -15
- package/dist/components/Panel/PanelContent.js.map +1 -1
- package/dist/components/Panel/PanelHeader.d.ts +10 -8
- package/dist/components/Panel/PanelHeader.d.ts.map +1 -1
- package/dist/components/Panel/PanelHeader.js +18 -116
- package/dist/components/Panel/PanelHeader.js.map +1 -1
- package/dist/components/Panel/PanelLinks.d.ts +6 -0
- package/dist/components/Panel/PanelLinks.d.ts.map +1 -0
- package/dist/components/Panel/PanelLinks.js +123 -0
- package/dist/components/Panel/PanelLinks.js.map +1 -0
- package/dist/components/Panel/PanelPluginLoader.d.ts +13 -0
- package/dist/components/Panel/PanelPluginLoader.d.ts.map +1 -0
- package/dist/components/Panel/PanelPluginLoader.js +51 -0
- package/dist/components/Panel/PanelPluginLoader.js.map +1 -0
- package/dist/components/Panel/index.d.ts +1 -0
- package/dist/components/Panel/index.d.ts.map +1 -1
- package/dist/components/Panel/index.js +1 -0
- package/dist/components/Panel/index.js.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.d.ts +2 -1
- package/dist/components/PanelDrawer/PanelDrawer.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.js +10 -7
- package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.d.ts +3 -3
- package/dist/components/PanelDrawer/PanelEditorForm.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.js +84 -70
- package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -1
- package/dist/components/PanelDrawer/PanelPreview.d.ts +3 -2
- package/dist/components/PanelDrawer/PanelPreview.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelPreview.js +8 -4
- package/dist/components/PanelDrawer/PanelPreview.js.map +1 -1
- package/dist/components/PanelDrawer/usePanelEditor.d.ts +12 -10
- package/dist/components/PanelDrawer/usePanelEditor.d.ts.map +1 -1
- package/dist/components/PanelDrawer/usePanelEditor.js +9 -6
- package/dist/components/PanelDrawer/usePanelEditor.js.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts +2 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.js +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.js.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.d.ts +2 -1
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.d.ts.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.js.map +1 -1
- package/dist/components/QuerySummaryTable/QuerySummaryTable.d.ts +2 -1
- package/dist/components/QuerySummaryTable/QuerySummaryTable.d.ts.map +1 -1
- package/dist/components/QuerySummaryTable/QuerySummaryTable.js +3 -5
- package/dist/components/QuerySummaryTable/QuerySummaryTable.js.map +1 -1
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.d.ts +2 -1
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.d.ts.map +1 -1
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +5 -7
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js.map +1 -1
- package/dist/components/SaveDashboardButton/SaveDashboardButton.d.ts +2 -1
- package/dist/components/SaveDashboardButton/SaveDashboardButton.d.ts.map +1 -1
- package/dist/components/SaveDashboardButton/SaveDashboardButton.js +3 -3
- package/dist/components/SaveDashboardButton/SaveDashboardButton.js.map +1 -1
- package/dist/components/Variables/BuiltinVariableAccordions.d.ts +2 -1
- package/dist/components/Variables/BuiltinVariableAccordions.d.ts.map +1 -1
- package/dist/components/Variables/BuiltinVariableAccordions.js +7 -14
- package/dist/components/Variables/BuiltinVariableAccordions.js.map +1 -1
- package/dist/components/Variables/EditVariablesButton.d.ts +2 -1
- package/dist/components/Variables/EditVariablesButton.d.ts.map +1 -1
- package/dist/components/Variables/EditVariablesButton.js +5 -5
- package/dist/components/Variables/EditVariablesButton.js.map +1 -1
- package/dist/components/Variables/{TemplateVariable.d.ts → Variable.d.ts} +6 -5
- package/dist/components/Variables/Variable.d.ts.map +1 -0
- package/dist/components/Variables/{TemplateVariable.js → Variable.js} +53 -61
- package/dist/components/Variables/Variable.js.map +1 -0
- package/dist/components/Variables/VariableEditor.d.ts +3 -2
- package/dist/components/Variables/VariableEditor.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditor.js +35 -41
- package/dist/components/Variables/VariableEditor.js.map +1 -1
- package/dist/components/Variables/VariableList.d.ts +4 -3
- package/dist/components/Variables/VariableList.d.ts.map +1 -1
- package/dist/components/Variables/VariableList.js +21 -20
- package/dist/components/Variables/VariableList.js.map +1 -1
- package/dist/components/Variables/index.d.ts +1 -1
- package/dist/components/Variables/index.d.ts.map +1 -1
- package/dist/components/Variables/index.js +2 -2
- package/dist/components/Variables/index.js.map +1 -1
- package/dist/constants/styles.d.ts +5 -2
- package/dist/constants/styles.d.ts.map +1 -1
- package/dist/constants/styles.js +6 -3
- package/dist/constants/styles.js.map +1 -1
- package/dist/constants/user-interface-text.d.ts +3 -1
- package/dist/constants/user-interface-text.d.ts.map +1 -1
- package/dist/constants/user-interface-text.js +3 -1
- package/dist/constants/user-interface-text.js.map +1 -1
- package/dist/context/DashboardProvider/DashboardProvider.d.ts +6 -3
- package/dist/context/DashboardProvider/DashboardProvider.d.ts.map +1 -1
- package/dist/context/DashboardProvider/DashboardProvider.js +11 -9
- package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -1
- package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.d.ts +4 -0
- package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.d.ts.map +1 -0
- package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.js +28 -0
- package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.js.map +1 -0
- package/dist/context/DashboardProvider/common.d.ts.map +1 -1
- package/dist/context/DashboardProvider/common.js +2 -2
- package/dist/context/DashboardProvider/common.js.map +1 -1
- package/dist/context/DashboardProvider/dashboard-provider-api.d.ts +45 -23
- package/dist/context/DashboardProvider/dashboard-provider-api.d.ts.map +1 -1
- package/dist/context/DashboardProvider/dashboard-provider-api.js +23 -6
- package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -1
- package/dist/context/DashboardProvider/delete-panel-group-slice.d.ts +2 -1
- package/dist/context/DashboardProvider/delete-panel-group-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/delete-panel-group-slice.js.map +1 -1
- package/dist/context/DashboardProvider/delete-panel-slice.js +1 -2
- package/dist/context/DashboardProvider/delete-panel-slice.js.map +1 -1
- package/dist/context/DashboardProvider/discard-changes-dialog-slice.js.map +1 -1
- package/dist/context/DashboardProvider/duplicate-panel-slice.js.map +1 -1
- package/dist/context/DashboardProvider/edit-json-dialog-slice.js.map +1 -1
- package/dist/context/DashboardProvider/index.d.ts +1 -2
- package/dist/context/DashboardProvider/index.d.ts.map +1 -1
- package/dist/context/DashboardProvider/index.js.map +1 -1
- package/dist/context/DashboardProvider/panel-editor-slice.d.ts +2 -9
- package/dist/context/DashboardProvider/panel-editor-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/panel-editor-slice.js +4 -7
- package/dist/context/DashboardProvider/panel-editor-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-group-editor-slice.d.ts +2 -1
- package/dist/context/DashboardProvider/panel-group-editor-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/panel-group-editor-slice.js +1 -2
- package/dist/context/DashboardProvider/panel-group-editor-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-group-slice.d.ts +3 -3
- package/dist/context/DashboardProvider/panel-group-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/panel-group-slice.js +7 -3
- package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -1
- package/dist/context/DashboardProvider/save-changes-dialog-slice.js.map +1 -1
- package/dist/context/DashboardProvider/view-panel-slice.d.ts +21 -0
- package/dist/context/DashboardProvider/view-panel-slice.d.ts.map +1 -0
- package/dist/context/DashboardProvider/view-panel-slice.js +73 -0
- package/dist/context/DashboardProvider/view-panel-slice.js.map +1 -0
- package/dist/context/DatasourceStoreProvider.d.ts +7 -7
- package/dist/context/DatasourceStoreProvider.d.ts.map +1 -1
- package/dist/context/DatasourceStoreProvider.js +18 -23
- package/dist/context/DatasourceStoreProvider.js.map +1 -1
- package/dist/context/VariableProvider/VariableProvider.d.ts +119 -0
- package/dist/context/VariableProvider/VariableProvider.d.ts.map +1 -0
- package/dist/context/{TemplateVariableProvider/TemplateVariableProvider.js → VariableProvider/VariableProvider.js} +62 -64
- package/dist/context/VariableProvider/VariableProvider.js.map +1 -0
- package/dist/context/{TemplateVariableProvider → VariableProvider}/hydrationUtils.d.ts +1 -1
- package/dist/context/VariableProvider/hydrationUtils.d.ts.map +1 -0
- package/dist/context/{TemplateVariableProvider → VariableProvider}/hydrationUtils.js +9 -12
- package/dist/context/VariableProvider/hydrationUtils.js.map +1 -0
- package/dist/context/VariableProvider/index.d.ts +2 -0
- package/dist/context/VariableProvider/index.d.ts.map +1 -0
- package/dist/{validation → context/VariableProvider}/index.js +2 -2
- package/dist/context/VariableProvider/index.js.map +1 -0
- package/dist/context/{TemplateVariableProvider → VariableProvider}/query-params.d.ts +2 -6
- package/dist/context/VariableProvider/query-params.d.ts.map +1 -0
- package/dist/context/{TemplateVariableProvider → VariableProvider}/query-params.js +1 -1
- package/dist/context/VariableProvider/query-params.js.map +1 -0
- package/dist/context/{TemplateVariableProvider → VariableProvider}/utils.d.ts +1 -1
- package/dist/context/VariableProvider/utils.d.ts.map +1 -0
- package/dist/context/{TemplateVariableProvider → VariableProvider}/utils.js +3 -3
- package/dist/context/VariableProvider/utils.js.map +1 -0
- package/dist/context/index.d.ts +1 -1
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +2 -2
- package/dist/context/index.js.map +1 -1
- package/dist/context/useDashboard.d.ts.map +1 -1
- package/dist/context/useDashboard.js +4 -4
- package/dist/context/useDashboard.js.map +1 -1
- package/dist/test/dashboard-provider.d.ts +1 -1
- package/dist/test/dashboard-provider.d.ts.map +1 -1
- package/dist/test/dashboard-provider.js.map +1 -1
- package/dist/test/datasource-provider.d.ts +3 -3
- package/dist/test/datasource-provider.d.ts.map +1 -1
- package/dist/test/datasource-provider.js +1 -1
- package/dist/test/datasource-provider.js.map +1 -1
- package/dist/test/plugin-registry.d.ts.map +1 -1
- package/dist/test/plugin-registry.js +8 -3
- package/dist/test/plugin-registry.js.map +1 -1
- package/dist/test/render.d.ts +2 -2
- package/dist/test/render.d.ts.map +1 -1
- package/dist/test/render.js +9 -7
- package/dist/test/render.js.map +1 -1
- package/dist/utils/panelUtils.d.ts.map +1 -1
- package/dist/utils/panelUtils.js.map +1 -1
- package/dist/views/ViewDashboard/DashboardApp.d.ts +4 -2
- package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -1
- package/dist/views/ViewDashboard/DashboardApp.js +6 -4
- package/dist/views/ViewDashboard/DashboardApp.js.map +1 -1
- package/dist/views/ViewDashboard/ViewDashboard.d.ts +4 -3
- package/dist/views/ViewDashboard/ViewDashboard.d.ts.map +1 -1
- package/dist/views/ViewDashboard/ViewDashboard.js +11 -10
- package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -1
- package/package.json +12 -12
- package/dist/cjs/context/TemplateVariableProvider/index.js +0 -30
- package/dist/cjs/stories/decorators/WithDashboard.js +0 -41
- package/dist/cjs/stories/decorators/WithDatasourceStore.js +0 -39
- package/dist/cjs/stories/decorators/WithTemplateVariables.js +0 -37
- package/dist/cjs/stories/decorators/constants.js +0 -39
- package/dist/cjs/stories/decorators/index.js +0 -33
- package/dist/components/Variables/TemplateVariable.d.ts.map +0 -1
- package/dist/components/Variables/TemplateVariable.js.map +0 -1
- package/dist/context/TemplateVariableProvider/TemplateVariableProvider.d.ts +0 -77
- package/dist/context/TemplateVariableProvider/TemplateVariableProvider.d.ts.map +0 -1
- package/dist/context/TemplateVariableProvider/TemplateVariableProvider.js.map +0 -1
- package/dist/context/TemplateVariableProvider/hydrationUtils.d.ts.map +0 -1
- package/dist/context/TemplateVariableProvider/hydrationUtils.js.map +0 -1
- package/dist/context/TemplateVariableProvider/index.d.ts +0 -2
- package/dist/context/TemplateVariableProvider/index.d.ts.map +0 -1
- package/dist/context/TemplateVariableProvider/index.js +0 -15
- package/dist/context/TemplateVariableProvider/index.js.map +0 -1
- package/dist/context/TemplateVariableProvider/query-params.d.ts.map +0 -1
- package/dist/context/TemplateVariableProvider/query-params.js.map +0 -1
- package/dist/context/TemplateVariableProvider/utils.d.ts.map +0 -1
- package/dist/context/TemplateVariableProvider/utils.js.map +0 -1
- package/dist/stories/decorators/WithDashboard.js +0 -33
- package/dist/stories/decorators/WithDashboard.js.map +0 -1
- package/dist/stories/decorators/WithDatasourceStore.js +0 -31
- package/dist/stories/decorators/WithDatasourceStore.js.map +0 -1
- package/dist/stories/decorators/WithTemplateVariables.js +0 -29
- package/dist/stories/decorators/WithTemplateVariables.js.map +0 -1
- package/dist/stories/decorators/constants.js +0 -31
- package/dist/stories/decorators/constants.js.map +0 -1
- package/dist/stories/decorators/index.js.map +0 -1
- package/dist/validation/index.d.ts +0 -2
- package/dist/validation/index.d.ts.map +0 -1
- package/dist/validation/index.js.map +0 -1
- package/dist/validation/panel.d.ts +0 -19
- package/dist/validation/panel.d.ts.map +0 -1
- package/dist/validation/panel.js +0 -21
- package/dist/validation/panel.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -21,64 +21,60 @@ function _export(target, all) {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
|
-
|
|
25
|
-
return
|
|
24
|
+
VariableProvider: function() {
|
|
25
|
+
return VariableProvider;
|
|
26
26
|
},
|
|
27
|
-
|
|
28
|
-
return
|
|
27
|
+
VariableProviderWithQueryParams: function() {
|
|
28
|
+
return VariableProviderWithQueryParams;
|
|
29
29
|
},
|
|
30
|
-
|
|
31
|
-
return
|
|
30
|
+
useExternalVariableDefinitions: function() {
|
|
31
|
+
return useExternalVariableDefinitions;
|
|
32
32
|
},
|
|
33
|
-
|
|
34
|
-
return
|
|
33
|
+
useVariableDefinitionActions: function() {
|
|
34
|
+
return useVariableDefinitionActions;
|
|
35
35
|
},
|
|
36
|
-
|
|
37
|
-
return
|
|
36
|
+
useVariableDefinitionAndState: function() {
|
|
37
|
+
return useVariableDefinitionAndState;
|
|
38
38
|
},
|
|
39
|
-
|
|
40
|
-
return
|
|
39
|
+
useVariableDefinitionStates: function() {
|
|
40
|
+
return useVariableDefinitionStates;
|
|
41
41
|
},
|
|
42
|
-
|
|
43
|
-
return
|
|
42
|
+
useVariableDefinitionStoreCtx: function() {
|
|
43
|
+
return useVariableDefinitionStoreCtx;
|
|
44
44
|
},
|
|
45
|
-
|
|
46
|
-
return
|
|
47
|
-
},
|
|
48
|
-
useTemplateVariableValues: function() {
|
|
49
|
-
return useTemplateVariableValues;
|
|
45
|
+
useVariableDefinitions: function() {
|
|
46
|
+
return useVariableDefinitions;
|
|
50
47
|
}
|
|
51
48
|
});
|
|
52
49
|
const _jsxruntime = require("react/jsx-runtime");
|
|
53
50
|
const _react = require("react");
|
|
54
51
|
const _zustand = require("zustand");
|
|
52
|
+
const _traditional = require("zustand/traditional");
|
|
55
53
|
const _immer = require("zustand/middleware/immer");
|
|
56
54
|
const _middleware = require("zustand/middleware");
|
|
57
|
-
const
|
|
55
|
+
const _shallow = require("zustand/shallow");
|
|
56
|
+
const _immer1 = require("immer");
|
|
58
57
|
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
59
58
|
const _core = require("@perses-dev/core");
|
|
60
59
|
const _utils = require("./utils");
|
|
61
60
|
const _hydrationUtils = require("./hydrationUtils");
|
|
62
61
|
const _queryparams = require("./query-params");
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
const TemplateVariableStoreContext = /*#__PURE__*/ (0, _react.createContext)(undefined);
|
|
69
|
-
function useTemplateVariableStoreCtx() {
|
|
70
|
-
const context = (0, _react.useContext)(TemplateVariableStoreContext);
|
|
62
|
+
/**
|
|
63
|
+
* Context object for {@link VariableDefinitionStore}.
|
|
64
|
+
*/ const VariableDefinitionStoreContext = /*#__PURE__*/ (0, _react.createContext)(undefined);
|
|
65
|
+
function useVariableDefinitionStoreCtx() {
|
|
66
|
+
const context = (0, _react.useContext)(VariableDefinitionStoreContext);
|
|
71
67
|
if (!context) {
|
|
72
|
-
throw new Error('
|
|
68
|
+
throw new Error('VariableStoreContext not initialized');
|
|
73
69
|
}
|
|
74
70
|
return context;
|
|
75
71
|
}
|
|
76
|
-
function
|
|
77
|
-
const store =
|
|
78
|
-
return (0,
|
|
79
|
-
const
|
|
72
|
+
function useVariableDefinitionStates(variableNames) {
|
|
73
|
+
const store = useVariableDefinitionStoreCtx();
|
|
74
|
+
return (0, _traditional.useStoreWithEqualityFn)(store, (s)=>{
|
|
75
|
+
const varStates = {};
|
|
80
76
|
// Collect values of local variables, from the variable state
|
|
81
|
-
const names = variableNames
|
|
77
|
+
const names = variableNames ?? s.variableDefinitions.map((value)=>value.spec.name);
|
|
82
78
|
names.forEach((name)=>{
|
|
83
79
|
const varState = s.variableState.get({
|
|
84
80
|
name
|
|
@@ -86,7 +82,7 @@ function useTemplateVariableValues(variableNames) {
|
|
|
86
82
|
if (!varState || varState.overridden) {
|
|
87
83
|
return;
|
|
88
84
|
}
|
|
89
|
-
|
|
85
|
+
varStates[name] = varState;
|
|
90
86
|
});
|
|
91
87
|
// Collect values of external variables, from the variable state
|
|
92
88
|
s.externalVariableDefinitions.forEach((d)=>{
|
|
@@ -100,23 +96,22 @@ function useTemplateVariableValues(variableNames) {
|
|
|
100
96
|
if (!varState || varState.overridden) {
|
|
101
97
|
return;
|
|
102
98
|
}
|
|
103
|
-
|
|
99
|
+
varStates[name] = varState;
|
|
104
100
|
});
|
|
105
101
|
});
|
|
106
|
-
return
|
|
102
|
+
return varStates;
|
|
107
103
|
}, (left, right)=>{
|
|
108
104
|
return JSON.stringify(left) === JSON.stringify(right);
|
|
109
105
|
});
|
|
110
106
|
}
|
|
111
|
-
function
|
|
112
|
-
const store =
|
|
107
|
+
function useVariableDefinitionAndState(name, source) {
|
|
108
|
+
const store = useVariableDefinitionStoreCtx();
|
|
113
109
|
return (0, _zustand.useStore)(store, (s)=>{
|
|
114
|
-
var _s_externalVariableDefinitions_find;
|
|
115
110
|
const state = s.variableState.get({
|
|
116
111
|
name,
|
|
117
112
|
source
|
|
118
113
|
});
|
|
119
|
-
const definitions = source ?
|
|
114
|
+
const definitions = source ? s.externalVariableDefinitions.find((v)=>v.source === source)?.definitions : s.variableDefinitions;
|
|
120
115
|
const definition = (definitions || []).find((v)=>v.spec.name === name);
|
|
121
116
|
return {
|
|
122
117
|
state,
|
|
@@ -124,9 +119,9 @@ function useTemplateVariable(name, source) {
|
|
|
124
119
|
};
|
|
125
120
|
});
|
|
126
121
|
}
|
|
127
|
-
function
|
|
128
|
-
const store =
|
|
129
|
-
return (0,
|
|
122
|
+
function useVariableDefinitionActions() {
|
|
123
|
+
const store = useVariableDefinitionStoreCtx();
|
|
124
|
+
return (0, _traditional.useStoreWithEqualityFn)(store, (s)=>{
|
|
130
125
|
return {
|
|
131
126
|
setVariableValue: s.setVariableValue,
|
|
132
127
|
setVariableLoading: s.setVariableLoading,
|
|
@@ -135,24 +130,20 @@ function useTemplateVariableActions() {
|
|
|
135
130
|
setVariableDefaultValues: s.setVariableDefaultValues,
|
|
136
131
|
getSavedVariablesStatus: s.getSavedVariablesStatus
|
|
137
132
|
};
|
|
138
|
-
});
|
|
133
|
+
}, _shallow.shallow);
|
|
139
134
|
}
|
|
140
|
-
function
|
|
141
|
-
const store =
|
|
135
|
+
function useVariableDefinitions() {
|
|
136
|
+
const store = useVariableDefinitionStoreCtx();
|
|
142
137
|
return (0, _zustand.useStore)(store, (s)=>s.variableDefinitions);
|
|
143
138
|
}
|
|
144
|
-
function
|
|
145
|
-
const store =
|
|
139
|
+
function useExternalVariableDefinitions() {
|
|
140
|
+
const store = useVariableDefinitionStoreCtx();
|
|
146
141
|
return (0, _zustand.useStore)(store, (s)=>s.externalVariableDefinitions);
|
|
147
142
|
}
|
|
148
|
-
function useTemplateVariableStore() {
|
|
149
|
-
const store = useTemplateVariableStoreCtx();
|
|
150
|
-
return (0, _zustand.useStore)(store);
|
|
151
|
-
}
|
|
152
143
|
function PluginProvider({ children, builtinVariables }) {
|
|
153
|
-
const originalValues =
|
|
154
|
-
const definitions =
|
|
155
|
-
const externalDefinitions =
|
|
144
|
+
const originalValues = useVariableDefinitionStates();
|
|
145
|
+
const definitions = useVariableDefinitions();
|
|
146
|
+
const externalDefinitions = useExternalVariableDefinitions();
|
|
156
147
|
const { absoluteTimeRange } = (0, _pluginsystem.useTimeRange)();
|
|
157
148
|
const values = (0, _react.useMemo)(()=>{
|
|
158
149
|
const contextValues = {};
|
|
@@ -166,12 +157,10 @@ function PluginProvider({ children, builtinVariables }) {
|
|
|
166
157
|
if (v.value === _core.DEFAULT_ALL_VALUE) {
|
|
167
158
|
const definition = (0, _utils.findVariableDefinitionByName)(name, definitions, externalDefinitions);
|
|
168
159
|
// If the variable is a list variable and has a custom all value, then use that value instead
|
|
169
|
-
if (
|
|
160
|
+
if (definition?.kind === 'ListVariable' && definition.spec.customAllValue) {
|
|
170
161
|
v.value = definition.spec.customAllValue;
|
|
171
162
|
} else {
|
|
172
|
-
|
|
173
|
-
var _v_options_map;
|
|
174
|
-
v.value = (_v_options_map = (_v_options = v.options) === null || _v_options === void 0 ? void 0 : _v_options.map((o)=>o.value)) !== null && _v_options_map !== void 0 ? _v_options_map : null;
|
|
163
|
+
v.value = v.options?.map((o)=>o.value) ?? null;
|
|
175
164
|
}
|
|
176
165
|
}
|
|
177
166
|
contextValues[name] = v;
|
|
@@ -250,7 +239,7 @@ function PluginProvider({ children, builtinVariables }) {
|
|
|
250
239
|
}
|
|
251
240
|
}
|
|
252
241
|
];
|
|
253
|
-
builtinVariables
|
|
242
|
+
builtinVariables?.forEach((def)=>result.push(def));
|
|
254
243
|
return result;
|
|
255
244
|
}, [
|
|
256
245
|
absoluteTimeRange,
|
|
@@ -260,7 +249,7 @@ function PluginProvider({ children, builtinVariables }) {
|
|
|
260
249
|
value: {
|
|
261
250
|
variables: allBuiltinVariables
|
|
262
251
|
},
|
|
263
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.
|
|
252
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.VariableContext.Provider, {
|
|
264
253
|
value: {
|
|
265
254
|
state: values
|
|
266
255
|
},
|
|
@@ -268,16 +257,16 @@ function PluginProvider({ children, builtinVariables }) {
|
|
|
268
257
|
})
|
|
269
258
|
});
|
|
270
259
|
}
|
|
271
|
-
function
|
|
260
|
+
function createVariableDefinitionStore({ initialVariableDefinitions = [], externalVariableDefinitions = [], queryParams }) {
|
|
272
261
|
const initialParams = (0, _queryparams.getInitalValuesFromQueryParameters)(queryParams ? queryParams[0] : {});
|
|
273
262
|
const store = (0, _zustand.createStore)()((0, _middleware.devtools)((0, _immer.immer)((set, get)=>({
|
|
274
|
-
variableState: (0, _hydrationUtils.
|
|
263
|
+
variableState: (0, _hydrationUtils.hydrateVariableDefinitionStates)(initialVariableDefinitions, initialParams, externalVariableDefinitions),
|
|
275
264
|
variableDefinitions: initialVariableDefinitions,
|
|
276
265
|
externalVariableDefinitions: externalVariableDefinitions,
|
|
277
266
|
setVariableDefinitions (definitions) {
|
|
278
267
|
set((state)=>{
|
|
279
268
|
state.variableDefinitions = definitions;
|
|
280
|
-
state.variableState = (0, _hydrationUtils.
|
|
269
|
+
state.variableState = (0, _hydrationUtils.hydrateVariableDefinitionStates)(definitions, initialParams, externalVariableDefinitions);
|
|
281
270
|
}, false, '[Variables] setVariableDefinitions' // Used for action name in Redux devtools
|
|
282
271
|
);
|
|
283
272
|
},
|
|
@@ -333,17 +322,17 @@ function createTemplateVariableSrvStore({ initialVariableDefinitions = [], exter
|
|
|
333
322
|
setVariableDefaultValues: ()=>{
|
|
334
323
|
const variableDefinitions = get().variableDefinitions;
|
|
335
324
|
const variableState = get().variableState;
|
|
336
|
-
const updatedVariables = (0, _immer1.
|
|
325
|
+
const updatedVariables = (0, _immer1.produce)(variableDefinitions, (draft)=>{
|
|
337
326
|
draft.forEach((variable, index)=>{
|
|
338
327
|
const name = variable.spec.name;
|
|
339
328
|
if (variable.kind === 'ListVariable') {
|
|
340
329
|
const currentVariable = variableState.get({
|
|
341
330
|
name
|
|
342
331
|
});
|
|
343
|
-
if (
|
|
332
|
+
if (currentVariable?.value !== undefined) {
|
|
344
333
|
draft[index] = {
|
|
345
334
|
kind: 'ListVariable',
|
|
346
|
-
spec: (0, _immer1.
|
|
335
|
+
spec: (0, _immer1.produce)(variable.spec, (specDraft)=>{
|
|
347
336
|
specDraft.defaultValue = currentVariable.value;
|
|
348
337
|
})
|
|
349
338
|
};
|
|
@@ -352,11 +341,11 @@ function createTemplateVariableSrvStore({ initialVariableDefinitions = [], exter
|
|
|
352
341
|
const currentVariable = variableState.get({
|
|
353
342
|
name
|
|
354
343
|
});
|
|
355
|
-
const currentVariableValue = typeof
|
|
356
|
-
if (
|
|
344
|
+
const currentVariableValue = typeof currentVariable?.value === 'string' ? currentVariable.value : '';
|
|
345
|
+
if (currentVariable?.value !== undefined) {
|
|
357
346
|
draft[index] = {
|
|
358
347
|
kind: 'TextVariable',
|
|
359
|
-
spec: (0, _immer1.
|
|
348
|
+
spec: (0, _immer1.produce)(variable.spec, (specDraft)=>{
|
|
360
349
|
specDraft.value = currentVariableValue;
|
|
361
350
|
})
|
|
362
351
|
};
|
|
@@ -373,30 +362,30 @@ function createTemplateVariableSrvStore({ initialVariableDefinitions = [], exter
|
|
|
373
362
|
return (0, _utils.checkSavedDefaultVariableStatus)(get().variableDefinitions, get().variableState);
|
|
374
363
|
}
|
|
375
364
|
}))));
|
|
376
|
-
return store;
|
|
365
|
+
return store; // TODO: @Gladorme check if we can avoid this cast
|
|
377
366
|
}
|
|
378
|
-
function
|
|
379
|
-
const [store] = (0, _react.useState)(
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsx)(
|
|
367
|
+
function VariableProvider({ children, initialVariableDefinitions = [], externalVariableDefinitions = [], builtinVariableDefinitions = [] }) {
|
|
368
|
+
const [store] = (0, _react.useState)(()=>createVariableDefinitionStore({
|
|
369
|
+
initialVariableDefinitions,
|
|
370
|
+
externalVariableDefinitions
|
|
371
|
+
}));
|
|
372
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(VariableDefinitionStoreContext.Provider, {
|
|
384
373
|
value: store,
|
|
385
374
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(PluginProvider, {
|
|
386
|
-
builtinVariables:
|
|
375
|
+
builtinVariables: builtinVariableDefinitions,
|
|
387
376
|
children: children
|
|
388
377
|
})
|
|
389
378
|
});
|
|
390
379
|
}
|
|
391
|
-
function
|
|
380
|
+
function VariableProviderWithQueryParams({ children, initialVariableDefinitions = [], externalVariableDefinitions = [], builtinVariableDefinitions: builtinVariables = [] }) {
|
|
392
381
|
const allVariableDefs = (0, _utils.mergeVariableDefinitions)(initialVariableDefinitions, externalVariableDefinitions);
|
|
393
382
|
const queryParams = (0, _queryparams.useVariableQueryParams)(allVariableDefs);
|
|
394
|
-
const [store] = (0, _react.useState)(
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsx)(
|
|
383
|
+
const [store] = (0, _react.useState)(()=>createVariableDefinitionStore({
|
|
384
|
+
initialVariableDefinitions,
|
|
385
|
+
externalVariableDefinitions,
|
|
386
|
+
queryParams
|
|
387
|
+
}));
|
|
388
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(VariableDefinitionStoreContext.Provider, {
|
|
400
389
|
value: store,
|
|
401
390
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(PluginProvider, {
|
|
402
391
|
builtinVariables: builtinVariables,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -14,16 +14,16 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
-
Object.defineProperty(exports, "
|
|
17
|
+
Object.defineProperty(exports, "hydrateVariableDefinitionStates", {
|
|
18
18
|
enumerable: true,
|
|
19
19
|
get: function() {
|
|
20
|
-
return
|
|
20
|
+
return hydrateVariableDefinitionStates;
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
23
|
const _core = require("@perses-dev/core");
|
|
24
24
|
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
25
|
-
// TODO: move to
|
|
26
|
-
function
|
|
25
|
+
// TODO: move to VariableProvider/utils.ts
|
|
26
|
+
function hydrateVariableState(variable, initialValue) {
|
|
27
27
|
const varState = {
|
|
28
28
|
value: null,
|
|
29
29
|
loading: false,
|
|
@@ -32,17 +32,14 @@ function hydrateTemplateVariableState(variable, initialValue) {
|
|
|
32
32
|
};
|
|
33
33
|
switch(variable.kind){
|
|
34
34
|
case 'TextVariable':
|
|
35
|
-
varState.value = initialValue
|
|
35
|
+
varState.value = initialValue ?? variable.spec.value;
|
|
36
36
|
break;
|
|
37
37
|
case 'ListVariable':
|
|
38
38
|
varState.options = [];
|
|
39
|
-
|
|
40
|
-
varState.value = (_ref = initialValue !== null && initialValue !== void 0 ? initialValue : variable.spec.defaultValue) !== null && _ref !== void 0 ? _ref : null;
|
|
39
|
+
varState.value = initialValue ?? variable.spec.defaultValue ?? null;
|
|
41
40
|
// TODO: smarter fallbacks for defaultValue when allowAllValue is true
|
|
42
41
|
if (varState.options.length > 0 && !varState.value) {
|
|
43
|
-
|
|
44
|
-
var _varState_options__value;
|
|
45
|
-
const firstOptionValue = (_varState_options__value = (_varState_options_ = varState.options[0]) === null || _varState_options_ === void 0 ? void 0 : _varState_options_.value) !== null && _varState_options__value !== void 0 ? _varState_options__value : null;
|
|
42
|
+
const firstOptionValue = varState.options[0]?.value ?? null;
|
|
46
43
|
if (firstOptionValue !== null) {
|
|
47
44
|
varState.value = variable.spec.allowMultiple ? [
|
|
48
45
|
firstOptionValue
|
|
@@ -63,7 +60,7 @@ function hydrateTemplateVariableState(variable, initialValue) {
|
|
|
63
60
|
}
|
|
64
61
|
return varState;
|
|
65
62
|
}
|
|
66
|
-
function
|
|
63
|
+
function hydrateVariableDefinitionStates(localDefinitions, initialValues, externalDefinitions = []) {
|
|
67
64
|
const state = new _pluginsystem.VariableStoreStateMap();
|
|
68
65
|
// Collect the names used by local definitions
|
|
69
66
|
let overridingNames = {};
|
|
@@ -83,7 +80,7 @@ function hydrateTemplateVariableStates(localDefinitions, initialValues, external
|
|
|
83
80
|
source,
|
|
84
81
|
name
|
|
85
82
|
}, {
|
|
86
|
-
...
|
|
83
|
+
...hydrateVariableState(v, initialValue),
|
|
87
84
|
overridden: !!overridingNames[name]
|
|
88
85
|
});
|
|
89
86
|
overridingNames[name] = true;
|
|
@@ -99,7 +96,7 @@ function hydrateTemplateVariableStates(localDefinitions, initialValues, external
|
|
|
99
96
|
state.set({
|
|
100
97
|
name
|
|
101
98
|
}, {
|
|
102
|
-
...
|
|
99
|
+
...hydrateVariableState(v, initialValue),
|
|
103
100
|
overriding: !!overriddenNames[name]
|
|
104
101
|
});
|
|
105
102
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
-
_export_star(require("./
|
|
17
|
+
_export_star(require("./VariableProvider"), exports);
|
|
18
18
|
function _export_star(from, to) {
|
|
19
19
|
Object.keys(from).forEach(function(k) {
|
|
20
20
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -43,7 +43,7 @@ function checkSavedDefaultVariableStatus(definitions, varState) {
|
|
|
43
43
|
const currentVariable = varState.get({
|
|
44
44
|
name
|
|
45
45
|
});
|
|
46
|
-
if (
|
|
46
|
+
if (currentVariable?.value !== null && currentVariable?.value !== savedVariable.spec.defaultValue) {
|
|
47
47
|
modifiedVariableNames.push(name);
|
|
48
48
|
isSavedVariableModified = true;
|
|
49
49
|
}
|
|
@@ -51,7 +51,7 @@ function checkSavedDefaultVariableStatus(definitions, varState) {
|
|
|
51
51
|
const currentVariable = varState.get({
|
|
52
52
|
name
|
|
53
53
|
});
|
|
54
|
-
const currentVariableValue = typeof
|
|
54
|
+
const currentVariableValue = typeof currentVariable?.value === 'string' ? currentVariable.value : '';
|
|
55
55
|
if (savedVariable.spec.value !== currentVariableValue) {
|
|
56
56
|
modifiedVariableNames.push(name);
|
|
57
57
|
isSavedVariableModified = true;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -16,7 +16,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
_export_star(require("./DashboardProvider"), exports);
|
|
18
18
|
_export_star(require("./DatasourceStoreProvider"), exports);
|
|
19
|
-
_export_star(require("./
|
|
19
|
+
_export_star(require("./VariableProvider"), exports);
|
|
20
20
|
_export_star(require("./useDashboard"), exports);
|
|
21
21
|
function _export_star(from, to) {
|
|
22
22
|
Object.keys(from).forEach(function(k) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -22,7 +22,7 @@ Object.defineProperty(exports, "useDashboard", {
|
|
|
22
22
|
});
|
|
23
23
|
const _core = require("@perses-dev/core");
|
|
24
24
|
const _DashboardProvider = require("./DashboardProvider");
|
|
25
|
-
const
|
|
25
|
+
const _VariableProvider = require("./VariableProvider");
|
|
26
26
|
function useDashboard() {
|
|
27
27
|
const { panels, panelGroups, panelGroupOrder, setDashboard: setDashboardResource, kind, metadata, display, duration, refreshInterval, datasources, ttl } = (0, _DashboardProvider.useDashboardStore)(({ panels, panelGroups, panelGroupOrder, setDashboard, kind, metadata, display, duration, refreshInterval, datasources, ttl })=>({
|
|
28
28
|
panels,
|
|
@@ -37,8 +37,8 @@ function useDashboard() {
|
|
|
37
37
|
datasources,
|
|
38
38
|
ttl
|
|
39
39
|
}));
|
|
40
|
-
const { setVariableDefinitions } = (0,
|
|
41
|
-
const variables = (0,
|
|
40
|
+
const { setVariableDefinitions } = (0, _VariableProvider.useVariableDefinitionActions)();
|
|
41
|
+
const variables = (0, _VariableProvider.useVariableDefinitions)();
|
|
42
42
|
const layouts = convertPanelGroupsToLayouts(panelGroups, panelGroupOrder);
|
|
43
43
|
const dashboard = kind === 'Dashboard' ? {
|
|
44
44
|
kind,
|
|
@@ -32,7 +32,7 @@ _export(exports, {
|
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
34
|
const _dashboardprovider = require("./dashboard-provider");
|
|
35
|
-
const prometheusDemoUrl = 'https://prometheus.demo.
|
|
35
|
+
const prometheusDemoUrl = 'https://prometheus.demo.prometheus.io';
|
|
36
36
|
const prometheusDemo = {
|
|
37
37
|
kind: 'GlobalDatasource',
|
|
38
38
|
metadata: {
|
|
@@ -38,11 +38,16 @@ const FakeTimeSeriesPlugin = {
|
|
|
38
38
|
content: FakeTimeSeriesChartOptionEditor
|
|
39
39
|
}
|
|
40
40
|
],
|
|
41
|
-
createInitialOptions: ()=>({})
|
|
41
|
+
createInitialOptions: ()=>({}),
|
|
42
|
+
supportedQueryTypes: [
|
|
43
|
+
'TimeSeriesQuery'
|
|
44
|
+
]
|
|
42
45
|
};
|
|
43
46
|
const MOCK_TIME_SERIES_PANEL = {
|
|
44
|
-
|
|
45
|
-
|
|
47
|
+
kind: 'Panel',
|
|
48
|
+
spec: {
|
|
49
|
+
name: 'TimeSeriesChart'
|
|
50
|
+
},
|
|
46
51
|
plugin: FakeTimeSeriesPlugin
|
|
47
52
|
};
|
|
48
53
|
const MOCK_PLUGINS = [
|
package/dist/cjs/test/render.js
CHANGED
|
@@ -21,15 +21,15 @@ Object.defineProperty(exports, "renderWithContext", {
|
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
23
|
const _jsxruntime = require("react/jsx-runtime");
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
24
|
+
const _components = require("@perses-dev/components");
|
|
25
|
+
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
26
|
+
const _reactquery = require("@tanstack/react-query");
|
|
27
|
+
const _react = require("@testing-library/react");
|
|
27
28
|
const _history = require("history");
|
|
29
|
+
const _react1 = require("react");
|
|
30
|
+
const _reactrouterdom = require("react-router-dom");
|
|
28
31
|
const _usequeryparams = require("use-query-params");
|
|
29
32
|
const _reactrouter6 = require("use-query-params/adapters/react-router-6");
|
|
30
|
-
const _reactquery = require("@tanstack/react-query");
|
|
31
|
-
const _components = require("@perses-dev/components");
|
|
32
|
-
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
33
33
|
const _context = require("../context");
|
|
34
34
|
const _test = require("../test");
|
|
35
35
|
const _pluginregistry = require("./plugin-registry");
|
|
@@ -37,11 +37,11 @@ const _pluginregistry = require("./plugin-registry");
|
|
|
37
37
|
* Workaround for React router upgrade type errors.
|
|
38
38
|
* More details: https://stackoverflow.com/a/69948457/17575201
|
|
39
39
|
*/ const CustomRouter = ({ history, children })=>{
|
|
40
|
-
const [state, setState] = (0,
|
|
40
|
+
const [state, setState] = (0, _react1.useState)({
|
|
41
41
|
action: history.action,
|
|
42
42
|
location: history.location
|
|
43
43
|
});
|
|
44
|
-
(0,
|
|
44
|
+
(0, _react1.useLayoutEffect)(()=>history.listen(setState), [
|
|
45
45
|
history
|
|
46
46
|
]);
|
|
47
47
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactrouterdom.Router, {
|
|
@@ -61,7 +61,8 @@ function renderWithContext(ui, options, history) {
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
});
|
|
64
|
-
const customHistory = history
|
|
64
|
+
const customHistory = history ?? (0, _history.createMemoryHistory)();
|
|
65
|
+
const mockRegistry = (0, _pluginsystem.mockPluginRegistry)(..._pluginregistry.MOCK_PLUGINS);
|
|
65
66
|
const BaseRender = ()=>/*#__PURE__*/ (0, _jsxruntime.jsx)(CustomRouter, {
|
|
66
67
|
history: customHistory,
|
|
67
68
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactquery.QueryClientProvider, {
|
|
@@ -76,7 +77,8 @@ function renderWithContext(ui, options, history) {
|
|
|
76
77
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.ChartsProvider, {
|
|
77
78
|
chartsTheme: _components.testChartsTheme,
|
|
78
79
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.PluginRegistry, {
|
|
79
|
-
|
|
80
|
+
pluginLoader: mockRegistry.pluginLoader,
|
|
81
|
+
defaultPluginKinds: mockRegistry.defaultPluginKinds,
|
|
80
82
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_context.DatasourceStoreProvider, {
|
|
81
83
|
..._test.defaultDatasourceProps,
|
|
82
84
|
children: ui
|
|
@@ -87,5 +89,5 @@ function renderWithContext(ui, options, history) {
|
|
|
87
89
|
})
|
|
88
90
|
})
|
|
89
91
|
});
|
|
90
|
-
return (0,
|
|
92
|
+
return (0, _react.render)(/*#__PURE__*/ (0, _jsxruntime.jsx)(BaseRender, {}), options);
|
|
91
93
|
}
|
|
@@ -28,7 +28,7 @@ const _pluginsystem = require("@perses-dev/plugin-system");
|
|
|
28
28
|
const _components1 = require("../../components");
|
|
29
29
|
const _context = require("../../context");
|
|
30
30
|
const DashboardApp = (props)=>{
|
|
31
|
-
const { dashboardResource, dashboardTitleComponent, emptyDashboardProps, onSave, onDiscard, initialVariableIsSticky, isReadonly, isCreating } = props;
|
|
31
|
+
const { dashboardResource, dashboardTitleComponent, emptyDashboardProps, onSave, onDiscard, initialVariableIsSticky, isReadonly, isVariableEnabled, isDatasourceEnabled, isCreating } = props;
|
|
32
32
|
const chartsTheme = (0, _components.useChartsTheme)();
|
|
33
33
|
const { isEditMode, setEditMode } = (0, _context.useEditMode)();
|
|
34
34
|
const { dashboard, setDashboard } = (0, _context.useDashboard)();
|
|
@@ -49,8 +49,7 @@ const DashboardApp = (props)=>{
|
|
|
49
49
|
const onEditButtonClick = ()=>{
|
|
50
50
|
setEditMode(true);
|
|
51
51
|
setOriginalDashboard(dashboard);
|
|
52
|
-
|
|
53
|
-
setSavedDatasources((_dashboard_spec_datasources = dashboard.spec.datasources) !== null && _dashboard_spec_datasources !== void 0 ? _dashboard_spec_datasources : {});
|
|
52
|
+
setSavedDatasources(dashboard.spec.datasources ?? {});
|
|
54
53
|
};
|
|
55
54
|
const onCancelButtonClick = ()=>{
|
|
56
55
|
// check if dashboard has been modified
|
|
@@ -82,12 +81,15 @@ const DashboardApp = (props)=>{
|
|
|
82
81
|
initialVariableIsSticky: initialVariableIsSticky,
|
|
83
82
|
onSave: onSave,
|
|
84
83
|
isReadonly: isReadonly,
|
|
84
|
+
isVariableEnabled: isVariableEnabled,
|
|
85
|
+
isDatasourceEnabled: isDatasourceEnabled,
|
|
85
86
|
onEditButtonClick: onEditButtonClick,
|
|
86
87
|
onCancelButtonClick: onCancelButtonClick
|
|
87
88
|
}),
|
|
88
89
|
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
|
|
89
90
|
sx: {
|
|
90
|
-
|
|
91
|
+
paddingTop: 2,
|
|
92
|
+
paddingX: 2,
|
|
91
93
|
height: '100%'
|
|
92
94
|
},
|
|
93
95
|
children: [
|