@perses-dev/dashboards 0.0.0-snapshot-scatterplot-fix-imports-95e1b59 → 0.0.0-snapshot-explorer-plugin-c4a7621
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 +1 -1
- package/dist/cjs/components/Datasources/DatasourceEditor.js +18 -18
- package/dist/cjs/components/Datasources/EditDatasourcesButton.js +2 -5
- package/dist/cjs/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +3 -4
- 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 +19 -4
- package/dist/cjs/components/GridLayout/GridLayout.js +61 -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 +14 -10
- package/dist/cjs/components/Panel/PanelActions.js +216 -0
- package/dist/cjs/components/Panel/PanelContent.js +4 -4
- package/dist/cjs/components/Panel/PanelHeader.js +36 -103
- package/dist/cjs/components/Panel/PanelLinks.js +136 -0
- package/dist/cjs/components/PanelDrawer/PanelDrawer.js +9 -6
- package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +67 -65
- 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} +43 -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 +15 -7
- package/dist/cjs/constants/user-interface-text.js +3 -0
- 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 +14 -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} +62 -69
- 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/stories/decorators/WithDashboard.js +1 -1
- package/dist/cjs/stories/decorators/WithDatasourceStore.js +1 -1
- package/dist/cjs/stories/decorators/{WithTemplateVariables.js → WithVariables.js} +9 -9
- package/dist/cjs/stories/decorators/index.js +2 -2
- package/dist/cjs/test/plugin-registry.js +4 -2
- package/dist/cjs/test/render.js +13 -11
- package/dist/cjs/views/ViewDashboard/DashboardApp.js +3 -3
- package/dist/cjs/views/ViewDashboard/ViewDashboard.js +7 -8
- 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 +2 -2
- package/dist/components/DashboardToolbar/DashboardToolbar.d.ts.map +1 -1
- package/dist/components/DashboardToolbar/DashboardToolbar.js +1 -1
- 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.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 +3 -4
- 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 -1
- package/dist/components/DownloadButton/DownloadButton.d.ts.map +1 -1
- 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 +21 -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 +63 -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/{context/TemplateVariableProvider/index.js → components/Panel/HeaderIconButton.js} +7 -3
- package/dist/components/Panel/HeaderIconButton.js.map +1 -0
- package/dist/components/Panel/Panel.d.ts +11 -5
- package/dist/components/Panel/Panel.d.ts.map +1 -1
- package/dist/components/Panel/Panel.js +15 -11
- package/dist/components/Panel/Panel.js.map +1 -1
- package/dist/components/Panel/PanelActions.d.ts +16 -0
- package/dist/components/Panel/PanelActions.d.ts.map +1 -0
- package/dist/components/Panel/PanelActions.js +203 -0
- package/dist/components/Panel/PanelActions.js.map +1 -0
- package/dist/components/Panel/PanelContent.d.ts +2 -1
- package/dist/components/Panel/PanelContent.d.ts.map +1 -1
- package/dist/components/Panel/PanelContent.js +4 -4
- package/dist/components/Panel/PanelContent.js.map +1 -1
- package/dist/components/Panel/PanelHeader.d.ts +8 -8
- package/dist/components/Panel/PanelHeader.d.ts.map +1 -1
- package/dist/components/Panel/PanelHeader.js +39 -106
- 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/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 +70 -68
- 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} +44 -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 +4 -2
- package/dist/constants/styles.d.ts.map +1 -1
- package/dist/constants/styles.js +5 -3
- package/dist/constants/styles.js.map +1 -1
- package/dist/constants/user-interface-text.d.ts +3 -0
- package/dist/constants/user-interface-text.d.ts.map +1 -1
- package/dist/constants/user-interface-text.js +3 -0
- 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 +36 -23
- package/dist/context/DashboardProvider/dashboard-provider-api.d.ts.map +1 -1
- package/dist/context/DashboardProvider/dashboard-provider-api.js +13 -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 +2 -2
- 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} +51 -54
- 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/stories/decorators/WithDashboard.js +1 -1
- package/dist/stories/decorators/WithDashboard.js.map +1 -1
- package/dist/stories/decorators/WithDatasourceStore.js +1 -1
- package/dist/stories/decorators/WithDatasourceStore.js.map +1 -1
- package/dist/stories/decorators/{WithTemplateVariables.js → WithVariables.js} +9 -9
- package/dist/stories/decorators/WithVariables.js.map +1 -0
- package/dist/stories/decorators/index.js +2 -2
- package/dist/stories/decorators/index.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 +2 -2
- package/dist/test/datasource-provider.d.ts.map +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 +4 -2
- 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 +2 -2
- package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -1
- package/dist/views/ViewDashboard/DashboardApp.js +3 -3
- 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 +8 -9
- package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -1
- package/package.json +9 -9
- package/dist/cjs/context/TemplateVariableProvider/index.js +0 -30
- 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.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/WithTemplateVariables.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,37 +21,35 @@ 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
55
|
const _immer1 = /*#__PURE__*/ _interop_require_default(require("immer"));
|
|
@@ -65,20 +63,22 @@ function _interop_require_default(obj) {
|
|
|
65
63
|
default: obj
|
|
66
64
|
};
|
|
67
65
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
/**
|
|
67
|
+
* Context object for {@link VariableDefinitionStore}.
|
|
68
|
+
*/ const VariableDefinitionStoreContext = /*#__PURE__*/ (0, _react.createContext)(undefined);
|
|
69
|
+
function useVariableDefinitionStoreCtx() {
|
|
70
|
+
const context = (0, _react.useContext)(VariableDefinitionStoreContext);
|
|
71
71
|
if (!context) {
|
|
72
|
-
throw new Error('
|
|
72
|
+
throw new Error('VariableStoreContext not initialized');
|
|
73
73
|
}
|
|
74
74
|
return context;
|
|
75
75
|
}
|
|
76
|
-
function
|
|
77
|
-
const store =
|
|
78
|
-
return (0,
|
|
79
|
-
const
|
|
76
|
+
function useVariableDefinitionStates(variableNames) {
|
|
77
|
+
const store = useVariableDefinitionStoreCtx();
|
|
78
|
+
return (0, _traditional.useStoreWithEqualityFn)(store, (s)=>{
|
|
79
|
+
const varStates = {};
|
|
80
80
|
// Collect values of local variables, from the variable state
|
|
81
|
-
const names = variableNames
|
|
81
|
+
const names = variableNames ?? s.variableDefinitions.map((value)=>value.spec.name);
|
|
82
82
|
names.forEach((name)=>{
|
|
83
83
|
const varState = s.variableState.get({
|
|
84
84
|
name
|
|
@@ -86,7 +86,7 @@ function useTemplateVariableValues(variableNames) {
|
|
|
86
86
|
if (!varState || varState.overridden) {
|
|
87
87
|
return;
|
|
88
88
|
}
|
|
89
|
-
|
|
89
|
+
varStates[name] = varState;
|
|
90
90
|
});
|
|
91
91
|
// Collect values of external variables, from the variable state
|
|
92
92
|
s.externalVariableDefinitions.forEach((d)=>{
|
|
@@ -100,23 +100,22 @@ function useTemplateVariableValues(variableNames) {
|
|
|
100
100
|
if (!varState || varState.overridden) {
|
|
101
101
|
return;
|
|
102
102
|
}
|
|
103
|
-
|
|
103
|
+
varStates[name] = varState;
|
|
104
104
|
});
|
|
105
105
|
});
|
|
106
|
-
return
|
|
106
|
+
return varStates;
|
|
107
107
|
}, (left, right)=>{
|
|
108
108
|
return JSON.stringify(left) === JSON.stringify(right);
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
|
-
function
|
|
112
|
-
const store =
|
|
111
|
+
function useVariableDefinitionAndState(name, source) {
|
|
112
|
+
const store = useVariableDefinitionStoreCtx();
|
|
113
113
|
return (0, _zustand.useStore)(store, (s)=>{
|
|
114
|
-
var _s_externalVariableDefinitions_find;
|
|
115
114
|
const state = s.variableState.get({
|
|
116
115
|
name,
|
|
117
116
|
source
|
|
118
117
|
});
|
|
119
|
-
const definitions = source ?
|
|
118
|
+
const definitions = source ? s.externalVariableDefinitions.find((v)=>v.source === source)?.definitions : s.variableDefinitions;
|
|
120
119
|
const definition = (definitions || []).find((v)=>v.spec.name === name);
|
|
121
120
|
return {
|
|
122
121
|
state,
|
|
@@ -124,8 +123,8 @@ function useTemplateVariable(name, source) {
|
|
|
124
123
|
};
|
|
125
124
|
});
|
|
126
125
|
}
|
|
127
|
-
function
|
|
128
|
-
const store =
|
|
126
|
+
function useVariableDefinitionActions() {
|
|
127
|
+
const store = useVariableDefinitionStoreCtx();
|
|
129
128
|
return (0, _zustand.useStore)(store, (s)=>{
|
|
130
129
|
return {
|
|
131
130
|
setVariableValue: s.setVariableValue,
|
|
@@ -137,22 +136,18 @@ function useTemplateVariableActions() {
|
|
|
137
136
|
};
|
|
138
137
|
});
|
|
139
138
|
}
|
|
140
|
-
function
|
|
141
|
-
const store =
|
|
139
|
+
function useVariableDefinitions() {
|
|
140
|
+
const store = useVariableDefinitionStoreCtx();
|
|
142
141
|
return (0, _zustand.useStore)(store, (s)=>s.variableDefinitions);
|
|
143
142
|
}
|
|
144
|
-
function
|
|
145
|
-
const store =
|
|
143
|
+
function useExternalVariableDefinitions() {
|
|
144
|
+
const store = useVariableDefinitionStoreCtx();
|
|
146
145
|
return (0, _zustand.useStore)(store, (s)=>s.externalVariableDefinitions);
|
|
147
146
|
}
|
|
148
|
-
function useTemplateVariableStore() {
|
|
149
|
-
const store = useTemplateVariableStoreCtx();
|
|
150
|
-
return (0, _zustand.useStore)(store);
|
|
151
|
-
}
|
|
152
147
|
function PluginProvider({ children, builtinVariables }) {
|
|
153
|
-
const originalValues =
|
|
154
|
-
const definitions =
|
|
155
|
-
const externalDefinitions =
|
|
148
|
+
const originalValues = useVariableDefinitionStates();
|
|
149
|
+
const definitions = useVariableDefinitions();
|
|
150
|
+
const externalDefinitions = useExternalVariableDefinitions();
|
|
156
151
|
const { absoluteTimeRange } = (0, _pluginsystem.useTimeRange)();
|
|
157
152
|
const values = (0, _react.useMemo)(()=>{
|
|
158
153
|
const contextValues = {};
|
|
@@ -166,12 +161,10 @@ function PluginProvider({ children, builtinVariables }) {
|
|
|
166
161
|
if (v.value === _core.DEFAULT_ALL_VALUE) {
|
|
167
162
|
const definition = (0, _utils.findVariableDefinitionByName)(name, definitions, externalDefinitions);
|
|
168
163
|
// If the variable is a list variable and has a custom all value, then use that value instead
|
|
169
|
-
if (
|
|
164
|
+
if (definition?.kind === 'ListVariable' && definition.spec.customAllValue) {
|
|
170
165
|
v.value = definition.spec.customAllValue;
|
|
171
166
|
} 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;
|
|
167
|
+
v.value = v.options?.map((o)=>o.value) ?? null;
|
|
175
168
|
}
|
|
176
169
|
}
|
|
177
170
|
contextValues[name] = v;
|
|
@@ -250,7 +243,7 @@ function PluginProvider({ children, builtinVariables }) {
|
|
|
250
243
|
}
|
|
251
244
|
}
|
|
252
245
|
];
|
|
253
|
-
builtinVariables
|
|
246
|
+
builtinVariables?.forEach((def)=>result.push(def));
|
|
254
247
|
return result;
|
|
255
248
|
}, [
|
|
256
249
|
absoluteTimeRange,
|
|
@@ -260,7 +253,7 @@ function PluginProvider({ children, builtinVariables }) {
|
|
|
260
253
|
value: {
|
|
261
254
|
variables: allBuiltinVariables
|
|
262
255
|
},
|
|
263
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.
|
|
256
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.VariableContext.Provider, {
|
|
264
257
|
value: {
|
|
265
258
|
state: values
|
|
266
259
|
},
|
|
@@ -268,16 +261,16 @@ function PluginProvider({ children, builtinVariables }) {
|
|
|
268
261
|
})
|
|
269
262
|
});
|
|
270
263
|
}
|
|
271
|
-
function
|
|
264
|
+
function createVariableDefinitionStore({ initialVariableDefinitions = [], externalVariableDefinitions = [], queryParams }) {
|
|
272
265
|
const initialParams = (0, _queryparams.getInitalValuesFromQueryParameters)(queryParams ? queryParams[0] : {});
|
|
273
266
|
const store = (0, _zustand.createStore)()((0, _middleware.devtools)((0, _immer.immer)((set, get)=>({
|
|
274
|
-
variableState: (0, _hydrationUtils.
|
|
267
|
+
variableState: (0, _hydrationUtils.hydrateVariableDefinitionStates)(initialVariableDefinitions, initialParams, externalVariableDefinitions),
|
|
275
268
|
variableDefinitions: initialVariableDefinitions,
|
|
276
269
|
externalVariableDefinitions: externalVariableDefinitions,
|
|
277
270
|
setVariableDefinitions (definitions) {
|
|
278
271
|
set((state)=>{
|
|
279
272
|
state.variableDefinitions = definitions;
|
|
280
|
-
state.variableState = (0, _hydrationUtils.
|
|
273
|
+
state.variableState = (0, _hydrationUtils.hydrateVariableDefinitionStates)(definitions, initialParams, externalVariableDefinitions);
|
|
281
274
|
}, false, '[Variables] setVariableDefinitions' // Used for action name in Redux devtools
|
|
282
275
|
);
|
|
283
276
|
},
|
|
@@ -340,7 +333,7 @@ function createTemplateVariableSrvStore({ initialVariableDefinitions = [], exter
|
|
|
340
333
|
const currentVariable = variableState.get({
|
|
341
334
|
name
|
|
342
335
|
});
|
|
343
|
-
if (
|
|
336
|
+
if (currentVariable?.value !== undefined) {
|
|
344
337
|
draft[index] = {
|
|
345
338
|
kind: 'ListVariable',
|
|
346
339
|
spec: (0, _immer1.default)(variable.spec, (specDraft)=>{
|
|
@@ -352,8 +345,8 @@ function createTemplateVariableSrvStore({ initialVariableDefinitions = [], exter
|
|
|
352
345
|
const currentVariable = variableState.get({
|
|
353
346
|
name
|
|
354
347
|
});
|
|
355
|
-
const currentVariableValue = typeof
|
|
356
|
-
if (
|
|
348
|
+
const currentVariableValue = typeof currentVariable?.value === 'string' ? currentVariable.value : '';
|
|
349
|
+
if (currentVariable?.value !== undefined) {
|
|
357
350
|
draft[index] = {
|
|
358
351
|
kind: 'TextVariable',
|
|
359
352
|
spec: (0, _immer1.default)(variable.spec, (specDraft)=>{
|
|
@@ -373,30 +366,30 @@ function createTemplateVariableSrvStore({ initialVariableDefinitions = [], exter
|
|
|
373
366
|
return (0, _utils.checkSavedDefaultVariableStatus)(get().variableDefinitions, get().variableState);
|
|
374
367
|
}
|
|
375
368
|
}))));
|
|
376
|
-
return store;
|
|
369
|
+
return store; // TODO: @Gladorme check if we can avoid this cast
|
|
377
370
|
}
|
|
378
|
-
function
|
|
379
|
-
const [store] = (0, _react.useState)(
|
|
371
|
+
function VariableProvider({ children, initialVariableDefinitions = [], externalVariableDefinitions = [], builtinVariableDefinitions = [] }) {
|
|
372
|
+
const [store] = (0, _react.useState)(createVariableDefinitionStore({
|
|
380
373
|
initialVariableDefinitions,
|
|
381
374
|
externalVariableDefinitions
|
|
382
375
|
}));
|
|
383
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsx)(
|
|
376
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(VariableDefinitionStoreContext.Provider, {
|
|
384
377
|
value: store,
|
|
385
378
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(PluginProvider, {
|
|
386
|
-
builtinVariables:
|
|
379
|
+
builtinVariables: builtinVariableDefinitions,
|
|
387
380
|
children: children
|
|
388
381
|
})
|
|
389
382
|
});
|
|
390
383
|
}
|
|
391
|
-
function
|
|
384
|
+
function VariableProviderWithQueryParams({ children, initialVariableDefinitions = [], externalVariableDefinitions = [], builtinVariableDefinitions: builtinVariables = [] }) {
|
|
392
385
|
const allVariableDefs = (0, _utils.mergeVariableDefinitions)(initialVariableDefinitions, externalVariableDefinitions);
|
|
393
386
|
const queryParams = (0, _queryparams.useVariableQueryParams)(allVariableDefs);
|
|
394
|
-
const [store] = (0, _react.useState)(
|
|
387
|
+
const [store] = (0, _react.useState)(createVariableDefinitionStore({
|
|
395
388
|
initialVariableDefinitions,
|
|
396
389
|
externalVariableDefinitions,
|
|
397
390
|
queryParams
|
|
398
391
|
}));
|
|
399
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsx)(
|
|
392
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(VariableDefinitionStoreContext.Provider, {
|
|
400
393
|
value: store,
|
|
401
394
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(PluginProvider, {
|
|
402
395
|
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,
|
|
@@ -30,7 +30,7 @@ function isWithDashboardParameter(parameter) {
|
|
|
30
30
|
const WithDashboard = (Story, context)=>{
|
|
31
31
|
const initParameter = context.parameters.withDashboard;
|
|
32
32
|
const parameter = isWithDashboardParameter(initParameter) ? initParameter : undefined;
|
|
33
|
-
const props = parameter
|
|
33
|
+
const props = parameter?.props;
|
|
34
34
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_dashboards.DashboardProvider, {
|
|
35
35
|
initialState: {
|
|
36
36
|
dashboardResource: _constants.EMPTY_DASHBOARD_RESOURCE
|
|
@@ -30,7 +30,7 @@ function isWithDatasourceStoreParameter(parameter) {
|
|
|
30
30
|
const WithDatasourceStore = (Story, context)=>{
|
|
31
31
|
const initParameter = context.parameters.withDatasourceStore;
|
|
32
32
|
const parameter = isWithDatasourceStoreParameter(initParameter) ? initParameter : undefined;
|
|
33
|
-
const props = parameter
|
|
33
|
+
const props = parameter?.props;
|
|
34
34
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_dashboards.DatasourceStoreProvider, {
|
|
35
35
|
..._test.defaultDatasourceProps,
|
|
36
36
|
...props,
|
|
@@ -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,23 +14,23 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
-
Object.defineProperty(exports, "
|
|
17
|
+
Object.defineProperty(exports, "WithVariables", {
|
|
18
18
|
enumerable: true,
|
|
19
19
|
get: function() {
|
|
20
|
-
return
|
|
20
|
+
return WithVariables;
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
23
|
const _jsxruntime = require("react/jsx-runtime");
|
|
24
24
|
const _dashboards = require("@perses-dev/dashboards");
|
|
25
25
|
// Type guard because storybook types parameters as `any`
|
|
26
|
-
function
|
|
26
|
+
function isWithVariableParameter(parameter) {
|
|
27
27
|
return !!parameter && typeof parameter === 'object' && 'props' in parameter;
|
|
28
28
|
}
|
|
29
|
-
const
|
|
30
|
-
const initParameter = context.parameters.
|
|
31
|
-
const parameter =
|
|
32
|
-
const props = parameter
|
|
33
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_dashboards.
|
|
29
|
+
const WithVariables = (Story, context)=>{
|
|
30
|
+
const initParameter = context.parameters.withVariables;
|
|
31
|
+
const parameter = isWithVariableParameter(initParameter) ? initParameter : undefined;
|
|
32
|
+
const props = parameter?.props;
|
|
33
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_dashboards.VariableProvider, {
|
|
34
34
|
...props,
|
|
35
35
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(Story, {})
|
|
36
36
|
});
|
|
@@ -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
|
|
@@ -17,7 +17,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
17
17
|
_export_star(require("./constants"), exports);
|
|
18
18
|
_export_star(require("./WithDashboard"), exports);
|
|
19
19
|
_export_star(require("./WithDatasourceStore"), exports);
|
|
20
|
-
_export_star(require("./
|
|
20
|
+
_export_star(require("./WithVariables"), exports);
|
|
21
21
|
function _export_star(from, to) {
|
|
22
22
|
Object.keys(from).forEach(function(k) {
|
|
23
23
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
@@ -41,8 +41,10 @@ const FakeTimeSeriesPlugin = {
|
|
|
41
41
|
createInitialOptions: ()=>({})
|
|
42
42
|
};
|
|
43
43
|
const MOCK_TIME_SERIES_PANEL = {
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
kind: 'Panel',
|
|
45
|
+
spec: {
|
|
46
|
+
name: 'TimeSeriesChart'
|
|
47
|
+
},
|
|
46
48
|
plugin: FakeTimeSeriesPlugin
|
|
47
49
|
};
|
|
48
50
|
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
|
}
|
|
@@ -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
|
|
@@ -87,7 +86,8 @@ const DashboardApp = (props)=>{
|
|
|
87
86
|
}),
|
|
88
87
|
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
|
|
89
88
|
sx: {
|
|
90
|
-
|
|
89
|
+
paddingTop: 2,
|
|
90
|
+
paddingX: 2,
|
|
91
91
|
height: '100%'
|
|
92
92
|
},
|
|
93
93
|
children: [
|